From e08c3054c7ab283355ea4de82eead402bc58fbf8 Mon Sep 17 00:00:00 2001 From: O01eg Date: Sun, 22 Dec 2024 20:11:48 +0400 Subject: [PATCH] WIP: Try to update SDL to 2.24.0 --- Sources.cmake | 4 +- ...C_HEADER-property-to-install-headers.patch | 101 ------------------ ...4-CMake-Add-MacOSX-Framework-support.patch | 19 +++- ...Make-Set-framework-install-directory.patch | 9 +- 4 files changed, 21 insertions(+), 112 deletions(-) delete mode 100644 patches/sdl/0003-CMake-Use-PUBLIC_HEADER-property-to-install-headers.patch diff --git a/Sources.cmake b/Sources.cmake index 7b9c316..46103b1 100644 --- a/Sources.cmake +++ b/Sources.cmake @@ -34,9 +34,9 @@ set(FREETYPE_VERSION 2.9) set(FREETYPE_URL http://downloads.sourceforge.net/project/freetype/freetype2/${FREETYPE_VERSION}/freetype-${FREETYPE_VERSION}.tar.gz) set(FREETYPE_MD5 d23a1b246e78890458c6672cb45eacd0) -set(SDL_VERSION 2.0.22) +set(SDL_VERSION 2.24.0) set(SDL_URL https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz) -set(SDL_MD5 40aedb499cb2b6f106d909d9d97f869a) +set(SDL_MD5 cf539ffe9e0dd6f943ac9de75fd2e56e) set(LIBOGG_VERSION 1.3.2) set(LIBOGG_URL http://downloads.xiph.org/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz) diff --git a/patches/sdl/0003-CMake-Use-PUBLIC_HEADER-property-to-install-headers.patch b/patches/sdl/0003-CMake-Use-PUBLIC_HEADER-property-to-install-headers.patch deleted file mode 100644 index 8f87fd9..0000000 --- a/patches/sdl/0003-CMake-Use-PUBLIC_HEADER-property-to-install-headers.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 8a05500c8ad7b72f38ca3ff67116b1e2e4d61afa Mon Sep 17 00:00:00 2001 -From: Marcel Metz -Date: Fri, 1 Apr 2016 17:51:35 +0200 -Subject: [PATCH] CMake: Use PUBLIC_HEADER property to install headers - ---- - CMakeLists.txt | 34 ++++++++++++++++++---------------- - 1 file changed, 18 insertions(+), 16 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 22b91ad..ab0ff17 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2874,6 +2874,17 @@ if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - endif() - endif() - -+if(NOT SDL2_DISABLE_INSTALL) -+ file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) -+ file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h) -+ foreach(_FNAME ${BIN_INCLUDE_FILES}) -+ get_filename_component(_INCNAME ${_FNAME} NAME) -+ list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME}) -+ endforeach() -+ list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) -+ install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) -+endif() -+ - if(ANDROID) - target_include_directories(sdl-build-options INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures") - endif() -@@ -2883,14 +2894,12 @@ if(IOS OR TVOS) - endif() - - if(SDL_SHARED) -- add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) -+ add_library(SDL2 SHARED ${INCLUDE_FILES} ${SOURCE_FILES} ${VERSION_SOURCES}) - # alias target for in-tree builds - add_library(SDL2::SDL2 ALIAS SDL2) -- if(APPLE) -- set_target_properties(SDL2 PROPERTIES -- MACOSX_RPATH 1 -- OUTPUT_NAME "SDL2-${LT_RELEASE}") -- elseif(UNIX AND NOT ANDROID) -+ set_target_properties(SDL2 PROPERTIES -+ PUBLIC_HEADER "${INCLUDE_FILES}") -+ if(UNIX AND NOT ANDROID) - set_target_properties(SDL2 PROPERTIES - VERSION ${LT_VERSION} - SOVERSION ${LT_MAJOR} -@@ -2929,9 +2938,11 @@ endif() - - if(SDL_STATIC) - set (BUILD_SHARED_LIBS FALSE) -- add_library(SDL2-static STATIC ${SOURCE_FILES}) -+ add_library(SDL2-static STATIC ${INCLUDE_FILES} ${SOURCE_FILES}) - # alias target for in-tree builds - add_library(SDL2::SDL2-static ALIAS SDL2-static) -+ set_target_properties(SDL2-static PROPERTIES -+ PUBLIC_HEADER "${INCLUDE_FILES}") - if (NOT SDL_SHARED OR NOT WIN32 OR MINGW) - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") - # Note: Apparently, OUTPUT_NAME must really be unique; even when -@@ -2974,7 +2985,8 @@ if(NOT SDL2_DISABLE_INSTALL) - install(TARGETS SDL2 EXPORT SDL2Targets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" -+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL2") - endif() - - if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) -@@ -3036,15 +3048,6 @@ if(NOT SDL2_DISABLE_INSTALL) - COMPONENT Devel - ) - -- file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) -- file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h) -- foreach(_FNAME ${BIN_INCLUDE_FILES}) -- get_filename_component(_INCNAME ${_FNAME} NAME) -- list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME}) -- endforeach() -- list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) -- install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) -- - string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) - if (UPPER_BUILD_TYPE MATCHES DEBUG) - set(SOPOSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") -@@ -3052,7 +3055,7 @@ if(NOT SDL2_DISABLE_INSTALL) - set(SOPOSTFIX "") - endif() - -- if(NOT (WINDOWS OR CYGWIN) OR MINGW) -+ if((NOT (WINDOWS OR CYGWIN) OR MINGW) AND (NOT BUILD_FRAMEWORK)) - if(SDL_SHARED) - set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. - get_target_property(SONAME SDL2 OUTPUT_NAME) --- -2.14.3 - diff --git a/patches/sdl/0004-CMake-Add-MacOSX-Framework-support.patch b/patches/sdl/0004-CMake-Add-MacOSX-Framework-support.patch index eb05360..2e35d76 100644 --- a/patches/sdl/0004-CMake-Add-MacOSX-Framework-support.patch +++ b/patches/sdl/0004-CMake-Add-MacOSX-Framework-support.patch @@ -12,8 +12,8 @@ index ec2cdd4..c3185d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -419,6 +419,9 @@ option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal - set_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON) - set_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON) + dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF) + dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) +if(APPLE) + set_option(BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF) @@ -35,9 +35,18 @@ index ec2cdd4..c3185d3 100644 + MACOSX_RPATH ON + OUTPUT_NAME "SDL2") + endif() - target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2 BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") - target_include_directories(SDL2 PUBLIC "$;$;$") + # FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS + target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD}) + target_include_directories(SDL2 PUBLIC +@@ -3052,7 +3055,7 @@ if(NOT SDL2_DISABLE_INSTALL) + set(SOPOSTFIX "") + endif() + +- if(NOT (WINDOWS OR CYGWIN) OR MINGW) ++ if((NOT (WINDOWS OR CYGWIN) OR MINGW) AND (NOT BUILD_FRAMEWORK)) + if(SDL_SHARED) + set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. + get_target_property(SONAME SDL2 OUTPUT_NAME) -- 2.14.3 diff --git a/patches/sdl/0005-CMake-Set-framework-install-directory.patch b/patches/sdl/0005-CMake-Set-framework-install-directory.patch index f944a57..1948f8e 100644 --- a/patches/sdl/0005-CMake-Set-framework-install-directory.patch +++ b/patches/sdl/0005-CMake-Set-framework-install-directory.patch @@ -11,14 +11,15 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index f32165cb7..50446f868 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -2999,6 +2999,7 @@ install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets +@@ -3189,6 +3189,7 @@ install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" -+ FRAMEWORK DESTINATION "${CMAKE_INSTALL_PREFIX}" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL2") +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ FRAMEWORK DESTINATION "${CMAKE_INSTALL_PREFIX}") endif() + if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) -- 2.14.3