Switch to CMake to build SDL2 and always build JACK support

Upstream increasingly prefers CMake for building SDL, so switch to
that.

Additionally, let's always build JACK support since PipeWire in
RHEL 9 provides libjack.
This commit is contained in:
Neal Gompa 2021-05-17 09:40:08 -04:00
parent 8e9e34c4e5
commit 104dfc214c

View File

@ -1,12 +1,6 @@
%if 0%{?rhel} >= 8
%bcond_with jack
%else
%bcond_without jack
%endif
Name: SDL2
Version: 2.0.14
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Cross-platform multimedia library
License: zlib and MIT
@ -18,8 +12,10 @@ Patch0: multilib.patch
# ptrdiff_t is not the same as khronos defines on 32bit arches
Patch1: SDL2-2.0.9-khrplatform.patch
BuildRequires: cmake
BuildRequires: make
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: alsa-lib-devel
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libGLU-devel
@ -38,9 +34,7 @@ BuildRequires: systemd-devel
# PulseAudio
BuildRequires: pkgconfig(libpulse-simple)
# Jack
%if %{with jack}
BuildRequires: pkgconfig(jack)
%endif
# D-Bus
BuildRequires: pkgconfig(dbus-1)
# IBus
@ -83,49 +77,40 @@ Static libraries for SDL2.
%prep
%autosetup -p1
# Compilation without ESD
sed -i -e 's/.*AM_PATH_ESD.*//' configure.ac
sed -i -e 's/\r//g' TODO.txt README.txt WhatsNew.txt BUGS.txt COPYING.txt CREDITS.txt README-SDL.txt
%build
%configure \
--enable-sdl-dlopen \
--enable-video-kmsdrm \
--disable-arts \
--disable-esd \
--disable-nas \
--enable-pulseaudio-shared \
%if %{with jack}
--enable-jack-shared \
%else
--disable-jack \
%endif
--enable-alsa \
--enable-video-wayland \
--enable-video-vulkan \
--enable-sse2=no \
--enable-sse3=no \
--disable-rpath \
# Deal with new CMake policy around whitespace in LDFLAGS...
export LDFLAGS="%{shrink:%{build_ldflags}}"
%cmake \
-DSDL_DLOPEN=ON \
-DVIDEO_KMSDRM=ON \
-DARTS=OFF \
-DESD=OFF \
-DNAS=OFF \
-DPULSEAUDIO_SHARED=ON \
-DJACK_SHARED=ON \
-DALSA=ON \
-DVIDEO_WAYLAND=ON \
-DVIDEO_VULKAN=ON \
-DSSE3=OFF \
-DRPATH=OFF \
-DSDL_STATIC=ON \
%ifarch ppc64le
--disable-altivec \
-DALTIVEC=OFF \
%endif
%make_build
%cmake_build
%install
%make_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
# remove libtool .la file
rm -vf %{buildroot}%{_libdir}/*.la
# remove static .a file
# rm -f %{buildroot}%{_libdir}/*.a
%ldconfig_scriptlets
%files
%license COPYING.txt
@ -146,6 +131,10 @@ rm -vf %{buildroot}%{_libdir}/*.la
%{_libdir}/lib*.a
%changelog
* Mon May 17 2021 Neal Gompa <ngompa13@gmail.com> - 2.0.14-4
- Switch to CMake to build SDL2
- Build JACK support unconditionally since PipeWire-JACK exists in RHEL 9
* Mon Feb 22 2021 Hans de Goede <hdegoede@redhat.com> - 2.0.14-3
- SDL2 no longer uses audiofile, drop the audiofile-devel BuildRequires