SDL2: bump version, remove upstreamed patches

This commit is contained in:
PulkoMandy
2024-03-24 11:34:12 +01:00
parent 03bac469ee
commit 69a6e15400
4 changed files with 33 additions and 967 deletions

View File

@@ -6,9 +6,9 @@ software, emulators, and popular games."
HOMEPAGE="https://www.libsdl.org/"
COPYRIGHT="1997-2022 Sam Lantinga"
LICENSE="Zlib"
REVISION="4"
REVISION="1"
SOURCE_URI="https://www.libsdl.org/release/SDL2-$portVersion.tar.gz"
CHECKSUM_SHA256="1a0f686498fb768ad9f3f80b39037a7d006eac093aad39cb4ebcc832a8887231"
CHECKSUM_SHA256="01215ffbc8cfc4ad165ba7573750f15ddda1f971d5a66e9dcaffd37c587f473a"
SOURCE_DIR="SDL2-$portVersion"
PATCHES="libsdl2-$portVersion.patchset"
@@ -17,7 +17,7 @@ SECONDARY_ARCHITECTURES="x86"
PROVIDES="
libsdl2$secondaryArchSuffix = $portVersion compat >= 2.0
lib:libSDL2_2.0$secondaryArchSuffix = 0.2600.4 compat >= 0
lib:libSDL2_2.0$secondaryArchSuffix = 0.3000.1 compat >= 0
"
REQUIRES="
haiku$secondaryArchSuffix
@@ -28,8 +28,8 @@ REQUIRES="
PROVIDES_devel="
libsdl2${secondaryArchSuffix}_devel = $portVersion compat >= 2.0
cmd:sdl2_config$secondaryArchSuffix = $portVersion compat >= 2.0
devel:libSDL2$secondaryArchSuffix = 0.2600.4 compat >= 0
devel:libSDL2_2.0$secondaryArchSuffix = 0.2600.4 compat >= 0
devel:libSDL2$secondaryArchSuffix = 0.3000.1 compat >= 0
devel:libSDL2_2.0$secondaryArchSuffix = 0.3000.1 compat >= 0
devel:libSDL2main$secondaryArchSuffix
"
REQUIRES_devel="

View File

@@ -1,493 +0,0 @@
From b4d2752b7cfa3981996edb197c99d342fa7d5ae4 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 2 Feb 2018 09:40:46 +0100
Subject: Fix secondary arch build.
Rather than trying to guess the name of libstdc++, run libtool in C++
mode so it figures this out by itself. The previous way of detecting
libstdc++ would not allow for building a secondary architecture package.
diff --git a/Makefile.in b/Makefile.in
index 57871be..ea7f5e5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -151,13 +151,13 @@ update-revision:
.PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
$(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS)
- $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
+ $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CXX --mode=link $(CXX) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
- $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLMAIN_OBJECTS) -rpath $(libdir)
+ $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CXX --mode=link $(CXX) -static -o $@ $(SDLMAIN_OBJECTS) -rpath $(libdir)
$(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS)
- $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLTEST_OBJECTS) -rpath $(libdir)
+ $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CXX --mode=link $(CXX) -static -o $@ $(SDLTEST_OBJECTS) -rpath $(libdir)
install: all install-bin install-hdrs install-lib install-data
install-bin:
diff --git a/configure.ac b/configure.ac
index b7e519b..8e15ca9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3942,9 +3942,6 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
# The Haiku platform requires special setup.
SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
- # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but
- # other spins, like x86-64, use a more standard "libstdc++.so.*"
- AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++")
;;
*-ios-*)
ARCH=ios
--
2.30.0
From f21290d64a86de299f16809ee22ec2af9c68a302 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 8 Mar 2021 14:34:02 +1000
Subject: Fix relative mode for mouse
diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h
index 34f0d5f..806fc51 100644
--- a/src/video/haiku/SDL_BWin.h
+++ b/src/video/haiku/SDL_BWin.h
@@ -140,7 +140,6 @@ class SDL_BWin:public BDirectWindow
_gl_type = gl_flags;
}
AddChild(_SDL_GLView);
- _SDL_GLView->SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY);
_SDL_GLView->EnableDirectMode(true);
_SDL_GLView->LockGL(); /* "New" GLViews are created */
Unlock();
diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc
index 817fccf..234eaf0 100644
--- a/src/video/haiku/SDL_bvideo.cc
+++ b/src/video/haiku/SDL_bvideo.cc
@@ -37,6 +37,12 @@ extern "C" {
#include "SDL_bframebuffer.h"
#include "SDL_bevents.h"
+#include "SDL_BWin.h"
+
+static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
+ return ((SDL_BWin*)(window->driverdata));
+}
+
#include <Url.h>
/* FIXME: Undefined functions */
@@ -152,12 +158,34 @@ static int HAIKU_ShowCursor(SDL_Cursor *cur)
return 0;
}
+static int
+HAIKU_SetRelativeMouseMode(SDL_bool enabled)
+{
+ SDL_Window *window = SDL_GetMouseFocus();
+ if (!window) {
+ return 0;
+ }
+
+ SDL_BWin *bewin = _ToBeWin(window);
+ BGLView *_SDL_GLView = bewin->GetGLView();
+
+ bewin->Lock();
+ if (enabled)
+ _SDL_GLView->SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY);
+ else
+ _SDL_GLView->SetEventMask(0, 0);
+ bewin->Unlock();
+
+ return 0;
+}
+
static void HAIKU_MouseInit(_THIS)
{
SDL_Mouse *mouse = SDL_GetMouse();
if (!mouse)
return;
mouse->ShowCursor = HAIKU_ShowCursor;
+ mouse->SetRelativeMouseMode = HAIKU_SetRelativeMouseMode;
mouse->cur_cursor = (SDL_Cursor*)0x1;
mouse->def_cursor = (SDL_Cursor*)0x2;
}
--
2.30.0
From e72180d6c6a05161fbb7051a3d0396a9371dd726 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 8 Mar 2021 14:34:40 +1000
Subject: Add support for system cursors
diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h
index 806fc51..974c152 100644
--- a/src/video/haiku/SDL_BWin.h
+++ b/src/video/haiku/SDL_BWin.h
@@ -37,6 +37,7 @@ extern "C" {
#include <stdio.h>
#include <AppKit.h>
+#include <Cursor.h>
#include <InterfaceKit.h>
#include <game/DirectWindow.h>
#if SDL_VIDEO_OPENGL
diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc
index 234eaf0..0948451 100644
--- a/src/video/haiku/SDL_bvideo.cc
+++ b/src/video/haiku/SDL_bvideo.cc
@@ -141,20 +141,72 @@ void HAIKU_DeleteDevice(SDL_VideoDevice * device)
SDL_free(device);
}
-static int HAIKU_ShowCursor(SDL_Cursor *cur)
+static SDL_Cursor *
+HAIKU_CreateSystemCursor(SDL_SystemCursor id)
+{
+ SDL_Cursor *cursor;
+ BCursorID cursorId = B_CURSOR_ID_SYSTEM_DEFAULT;
+
+ switch(id)
+ {
+ default:
+ SDL_assert(0);
+ return NULL;
+ case SDL_SYSTEM_CURSOR_ARROW: cursorId = B_CURSOR_ID_SYSTEM_DEFAULT; break;
+ case SDL_SYSTEM_CURSOR_IBEAM: cursorId = B_CURSOR_ID_I_BEAM; break;
+ case SDL_SYSTEM_CURSOR_WAIT: cursorId = B_CURSOR_ID_PROGRESS; break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR: cursorId = B_CURSOR_ID_CROSS_HAIR; break;
+ case SDL_SYSTEM_CURSOR_WAITARROW: cursorId = B_CURSOR_ID_PROGRESS; break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE: cursorId = B_CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST; break;
+ case SDL_SYSTEM_CURSOR_SIZENESW: cursorId = B_CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST; break;
+ case SDL_SYSTEM_CURSOR_SIZEWE: cursorId = B_CURSOR_ID_RESIZE_EAST_WEST; break;
+ case SDL_SYSTEM_CURSOR_SIZENS: cursorId = B_CURSOR_ID_RESIZE_NORTH_SOUTH; break;
+ case SDL_SYSTEM_CURSOR_SIZEALL: cursorId = B_CURSOR_ID_MOVE; break;
+ case SDL_SYSTEM_CURSOR_NO: cursorId = B_CURSOR_ID_NOT_ALLOWED; break;
+ case SDL_SYSTEM_CURSOR_HAND: cursorId = B_CURSOR_ID_FOLLOW_LINK; break;
+ }
+
+ cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ cursor->driverdata = (void *)new BCursor(cursorId);
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static SDL_Cursor *
+HAIKU_CreateDefaultCursor()
+{
+ return HAIKU_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
+}
+
+static void
+HAIKU_FreeCursor(SDL_Cursor * cursor)
+{
+ if (cursor->driverdata) {
+ delete (BCursor*) cursor->driverdata;
+ }
+ SDL_free(cursor);
+}
+
+static int HAIKU_ShowCursor(SDL_Cursor *cursor)
{
SDL_Mouse *mouse = SDL_GetMouse();
- int show;
+
if (!mouse)
return 0;
- show = (cur || !mouse->focus);
- if (show) {
- if (be_app->IsCursorHidden())
- be_app->ShowCursor();
+
+ if (cursor) {
+ BCursor *hCursor = (BCursor*)cursor->driverdata;
+ be_app->SetCursor(hCursor);
} else {
- if (!be_app->IsCursorHidden())
- be_app->HideCursor();
+ BCursor *hCursor = new BCursor(B_CURSOR_ID_NO_CURSOR);
+ be_app->SetCursor(hCursor);
+ delete hCursor;
}
+
return 0;
}
@@ -184,10 +236,12 @@ static void HAIKU_MouseInit(_THIS)
SDL_Mouse *mouse = SDL_GetMouse();
if (!mouse)
return;
+ mouse->CreateSystemCursor = HAIKU_CreateSystemCursor;
mouse->ShowCursor = HAIKU_ShowCursor;
+ mouse->FreeCursor = HAIKU_FreeCursor;
mouse->SetRelativeMouseMode = HAIKU_SetRelativeMouseMode;
- mouse->cur_cursor = (SDL_Cursor*)0x1;
- mouse->def_cursor = (SDL_Cursor*)0x2;
+
+ SDL_SetDefaultCursor(HAIKU_CreateDefaultCursor());
}
int HAIKU_VideoInit(_THIS)
--
2.30.0
From e3c8ac3ec956272129a320ff5a7347d9050d69ca Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 8 Mar 2021 14:36:14 +1000
Subject: Disable direct mode for BGLView
diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h
index 974c152..83bb346 100644
--- a/src/video/haiku/SDL_BWin.h
+++ b/src/video/haiku/SDL_BWin.h
@@ -141,7 +141,7 @@ class SDL_BWin:public BDirectWindow
_gl_type = gl_flags;
}
AddChild(_SDL_GLView);
- _SDL_GLView->EnableDirectMode(true);
+ _SDL_GLView->EnableDirectMode(false); /* Disable direct mode */
_SDL_GLView->LockGL(); /* "New" GLViews are created */
Unlock();
return (_SDL_GLView);
--
2.30.0
From 8ac03106fea9245de0b495d23e38bf4055b8df55 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 8 Mar 2021 14:36:48 +1000
Subject: Fix build for gcc2
diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc
index 0948451..f3c80ac 100644
--- a/src/video/haiku/SDL_bvideo.cc
+++ b/src/video/haiku/SDL_bvideo.cc
@@ -18,11 +18,14 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
+
#include "../../SDL_internal.h"
#include "../../main/haiku/SDL_BApp.h"
#if SDL_VIDEO_DRIVER_HAIKU
+#include "SDL_BWin.h"
+#include <Url.h>
#ifdef __cplusplus
extern "C" {
@@ -37,14 +40,10 @@ extern "C" {
#include "SDL_bframebuffer.h"
#include "SDL_bevents.h"
-#include "SDL_BWin.h"
-
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata));
}
-#include <Url.h>
-
/* FIXME: Undefined functions */
// #define HAIKU_PumpEvents NULL
#define HAIKU_StartTextInput NULL
--
2.30.0
From 27e186cc748fb703abd03fa433c700725980e049 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 25 Apr 2021 13:35:32 +0200
Subject: Haiku: cmake build
use CMAKE_INSTALL_ variables where applicable
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9b9eb6..c203236 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1141,7 +1141,7 @@ elseif(EMSCRIPTEN)
endif()
endif()
-elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
+elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
if(SDL_AUDIO)
if(SYSV5 OR SOLARIS OR HPUX)
set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
@@ -1927,30 +1927,46 @@ elseif(APPLE)
CheckPTHREAD()
elseif(HAIKU)
+ if(SDL_AUDIO)
+ set(SDL_AUDIO_DRIVER_HAIKU 1)
+ file(GLOB HAIKU_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/haiku/*.cc)
+ set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_AUDIO_SOURCES})
+ set(HAVE_SDL_AUDIO TRUE)
+ endif()
+
+ if(SDL_JOYSTICK)
+ set(SDL_JOYSTICK_HAIKU 1)
+ file(GLOB HAIKU_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/haiku/*.cc)
+ set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_JOYSTICK_SOURCES})
+ set(HAVE_SDL_JOYSTICK TRUE)
+ endif()
+
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc)
set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES})
set(HAVE_SDL_MISC TRUE)
if(SDL_VIDEO)
set(SDL_VIDEO_DRIVER_HAIKU 1)
- file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.c)
+ file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.cc)
set(SOURCE_FILES ${SOURCE_FILES} ${HAIKUVIDEO_SOURCES})
set(HAVE_SDL_VIDEO TRUE)
if(VIDEO_OPENGL)
# TODO: Use FIND_PACKAGE(OpenGL) instead
set(SDL_VIDEO_OPENGL 1)
- set(SDL_VIDEO_OPENGL_BGL 1)
+ set(SDL_VIDEO_OPENGL_HAIKU 1)
set(SDL_VIDEO_RENDER_OGL 1)
list(APPEND EXTRA_LIBS GL)
set(HAVE_VIDEO_OPENGL TRUE)
endif()
endif()
- set(SDL_FILESYSTEM_HAIKU 1)
- file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/haiku/*.cc)
- set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
- set(HAVE_SDL_FILESYSTEM TRUE)
+ if(SDL_FILESYSTEM)
+ set(SDL_FILESYSTEM_HAIKU 1)
+ file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/haiku/*.cc)
+ set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
+ set(HAVE_SDL_FILESYSTEM TRUE)
+ endif()
if(SDL_TIMERS)
set(SDL_TIMER_HAIKU 1)
@@ -1959,13 +1975,24 @@ elseif(HAIKU)
set(HAVE_SDL_TIMERS TRUE)
endif()
+ if(SDL_POWER)
+ set(SDL_POWER_HAIKU 1)
+ file(GLOB HAIKU_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/haiku/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_POWER_SOURCES})
+ set(HAVE_SDL_POWER TRUE)
+ endif()
+
if(SDL_LOCALE)
file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/haiku/*.cc)
set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
set(HAVE_SDL_LOCALE TRUE)
endif()
+ file(GLOB MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/haiku/*.cc)
+ set(SOURCE_FILES ${SOURCE_FILES} ${MAIN_SOURCES})
+
CheckPTHREAD()
+ list(APPEND EXTRA_LIBS root be media game device textencoding)
elseif(RISCOS)
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c)
@@ -2089,9 +2116,9 @@ endif()
if(NOT WINDOWS OR CYGWIN)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
- set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
- set(bindir "\${exec_prefix}/bin")
- set(includedir "\${prefix}/include")
+ set(libdir "${CMAKE_INSTALL_LIBDIR}")
+ set(bindir "${CMAKE_INSTALL_BINDIR}")
+ set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
if(SDL_STATIC)
set(ENABLE_STATIC_TRUE "")
set(ENABLE_STATIC_FALSE "#")
@@ -2199,7 +2226,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
# Always build SDLmain
if(NOT WINDOWS_STORE)
add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
-target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
+target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>)
set(_INSTALL_LIBS "SDL2main")
if (NOT ANDROID)
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
@@ -2239,7 +2266,7 @@ if(SDL_SHARED)
endif()
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
- target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
+ target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>)
if(ANDROID)
target_include_directories(SDL2 PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures)
else()
@@ -2309,15 +2336,15 @@ endif()
##### Installation targets #####
install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
- LIBRARY DESTINATION "lib${LIB_SUFFIX}"
- ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
- RUNTIME DESTINATION bin)
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
##### Export files #####
if (WINDOWS)
set(PKG_PREFIX "cmake")
else ()
- set(PKG_PREFIX "lib${LIB_SUFFIX}/cmake/SDL2")
+ set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/SDL2")
endif ()
include(CMakePackageConfigHelpers)
@@ -2346,7 +2373,7 @@ foreach(_FNAME ${BIN_INCLUDE_FILES})
list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME})
endforeach()
list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
-install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2)
+install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2)
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
if (UPPER_BUILD_TYPE MATCHES DEBUG)
@@ -2364,7 +2391,7 @@ if(NOT (WINDOWS OR CYGWIN))
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
\"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\"
WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")")
- install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "lib${LIB_SUFFIX}")
+ install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}")
endif()
endif()
if(FREEBSD)
@@ -2372,9 +2399,9 @@ if(NOT (WINDOWS OR CYGWIN))
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig")
else()
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc
- DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/pkgconfig")
endif()
- install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin)
+ install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}")
# TODO: what about the .spec file? Is it only needed for RPM creation?
install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal")
endif()
--
2.30.0

View File

@@ -1,469 +0,0 @@
From 7a4fc529d097359a985556cb2f5ba601c8de3a0f Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 12 Jan 2022 11:59:06 +1000
Subject: Workaround for gcc2
diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index 5c3f012..6fc3c14 100644
--- a/src/stdlib/SDL_string.c
+++ b/src/stdlib/SDL_string.c
@@ -33,6 +33,10 @@
#include <psp2/kernel/clib.h>
#endif
+#if __GNUC__ == 2
+#define va_copy(to, from) __va_copy(to, from)
+#endif
+
#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL)
#define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F'))
#define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f'))
--
2.37.3
From 66219afffdd033230f687202256eb0d9249845f2 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 29 Mar 2023 21:28:21 +0200
Subject: Haiku: use a BLooper for events.
only create a BApplication when it doesn't already exist.
diff --git a/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h
index 868b4ed..f7d7af4 100644
--- a/src/main/haiku/SDL_BApp.h
+++ b/src/main/haiku/SDL_BApp.h
@@ -53,6 +53,7 @@ extern "C" {
/* Forward declarations */
+class SDL_BLooper;
class SDL_BWin;
/* Message constants */
@@ -78,32 +79,24 @@ enum ToSDL {
};
+extern "C" SDL_BLooper *SDL_Looper;
-/* Create a descendant of BApplication */
-class SDL_BApp : public BApplication {
+
+/* Create a descendant of BLooper */
+class SDL_BLooper : public BLooper {
public:
- SDL_BApp(const char* signature) :
- BApplication(signature) {
+ SDL_BLooper(const char* name) :
+ BLooper(name) {
#if SDL_VIDEO_OPENGL
_current_context = NULL;
#endif
}
- virtual ~SDL_BApp() {
+ virtual ~SDL_BLooper() {
}
- virtual void RefsReceived(BMessage* message) {
- char filePath[512];
- entry_ref entryRef;
- for (int32 i = 0; message->FindRef("refs", i, &entryRef) == B_OK; i++) {
- BPath referencePath = BPath(&entryRef);
- SDL_SendDropFile(NULL, referencePath.Path());
- }
- return;
- }
-
/* Event-handling functions */
virtual void MessageReceived(BMessage* message) {
/* Sort out SDL-related messages */
@@ -173,7 +166,7 @@ public:
break;
default:
- BApplication::MessageReceived(message);
+ BLooper::MessageReceived(message);
break;
}
}
diff --git a/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc
index 9acbc54..5dea3a4 100644
--- a/src/main/haiku/SDL_BeApp.cc
+++ b/src/main/haiku/SDL_BeApp.cc
@@ -31,7 +31,7 @@
#include <storage/File.h>
#include <unistd.h>
-#include "SDL_BApp.h" /* SDL_BApp class definition */
+#include "SDL_BApp.h" /* SDL_BLooper class definition */
#include "SDL_BeApp.h"
#include "SDL_timer.h"
#include "SDL_error.h"
@@ -44,13 +44,39 @@ extern "C" {
#include "../../thread/SDL_systhread.h"
-/* Flag to tell whether or not the Be application is active or not */
+/* Flag to tell whether or not the Be application and looper are active or not */
static int SDL_BeAppActive = 0;
static SDL_Thread *SDL_AppThread = NULL;
+SDL_BLooper *SDL_Looper = NULL;
+
/* Default application signature */
const char *signature = "application/x-SDL-executable";
+
+/* Create a descendant of BApplication */
+class SDL_BApp : public BApplication {
+public:
+ SDL_BApp(const char* signature) :
+ BApplication(signature) {
+ }
+
+
+ virtual ~SDL_BApp() {
+ }
+
+
+ virtual void RefsReceived(BMessage* message) {
+ entry_ref entryRef;
+ for (int32 i = 0; message->FindRef("refs", i, &entryRef) == B_OK; i++) {
+ BPath referencePath = BPath(&entryRef);
+ SDL_SendDropFile(NULL, referencePath.Path());
+ }
+ return;
+ }
+};
+
+
static int
StartBeApp(void *unused)
{
@@ -78,35 +104,49 @@ StartBeApp(void *unused)
return (0);
}
-/* Initialize the Be Application, if it's not already started */
-int
-SDL_InitBeApp(void)
+
+static int
+StartBeLooper()
{
- /* Create the BApplication that handles appserver interaction */
- if (SDL_BeAppActive <= 0) {
+ if (!be_app) {
SDL_AppThread = SDL_CreateThreadInternal(StartBeApp, "SDLApplication", 0, NULL);
if (SDL_AppThread == NULL) {
return SDL_SetError("Couldn't create BApplication thread");
}
- /* Change working directory to that of executable */
- app_info info;
- if (B_OK == be_app->GetAppInfo(&info)) {
- entry_ref ref = info.ref;
- BEntry entry;
- if (B_OK == entry.SetTo(&ref)) {
- BPath path;
- if (B_OK == path.SetTo(&entry)) {
- if (B_OK == path.GetParent(&path)) {
- chdir(path.Path());
- }
+ do {
+ SDL_Delay(10);
+ } while ((be_app == NULL) || be_app->IsLaunching());
+ }
+
+ /* Change working directory to that of executable */
+ app_info info;
+ if (B_OK == be_app->GetAppInfo(&info)) {
+ entry_ref ref = info.ref;
+ BEntry entry;
+ if (B_OK == entry.SetTo(&ref)) {
+ BPath path;
+ if (B_OK == path.SetTo(&entry)) {
+ if (B_OK == path.GetParent(&path)) {
+ chdir(path.Path());
}
}
}
+ }
- do {
- SDL_Delay(10);
- } while ((be_app == NULL) || be_app->IsLaunching());
+ SDL_Looper = new SDL_BLooper("SDLLooper");
+ SDL_Looper->Run();
+ return (0);
+}
+
+
+/* Initialize the Be Application, if it's not already started */
+int
+SDL_InitBeApp(void)
+{
+ /* Create the BApplication that handles appserver interaction */
+ if (SDL_BeAppActive <= 0) {
+ StartBeLooper();
/* Mark the application active */
SDL_BeAppActive = 0;
@@ -128,6 +168,9 @@ SDL_QuitBeApp(void)
/* If the reference count reached zero, clean up the app */
if (SDL_BeAppActive == 0) {
+ SDL_Looper->Lock();
+ SDL_Looper->Quit();
+ SDL_Looper = NULL;
if (SDL_AppThread != NULL) {
if (be_app != NULL) { /* Not tested */
be_app->PostMessage(B_QUIT_REQUESTED);
@@ -144,7 +187,7 @@ SDL_QuitBeApp(void)
#endif
/* SDL_BApp functions */
-void SDL_BApp::ClearID(SDL_BWin *bwin) {
+void SDL_BLooper::ClearID(SDL_BWin *bwin) {
_SetSDLWindow(NULL, bwin->GetID());
int32 i = _GetNumWindowSlots() - 1;
while(i >= 0 && GetSDLWindow(i) == NULL) {
diff --git a/src/video/haiku/SDL_BApp.h b/src/video/haiku/SDL_BApp.h
index 868b4ed..f7d7af4 100644
--- a/src/video/haiku/SDL_BApp.h
+++ b/src/video/haiku/SDL_BApp.h
@@ -53,6 +53,7 @@ extern "C" {
/* Forward declarations */
+class SDL_BLooper;
class SDL_BWin;
/* Message constants */
@@ -78,32 +79,24 @@ enum ToSDL {
};
+extern "C" SDL_BLooper *SDL_Looper;
-/* Create a descendant of BApplication */
-class SDL_BApp : public BApplication {
+
+/* Create a descendant of BLooper */
+class SDL_BLooper : public BLooper {
public:
- SDL_BApp(const char* signature) :
- BApplication(signature) {
+ SDL_BLooper(const char* name) :
+ BLooper(name) {
#if SDL_VIDEO_OPENGL
_current_context = NULL;
#endif
}
- virtual ~SDL_BApp() {
+ virtual ~SDL_BLooper() {
}
- virtual void RefsReceived(BMessage* message) {
- char filePath[512];
- entry_ref entryRef;
- for (int32 i = 0; message->FindRef("refs", i, &entryRef) == B_OK; i++) {
- BPath referencePath = BPath(&entryRef);
- SDL_SendDropFile(NULL, referencePath.Path());
- }
- return;
- }
-
/* Event-handling functions */
virtual void MessageReceived(BMessage* message) {
/* Sort out SDL-related messages */
@@ -173,7 +166,7 @@ public:
break;
default:
- BApplication::MessageReceived(message);
+ BLooper::MessageReceived(message);
break;
}
}
diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h
index e711ee0..d9f0340 100644
--- a/src/video/haiku/SDL_BWin.h
+++ b/src/video/haiku/SDL_BWin.h
@@ -125,8 +125,8 @@ class SDL_BWin: public BWindow
#if SDL_VIDEO_OPENGL
if (_SDL_GLView) {
- if (((SDL_BApp*)be_app)->GetCurrentContext() == _SDL_GLView)
- ((SDL_BApp*)be_app)->SetCurrentContext(NULL);
+ if (SDL_Looper->GetCurrentContext() == _SDL_GLView)
+ SDL_Looper->SetCurrentContext(NULL);
if (_SDL_GLView == _cur_view)
RemoveChild(_SDL_GLView);
_SDL_GLView = NULL;
@@ -205,8 +205,8 @@ class SDL_BWin: public BWindow
void RemoveGLView() {
Lock();
if(_SDL_GLView != NULL) {
- if (((SDL_BApp*)be_app)->GetCurrentContext() == _SDL_GLView)
- ((SDL_BApp*)be_app)->SetCurrentContext(NULL);
+ if (SDL_Looper->GetCurrentContext() == _SDL_GLView)
+ SDL_Looper->SetCurrentContext(NULL);
_SDL_GLView = NULL;
UpdateCurrentView();
// _SDL_GLView deleted by HAIKU_GL_DeleteContext
@@ -549,7 +549,7 @@ private:
if (keyUtf8 != NULL) {
msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len);
}
- be_app->PostMessage(&msg);
+ SDL_Looper->PostMessage(&msg);
}
void _RepaintEvent() {
@@ -559,7 +559,7 @@ private:
}
void _PostWindowEvent(BMessage &msg) {
msg.AddInt32("window-id", _id);
- be_app->PostMessage(&msg);
+ SDL_Looper->PostMessage(&msg);
}
/* Command methods (functions called upon by SDL) */
diff --git a/src/video/haiku/SDL_bframebuffer.cc b/src/video/haiku/SDL_bframebuffer.cc
index bf7a002..3c297a1 100644
--- a/src/video/haiku/SDL_bframebuffer.cc
+++ b/src/video/haiku/SDL_bframebuffer.cc
@@ -39,8 +39,8 @@ static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata));
}
-static SDL_INLINE SDL_BApp *_GetBeApp() {
- return ((SDL_BApp*)be_app);
+static SDL_INLINE SDL_BLooper *_GetBeLooper() {
+ return SDL_Looper;
}
int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
diff --git a/src/video/haiku/SDL_bmodes.cc b/src/video/haiku/SDL_bmodes.cc
index 62ec4ec..5d44a88 100644
--- a/src/video/haiku/SDL_bmodes.cc
+++ b/src/video/haiku/SDL_bmodes.cc
@@ -52,8 +52,8 @@ static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata));
}
-static SDL_INLINE SDL_BApp *_GetBeApp() {
- return ((SDL_BApp*)be_app);
+static SDL_INLINE SDL_BLooper *_GetBeLooper() {
+ return SDL_Looper;
}
static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
diff --git a/src/video/haiku/SDL_bopengl.cc b/src/video/haiku/SDL_bopengl.cc
index d1ab6b8..f64ca2f 100644
--- a/src/video/haiku/SDL_bopengl.cc
+++ b/src/video/haiku/SDL_bopengl.cc
@@ -39,8 +39,8 @@ static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata));
}
-static SDL_INLINE SDL_BApp *_GetBeApp() {
- return ((SDL_BApp*)be_app);
+static SDL_INLINE SDL_BLooper *_GetBeLooper() {
+ return SDL_Looper;
}
/* Passing a NULL path means load pointers from the application */
@@ -97,7 +97,7 @@ int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
return SDL_SetError("MakeCurrent failed");
}
}
- _GetBeApp()->SetCurrentContext(glView);
+ _GetBeLooper()->SetCurrentContext(glView);
return 0;
}
@@ -138,7 +138,7 @@ SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window) {
}
#endif
bwin->CreateGLView(gl_flags);
- _GetBeApp()->SetCurrentContext(bwin->GetGLView());
+ _GetBeLooper()->SetCurrentContext(bwin->GetGLView());
return (SDL_GLContext)(bwin->GetGLView());
}
diff --git a/src/video/haiku/SDL_bwindow.cc b/src/video/haiku/SDL_bwindow.cc
index a9cc173..b79f34b 100644
--- a/src/video/haiku/SDL_bwindow.cc
+++ b/src/video/haiku/SDL_bwindow.cc
@@ -37,8 +37,8 @@ static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata));
}
-static SDL_INLINE SDL_BApp *_GetBeApp() {
- return ((SDL_BApp*)be_app);
+static SDL_INLINE SDL_BLooper *_GetBeLooper() {
+ return SDL_Looper;
}
static int _InitWindow(_THIS, SDL_Window *window) {
@@ -71,7 +71,7 @@ static int _InitWindow(_THIS, SDL_Window *window) {
return -1;
window->driverdata = bwin;
- int32 winID = _GetBeApp()->GetID(window);
+ int32 winID = _GetBeLooper()->GetID(window);
bwin->SetID(winID);
return 0;
@@ -218,7 +218,7 @@ void HAIKU_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
void HAIKU_DestroyWindow(_THIS, SDL_Window * window) {
_ToBeWin(window)->LockLooper(); /* This MUST be locked */
- _GetBeApp()->ClearID(_ToBeWin(window));
+ _GetBeLooper()->ClearID(_ToBeWin(window));
_ToBeWin(window)->Quit();
window->driverdata = NULL;
}
--
2.37.3
From f18aaee1b460e83d78531807f856d1dc0dcddada Mon Sep 17 00:00:00 2001
From: PulkoMandy <pulkomandy@pulkomandy.tk>
Date: Thu, 13 Apr 2023 17:38:14 +0200
Subject: Don't change the current directory when starting from Terminal.
diff --git a/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc
index 5dea3a4..3dfa430 100644
--- a/src/main/haiku/SDL_BeApp.cc
+++ b/src/main/haiku/SDL_BeApp.cc
@@ -119,9 +119,13 @@ StartBeLooper()
} while ((be_app == NULL) || be_app->IsLaunching());
}
- /* Change working directory to that of executable */
+ /* If started from the GUI, change working directory to that of executable.
+ * This matches behavior on other platforms and may be needed by some SDL software.
+ * Don't do it when started from terminal (TERM environment variable is set), because in that
+ * case, the current directory may be important, and after this there will be no way to know
+ * what it was. */
app_info info;
- if (B_OK == be_app->GetAppInfo(&info)) {
+ if (NULL == getenv("TERM") && B_OK == be_app->GetAppInfo(&info)) {
entry_ref ref = info.ref;
BEntry entry;
if (B_OK == entry.SetTo(&ref)) {
--
2.37.3

View File

@@ -0,0 +1,28 @@
From 7dca1583b02f61bb22eb112bad97114f46cde292 Mon Sep 17 00:00:00 2001
From: PulkoMandy <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Mar 2024 11:28:45 +0100
Subject: Don't change current directory if started from Terminal
diff --git a/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc
index a736a9f..92f0aeb 100644
--- a/src/main/haiku/SDL_BeApp.cc
+++ b/src/main/haiku/SDL_BeApp.cc
@@ -118,9 +118,12 @@ static int StartBeLooper()
} while ((!be_app) || be_app->IsLaunching());
}
- /* Change working directory to that of executable */
+ /* If started from the GUI, change working directory to that of executable.
+ * This matches the behavior on other platforms that some SDL software expects.
+ * If the TERM environment variable is set, we are being started from the terminal, in that
+ * case, it is more important to preserve the current directory. */
app_info info;
- if (B_OK == be_app->GetAppInfo(&info)) {
+ if (NULL == getenv("TERM") && B_OK == be_app->GetAppInfo(&info)) {
entry_ref ref = info.ref;
BEntry entry;
if (B_OK == entry.SetTo(&ref)) {
--
2.43.2