%global commit e6b9f31306dd29cddce44e71b15ec04f5da8c9a3 %global shortcommit %{sub %{commit} 1 7} %global commitdate 20241004.2115 Name: sdl2-compat Version: 2.30.50~git%{commitdate}.%{shortcommit} Release: 1%{?dist} 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 Source0: %{url}/archive/%{commit}/%{name}-%{shortcommit}.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 BuildRequires: mesa-libGL-devel BuildRequires: mesa-libGLU-devel # This replaces SDL2 Obsoletes: SDL2 < 2.30.3-3 Conflicts: SDL2 < 2.30.50 Provides: SDL2 = %{version} Provides: SDL%{?_isa} = %{version} # This dlopens SDL3 (?!), so manually depend on it Requires: SDL3%{?_isa} >= 3.1.3 %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 Requires: %{name}%{?_isa} = %{version}-%{release} # This replaces SDL2-devel Obsoletes: SDL2-devel < 2.30.3-3 Conflicts: SDL2-devel < 2.30.50 Provides: SDL2-devel = %{version} Provides: SDL2-devel%{?_isa} = %{version} # 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. %package static Summary: Static library to develop SDL 2.0 applications using SDL 3.0 Requires: %{name}-devel%{?_isa} = %{version}-%{release} # This replaces SDL-static Obsoletes: SDL-static < 1.2.15-49 Conflicts: SDL-static < 1.2.50 Provides: SDL-static = %{version} Provides: SDL-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. %prep %dnl autosetup -n %{name}-release-%{version} -S git_am %autosetup -n %{name}-%{commit} -S git_am %build %cmake -DSDL2COMPAT_STATIC=ON %cmake_build %install %cmake_install # Rename SDL_config.h to SDL_config-.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-.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 %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 %files static %{_libdir}/libSDL2.a %{_libdir}/cmake/SDL2/SDL2-staticTargets*.cmake %changelog * Fri Oct 04 2024 Neal Gompa - 2.30.50~git20241004.2115.e6b9f31-1 - Initial package