Update to 2.0.18

This includes a number of fixes for Wayland support.

Additionally, fix a multilib conflict with SDL_revision.h
discovered in Fedora Linux 35 development.

Finally, fix the issue so that the -devel subpackage does not require
the -static subpackage.

Resolves: rhbz#2028076

Signed-off-by: Neal Gompa <ngompa@centosproject.org>
This commit is contained in:
Neal Gompa 2022-01-04 10:18:04 -05:00
parent 414b60771c
commit 33fa831b30
7 changed files with 280 additions and 65 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@
/SDL2-2.0.12.tar.gz
/SDL2-2.0.14.tar.gz
/SDL2-2.0.16.tar.gz
/SDL2-2.0.18.tar.gz

View File

@ -0,0 +1,111 @@
From 7393bdae70b445334157410f61372937b922cdc6 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
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 "$<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}")
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 "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>")
@@ -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 "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
@@ -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

View File

@ -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?

View File

@ -0,0 +1,39 @@
From 068c13b1cac4fead98a458b70ef482ddc8205358 Mon Sep 17 00:00:00 2001
From: David Redondo <kde@david-redondo.de>
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)

View File

@ -9,22 +9,28 @@
%global libdecor_majver 0
Name: SDL2
Version: 2.0.16
Release: 5%{?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
@ -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,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
@ -106,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
@ -135,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-<arch>.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
@ -146,15 +157,26 @@ 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 <ngompa@centosproject.org> - 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 <ngompa@centosproject.org> - 2.0.16-5
- Re-enable libdecor support now that it's available in RHEL 9
Resolves: rhbz#2003471

83
SDL_revision.h Normal file
View File

@ -0,0 +1,83 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 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.
*/
/*
* This SDL_revision.h is a wrapper include file for the original SDL_revision.h,
* which has been renamed to SDL_revision-<arch>.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 <spotrh@gmail.com>
*/
/**
* \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

View File

@ -1 +1 @@
SHA512 (SDL2-2.0.16.tar.gz) = ec75ef8526792650c2647b78bb0244f973774418aeae33a2182d90ce696b30acb652f8be9c2012a16c1c5d5622f7630ff2e1eadae27ea3dc78ab47730cf5e62f
SHA512 (SDL2-2.0.18.tar.gz) = 8688b855ce15d574fb0726dd2a44109bb7b34d81c652c51025a32bf7eb7015ceb685834cf9fc3f97a2f5f5a3203f548ce6845420fafae7e5dc6bb9d11ce1740d