From e82a987973c58f69538fd9f574a347920d1b8284 Mon Sep 17 00:00:00 2001 From: ksterker Date: Thu, 20 Oct 2016 22:09:30 +0200 Subject: [PATCH] SDL2-2.0.5 recipe based on previous recipe and patchset (#830) * Added recipe for SDL2 2.0.5 --- media-libs/libsdl2/libsdl2-2.0.5.recipe | 88 +++++++ .../libsdl2/patches/libsdl2-2.0.5.patchset | 243 ++++++++++++++++++ 2 files changed, 331 insertions(+) create mode 100644 media-libs/libsdl2/libsdl2-2.0.5.recipe create mode 100644 media-libs/libsdl2/patches/libsdl2-2.0.5.patchset diff --git a/media-libs/libsdl2/libsdl2-2.0.5.recipe b/media-libs/libsdl2/libsdl2-2.0.5.recipe new file mode 100644 index 000000000..9e1fb5150 --- /dev/null +++ b/media-libs/libsdl2/libsdl2-2.0.5.recipe @@ -0,0 +1,88 @@ +SUMMARY="Simple Direct Media Layer 2.0" +DESCRIPTION="Simple DirectMedia Layer is a cross-platform development library \ +designed to provide low level access to audio, keyboard, mouse, joystick, and \ +graphics hardware via OpenGL and Direct3D. It is used by video playback \ +software, emulators, and popular games." +HOMEPAGE="http://www.libsdl.org/" +COPYRIGHT="1997-2016 Sam Lantinga" +LICENSE="Zlib" +REVISION="1" +SOURCE_URI="http://www.libsdl.org/release/SDL2-$portVersion.tar.gz" +CHECKSUM_SHA256="442038cf55965969f2ff06d976031813de643af9c9edc9e331bd761c242e8785" +SOURCE_DIR="SDL2-$portVersion" +PATCHES="libsdl2-$portVersion.patchset" + +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + +PROVIDES=" + libsdl2$secondaryArchSuffix = $portVersion compat >= 2.0 + lib:libSDL2$secondaryArchSuffix = 0.5.0 compat >= 0 + lib:libSDL2_2.0$secondaryArchSuffix = 0.5.0 compat >= 0 + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libGL$secondaryArchSuffix + lib:libglu$secondaryArchSuffix + " + +PROVIDES_devel=" + libsdl2${secondaryArchSuffix}_devel = $portVersion compat >= 2.0 + cmd:sdl2_config$secondaryArchSuffix = $portVersion compat >= 2.0 + devel:libSDL2$secondaryArchSuffix = 0.5.0 compat >= 0 + devel:libSDL2main$secondaryArchSuffix = 0.5.0 compat >= 0 + devel:libSDL2_test$secondaryArchSuffix = 0.5.0 compat >= 0 + devel:libSDL2_2.0$secondaryArchSuffix = 0.5.0 compat >= 0 + " +REQUIRES_devel=" + libsdl2$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libgl$secondaryArchSuffix + devel:libglu$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:autoconf + cmd:libtool + cmd:aclocal + cmd:make + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:which + cmd:pkg_config$secondaryArchSuffix + cmd:gettext + " + +PATCH() +{ + if [ $effectiveTargetArchitecture != "x86_gcc2" ]; then + sed -i 's/lstdc++.r4/lstdc++/' configure.in + fi +} + +BUILD() +{ + autoreconf -fi + runConfigure ./configure + make $jobArgs +} + +INSTALL() +{ + make install + + # devel package + prepareInstalledDevelLibs \ + libSDL2 \ + libSDL2main \ + libSDL2_test \ + libSDL2-2.0 + + fixPkgconfig + fixDevelopLibDirReferences $binDir/sdl2-config + + packageEntries devel \ + $developDir $binDir/sdl2-config $dataDir +} diff --git a/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset b/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset new file mode 100644 index 000000000..94f445848 --- /dev/null +++ b/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset @@ -0,0 +1,243 @@ +From 1411b340e473e75344ce336b89326fefd5962821 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Fri, 29 Aug 2014 15:24:11 +0000 +Subject: haiku patch + + +diff --git a/configure.in b/configure.in +index f585d01..47186d6 100644 +--- a/configure.in ++++ b/configure.in +@@ -276,7 +276,7 @@ if test x$enable_libc = xyes; then + AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) + AC_CHECK_FUNCS(iconv) + +- AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include ]) ++ AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], [], [Description])], ,[#include ]) + fi + + dnl AC_CHECK_SIZEOF(void*) +@@ -1466,7 +1466,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma + ],[ + ],[ + have_const_param_XextAddDisplay=yes +- AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY) ++ AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], [], [Description]) + ]) + AC_MSG_RESULT($have_const_param_XextAddDisplay) + +@@ -1484,7 +1484,7 @@ XGetEventData(display, cookie); + XFreeEventData(display, cookie); + ],[ + have_XGenericEvent=yes +- AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS) ++ AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], [], [Description]) + ]) + AC_MSG_RESULT($have_XGenericEvent) + +@@ -1598,7 +1598,7 @@ int event_type = XI_TouchBegin; + XITouchClassInfo *t; + ],[ + have_xinput2_multitouch=yes +- AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH) ++ AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], [], [Description]) + SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" + ]) + AC_MSG_RESULT($have_xinput2_multitouch) +@@ -2451,7 +2451,7 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) + sem_timedwait(NULL, NULL); + ],[ + have_sem_timedwait=yes +- AC_DEFINE(HAVE_SEM_TIMEDWAIT) ++ AC_DEFINE([HAVE_SEM_TIMEDWAIT], [], [Description]) + ]) + AC_MSG_RESULT($have_sem_timedwait) + fi +@@ -3188,7 +3188,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau + fi + # The Haiku platform requires special setup. + SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" +- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" ++ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding -lstdc++.r4" + ;; + arm*-apple-darwin*) + # iOS - We are not writing anything to confdefs.h because you have to replace +diff --git a/src/thread/pthread/SDL_systhread.c b/src/thread/pthread/SDL_systhread.c +index 22f7bd5..486cf69 100644 +--- a/src/thread/pthread/SDL_systhread.c ++++ b/src/thread/pthread/SDL_systhread.c +@@ -53,7 +53,7 @@ + #endif + + #ifdef __HAIKU__ +-#include ++#include + #endif + + #include "SDL_assert.h" +diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h +index dade664..416c30c 100644 +--- a/src/video/haiku/SDL_BWin.h ++++ b/src/video/haiku/SDL_BWin.h +@@ -38,9 +38,9 @@ extern "C" { + #include + #include + #include +-#include ++#include + #if SDL_VIDEO_OPENGL +-#include ++#include + #endif + #include "SDL_events.h" + #include "../../main/haiku/SDL_BApp.h" +diff --git a/src/video/haiku/SDL_bopengl.cc b/src/video/haiku/SDL_bopengl.cc +index 15454f1..c42a910 100644 +--- a/src/video/haiku/SDL_bopengl.cc ++++ b/src/video/haiku/SDL_bopengl.cc +@@ -56,7 +56,7 @@ int BE_GL_LoadLibrary(_THIS, const char *path) + if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY, + &location) == B_OK) { + +- _this->gl_config.dll_handle = (void *) info.id; ++ _this->gl_config.dll_handle = (void *)(addr_t) info.id; + _this->gl_config.driver_loaded = 1; + SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", + SDL_arraysize(_this->gl_config.driver_path)); +@@ -71,7 +71,7 @@ void *BE_GL_GetProcAddress(_THIS, const char *proc) + void *location = NULL; + status_t err; + if ((err = +- get_image_symbol((image_id) _this->gl_config.dll_handle, ++ get_image_symbol((image_id)(addr_t) _this->gl_config.dll_handle, + proc, B_SYMBOL_TYPE_ANY, + &location)) == B_OK) { + return location; +-- +2.2.2 + + +From 2969992d8368ee4c9661552897fb2d98e4180009 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Wed, 3 Sep 2014 19:22:12 +0200 +Subject: Fix null pointer dereference. + + +diff --git a/src/video/haiku/SDL_bopengl.cc b/src/video/haiku/SDL_bopengl.cc +index c42a910..4d98641 100644 +--- a/src/video/haiku/SDL_bopengl.cc ++++ b/src/video/haiku/SDL_bopengl.cc +@@ -93,7 +93,8 @@ void BE_GL_SwapWindow(_THIS, SDL_Window * window) { + } + + int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { +- _GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView()); ++ SDL_BWin* win = (SDL_BWin*)context; ++ _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL); + return 0; + } + +-- +2.2.2 + + + + +From 7191972735818e39e3c02e1a69ffc88f67a377ab Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Thu, 25 Feb 2016 20:23:41 +0000 +Subject: remove nacl, missing templates on Haiku + + +diff --git a/configure.in b/configure.in +index 47186d6..5fcfeec 100644 +--- a/configure.in ++++ b/configure.in +@@ -1317,32 +1317,6 @@ AC_HELP_STRING([--enable-mir-shared], [dynamically load Mir support [[default=ma + fi + } + +-dnl Check for Native Client stuff +-CheckNativeClient() +-{ +- AC_TRY_COMPILE([ +- #if !defined(__native_client__) +- #error "NO NACL" +- #endif +- ],[ +- ],[ +- AC_DEFINE(SDL_VIDEO_DRIVER_NACL) +- AC_DEFINE(SDL_AUDIO_DRIVER_NACL) +- AC_DEFINE(HAVE_POW, 1, [ ]) +- AC_DEFINE(HAVE_OPENGLES2, 1, [ ]) +- AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) +- AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) +- +- SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS" +- +- SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c" +- SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c" +- SUMMARY_audio="${SUMMARY_audio} nacl" +- SOURCES="$SOURCES $srcdir/src/video/nacl/*.c" +- SUMMARY_video="${SUMMARY_video} nacl opengles2" +- ]) +-} +- + + dnl Find the X11 include and library directories + CheckX11() +-- +2.2.2 + + +From c69f84542f84c2a40dd811c6524fa862fefff276 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= +Date: Mon, 11 Jul 2016 15:39:01 +0200 +Subject: Try to find correct application signature from app resources + +Instead of always hardcoding application/x-SDL-executable. + +diff --git a/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc +index 36c2a1a..4676c58 100644 +--- a/src/main/haiku/SDL_BeApp.cc ++++ b/src/main/haiku/SDL_BeApp.cc +@@ -25,8 +25,10 @@ + /* Handle the BeApp specific portions of the application */ + + #include ++#include + #include + #include ++#include + #include + + #include "SDL_BApp.h" /* SDL_BApp class definition */ +@@ -49,7 +51,24 @@ StartBeApp(void *unused) + { + BApplication *App; + +- App = new SDL_BApp("application/x-SDL-executable"); ++ // default application signature ++ const char *signature = "application/x-SDL-executable"; ++ // dig resources for correct signature ++ image_info info; ++ int32 cookie = 0; ++ if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { ++ BFile f(info.name, O_RDONLY); ++ if (f.InitCheck() == B_OK) { ++ BAppFileInfo app_info(&f); ++ if (app_info.InitCheck() == B_OK) { ++ char sig[B_MIME_TYPE_LENGTH]; ++ if (app_info.GetSignature(sig) == B_OK) ++ signature = strndup(sig, B_MIME_TYPE_LENGTH); ++ } ++ } ++ } ++ ++ App = new SDL_BApp(signature); + + App->Run(); + delete App; +-- +2.8.0 +