Make SDL2 work better

* Fix a compilation problem on gcc2
* Use dlopen for shared library suport, as the custom code doesn't look
for libs in the right place (fixes libSDL2 not finding libpng, for
example).
This commit is contained in:
Adrien Destugues
2014-07-13 08:42:05 +02:00
parent c0fc937704
commit ca546eeb3d

View File

@@ -1,18 +1,9 @@
From 5491ee3ebfd9ddb58dad8e46a0b9afd30e12f000 Mon Sep 17 00:00:00 2001
From eeccaba1d365f8ce622c38cbd59c07ef28d9c335 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 15 Jan 2014 00:55:06 -0600
Subject: [PATCH] Haiku: Clean up includes
Subject: Haiku: Clean up includes
* Remove random references to be/os/
---
src/joystick/beos/SDL_bejoystick.cc | 4 ++--
src/loadso/beos/SDL_sysloadso.c | 2 +-
src/thread/beos/SDL_syssem.c | 2 +-
src/thread/beos/SDL_systhread.c | 2 +-
src/thread/beos/SDL_systhread_c.h | 2 +-
src/timer/beos/SDL_systimer.c | 2 +-
src/video/bwindow/SDL_BWin.h | 4 ++--
7 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/joystick/beos/SDL_bejoystick.cc b/src/joystick/beos/SDL_bejoystick.cc
index c324581..2b93d09 100644
@@ -113,3 +104,162 @@ index 6b6a71e..fc034ed 100644
--
1.8.3.4
From ca4d682e5434f5ca262d01c70f9db522b24c6844 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 10 Jul 2014 15:07:01 +0200
Subject: Initialize variable to avoid crash.
diff --git a/src/video/bwindow/SDL_BWin.h b/src/video/bwindow/SDL_BWin.h
index fc034ed..3246bad 100644
--- a/src/video/bwindow/SDL_BWin.h
+++ b/src/video/bwindow/SDL_BWin.h
@@ -83,6 +83,7 @@ class SDL_BWin:public BDirectWindow
_trash_window_buffer = false;
_buffer_locker = new BLocker();
_bitmap = NULL;
+ _clips = NULL;
#ifdef DRAWTHREAD
_draw_thread_id = spawn_thread(BE_DrawThread, "drawing_thread",
B_NORMAL_PRIORITY, (void*) this);
--
1.8.3.4
From ffd12eaadf11ce7b2ec606cbbf8a29913f9681b8 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 10 Jul 2014 17:22:57 +0200
Subject: Use dlopen for SDL loadso.
* This works fine, no need for platform specific implementation.
diff --git a/configure.in b/configure.in
index 5c56f00..3b024ac 100644
--- a/configure.in
+++ b/configure.in
@@ -2616,6 +2616,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
*-*-beos* | *-*-haiku*)
ARCH=beos
ac_default_prefix=/boot/common
+ CheckDLOPEN
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
@@ -2647,12 +2648,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
have_timers=yes
fi
- # Set up files for the shared object loading library
- if test x$enable_loadso = xyes; then
- AC_DEFINE(SDL_LOADSO_BEOS, 1, [ ])
- SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
- have_loadso=yes
- fi
# Set up files for the system power library
if test x$enable_power = xyes; then
AC_DEFINE(SDL_POWER_BEOS, 1, [ ])
diff --git a/src/loadso/beos/SDL_sysloadso.c b/src/loadso/beos/SDL_sysloadso.c
deleted file mode 100644
index 0679bcb..0000000
--- a/src/loadso/beos/SDL_sysloadso.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_config.h"
-
-#ifdef SDL_LOADSO_BEOS
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines */
-
-#include <stdio.h>
-#include <image.h>
-
-#include "SDL_loadso.h"
-
-void *
-SDL_LoadObject(const char *sofile)
-{
- void *handle = NULL;
- image_id library_id = load_add_on(sofile);
- if (library_id < 0) {
- SDL_SetError(strerror((int) library_id));
- } else {
- handle = (void *) (library_id);
- }
- return (handle);
-}
-
-void *
-SDL_LoadFunction(void *handle, const char *name)
-{
- void *sym = NULL;
- image_id library_id = (image_id) handle;
- status_t rc =
- get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym);
- if (rc != B_NO_ERROR) {
- SDL_SetError(strerror(rc));
- }
- return (sym);
-}
-
-void
-SDL_UnloadObject(void *handle)
-{
- image_id library_id;
- if (handle != NULL) {
- library_id = (image_id) handle;
- unload_add_on(library_id);
- }
-}
-
-#endif /* SDL_LOADSO_BEOS */
-
-/* vi: set ts=4 sw=4 expandtab: */
--
1.8.3.4
From 077d0aedbb3e593a62aabc2933addbfe9fef1bb0 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 11 Jul 2014 11:54:17 +0200
Subject: SDL_thread: gcc2 fix.
diff --git a/include/SDL_thread.h b/include/SDL_thread.h
index f248c3d..1e1ccec 100644
--- a/include/SDL_thread.h
+++ b/include/SDL_thread.h
@@ -228,7 +228,8 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
* \sa SDL_TLSCreate()
* \sa SDL_TLSGet()
*/
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
+typedef void(*Destructor)(void*);
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, Destructor destructor);
/* Ends C function definitions when using C++ */
--
1.8.3.4