From db6e7a4b547d445363670f848b441f9dcf046204 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Tue, 4 Jan 2022 09:51:45 -0500 Subject: [PATCH] Add patches to fix package build - Backport fix for building against wayland-1.20+ - Add patch to split SDL2 CMake targets for static libraries --- PR5171-split-static-cmake-targets.patch | 111 ++++++++++++++++++ ....0.18-Fix-build-against-wayland-1.20.patch | 39 ++++++ SDL2.spec | 21 +++- 3 files changed, 167 insertions(+), 4 deletions(-) create mode 100644 PR5171-split-static-cmake-targets.patch create mode 100644 SDL2-2.0.18-Fix-build-against-wayland-1.20.patch diff --git a/PR5171-split-static-cmake-targets.patch b/PR5171-split-static-cmake-targets.patch new file mode 100644 index 0000000..2cc6c75 --- /dev/null +++ b/PR5171-split-static-cmake-targets.patch @@ -0,0 +1,111 @@ +From 7393bdae70b445334157410f61372937b922cdc6 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Tue, 4 Jan 2022 09:35:41 -0500 +Subject: [PATCH] cmake: Split SDL2-static and SDL2main into their own target + exports + +This makes it so that the generated targets are not interdependent, +which allows Linux distributions to split libraries into the +appropriate subpackages as needed. +--- + CMakeLists.txt | 56 +++++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 44 insertions(+), 12 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 76cc3c516..be15edc74 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2748,7 +2748,6 @@ if(NOT WINDOWS_STORE) + add_library(SDL2::SDL2main ALIAS SDL2main) + target_include_directories(SDL2main BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") + target_include_directories(SDL2main PUBLIC "$" $ $) +- set(_INSTALL_LIBS "SDL2main") + if (NOT ANDROID) + set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") + endif() +@@ -2794,7 +2793,6 @@ if(SDL_SHARED) + endif() + set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") + endif() +- set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) + target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2 BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") + target_include_directories(SDL2 PUBLIC "$;$;$") +@@ -2826,7 +2824,6 @@ if(SDL_STATIC) + endif() + # TODO: Win32 platforms keep the same suffix .lib for import and static + # libraries - do we need to consider this? +- set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) + target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2-static BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") + target_include_directories(SDL2-static PUBLIC "$" $ $) +@@ -2848,10 +2845,26 @@ if(SDL_TEST) + endif() + + ##### Installation targets ##### +-install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets +- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++if(SDL_SHARED) ++ install(TARGETS SDL2 EXPORT SDL2Targets ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++endif() ++ ++if(NOT WINDOWS_STORE) ++ install(TARGETS SDL2main EXPORT SDL2mainTargets ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++endif() ++ ++if(SDL_STATIC) ++ install(TARGETS SDL2-static EXPORT SDL2staticTargets ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++endif() + + ##### Export files ##### + if (WINDOWS AND NOT MINGW) +@@ -2866,11 +2879,30 @@ write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" + COMPATIBILITY AnyNewerVersion + ) + +-install(EXPORT SDL2Targets +- FILE SDL2Targets.cmake +- NAMESPACE SDL2:: +- DESTINATION ${PKG_PREFIX} +-) ++if(SDL_SHARED) ++ install(EXPORT SDL2Targets ++ FILE SDL2Targets.cmake ++ NAMESPACE SDL2:: ++ DESTINATION ${PKG_PREFIX} ++ ) ++endif() ++ ++if(NOT WINDOWS_STORE) ++ install(EXPORT SDL2mainTargets ++ FILE SDL2mainTargets.cmake ++ NAMESPACE SDL2:: ++ DESTINATION ${PKG_PREFIX} ++ ) ++endif() ++ ++if(SDL_STATIC) ++ install(EXPORT SDL2staticTargets ++ FILE SDL2staticTargets.cmake ++ NAMESPACE SDL2:: ++ DESTINATION ${PKG_PREFIX} ++ ) ++endif() ++ + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake +-- +2.33.1 + diff --git a/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch b/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch new file mode 100644 index 0000000..25c191c --- /dev/null +++ b/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch @@ -0,0 +1,39 @@ +From 068c13b1cac4fead98a458b70ef482ddc8205358 Mon Sep 17 00:00:00 2001 +From: David Redondo +Date: Fri, 10 Dec 2021 16:22:34 +0100 +Subject: [PATCH] Fix build against wayland 1.20 + +Fixes #5088 +--- + src/video/wayland/SDL_waylanddyn.h | 2 ++ + src/video/wayland/SDL_waylandsym.h | 4 ++++ + 2 files changed, 6 insertions(+) + +diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h +index 13b0884d076..2268555604a 100644 +--- a/src/video/wayland/SDL_waylanddyn.h ++++ b/src/video/wayland/SDL_waylanddyn.h +@@ -95,6 +95,8 @@ void SDL_WAYLAND_UnloadSymbols(void); + #define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned) + #define wl_proxy_set_tag (*WAYLAND_wl_proxy_set_tag) + #define wl_proxy_get_tag (*WAYLAND_wl_proxy_get_tag) ++#define wl_proxy_marshal_flags (*WAYLAND_wl_proxy_marshal_flags) ++#define wl_proxy_marshal_array_flags (*WAYLAND_wl_proxy_marshal_array_flags) + + #define wl_seat_interface (*WAYLAND_wl_seat_interface) + #define wl_surface_interface (*WAYLAND_wl_surface_interface) +diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h +index d6e6a761d39..32e47d26e2d 100644 +--- a/src/video/wayland/SDL_waylandsym.h ++++ b/src/video/wayland/SDL_waylandsym.h +@@ -84,6 +84,10 @@ SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_18) + SDL_WAYLAND_SYM(void, wl_proxy_set_tag, (struct wl_proxy *, const char * const *)) + SDL_WAYLAND_SYM(const char * const *, wl_proxy_get_tag, (struct wl_proxy *)) + ++SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_20) ++SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interfac, uint32_t version, uint32_t flags, ...)) ++SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_array_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, uint32_t flags, union wl_argument *args)) ++ + SDL_WAYLAND_INTERFACE(wl_seat_interface) + SDL_WAYLAND_INTERFACE(wl_surface_interface) + SDL_WAYLAND_INTERFACE(wl_shm_pool_interface) diff --git a/SDL2.spec b/SDL2.spec index 6d72ef9..3925b4b 100644 --- a/SDL2.spec +++ b/SDL2.spec @@ -10,7 +10,7 @@ Name: SDL2 Version: 2.0.18 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Cross-platform multimedia library License: zlib and MIT URL: http://www.libsdl.org/ @@ -23,6 +23,12 @@ Patch0: multilib.patch Patch1: SDL2-2.0.9-khrplatform.patch # Backports from upstream +## From: https://github.com/libsdl-org/SDL/commit/e2ade2bfc46d915cd306c63c830b81d800b2575f +Patch100: SDL2-2.0.18-Fix-build-against-wayland-1.20.patch + +# Proposed upstream +## From: https://github.com/libsdl-org/SDL/pull/5171 +Patch500: PR5171-split-static-cmake-targets.patch BuildRequires: git-core BuildRequires: cmake @@ -81,8 +87,6 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Requires: mesa-libEGL-devel%{?_isa} Requires: mesa-libGLES-devel%{?_isa} Requires: libX11-devel%{?_isa} -# Needed to keep CMake happy -Requires: %{name}-static%{?_isa} = %{version}-%{release} %description devel Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed @@ -92,6 +96,8 @@ developing SDL applications. %package static Summary: Static libraries for SDL2 +# Needed to keep CMake happy +Requires: %{name}-devel%{?_isa} = %{version}-%{release} %description static Static libraries for SDL2. @@ -151,15 +157,22 @@ install -p -m 644 %{SOURCE2} %{buildroot}%{_includedir}/SDL2/SDL_revision.h %{_bindir}/*-config %{_libdir}/lib*.so %{_libdir}/pkgconfig/sdl2.pc -%{_libdir}/cmake/SDL2/ +%dir %{_libdir}/cmake/SDL2 +%{_libdir}/cmake/SDL2/SDL2Config*.cmake %{_includedir}/SDL2 %{_datadir}/aclocal/* %files static %license LICENSE.txt %{_libdir}/lib*.a +%{_libdir}/cmake/SDL2/SDL2mainTargets*.cmake +%{_libdir}/cmake/SDL2/SDL2staticTargets*.cmake %changelog +* Tue Jan 04 2022 Neal Gompa - 2.0.18-3 +- Backport fix for building against wayland-1.20+ +- Add patch to split SDL2 CMake targets for static libraries + * Wed Dec 01 2021 Neal Gompa - 2.0.18-2 - Use correct build options