Initial commit on c10s

Resolves: RHEL-77078
Initial commit on c10s
  Resolves: RHEL-77078
This commit is contained in:
Wim Taymans 2025-02-10 18:10:35 +01:00
parent 37fbeb83c0
commit 320fb080a5
6 changed files with 383 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/sdl2-compat-2.30.52.tar.gz

83
SDL2_config.h Normal file
View File

@ -0,0 +1,83 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 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_config.h is a wrapper include file for the original SDL_config.h,
* which has been renamed to SDL_config-<arch>.h. There are conflicts for the
* original SDL_config.h on multilib systems, which result from arch-specific
* configuration options. Please do not use the arch-specific file directly.
*
* Copyright (C) 2013 Igor Gnatenko
* Igor Gnatenko <i.gnatenko.brain@gmail.com>
*/
/**
* \file SDL_config.h
*/
#ifdef SDL_config_wrapper_h
#error "SDL_config_wrapper_h should not be defined!"
#endif
#define SDL_config_wrapper_h
#if defined(__i386__)
#include "SDL_config-i386.h"
#elif defined(__ia64__)
#include "SDL_config-ia64.h"
#elif defined(__powerpc64__)
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#include "SDL_config-ppc64.h"
# else
#include "SDL_config-ppc64le.h"
# endif
#elif defined(__powerpc__)
#include "SDL_config-ppc.h"
#elif defined(__s390x__)
#include "SDL_config-s390x.h"
#elif defined(__s390__)
#include "SDL_config-s390.h"
#elif defined(__x86_64__)
#include "SDL_config-x86_64.h"
#elif defined(__arm__)
#include "SDL_config-arm.h"
#elif defined(__alpha__)
#include "SDL_config-alpha.h"
#elif defined(__sparc__) && defined (__arch64__)
#include "SDL_config-sparc64.h"
#elif defined(__sparc__)
#include "SDL_config-sparc.h"
#elif defined(__aarch64__)
#include "SDL_config-aarch64.h"
#elif defined(__mips64) && defined(__MIPSEL__)
#include "SDL_config-mips64el.h"
#elif defined(__mips64)
#include "SDL_config-mips64.h"
#elif defined(__mips) && defined(__MIPSEL__)
#include "SDL_config-mipsel.h"
#elif defined(__mips)
#include "SDL_config-mips.h"
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#include "SDL_config-riscv64.h"
#else
#error "The SDL2-devel package is not usable with the architecture."
#endif
#undef SDL_config_wrapper_h

83
SDL2_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

@ -0,0 +1,44 @@
From 05a4c6ae359c6a4fc4b1a91b0e9aa823c514f615 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org>
Date: Fri, 4 Oct 2024 19:04:35 -0400
Subject: [PATCH] Remove libdir definition from sdl2-config for multilib
support
If we export the library directory, then the contents of sdl2-config
wind up differing across architectures, which will make sdl2-compat
not multilib-safe.
Thus, strip out the libdir stuff so that this isn't a problem.
---
sdl2-config.in | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sdl2-config.in b/sdl2-config.in
index d21b1b2..cea0910 100755
--- a/sdl2-config.in
+++ b/sdl2-config.in
@@ -10,7 +10,6 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
exec_prefix_set=no
-libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
@ENABLE_STATIC_FALSE@usage="\
@@ -53,11 +52,11 @@ while test $# -gt 0; do
echo -I${includedir}/SDL2 @SDL_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
-@ENABLE_SHARED_TRUE@ echo -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@
+@ENABLE_SHARED_TRUE@ echo @SDL_RLD_FLAGS@ @SDL_LIBS@
@ENABLE_SHARED_TRUE@ ;;
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs)
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs)
-@ENABLE_STATIC_TRUE@ echo -L${libdir} @SDL_LIBS@ @SDL_STATIC_LIBS@
+@ENABLE_STATIC_TRUE@ echo @SDL_LIBS@ @SDL_STATIC_LIBS@
@ENABLE_STATIC_TRUE@ ;;
*)
echo "${usage}" 1>&2
--
2.46.2

171
sdl2-compat.spec Normal file
View File

@ -0,0 +1,171 @@
%global sdl3_minver 3.2.2
# Features disabled for RHEL
%if 0%{?rhel}
%bcond_with static
%else
%bcond_without static
%endif
Name: sdl2-compat
Version: 2.30.52
Release: 1%{?dist}
SourceLicense: Zlib and Apache-2.0 and MIT and BSD-3-Clause
Summary: SDL 2.0 runtime compatibility library using SDL 3.0
License: Zlib
URL: https://github.com/libsdl-org/sdl2-compat
Source0: %{url}/archive/release-%{version}/%{name}-%{version}.tar.gz
# Multilib aware-header stub
Source1: SDL2_config.h
Source2: SDL2_revision.h
# Backports from upstream (0001~0500)
# Proposed patches (0501~1000)
# Fedora specific patches (1001+)
Patch1001: sdl2-compat-sdlconfig-multilib.patch
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: git-core
BuildRequires: make
BuildRequires: SDL3-devel >= %{sdl3_minver}
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libGLU-devel
# This replaces SDL2
Obsoletes: SDL2 < 2.30.11-2
Conflicts: SDL2 < 2.30.50~
Provides: SDL2 = %{version}
Provides: SDL2%{?_isa} = %{version}
# This dlopens SDL3 (?!), so manually depend on it
Requires: SDL3%{?_isa} >= %{sdl3_minver}
%description
Simple DirectMedia Layer (SDL) is a cross-platform multimedia library
designed to provide fast access to the graphics frame buffer and audio device.
This code is a compatibility layer; it provides a binary-compatible API for
programs written against SDL 2.0, but it uses SDL 3.0 behind the scenes.
If you are writing new code, please target SDL 3.0 directly and do not use
this layer.
%package devel
Summary: Files to develop SDL 2.0 applications using SDL 3.0
# License of SDL-2.0 headers
License: Zlib and Apache-2.0 and MIT and BSD-3-Clause
Requires: %{name}%{?_isa} = %{version}-%{release}
# This replaces SDL2-devel
Obsoletes: SDL2-devel < 2.30.11-2
Conflicts: SDL2-devel < 2.30.50~
Provides: SDL2-devel = %{version}
Provides: SDL2-devel%{?_isa} = %{version}
%if ! %{with static}
# We don't provide the static library, but we want to replace SDL2-static anyway
Obsoletes: SDL2-static < 2.30.11-2
Conflicts: SDL2-static < 2.30.50~
%endif
# Add deps required to compile SDL apps
## For SDL_opengl.h
Requires: pkgconfig(gl)
Requires: pkgconfig(glu)
## For SDL_syswm.h
Requires: pkgconfig(x11)
Requires: pkgconfig(xproto)
%description devel
Simple DirectMedia Layer (SDL) is a cross-platform multimedia library
designed to provide fast access to the graphics frame buffer and audio device.
This code is a compatibility layer; it provides a source-compatible API for
programs written against SDL 2.0, but it uses SDL 3.0 behind the scenes.
If you are writing new code, please target SDL 3.0 directly and do not use
this layer.
%if %{with static}
%package static
Summary: Static library to develop SDL 2.0 applications using SDL 3.0
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
# This replaces SDL2-static
Obsoletes: SDL2-static < 2.30.11-2
Conflicts: SDL2-static < 2.30.50~
Provides: SDL2-static = %{version}
Provides: SDL2-static%{?_isa} = %{version}
%description static
Simple DirectMedia Layer (SDL) is a cross-platform multimedia library
designed to provide fast access to the graphics frame buffer and audio device.
This code is a compatibility layer; it provides a static link library for
programs written against SDL 2.0, but it uses SDL 3.0 behind the scenes.
Note that applications that use this library will need to declare SDL2 as
a dependency manually, as the library is dlopen()'d to preserve APIs between
SDL-2.0 and SDL-3.0.
If you are writing new code, please target SDL 3.0 directly and do not use
this layer.
%endif
%prep
%autosetup -n %{name}-release-%{version} -S git_am
%build
%cmake %{?with_static:-DSDL2COMPAT_STATIC=ON}
%cmake_build
%install
%cmake_install
# Rename SDL_config.h to SDL_config-<arch>.h to avoid file conflicts on
# multilib systems and install SDL_config.h wrapper
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
%check
%ctest
%files
%license LICENSE.txt
%doc README.md BUGS.md COMPATIBILITY.md
%{_libdir}/libSDL2-2.0.so.*
%files devel
%{_bindir}/sdl2-config
%{_datadir}/aclocal/sdl2.m4
%{_includedir}/SDL2/
%dir %{_libdir}/cmake/SDL2
%{_libdir}/cmake/SDL2/SDL2Config*.cmake
%{_libdir}/cmake/SDL2/SDL2Targets*.cmake
%{_libdir}/cmake/SDL2/SDL2mainTargets*.cmake
%{_libdir}/libSDL2-2.0.so
%{_libdir}/libSDL2.so
%{_libdir}/pkgconfig/sdl2_compat.pc
%{_libdir}/libSDL2main.a
%{_libdir}/libSDL2_test.a
%{_libdir}/cmake/SDL2/SDL2_testTargets*.cmake
%if %{with static}
%files static
%{_libdir}/libSDL2.a
%{_libdir}/cmake/SDL2/SDL2-staticTargets*.cmake
%endif
%changelog
* Mon Feb 10 2025 Wim Taymans <wtaymans@redhat.com> - 2.30.52-1
Initial commit on c10s
Resolves: RHEL-77078

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (sdl2-compat-2.30.52.tar.gz) = ddcc99fda3188605367389d6e5908bb3b01ac300aab22aea60e02156b5e51f599b695a950bd3c7f3f2a7c2c1a1fb713ff56d4fb5fe69ea7b38baf45347c7f0ca