# Contributor: August Klein # Maintainer: Simon Zeni pkgname=sdl2 pkgver=2.28.2 pkgrel=0 pkgdesc="development library designed to provide low level access to audio, keyboard, mouse, joystick and graphics" url="https://www.libsdl.org" arch="all" license="Zlib" depends_dev="$pkgname directfb-dev mesa-dev" makedepends=" alsa-lib-dev cmake eudev-dev jack-dev libsamplerate-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxkbcommon-dev libxrandr-dev libxrender-dev libxscrnsaver-dev libusb-dev pipewire-dev pulseaudio-dev samurai wayland-dev wayland-protocols $depends_dev " subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev" source="https://www.libsdl.org/release/SDL2-$pkgver.tar.gz" builddir="$srcdir/SDL2-$pkgver" # secfixes: # 2.0.18-r0: # - CVE-2021-33657 # 2.0.10-r0: # - CVE-2019-7572 # - CVE-2019-7573 # - CVE-2019-7574 # - CVE-2019-7575 # - CVE-2019-7576 # - CVE-2019-7578 # - CVE-2019-7635 # - CVE-2019-7636 # - CVE-2019-7637 # - CVE-2019-7638 build() { # NOTE: Please do not remove the -DSDL_DIRECTFB=ON flag. # Some apps, used for booting Alpine derivatives, require this to function! if [ "$CBUILD" != "$CHOST" ]; then CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" fi CFLAGS="$CFLAGS -flto=auto -ffat-lto-objects" \ cmake -B build -G Ninja \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_JOB_POOLS=thr=3 \ -DCMAKE_JOB_POOL_LINK=thr \ -DBUILD_SHARED_LIBS=True \ -DSDL_TEST=ON \ -DSDL_TESTS="$(want_check && echo ON || echo OFF)" \ -DSDL_ALSA=ON \ -DSDL_JACK=ON \ -DSDL_CLOCK_GETTIME=ON \ -DSDL_ARTS=OFF \ -DSDL_ESD=OFF \ -DSDL_NAS=OFF \ -DSDL_RPATH=OFF \ -DSDL_X11=ON \ -DSDL_DIRECTFB=ON \ -DSDL_WAYLAND=ON \ -DSDL_STATIC=ON \ -DSDL_SHARED=ON \ $CMAKE_CROSSOPTS ninja -C build } check() { ctest --test-dir build --output-on-failure } package() { DESTDIR="$pkgdir" ninja -C build install } dev() { default_dev # move back dev symlink into main package so things can dlopen it # libSDL2.so -> libSDL2-2.0.so -> libSDL2-2.0.so.version mv "$subpkgdir"/usr/lib/libSDL2.so "$subpkgdir"/usr/lib/libSDL2-2.0.so \ "$pkgdir"/usr/lib } sha512sums=" 2c5559c4ec2a71bb89b3fc6e9d0a2b206b8cc1021dfa4ad328aab9a931757ed5fac5ec76d4966dccf81bd861de20963e2013bac62be9ef75ebe1c08678999c39 SDL2-2.28.2.tar.gz "