From 0558d6df56b30c50cb98910a8b9af2dd1b9ad641 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 1 Feb 2022 12:58:47 -0500 Subject: [PATCH] import SDL2-2.0.18-1.el9 --- .SDL2.metadata | 2 +- .gitignore | 2 +- .../PR5171-split-static-cmake-targets.patch | 111 ++++++++++++++++++ SOURCES/SDL2-2.0.16-PR4622.patch | 41 ------- ....0.18-Fix-build-against-wayland-1.20.patch | 39 ++++++ SOURCES/SDL_revision.h | 83 +++++++++++++ SPECS/SDL2.spec | 87 ++++++++++---- 7 files changed, 298 insertions(+), 67 deletions(-) create mode 100644 SOURCES/PR5171-split-static-cmake-targets.patch delete mode 100644 SOURCES/SDL2-2.0.16-PR4622.patch create mode 100644 SOURCES/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch create mode 100644 SOURCES/SDL_revision.h diff --git a/.SDL2.metadata b/.SDL2.metadata index a3046ca..22b9170 100644 --- a/.SDL2.metadata +++ b/.SDL2.metadata @@ -1 +1 @@ -57825428174adb2ac947e4014080c262505aa972 SOURCES/SDL2-2.0.16.tar.gz +419c62567d197a52a2136865c158f894939c1adf SOURCES/SDL2-2.0.18.tar.gz diff --git a/.gitignore b/.gitignore index e718646..8f66c37 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/SDL2-2.0.16.tar.gz +SOURCES/SDL2-2.0.18.tar.gz diff --git a/SOURCES/PR5171-split-static-cmake-targets.patch b/SOURCES/PR5171-split-static-cmake-targets.patch new file mode 100644 index 0000000..2cc6c75 --- /dev/null +++ b/SOURCES/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/SOURCES/SDL2-2.0.16-PR4622.patch b/SOURCES/SDL2-2.0.16-PR4622.patch deleted file mode 100644 index 1e93512..0000000 --- a/SOURCES/SDL2-2.0.16-PR4622.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 26fe83205..9b7ae7098 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2662,15 +2662,15 @@ endif() - - ##### Installation targets ##### - install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets -- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}" -- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}" -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - - ##### Export files ##### - if (WINDOWS) - set(PKG_PREFIX "cmake") - else () -- set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/SDL2") -+ set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") - endif () - - include(CMakePackageConfigHelpers) -@@ -2717,7 +2717,7 @@ if(NOT (WINDOWS OR CYGWIN OR MINGW)) - 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 "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}") -+ install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") - endif() - endif() - if(FREEBSD) -@@ -2725,7 +2725,7 @@ if(NOT (WINDOWS OR CYGWIN OR MINGW)) - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") - else() - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc -- DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/pkgconfig") -+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endif() - install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}") - # TODO: what about the .spec file? Is it only needed for RPM creation? diff --git a/SOURCES/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch b/SOURCES/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch new file mode 100644 index 0000000..25c191c --- /dev/null +++ b/SOURCES/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/SOURCES/SDL_revision.h b/SOURCES/SDL_revision.h new file mode 100644 index 0000000..e43c4ec --- /dev/null +++ b/SOURCES/SDL_revision.h @@ -0,0 +1,83 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + 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. +*/ + +/* + * This SDL_revision.h is a wrapper include file for the original SDL_revision.h, + * which has been renamed to SDL_revision-.h. There are conflicts for the + * original SDL_revision.h on multilib systems, which result from REVISION + * inconsistency between architecture builds, though, I'm not sure why. + * Computers are weird. + * + * Copyright (C) 2021 Tom Callaway + */ + +/** + * \file SDL_revision.h + */ + +#ifdef SDL_revision_wrapper_h +#error "SDL_revision_wrapper_h should not be defined!" +#endif +#define SDL_revision_wrapper_h + +#if defined(__i386__) +#include "SDL_revision-i386.h" +#elif defined(__ia64__) +#include "SDL_revision-ia64.h" +#elif defined(__powerpc64__) +# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#include "SDL_revision-ppc64.h" +# else +#include "SDL_revision-ppc64le.h" +# endif +#elif defined(__powerpc__) +#include "SDL_revision-ppc.h" +#elif defined(__s390x__) +#include "SDL_revision-s390x.h" +#elif defined(__s390__) +#include "SDL_revision-s390.h" +#elif defined(__x86_64__) +#include "SDL_revision-x86_64.h" +#elif defined(__arm__) +#include "SDL_revision-arm.h" +#elif defined(__alpha__) +#include "SDL_revision-alpha.h" +#elif defined(__sparc__) && defined (__arch64__) +#include "SDL_revision-sparc64.h" +#elif defined(__sparc__) +#include "SDL_revision-sparc.h" +#elif defined(__aarch64__) +#include "SDL_revision-aarch64.h" +#elif defined(__mips64) && defined(__MIPSEL__) +#include "SDL_revision-mips64el.h" +#elif defined(__mips64) +#include "SDL_revision-mips64.h" +#elif defined(__mips) && defined(__MIPSEL__) +#include "SDL_revision-mipsel.h" +#elif defined(__mips) +#include "SDL_revision-mips.h" +#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 +#include "SDL_revision-riscv64.h" +#else +#error "The SDL2-devel package is not usable with the architecture." +#endif + +#undef SDL_revision_wrapper_h diff --git a/SPECS/SDL2.spec b/SPECS/SDL2.spec index 28784db..0e64ccc 100644 --- a/SPECS/SDL2.spec +++ b/SPECS/SDL2.spec @@ -1,20 +1,36 @@ +# For the generated library symbol suffix +%if 0%{?__isa_bits} == 32 +%global libsymbolsuffix %{nil} +%else +%global libsymbolsuffix ()(%{__isa_bits}bit) +%endif + +# For declaring rich dependency on libdecor +%global libdecor_majver 0 + Name: SDL2 -Version: 2.0.16 -Release: 4%{?dist} +Version: 2.0.18 +Release: 1%{?dist} Summary: Cross-platform multimedia library License: zlib and MIT URL: http://www.libsdl.org/ Source0: http://www.libsdl.org/release/%{name}-%{version}.tar.gz Source1: SDL_config.h +Source2: SDL_revision.h Patch0: multilib.patch # ptrdiff_t is not the same as khronos defines on 32bit arches Patch1: SDL2-2.0.9-khrplatform.patch -# Proposed upstream -## From: https://github.com/libsdl-org/SDL/pull/4622 -Patch0101: SDL2-2.0.16-PR4622.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 BuildRequires: make BuildRequires: gcc @@ -45,7 +61,7 @@ BuildRequires: pkgconfig(dbus-1) # IBus BuildRequires: pkgconfig(ibus-1.0) # Wayland -#BuildRequires: pkgconfig(libdecor-0) +BuildRequires: pkgconfig(libdecor-%{libdecor_majver}) BuildRequires: pkgconfig(wayland-client) BuildRequires: pkgconfig(wayland-egl) BuildRequires: pkgconfig(wayland-cursor) @@ -58,6 +74,9 @@ BuildRequires: vulkan-devel BuildRequires: mesa-libgbm-devel BuildRequires: libdrm-devel +# Ensure libdecor is pulled in when libwayland-client is (rhbz#1992804) +Requires: (libdecor-%{libdecor_majver}.so.%{libdecor_majver}%{libsymbolsuffix} if libwayland-client) + %description Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed to provide fast access to the graphics frame buffer and audio device. @@ -68,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 @@ -79,12 +96,14 @@ 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. %prep -%autosetup -p1 +%autosetup -S git sed -i -e 's/\r//g' TODO.txt README.md WhatsNew.txt BUGS.txt LICENSE.txt CREDITS.txt README-SDL.txt %build @@ -93,23 +112,23 @@ export LDFLAGS="%{shrink:%{build_ldflags}}" %cmake \ -DSDL_DLOPEN=ON \ - -DVIDEO_KMSDRM=ON \ - -DARTS=OFF \ - -DESD=OFF \ - -DNAS=OFF \ - -DPULSEAUDIO_SHARED=ON \ - -DJACK_SHARED=ON \ - -DPIPEWIRE_SHARED=ON \ - -DALSA=ON \ - -DVIDEO_WAYLAND=ON \ - -DLIBDECOR_SHARED=ON \ - -DVIDEO_VULKAN=ON \ - -DSSE3=OFF \ - -DRPATH=OFF \ + -DSDL_VIDEO_KMSDRM=ON \ + -DSDL_ARTS=OFF \ + -DSDL_ESD=OFF \ + -DSDL_NAS=OFF \ + -DSDL_PULSEAUDIO_SHARED=ON \ + -DSDL_JACK_SHARED=ON \ + -DSDL_PIPEWIRE_SHARED=ON \ + -DSDL_ALSA=ON \ + -DSDL_VIDEO_WAYLAND=ON \ + -DSDL_LIBDECOR_SHARED=ON \ + -DSDL_VIDEO_VULKAN=ON \ + -DSDL_SSE3=OFF \ + -DSDL_RPATH=OFF \ -DSDL_STATIC=ON \ -DSDL_STATIC_PIC=ON \ %ifarch ppc64le - -DALTIVEC=OFF \ + -DSDL_ALTIVEC=OFF \ %endif %cmake_build @@ -122,6 +141,11 @@ export LDFLAGS="%{shrink:%{build_ldflags}}" mv %{buildroot}%{_includedir}/SDL2/SDL_config.h %{buildroot}%{_includedir}/SDL2/SDL_config-%{_arch}.h install -p -m 644 %{SOURCE1} %{buildroot}%{_includedir}/SDL2/SDL_config.h +# Rename SDL_revision.h to SDL_revision-.h to avoid file conflicts on +# multilib systems and install SDL_revision.h wrapper +# TODO: Figure out how in the hell the SDL_REVISION changes between architectures on the same SRPM. +mv %{buildroot}%{_includedir}/SDL2/SDL_revision.h %{buildroot}%{_includedir}/SDL2/SDL_revision-%{_arch}.h +install -p -m 644 %{SOURCE2} %{buildroot}%{_includedir}/SDL2/SDL_revision.h %files %license LICENSE.txt @@ -133,15 +157,30 @@ install -p -m 644 %{SOURCE1} %{buildroot}%{_includedir}/SDL2/SDL_config.h %{_bindir}/*-config %{_libdir}/lib*.so %{_libdir}/pkgconfig/sdl2.pc -%{_libdir}/cmake/SDL2/ +%dir %{_libdir}/cmake/SDL2 +%{_libdir}/cmake/SDL2/SDL2Config*.cmake +%{_libdir}/cmake/SDL2/SDL2Targets*.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-1 +- Update to 2.0.18 + Resolves: rhbz#2028076 +- Fix multilib conflict with SDL_revision.h (rhbz#2008838) +- Backport fix for building against wayland-1.20+ +- Add patch to split SDL2 CMake targets for static libraries (rhbz#1965359) + +* Wed Dec 01 2021 Neal Gompa - 2.0.16-5 +- Re-enable libdecor support now that it's available in RHEL 9 + Resolves: rhbz#2003471 + * Thu Aug 26 2021 Wim Taymans - 2.0.16-4 - Build with SDL_STATIC_PIC and SDL_STATIC to actually make the static version of SDL2