HaikuPorts
  • Login
  • Preferences
  • Help/Guide
  • Wiki
  • Timeline
  • Roadmap
  • View Tickets
  • Search
  • Port Log
  • Blog

Context Navigation

  • Back to Ticket #327

Ticket #327: plib-1.8.5.patch

File plib-1.8.5.patch, 10.9 KB (added by michaelvoliveira, 5 years ago)

patch to correct old BeOS code and don't use GLX. Uses empty joystick, sound, and windows functions

  • configure.in

    diff -Naur plib-1.8.5/configure.in plib-1.8.5-haiku/configure.in
    old new  
    3636AC_PROG_CXX 
    3737AC_PROG_CXXCPP 
    3838AC_PROG_INSTALL 
    39 AC_PROG_RANLIB 
     39AC_PROG_LIBTOOL 
    4040 
    4141dnl Command line arguments 
    4242 
    … …  
    276276 
    277277        LDFLAGS="$LDFLAGS $X_LIBS" 
    278278 
    279         LIBS="$LIBS $X_PRE_LIBS -lXi -lXmu -lXext -lX11 $X_EXTRA_LIBS -lm" 
     279        LIBS="$LIBS $X_PRE_LIBS $X_EXTRA_LIBS" 
    280280 
    281281dnl ========================================================= 
    282282dnl    if test "x$x_includes" != "x"; then 
    … …  
    289289        AC_CHECK_LIB(pthread, pthread_create) 
    290290        AC_CHECK_LIB(GL, glNewList) 
    291291        if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then 
    292                 dnl if no GL, check for MesaGL 
    293                 AC_CHECK_LIB(MesaGL, glNewList,, 
     292                dnl if no GL, check for GL 
     293                AC_CHECK_LIB(GL, glNewList,, 
    294294                AC_MSG_ERROR([could not find working GL library])) 
    295295        fi 
    296296 
    … …  
    356356CFLAGS="$CFLAGS $WFLAG" 
    357357CXXFLAGS="$CXXFLAGS $WFLAG" 
    358358 
     359dnl Required to build shared libraries later 
     360CFLAGS="$CFLAGS -fPIC" 
     361CPPFLAGS="$CFLAGS" 
     362CXXFLAGS="$CFLAGS" 
     363 
    359364dnl FreeBSD requires the -pthread switch to enable pthreads. Look for this 
    360365dnl weirdness. 
    361366save_CXXFLAGS="$CXXFLAGS" 
  • src/fnt/fntTXF.cxx

    diff -Naur plib-1.8.5/src/fnt/fntTXF.cxx plib-1.8.5-haiku/src/fnt/fntTXF.cxx
    old new  
    3030#  include <OpenGL/CGLCurrent.h> 
    3131#elif defined(UL_WIN32) 
    3232   /* Nothing */ 
     33#elif defined(UL_BEOS) 
     34   /* Nothing */ 
    3335#else 
    3436#  include <GL/glx.h> 
    3537#endif 
    … …  
    4446  return ( aglGetCurrentContext () != NULL ) ; 
    4547#elif defined(UL_MAC_OSX) 
    4648  return ( CGLGetCurrentContext () != NULL ) ; 
     49#elif defined(UL_BEOS) 
     50  return true ; 
    4751#else 
    4852  return ( glXGetCurrentContext () != NULL ) ; 
    4953#endif 
  • src/js/jsNone.cxx

    diff -Naur plib-1.8.5/src/js/jsNone.cxx plib-1.8.5-haiku/src/js/jsNone.cxx
    old new  
    2222 
    2323#include "js.h" 
    2424 
    25 #if defined(UL_IRIX) || defined(UL_SOLARIS) || defined (UL_HPUX) 
     25#if defined(UL_IRIX) || defined(UL_SOLARIS) || defined (UL_HPUX) || defined (UL_BEOS) 
    2626 
    2727struct os_specific_s ; 
    2828 
  • src/pui/pu.cxx

    diff -Naur plib-1.8.5/src/pui/pu.cxx plib-1.8.5-haiku/src/pui/pu.cxx
    old new  
    2727#  include <agl.h> 
    2828#elif defined(UL_CGL) 
    2929#  include <OpenGL/CGLCurrent.h> 
    30 #elif defined(UL_GLX) 
     30#elif defined(UL_GLX) && !defined(UL_BEOS) 
    3131#  include <GL/glx.h> 
    3232#endif 
    3333 
    … …  
    107107  return ( aglGetCurrentContext () != NULL ) ; 
    108108#elif defined(UL_CGL) 
    109109  return ( CGLGetCurrentContext () != NULL ) ; 
    110 #elif defined(UL_GLX) 
     110#elif defined(UL_GLX) && !defined(UL_BEOS) 
    111111  return ( glXGetCurrentContext () != NULL ) ; 
    112112#else 
    113113  return true ; 
  • src/pw/Makefile.am

    diff -Naur plib-1.8.5/src/pw/Makefile.am plib-1.8.5-haiku/src/pw/Makefile.am
    old new  
    44 
    55include_HEADERS = pw.h 
    66 
    7 libplibpw_a_SOURCES = pw.cxx pwX11.cxx pwWindows.cxx pwMacOSX.cxx 
     7libplibpw_a_SOURCES = pw.cxx pwX11.cxx pwHaiku.cxx pwWindows.cxx pwMacOSX.cxx 
    88 
    99INCLUDES = -I$(top_srcdir)/src/util 
    1010 
  • src/pw/pwHaiku.cxx

    diff -Naur plib-1.8.5/src/pw/pwHaiku.cxx plib-1.8.5-haiku/src/pw/pwHaiku.cxx
    old new  
     1#include "ul.h" 
     2 
     3/* ONLY COMPILE THIS FILE FOR HAIKU/BEOS EQUIPPED SYSTEMS */ 
     4 
     5#if defined(UL_BEOS) 
     6 
     7#include "pw.h" 
     8 
     9#include <stdio.h> 
     10#include <stdlib.h> 
     11#include <math.h> 
     12#include <string.h> 
     13#include <assert.h> 
     14 
     15#include <GL/gl.h> 
     16 
     17static bool initialised    = false ; 
     18static bool insideCallback = false ; 
     19static int modifiers   = 0 ; 
     20static int origin [2]  = {   0,   0 } ; 
     21static int size   [2]  = { 640, 480 } ; 
     22static int currScreen  = 0 ; 
     23static int currConnect = 0 ; 
     24static int currCursor  = PW_CURSOR_LEFT ; 
     25 
     26static pwResizeCB     *resizeCB = NULL ; 
     27static pwExitCB       *exitCB   = NULL ; 
     28static pwKeybdFunc    *kbCB     = NULL ; 
     29static pwMouseFunc    *msCB     = NULL ; 
     30static pwMousePosFunc *mpCB     = NULL ; 
     31 
     32static bool autoRepeat = false ; 
     33 
     34void pwSetAutoRepeatKey ( bool enable ) 
     35{ 
     36  autoRepeat = enable ; 
     37} 
     38 
     39 
     40struct PixelFormat 
     41{ 
     42  int num_samples ; 
     43  int bits_per_pixel ; ; 
     44  int z_bits ; 
     45} ; 
     46 
     47 
     48static PixelFormat preferred_pixel_formats [] = 
     49{ 
     50  /* NumSamples, RGB_bits, Z_bits */ 
     51 
     52  {  0, 24, 24 },  /* Progressively nastier image formats */ 
     53  {  0, 16, 24 }, 
     54  {  0, 16, 16 }, 
     55  {  0,  3, 16 }, 
     56  {  0,  3,  1 }, 
     57  { -1, -1, -1 }   /* Magic end marker */ 
     58} ; 
     59 
     60 
     61void defaultExitFunc () 
     62{ 
     63  pwCleanup () ; 
     64  exit ( 0 ) ; 
     65} 
     66 
     67 
     68void pwInit ( int multisample, int num_samples ) 
     69{ 
     70  pwInit ( 0, 0, -1, -1, multisample, "NoName", FALSE, num_samples ) ; 
     71} 
     72 
     73 
     74void pwSetCallbacks ( pwKeybdFunc *kb, pwMouseFunc *ms, 
     75                      pwMousePosFunc *mp, pwResizeCB *rcb, 
     76                      pwExitCB *ecb ) 
     77{ 
     78  if ( ! initialised ) 
     79  { 
     80    fprintf ( stderr, "PW: You must not call pwSetCallbacks before pwInit.\n"); 
     81    exit ( 1 ) ; 
     82  } 
     83 
     84  kbCB = kb ; 
     85  msCB = ms ; 
     86  mpCB = mp ; 
     87  resizeCB = rcb ; 
     88  exitCB   = ecb ? ecb : defaultExitFunc ; 
     89} 
     90 
     91 
     92void pwInit ( int x, int y, int w, int h, int multisample, 
     93              char *title, int border, int num_samples ) 
     94{ 
     95  char *displayName = getenv ( "DISPLAY" ) ; 
     96 
     97  if ( displayName == NULL ) displayName = ":0.0" ; 
     98 
     99  pwSetCursor ( PW_CURSOR_LEFT ) ; 
     100 
     101#ifdef GL_MULTISAMPLE_FILTER_HINT_NV 
     102  glHint ( GL_MULTISAMPLE_FILTER_HINT_NV, multisample ) ; 
     103#endif 
     104 
     105  kbCB     = NULL ; 
     106  msCB     = NULL ; 
     107  mpCB     = NULL ; 
     108  resizeCB = NULL ; 
     109  exitCB   = defaultExitFunc ; 
     110 
     111  initialised = true ; 
     112  insideCallback = false ; 
     113 
     114  glClear ( GL_COLOR_BUFFER_BIT ) ; 
     115  pwSwapBuffers () ; 
     116  glClear ( GL_COLOR_BUFFER_BIT ) ; 
     117  pwSwapBuffers () ; 
     118} 
     119 
     120 
     121void pwGetSize ( int *w, int *h ) 
     122{ 
     123  if ( w ) *w = size[0] ; 
     124  if ( h ) *h = size[1] ; 
     125} 
     126 
     127 
     128void pwSetCursor ( int c ) 
     129{ 
     130 
     131} 
     132 
     133 
     134void pwSetSize ( int w, int h ) 
     135{ 
     136 
     137} 
     138 
     139 
     140void pwSetOrigin ( int x, int y ) 
     141{ 
     142 
     143} 
     144 
     145 
     146void pwSetSizeOrigin ( int x, int y, int w, int h ) 
     147{ 
     148 
     149} 
     150 
     151int pwGetModifiers () 
     152{ 
     153  return modifiers ; 
     154} 
     155 
     156 
     157static void getEvents () 
     158{ 
     159 
     160} 
     161 
     162 
     163void pwSwapBuffers () 
     164{ 
     165  if ( ! initialised ) 
     166  { 
     167    fprintf ( stderr, "PLIB/PW: FATAL - Application called pwSwapBuffers" 
     168                      " before pwInit.\n" ) ; 
     169    exit ( 1 ) ; 
     170  } 
     171 
     172  if ( insideCallback ) 
     173  { 
     174    fprintf ( stderr, "PLIB/PW: FATAL - Application called pwSwapBuffers" 
     175                      " from inside a callback function.\n" ) ; 
     176    exit ( 1 ) ; 
     177  } 
     178 
     179  glFlush () ; 
     180  getEvents () ; 
     181} 
     182 
     183 
     184#ifdef NEED_GAMMA 
     185void pwSetGamma ( float g ) 
     186{ 
     187   
     188} 
     189#endif 
     190 
     191 
     192void pwCleanup () 
     193{ 
     194  if ( ! initialised ) 
     195    fprintf ( stderr, "PLIB/PW: WARNING - Application called pwCleanup" 
     196                      " before pwInit.\n" ) ; 
     197} 
     198 
     199 
     200#endif 
  • src/pw/pwX11.cxx

    diff -Naur plib-1.8.5/src/pw/pwX11.cxx plib-1.8.5-haiku/src/pw/pwX11.cxx
    old new  
    22 
    33/* ONLY COMPILE THIS FILE FOR GLX/X11 EQUIPPED SYSTEMS */ 
    44 
    5 #ifdef UL_GLX 
     5#if defined(UL_GLX) && !defined(UL_BEOS) 
    66 
    77#include "pw.h" 
    88 
  • src/sl/sl.h

    diff -Naur plib-1.8.5/src/sl/sl.h plib-1.8.5-haiku/src/sl/sl.h
    old new  
    4444#define SLDSP_DEFAULT_DEVICE "/dev/audio" 
    4545#elif defined(UL_MACINTOSH) || defined(UL_MAC_OSX) 
    4646#define SLDSP_DEFAULT_DEVICE "dsp" // dummy 
     47#elif defined(UL_BEOS) 
     48#define SLDSP_DEFAULT_DEVICE "/dev/audio" 
    4749#else 
    4850#error "Port me !" 
    4951#endif 
  • src/sl/slDSP.cxx

    diff -Naur plib-1.8.5/src/sl/slDSP.cxx plib-1.8.5-haiku/src/sl/slDSP.cxx
    old new  
    10801080  return secUsed; 
    10811081} 
    10821082 
     1083/* ------------------------------------------------------------ */ 
     1084/* Haiku/BeOS audio                                             */ 
     1085/* ------------------------------------------------------------ */ 
     1086 
     1087#elif defined(UL_BEOS) 
     1088 
     1089void slDSP::open ( const char *device, int _rate, int _stereo, int _bps ) 
     1090{ 
     1091 
     1092} 
     1093 
     1094 
     1095void slDSP::close () 
     1096{ 
     1097 
     1098} 
     1099 
     1100 
     1101int slDSP::getDriverBufferSize () 
     1102{ 
     1103  if ( error ) 
     1104    return 0 ; 
     1105} 
     1106 
     1107void slDSP::getBufferInfo () 
     1108{ 
     1109  if ( error ) 
     1110    return ; 
     1111} 
     1112 
     1113 
     1114void slDSP::write ( void *buffer, size_t length ) 
     1115{ 
     1116         
     1117} 
     1118 
     1119 
     1120float slDSP::secondsRemaining () 
     1121{ 
     1122  int   samples_remain; 
     1123 
     1124  if ( error ) 
     1125    return 0.0f ; 
     1126} 
     1127 
     1128 
     1129float slDSP::secondsUsed () 
     1130{ 
     1131  int   samples_used; 
     1132 
     1133  if ( error ) 
     1134    return 0.0f ; 
     1135} 
     1136 
     1137 
     1138void slDSP::sync () 
     1139{  
     1140   if ( error ) 
     1141     return ; 
     1142} 
     1143 
     1144void slDSP::stop () 
     1145{  
     1146} 
     1147 
     1148 
    10831149#endif 
    10841150 
    10851151 
  • src/ssg/ssg.cxx

    diff -Naur plib-1.8.5/src/ssg/ssg.cxx plib-1.8.5-haiku/src/ssg/ssg.cxx
    old new  
    3131#  include <OpenGL/CGLCurrent.h> 
    3232#elif defined(UL_WIN32) 
    3333   /* Nothing */ 
     34#elif defined(UL_BEOS) 
     35   /* Nothing */ 
    3436#else 
    3537#  include <GL/glx.h> 
    3638#endif 
    … …  
    4547  return ( aglGetCurrentContext () != NULL ) ; 
    4648#elif defined(UL_MAC_OSX) 
    4749  return ( CGLGetCurrentContext () != NULL ) ; 
     50#elif defined(UL_BEOS) 
     51  return true ; 
    4852#else 
    4953  return ( glXGetCurrentContext () != NULL ) ; 
    5054#endif 
  • src/util/ul.h

    diff -Naur plib-1.8.5/src/util/ul.h plib-1.8.5-haiku/src/util/ul.h
    old new  
    6060#define UL_WIN32     1 
    6161#define UL_MSVC      1    /* Windoze AND MSVC. */ 
    6262 
    63 #elif defined(__BEOS__) 
     63#elif defined(__BEOS__) || defined(__HAIKU__) 
    6464 
    6565#define UL_BEOS      1 
    6666 
    … …  
    118118 
    119119#ifdef UL_BEOS 
    120120#include <be/kernel/image.h> 
    121 #define  UL_GLX     1 
     121#define  UL_GLX     0 
    122122#endif 
    123123 
    124124#ifdef UL_MACINTOSH 
    … …  
    647647    } 
    648648}; 
    649649 
    650 #elif defined (__BEOS__) 
     650#elif defined (__BEOS__) || (__HAIKU__) 
    651651 
    652652class ulDynamicLibrary 
    653653{ 
    … …  
    675675  { 
    676676    void *sym = NULL ; 
    677677 
    678     if ( handle && 
    679          get_image_symbol ( handle, "funcname", 
     678    if ( *handle && 
     679         get_image_symbol ( *handle, "funcname", 
    680680                            B_SYMBOL_TYPE_TEXT, &sym ) == B_NO_ERROR ) 
    681681      return sym ; 
    682682 
    … …  
    686686  ~ulDynamicLibrary () 
    687687  { 
    688688    if ( handle != NULL ) 
    689       unload_add_on ( handle ) ; 
     689      unload_add_on ( *handle ) ; 
    690690 
    691691    delete handle ; 
    692692  } 

Download in other formats:

  • Original Format

Trac Powered

Powered by Trac 0.13dev-r10686
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/