haiku: Various fixes from haikuports.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 01 May 2017 18:39:05 -0400
changeset 109839f9160df4f1f
parent 10982 d49da5f38a14
child 10984 fb6d770b08f9
haiku: Various fixes from haikuports.

Based on patch here:

https://github.com/haikuports/haikuports/blob/master/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset
configure
configure.in
src/main/haiku/SDL_BeApp.cc
src/thread/pthread/SDL_systhread.c
src/video/haiku/SDL_BWin.h
src/video/haiku/SDL_bopengl.cc
     1.1 --- a/configure	Sat Apr 29 22:50:35 2017 +0200
     1.2 +++ b/configure	Mon May 01 18:39:05 2017 -0400
     1.3 @@ -16744,7 +16744,8 @@
     1.4      ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include <signal.h>
     1.5  "
     1.6  if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes; then :
     1.7 -  $as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h
     1.8 +
     1.9 +$as_echo "#define HAVE_SA_SIGACTION /**/" >>confdefs.h
    1.10  
    1.11  fi
    1.12  
    1.13 @@ -20173,7 +20174,8 @@
    1.14  if ac_fn_c_try_compile "$LINENO"; then :
    1.15  
    1.16              have_const_param_XextAddDisplay=yes
    1.17 -            $as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h
    1.18 +
    1.19 +$as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY /**/" >>confdefs.h
    1.20  
    1.21  
    1.22  fi
    1.23 @@ -20207,7 +20209,8 @@
    1.24  if ac_fn_c_try_compile "$LINENO"; then :
    1.25  
    1.26                  have_XGenericEvent=yes
    1.27 -                $as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h
    1.28 +
    1.29 +$as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS /**/" >>confdefs.h
    1.30  
    1.31  
    1.32  fi
    1.33 @@ -20552,7 +20555,8 @@
    1.34  if ac_fn_c_try_compile "$LINENO"; then :
    1.35  
    1.36              	have_xinput2_multitouch=yes
    1.37 -            	$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h
    1.38 +
    1.39 +$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /**/" >>confdefs.h
    1.40  
    1.41                  SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
    1.42  
    1.43 @@ -22278,7 +22282,8 @@
    1.44  if ac_fn_c_try_link "$LINENO"; then :
    1.45  
    1.46                  have_sem_timedwait=yes
    1.47 -                $as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h
    1.48 +
    1.49 +$as_echo "#define HAVE_SEM_TIMEDWAIT /**/" >>confdefs.h
    1.50  
    1.51  
    1.52  fi
    1.53 @@ -23670,7 +23675,7 @@
    1.54          fi
    1.55          # The Haiku platform requires special setup.
    1.56          SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
    1.57 -        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
    1.58 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding -lstdc++.r4"
    1.59          ;;
    1.60      arm*-apple-darwin*|*-ios-*)
    1.61          ARCH=ios
     2.1 --- a/configure.in	Sat Apr 29 22:50:35 2017 +0200
     2.2 +++ b/configure.in	Mon May 01 18:39:05 2017 -0400
     2.3 @@ -276,7 +276,7 @@
     2.4      AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
     2.5      AC_CHECK_FUNCS(iconv)
     2.6  
     2.7 -    AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include <signal.h>])
     2.8 +    AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], [], [Description])], ,[#include <signal.h>])
     2.9  fi
    2.10  
    2.11  dnl AC_CHECK_SIZEOF(void*)
    2.12 @@ -1619,7 +1619,7 @@
    2.13              ],[
    2.14              ],[
    2.15              have_const_param_XextAddDisplay=yes
    2.16 -            AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY)
    2.17 +            AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], [], [Description])
    2.18              ])
    2.19              AC_MSG_RESULT($have_const_param_XextAddDisplay)
    2.20  
    2.21 @@ -1637,7 +1637,7 @@
    2.22  XFreeEventData(display, cookie);
    2.23              ],[
    2.24                  have_XGenericEvent=yes
    2.25 -                AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
    2.26 +                AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], [], [Description])
    2.27              ])
    2.28              AC_MSG_RESULT($have_XGenericEvent)
    2.29  
    2.30 @@ -1751,7 +1751,7 @@
    2.31  XITouchClassInfo *t;
    2.32              	],[
    2.33              	have_xinput2_multitouch=yes
    2.34 -            	AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
    2.35 +            	AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], [], [Description])
    2.36                  SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
    2.37              	])
    2.38              	AC_MSG_RESULT($have_xinput2_multitouch)
    2.39 @@ -2605,7 +2605,7 @@
    2.40                    sem_timedwait(NULL, NULL);
    2.41                  ],[
    2.42                  have_sem_timedwait=yes
    2.43 -                AC_DEFINE(HAVE_SEM_TIMEDWAIT)
    2.44 +                AC_DEFINE([HAVE_SEM_TIMEDWAIT], [], [Description])
    2.45                  ])
    2.46                  AC_MSG_RESULT($have_sem_timedwait)
    2.47              fi
    2.48 @@ -3345,7 +3345,7 @@
    2.49          fi
    2.50          # The Haiku platform requires special setup.
    2.51          SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
    2.52 -        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
    2.53 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding -lstdc++.r4"
    2.54          ;;
    2.55      arm*-apple-darwin*|*-ios-*)
    2.56          ARCH=ios
     3.1 --- a/src/main/haiku/SDL_BeApp.cc	Sat Apr 29 22:50:35 2017 +0200
     3.2 +++ b/src/main/haiku/SDL_BeApp.cc	Mon May 01 18:39:05 2017 -0400
     3.3 @@ -25,8 +25,10 @@
     3.4  /* Handle the BeApp specific portions of the application */
     3.5  
     3.6  #include <AppKit.h>
     3.7 +#include <storage/AppFileInfo.h>
     3.8  #include <storage/Path.h>
     3.9  #include <storage/Entry.h>
    3.10 +#include <storage/File.h>
    3.11  #include <unistd.h>
    3.12  
    3.13  #include "SDL_BApp.h"	/* SDL_BApp class definition */
    3.14 @@ -51,7 +53,24 @@
    3.15  {
    3.16      BApplication *App;
    3.17  
    3.18 -    App = new SDL_BApp("application/x-SDL-executable");
    3.19 +	// default application signature
    3.20 +	const char *signature = "application/x-SDL-executable";
    3.21 +	// dig resources for correct signature
    3.22 +	image_info info;
    3.23 +	int32 cookie = 0;
    3.24 +	if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
    3.25 +		BFile f(info.name, O_RDONLY);
    3.26 +		if (f.InitCheck() == B_OK) {
    3.27 +			BAppFileInfo app_info(&f);
    3.28 +			if (app_info.InitCheck() == B_OK) {
    3.29 +				char sig[B_MIME_TYPE_LENGTH];
    3.30 +				if (app_info.GetSignature(sig) == B_OK)
    3.31 +					signature = strndup(sig, B_MIME_TYPE_LENGTH);
    3.32 +			}
    3.33 +		}
    3.34 +	}
    3.35 +
    3.36 +	App = new SDL_BApp(signature);
    3.37  
    3.38      App->Run();
    3.39      delete App;
     4.1 --- a/src/thread/pthread/SDL_systhread.c	Sat Apr 29 22:50:35 2017 +0200
     4.2 +++ b/src/thread/pthread/SDL_systhread.c	Mon May 01 18:39:05 2017 -0400
     4.3 @@ -52,7 +52,7 @@
     4.4  #endif
     4.5  
     4.6  #ifdef __HAIKU__
     4.7 -#include <be/kernel/OS.h>
     4.8 +#include <kernel/OS.h>
     4.9  #endif
    4.10  
    4.11  #include "SDL_assert.h"
     5.1 --- a/src/video/haiku/SDL_BWin.h	Sat Apr 29 22:50:35 2017 +0200
     5.2 +++ b/src/video/haiku/SDL_BWin.h	Mon May 01 18:39:05 2017 -0400
     5.3 @@ -38,9 +38,9 @@
     5.4  #include <stdio.h>
     5.5  #include <AppKit.h>
     5.6  #include <InterfaceKit.h>
     5.7 -#include <be/game/DirectWindow.h>
     5.8 +#include <game/DirectWindow.h>
     5.9  #if SDL_VIDEO_OPENGL
    5.10 -#include <be/opengl/GLView.h>
    5.11 +#include <opengl/GLView.h>
    5.12  #endif
    5.13  #include "SDL_events.h"
    5.14  #include "../../main/haiku/SDL_BApp.h"
     6.1 --- a/src/video/haiku/SDL_bopengl.cc	Sat Apr 29 22:50:35 2017 +0200
     6.2 +++ b/src/video/haiku/SDL_bopengl.cc	Mon May 01 18:39:05 2017 -0400
     6.3 @@ -94,7 +94,8 @@
     6.4  }
     6.5  
     6.6  int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
     6.7 -    _GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView());
     6.8 +    SDL_BWin* win = (SDL_BWin*)context;
     6.9 +    _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL);
    6.10      return 0;
    6.11  }
    6.12