Date: Fri, 6 Mar 2009 12:41:17 -0800 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Tue, 17 Mar 2009 03:58:53 +0000
branchSDL-1.2
changeset 41647a4c511c980a
parent 4163 bec67d0b6645
child 4165 3b8ac3d311a2
Date: Fri, 6 Mar 2009 12:41:17 -0800
From: scott mc
Subject: Re: [SDL] patch for building on haiku

Ok. I've combined the various Haiku patches for the SDL-1.2 branch
into one .diff file
configure.in
include/SDL_platform.h
include/begin_code.h
src/video/bwindow/SDL_sysvideo.cc
src/video/bwindow/SDL_sysyuv.cc
src/video/bwindow/SDL_sysyuv.h
test/configure.in
test/testplatform.c
     1.1 --- a/configure.in	Tue Feb 17 05:25:25 2009 +0000
     1.2 +++ b/configure.in	Tue Mar 17 03:58:53 2009 +0000
     1.3 @@ -40,7 +40,7 @@
     1.4  AC_SUBST(LT_AGE)
     1.5  
     1.6  dnl Detect the canonical build and host environments
     1.7 -AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
     1.8 +AC_CONFIG_AUX_DIR([build-scripts])
     1.9  AC_CANONICAL_HOST
    1.10  AC_C_BIGENDIAN
    1.11  if test x$ac_cv_c_bigendian = xyes; then
    1.12 @@ -2493,7 +2493,7 @@
    1.13          SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
    1.14          SDL_LIBS="-lSDLmain $SDL_LIBS"
    1.15          ;;
    1.16 -    *-*-beos*)
    1.17 +    *-*-beos* | *-*-haiku*)
    1.18          ARCH=beos
    1.19          ac_default_prefix=/boot/develop/tools/gnupro
    1.20          CheckDummyVideo
    1.21 @@ -2536,8 +2536,16 @@
    1.22          fi
    1.23          # Set up files for the shared object loading library
    1.24          if test x$enable_loadso = xyes; then
    1.25 -            AC_DEFINE(SDL_LOADSO_BEOS)
    1.26 -            SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
    1.27 +            case "$host" in
    1.28 +                *-*-beos*)
    1.29 +                    AC_DEFINE(SDL_LOADSO_BEOS)
    1.30 +                    SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
    1.31 +                ;;
    1.32 +                *-*-haiku*)
    1.33 +                    AC_DEFINE(SDL_LOADSO_DLOPEN)
    1.34 +                    SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
    1.35 +                ;;
    1.36 +            esac    
    1.37              have_loadso=yes
    1.38          fi
    1.39          # The BeOS platform requires special setup.
     2.1 --- a/include/SDL_platform.h	Tue Feb 17 05:25:25 2009 +0000
     2.2 +++ b/include/SDL_platform.h	Tue Mar 17 03:58:53 2009 +0000
     2.3 @@ -33,6 +33,10 @@
     2.4  #undef __BEOS__
     2.5  #define __BEOS__	1
     2.6  #endif
     2.7 +#if defined(__HAIKU__)
     2.8 +#undef __HAIKU__
     2.9 +#define __HAIKU__ 1
    2.10 +#endif
    2.11  #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
    2.12  #undef __BSDI__
    2.13  #define __BSDI__	1
    2.14 @@ -45,6 +49,10 @@
    2.15  #undef __FREEBSD__
    2.16  #define __FREEBSD__	1
    2.17  #endif
    2.18 +#if defined(__HAIKU__)
    2.19 +#undef __HAIKU__
    2.20 +#define __HAIKU__	1
    2.21 +#endif
    2.22  #if defined(hpux) || defined(__hpux) || defined(__hpux__)
    2.23  #undef __HPUX__
    2.24  #define __HPUX__	1
     3.1 --- a/include/begin_code.h	Tue Feb 17 05:25:25 2009 +0000
     3.2 +++ b/include/begin_code.h	Tue Mar 17 03:58:53 2009 +0000
     3.3 @@ -33,7 +33,7 @@
     3.4  
     3.5  /* Some compilers use a special export keyword */
     3.6  #ifndef DECLSPEC
     3.7 -# if defined(__BEOS__)
     3.8 +# if defined(__BEOS__) || defined(__HAIKU__)
     3.9  #  if defined(__GNUC__)
    3.10  #   define DECLSPEC	__declspec(dllexport)
    3.11  #  else
     4.1 --- a/src/video/bwindow/SDL_sysvideo.cc	Tue Feb 17 05:25:25 2009 +0000
     4.2 +++ b/src/video/bwindow/SDL_sysvideo.cc	Tue Mar 17 03:58:53 2009 +0000
     4.3 @@ -57,7 +57,7 @@
     4.4  static void BE_FreeHWSurface(_THIS, SDL_Surface *surface);
     4.5  
     4.6  static int BE_ToggleFullScreen(_THIS, int fullscreen);
     4.7 -static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
     4.8 +SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
     4.9  
    4.10  /* OpenGL functions */
    4.11  #if SDL_VIDEO_OPENGL
    4.12 @@ -637,8 +637,12 @@
    4.13  			int32 cookie = 0;
    4.14  			while (get_next_image_info(0,&cookie,&info) == B_OK) {
    4.15  				void *location = NULL;
    4.16 -				if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) {
    4.17 -					_this->gl_config.dll_handle = (void*)cookie;
    4.18 +#ifdef __HAIKU__
    4.19 +				if (get_image_symbol(info.id,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { // This is how it actually works in Haiku
    4.20 +#else
    4.21 +				if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { // I don't know if that *did* work in BeOS
    4.22 +#endif
    4.23 +					_this->gl_config.dll_handle = (void*)info.id;
    4.24  					_this->gl_config.driver_loaded = 1;
    4.25  					SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", SDL_arraysize(_this->gl_config.driver_path));
    4.26  				}
     5.1 --- a/src/video/bwindow/SDL_sysyuv.cc	Tue Feb 17 05:25:25 2009 +0000
     5.2 +++ b/src/video/bwindow/SDL_sysyuv.cc	Tue Mar 17 03:58:53 2009 +0000
     5.3 @@ -94,7 +94,7 @@
     5.4  
     5.5  // See <GraphicsDefs.h> [btw: Cb=U, Cr=V]
     5.6  // See also http://www.fourcc.org/indexyuv.htm
     5.7 -enum color_space convert_color_space(Uint32 format) {
     5.8 +color_space convert_color_space(Uint32 format) {
     5.9  	switch (format) {
    5.10  	case SDL_YV12_OVERLAY:
    5.11  		return B_YUV9;
     6.1 --- a/src/video/bwindow/SDL_sysyuv.h	Tue Feb 17 05:25:25 2009 +0000
     6.2 +++ b/src/video/bwindow/SDL_sysyuv.h	Tue Mar 17 03:58:53 2009 +0000
     6.3 @@ -62,7 +62,7 @@
     6.4  };
     6.5  
     6.6  extern BBitmap * BE_GetOverlayBitmap(BRect bounds, color_space cs);
     6.7 -extern SDL_Overlay* BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface* display);
     6.8 +SDL_Overlay* BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface* display);
     6.9  extern int BE_LockYUVOverlay(_THIS, SDL_Overlay* overlay);
    6.10  extern void BE_UnlockYUVOverlay(_THIS, SDL_Overlay* overlay);
    6.11  extern int BE_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* src, SDL_Rect* dst);
     7.1 --- a/test/configure.in	Tue Feb 17 05:25:25 2009 +0000
     7.2 +++ b/test/configure.in	Tue Mar 17 03:58:53 2009 +0000
     7.3 @@ -20,7 +20,7 @@
     7.4          MATHLIB=""
     7.5          SYS_GL_LIBS="-lopengl32"
     7.6          ;;
     7.7 -    *-*-beos*)
     7.8 +    *-*-beos* | *-*-haiku*)
     7.9          EXE=""
    7.10          MATHLIB=""
    7.11          SYS_GL_LIBS="-lGL"
     8.1 --- a/test/testplatform.c	Tue Feb 17 05:25:25 2009 +0000
     8.2 +++ b/test/testplatform.c	Tue Mar 17 03:58:53 2009 +0000
     8.3 @@ -162,6 +162,8 @@
     8.4  			"Dreamcast"
     8.5  #elif __FREEBSD__
     8.6  			"FreeBSD"
     8.7 +#elif __HAIKU__
     8.8 +			"Haiku"
     8.9  #elif __HPUX__
    8.10  			"HP-UX"
    8.11  #elif __IRIX__