Initial .bep and .patch file for plib, by michaelvoliveira.

This commit is contained in:
Scott McCreary
2010-11-29 07:10:46 +00:00
parent 7f16525e8b
commit 4a90ac5b8a
2 changed files with 509 additions and 0 deletions

View File

@@ -0,0 +1,485 @@
diff -Naur plib-1.8.5/configure.in plib-1.8.5-haiku/configure.in
--- plib-1.8.5/configure.in 2008-03-11 02:09:43.007602176 +0000
+++ plib-1.8.5-haiku/configure.in 2010-08-05 08:14:40.730071040 +0000
@@ -36,7 +36,7 @@
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
-AC_PROG_RANLIB
+AC_PROG_LIBTOOL
dnl Command line arguments
@@ -276,7 +276,7 @@
LDFLAGS="$LDFLAGS $X_LIBS"
- LIBS="$LIBS $X_PRE_LIBS -lXi -lXmu -lXext -lX11 $X_EXTRA_LIBS -lm"
+ LIBS="$LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
dnl =========================================================
dnl if test "x$x_includes" != "x"; then
@@ -289,8 +289,8 @@
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(GL, glNewList)
if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
- dnl if no GL, check for MesaGL
- AC_CHECK_LIB(MesaGL, glNewList,,
+ dnl if no GL, check for GL
+ AC_CHECK_LIB(GL, glNewList,,
AC_MSG_ERROR([could not find working GL library]))
fi
@@ -356,6 +356,11 @@
CFLAGS="$CFLAGS $WFLAG"
CXXFLAGS="$CXXFLAGS $WFLAG"
+dnl Required to build shared libraries later
+CFLAGS="$CFLAGS -fPIC"
+CPPFLAGS="$CFLAGS"
+CXXFLAGS="$CFLAGS"
+
dnl FreeBSD requires the -pthread switch to enable pthreads. Look for this
dnl weirdness.
save_CXXFLAGS="$CXXFLAGS"
diff -Naur plib-1.8.5/src/fnt/fntTXF.cxx plib-1.8.5-haiku/src/fnt/fntTXF.cxx
--- plib-1.8.5/src/fnt/fntTXF.cxx 2008-03-11 02:06:20.022282240 +0000
+++ plib-1.8.5-haiku/src/fnt/fntTXF.cxx 2010-08-05 08:14:40.734527488 +0000
@@ -30,6 +30,8 @@
# include <OpenGL/CGLCurrent.h>
#elif defined(UL_WIN32)
/* Nothing */
+#elif defined(UL_BEOS)
+ /* Nothing */
#else
# include <GL/glx.h>
#endif
@@ -44,6 +46,8 @@
return ( aglGetCurrentContext () != NULL ) ;
#elif defined(UL_MAC_OSX)
return ( CGLGetCurrentContext () != NULL ) ;
+#elif defined(UL_BEOS)
+ return true ;
#else
return ( glXGetCurrentContext () != NULL ) ;
#endif
diff -Naur plib-1.8.5/src/js/jsNone.cxx plib-1.8.5-haiku/src/js/jsNone.cxx
--- plib-1.8.5/src/js/jsNone.cxx 2008-03-11 02:06:21.023330816 +0000
+++ plib-1.8.5-haiku/src/js/jsNone.cxx 2010-08-05 08:14:40.737411072 +0000
@@ -22,7 +22,7 @@
#include "js.h"
-#if defined(UL_IRIX) || defined(UL_SOLARIS) || defined (UL_HPUX)
+#if defined(UL_IRIX) || defined(UL_SOLARIS) || defined (UL_HPUX) || defined (UL_BEOS)
struct os_specific_s ;
diff -Naur plib-1.8.5/src/pui/pu.cxx plib-1.8.5-haiku/src/pui/pu.cxx
--- plib-1.8.5/src/pui/pu.cxx 2008-03-11 02:06:23.030146560 +0000
+++ plib-1.8.5-haiku/src/pui/pu.cxx 2010-08-05 08:14:40.741605376 +0000
@@ -27,7 +27,7 @@
# include <agl.h>
#elif defined(UL_CGL)
# include <OpenGL/CGLCurrent.h>
-#elif defined(UL_GLX)
+#elif defined(UL_GLX) && !defined(UL_BEOS)
# include <GL/glx.h>
#endif
@@ -107,7 +107,7 @@
return ( aglGetCurrentContext () != NULL ) ;
#elif defined(UL_CGL)
return ( CGLGetCurrentContext () != NULL ) ;
-#elif defined(UL_GLX)
+#elif defined(UL_GLX) && !defined(UL_BEOS)
return ( glXGetCurrentContext () != NULL ) ;
#else
return true ;
diff -Naur plib-1.8.5/src/pw/Makefile.am plib-1.8.5-haiku/src/pw/Makefile.am
--- plib-1.8.5/src/pw/Makefile.am 2008-03-11 02:06:20.019922944 +0000
+++ plib-1.8.5-haiku/src/pw/Makefile.am 2010-08-05 07:45:50.000000000 +0000
@@ -4,7 +4,7 @@
include_HEADERS = pw.h
-libplibpw_a_SOURCES = pw.cxx pwX11.cxx pwWindows.cxx pwMacOSX.cxx
+libplibpw_a_SOURCES = pw.cxx pwX11.cxx pwHaiku.cxx pwWindows.cxx pwMacOSX.cxx
INCLUDES = -I$(top_srcdir)/src/util
diff -Naur plib-1.8.5/src/pw/pwHaiku.cxx plib-1.8.5-haiku/src/pw/pwHaiku.cxx
--- plib-1.8.5/src/pw/pwHaiku.cxx 1970-01-01 00:00:00.000000000 +0000
+++ plib-1.8.5-haiku/src/pw/pwHaiku.cxx 2010-08-05 08:09:06.000000000 +0000
@@ -0,0 +1,200 @@
+#include "ul.h"
+
+/* ONLY COMPILE THIS FILE FOR HAIKU/BEOS EQUIPPED SYSTEMS */
+
+#if defined(UL_BEOS)
+
+#include "pw.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <assert.h>
+
+#include <GL/gl.h>
+
+static bool initialised = false ;
+static bool insideCallback = false ;
+static int modifiers = 0 ;
+static int origin [2] = { 0, 0 } ;
+static int size [2] = { 640, 480 } ;
+static int currScreen = 0 ;
+static int currConnect = 0 ;
+static int currCursor = PW_CURSOR_LEFT ;
+
+static pwResizeCB *resizeCB = NULL ;
+static pwExitCB *exitCB = NULL ;
+static pwKeybdFunc *kbCB = NULL ;
+static pwMouseFunc *msCB = NULL ;
+static pwMousePosFunc *mpCB = NULL ;
+
+static bool autoRepeat = false ;
+
+void pwSetAutoRepeatKey ( bool enable )
+{
+ autoRepeat = enable ;
+}
+
+
+struct PixelFormat
+{
+ int num_samples ;
+ int bits_per_pixel ; ;
+ int z_bits ;
+} ;
+
+
+static PixelFormat preferred_pixel_formats [] =
+{
+ /* NumSamples, RGB_bits, Z_bits */
+
+ { 0, 24, 24 }, /* Progressively nastier image formats */
+ { 0, 16, 24 },
+ { 0, 16, 16 },
+ { 0, 3, 16 },
+ { 0, 3, 1 },
+ { -1, -1, -1 } /* Magic end marker */
+} ;
+
+
+void defaultExitFunc ()
+{
+ pwCleanup () ;
+ exit ( 0 ) ;
+}
+
+
+void pwInit ( int multisample, int num_samples )
+{
+ pwInit ( 0, 0, -1, -1, multisample, "NoName", FALSE, num_samples ) ;
+}
+
+
+void pwSetCallbacks ( pwKeybdFunc *kb, pwMouseFunc *ms,
+ pwMousePosFunc *mp, pwResizeCB *rcb,
+ pwExitCB *ecb )
+{
+ if ( ! initialised )
+ {
+ fprintf ( stderr, "PW: You must not call pwSetCallbacks before pwInit.\n");
+ exit ( 1 ) ;
+ }
+
+ kbCB = kb ;
+ msCB = ms ;
+ mpCB = mp ;
+ resizeCB = rcb ;
+ exitCB = ecb ? ecb : defaultExitFunc ;
+}
+
+
+void pwInit ( int x, int y, int w, int h, int multisample,
+ char *title, int border, int num_samples )
+{
+ char *displayName = getenv ( "DISPLAY" ) ;
+
+ if ( displayName == NULL ) displayName = ":0.0" ;
+
+ pwSetCursor ( PW_CURSOR_LEFT ) ;
+
+#ifdef GL_MULTISAMPLE_FILTER_HINT_NV
+ glHint ( GL_MULTISAMPLE_FILTER_HINT_NV, multisample ) ;
+#endif
+
+ kbCB = NULL ;
+ msCB = NULL ;
+ mpCB = NULL ;
+ resizeCB = NULL ;
+ exitCB = defaultExitFunc ;
+
+ initialised = true ;
+ insideCallback = false ;
+
+ glClear ( GL_COLOR_BUFFER_BIT ) ;
+ pwSwapBuffers () ;
+ glClear ( GL_COLOR_BUFFER_BIT ) ;
+ pwSwapBuffers () ;
+}
+
+
+void pwGetSize ( int *w, int *h )
+{
+ if ( w ) *w = size[0] ;
+ if ( h ) *h = size[1] ;
+}
+
+
+void pwSetCursor ( int c )
+{
+
+}
+
+
+void pwSetSize ( int w, int h )
+{
+
+}
+
+
+void pwSetOrigin ( int x, int y )
+{
+
+}
+
+
+void pwSetSizeOrigin ( int x, int y, int w, int h )
+{
+
+}
+
+int pwGetModifiers ()
+{
+ return modifiers ;
+}
+
+
+static void getEvents ()
+{
+
+}
+
+
+void pwSwapBuffers ()
+{
+ if ( ! initialised )
+ {
+ fprintf ( stderr, "PLIB/PW: FATAL - Application called pwSwapBuffers"
+ " before pwInit.\n" ) ;
+ exit ( 1 ) ;
+ }
+
+ if ( insideCallback )
+ {
+ fprintf ( stderr, "PLIB/PW: FATAL - Application called pwSwapBuffers"
+ " from inside a callback function.\n" ) ;
+ exit ( 1 ) ;
+ }
+
+ glFlush () ;
+ getEvents () ;
+}
+
+
+#ifdef NEED_GAMMA
+void pwSetGamma ( float g )
+{
+
+}
+#endif
+
+
+void pwCleanup ()
+{
+ if ( ! initialised )
+ fprintf ( stderr, "PLIB/PW: WARNING - Application called pwCleanup"
+ " before pwInit.\n" ) ;
+}
+
+
+#endif
diff -Naur plib-1.8.5/src/pw/pwX11.cxx plib-1.8.5-haiku/src/pw/pwX11.cxx
--- plib-1.8.5/src/pw/pwX11.cxx 2008-03-11 02:06:20.020447232 +0000
+++ plib-1.8.5-haiku/src/pw/pwX11.cxx 2010-08-05 08:07:48.000000000 +0000
@@ -2,7 +2,7 @@
/* ONLY COMPILE THIS FILE FOR GLX/X11 EQUIPPED SYSTEMS */
-#ifdef UL_GLX
+#if defined(UL_GLX) && !defined(UL_BEOS)
#include "pw.h"
diff -Naur plib-1.8.5/src/sl/sl.h plib-1.8.5-haiku/src/sl/sl.h
--- plib-1.8.5/src/sl/sl.h 2008-03-11 02:06:24.040894464 +0000
+++ plib-1.8.5-haiku/src/sl/sl.h 2010-08-05 08:14:40.749731840 +0000
@@ -44,6 +44,8 @@
#define SLDSP_DEFAULT_DEVICE "/dev/audio"
#elif defined(UL_MACINTOSH) || defined(UL_MAC_OSX)
#define SLDSP_DEFAULT_DEVICE "dsp" // dummy
+#elif defined(UL_BEOS)
+#define SLDSP_DEFAULT_DEVICE "/dev/audio"
#else
#error "Port me !"
#endif
diff -Naur plib-1.8.5/src/sl/slDSP.cxx plib-1.8.5-haiku/src/sl/slDSP.cxx
--- plib-1.8.5/src/sl/slDSP.cxx 2008-03-11 02:06:24.040370176 +0000
+++ plib-1.8.5-haiku/src/sl/slDSP.cxx 2010-08-05 08:14:40.753401856 +0000
@@ -1080,6 +1080,72 @@
return secUsed;
}
+/* ------------------------------------------------------------ */
+/* Haiku/BeOS audio */
+/* ------------------------------------------------------------ */
+
+#elif defined(UL_BEOS)
+
+void slDSP::open ( const char *device, int _rate, int _stereo, int _bps )
+{
+
+}
+
+
+void slDSP::close ()
+{
+
+}
+
+
+int slDSP::getDriverBufferSize ()
+{
+ if ( error )
+ return 0 ;
+}
+
+void slDSP::getBufferInfo ()
+{
+ if ( error )
+ return ;
+}
+
+
+void slDSP::write ( void *buffer, size_t length )
+{
+
+}
+
+
+float slDSP::secondsRemaining ()
+{
+ int samples_remain;
+
+ if ( error )
+ return 0.0f ;
+}
+
+
+float slDSP::secondsUsed ()
+{
+ int samples_used;
+
+ if ( error )
+ return 0.0f ;
+}
+
+
+void slDSP::sync ()
+{
+ if ( error )
+ return ;
+}
+
+void slDSP::stop ()
+{
+}
+
+
#endif
diff -Naur plib-1.8.5/src/ssg/ssg.cxx plib-1.8.5-haiku/src/ssg/ssg.cxx
--- plib-1.8.5/src/ssg/ssg.cxx 2008-03-11 02:06:23.016252928 +0000
+++ plib-1.8.5-haiku/src/ssg/ssg.cxx 2010-08-05 08:14:40.757596160 +0000
@@ -31,6 +31,8 @@
# include <OpenGL/CGLCurrent.h>
#elif defined(UL_WIN32)
/* Nothing */
+#elif defined(UL_BEOS)
+ /* Nothing */
#else
# include <GL/glx.h>
#endif
@@ -45,6 +47,8 @@
return ( aglGetCurrentContext () != NULL ) ;
#elif defined(UL_MAC_OSX)
return ( CGLGetCurrentContext () != NULL ) ;
+#elif defined(UL_BEOS)
+ return true ;
#else
return ( glXGetCurrentContext () != NULL ) ;
#endif
diff -Naur plib-1.8.5/src/util/ul.h plib-1.8.5-haiku/src/util/ul.h
--- plib-1.8.5/src/util/ul.h 2008-03-11 02:10:13.027262976 +0000
+++ plib-1.8.5-haiku/src/util/ul.h 2010-08-05 08:14:40.762576896 +0000
@@ -60,7 +60,7 @@
#define UL_WIN32 1
#define UL_MSVC 1 /* Windoze AND MSVC. */
-#elif defined(__BEOS__)
+#elif defined(__BEOS__) || defined(__HAIKU__)
#define UL_BEOS 1
@@ -118,7 +118,7 @@
#ifdef UL_BEOS
#include <be/kernel/image.h>
-#define UL_GLX 1
+#define UL_GLX 0
#endif
#ifdef UL_MACINTOSH
@@ -647,7 +647,7 @@
}
};
-#elif defined (__BEOS__)
+#elif defined (__BEOS__) || (__HAIKU__)
class ulDynamicLibrary
{
@@ -675,8 +675,8 @@
{
void *sym = NULL ;
- if ( handle &&
- get_image_symbol ( handle, "funcname",
+ if ( *handle &&
+ get_image_symbol ( *handle, "funcname",
B_SYMBOL_TYPE_TEXT, &sym ) == B_NO_ERROR )
return sym ;
@@ -686,7 +686,7 @@
~ulDynamicLibrary ()
{
if ( handle != NULL )
- unload_add_on ( handle ) ;
+ unload_add_on ( *handle ) ;
delete handle ;
}

View File

@@ -0,0 +1,24 @@
DESCRIPTION="plib - A Suite of Portable Game Libraries"
HOMEPAGE="http://plib.sourceforge.net/"
SRC_URI="http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz"
CHECKSUM_MD5="47a6fbf63668c1eed631024038b2ea90"
REVISION="1"
STATUS_HAIKU="stable"
DEPEND=""
BUILD {
cd plib-1.8.5
libtoolize --force --copy --install
./autogen.sh
./configure --prefix=/boot/common
make
}
INSTALL {
cd plib-1.8.5
make install
}
LICENSE="GNU LGPL v2.1"
COPYRIGHT="1999-2005 Steve J. Baker"