%define fname SDL %define lib_name_orig lib%{fname} %global major 0 %define apiver 1.2 %define libname %{?_lib}%{fname}%{apiver}_%{major} %define devname %{?_lib}%{fname}-devel %bcond_with static Name: sdl12-compat Version: 1.2.68 Release: 1%{?dist} Summary: SDL 1.2 runtime compatibility library using SDL 2.0 Group: System/Libraries Epoch: 1 # mp3 decoder code is MIT-0/PD # SDL_opengl.h is zlib and MIT License: zlib and (Public Domain or MIT-0) and MIT URL: https://github.com/libsdl-org/sdl12-compat Source0: %{url}/archive/release-%{version}/%{name}-release-%{version}.tar.gz # Backports from upstream (0001~0500) # Proposed patches (0501~1000) BuildRequires: cmake BuildRequires: gcc BuildRequires: git-core BuildRequires: make BuildRequires: pkgconfig(sdl2) BuildRequires: pkgconfig(gl) BuildRequires: pkgconfig(glu) %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 1.2, but it uses SDL 2.0 behind the scenes. If you are writing new code, please target SDL 2.0 directly and do not use this layer. %package -n %{libname} Summary: SDL 1.2 runtime compatibility library using SDL 2.0 Group: System/Libraries Provides: %{name} = %{version}-%{release} Provides: SDL = %{version} Provides: SDL%{?_isa} = %{version} # This dlopens SDL2 (?!), so manually depend on it Requires: %{?_lib}sdl2.0_0 >= 2.0.18 %description -n %{libname} 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 1.2, but it uses SDL 2.0 behind the scenes. If you are writing new code, please target SDL 2.0 directly and do not use this layer. %package -n %{devname} Summary: Files to develop SDL 1.2 applications using SDL 2.0 Group: Development/C Requires: %{libname}%{?_isa} = %{epoch}:%{version}-%{release} Provides: SDL-devel = %{version} Provides: SDL-devel%{?_isa} = %{version} Provides: %{lib_name_orig}-devel = 1.2.50 Provides: SDL-devel = 1.2.50 Provides: SDL%{apiver}-devel = 1.2.50 # 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) %if %{without static} Obsoletes: %{_lib}SDL-static-devel < 1.2.50 %endif %description -n %{devname} 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 1.2, but it uses SDL 2.0 behind the scenes. If you are writing new code, please target SDL 2.0 directly and do not use this layer. %if %{with static} %package static Summary: Static library to develop SDL 1.2 applications using SDL 2.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 1.2, but it uses SDL 2.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-1.2 and SDL-2.0. If you are writing new code, please target SDL 2.0 directly and do not use this layer. %endif %prep %autosetup -n %{name}-release-%{version} -S git_am %build %cmake %{?with_static:-DSTATICDEVEL=ON} %cmake_build %install %cmake_install %if ! %{with static} # Delete leftover static files rm -rf %{buildroot}%{_libdir}/*.a %endif %files -n %{libname} %license LICENSE.txt %doc README.md BUGS.md COMPATIBILITY.md %{_libdir}/libSDL-1.2.so.* %files -n %{devname} %{_bindir}/sdl-config %{_datadir}/aclocal/sdl.m4 %{_includedir}/SDL/ %{_libdir}/libSDL-1.2.so %{_libdir}/libSDL.so %{_libdir}/pkgconfig/sdl12_compat.pc %if %{with static} %files static %{_libdir}/libSDL.a %{_libdir}/libSDLmain.a %endif