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.

Resolves: rhbz#1989083
This commit is contained in:
Neal Gompa 2021-05-17 09:40:08 -04:00 committed by Wim Taymans
parent ec71ad38cb
commit c087e4e7e8

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: 5%{?dist}
Release: 6%{?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
* Thu Aug 26 2021 Neal Gompa <ngompa13@gmail.com> - 2.0.14-6
- Switch to CMake to build SDL2
- Build JACK support unconditionally since PipeWire-JACK exists in RHEL 9
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.14-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688