From 5b6c9e28b39981382bc044f3b60e63647c1b28e1 Mon Sep 17 00:00:00 2001 From: BtbN Date: Sat, 11 Dec 2021 01:57:56 +0100 Subject: [PATCH] Add alsa-lib --- scripts.d/25-gmp.sh | 1 + scripts.d/45-alsalib.sh | 53 +++++++++++++++++++++++++++++++++++++++++ scripts.d/50-sdl.sh | 13 ++++++++-- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100755 scripts.d/45-alsalib.sh diff --git a/scripts.d/25-gmp.sh b/scripts.d/25-gmp.sh index a586c34..422d267 100755 --- a/scripts.d/25-gmp.sh +++ b/scripts.d/25-gmp.sh @@ -18,6 +18,7 @@ ffbuild_dockerbuild() { --prefix="$FFBUILD_PREFIX" --disable-shared --enable-static + --with-pic ) if [[ $TARGET == win* || $TARGET == linux* ]]; then diff --git a/scripts.d/45-alsalib.sh b/scripts.d/45-alsalib.sh new file mode 100755 index 0000000..8dcc288 --- /dev/null +++ b/scripts.d/45-alsalib.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +ALSALIB_REPO="https://github.com/alsa-project/alsa-lib.git" +ALSALIB_COMMIT="1454b5f118a3b92663923fe105daecfeb7e20f1b" + +ffbuild_enabled() { + [[ $TARGET == linux* ]] || return 1 + return 0 +} + +ffbuild_dockerbuild() { + git-mini-clone "$ALSALIB_REPO" "$ALSALIB_COMMIT" alsalib + cd alsalib + + autoreconf -i + + local myconf=( + --prefix="$FFBUILD_PREFIX" + --with-configdir="/usr/share/alsa" + --disable-shared + --enable-static + --with-pic + --without-debug + --without-versioned + --disable-old-symbols + --disable-python + --disable-topology + --disable-alisp + ) + + if [[ $TARGET == linux* ]]; then + myconf+=( + --host="$FFBUILD_TOOLCHAIN" + ) + else + echo "Unknown target" + return -1 + fi + + ./configure "${myconf[@]}" + make -j$(nproc) + make install + + rm -rf "$FFBUILD_PREFIX"/{bin/aserver,share/alsa} +} + +ffbuild_configure() { + echo --enable-alsa +} + +ffbuild_unconfigure() { + echo --disable-alsa +} diff --git a/scripts.d/50-sdl.sh b/scripts.d/50-sdl.sh index 3337d7e..40d5120 100755 --- a/scripts.d/50-sdl.sh +++ b/scripts.d/50-sdl.sh @@ -17,13 +17,20 @@ ffbuild_dockerbuild() { -DSDL_SHARED=OFF -DSDL_STATIC=ON -DSDL_STATIC_PIC=ON + -DSDL_TEST=OFF ) if [[ $TARGET == linux* ]]; then mycmake+=( + -DSDL_X11=ON -DSDL_X11_SHARED=OFF -DHAVE_XGENERICEVENT=TRUE -DSDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM=1 + + -DSDL_ALSA=ON + -DSDL_ALSA_SHARED=OFF + -DHAVE_ASOUNDLIB_H=TRUE + -DHAVE_LIBASOUND=TRUE ) fi @@ -33,9 +40,11 @@ ffbuild_dockerbuild() { ninja install if [[ $TARGET == linux* ]]; then - sed -ri -e 's/ \-l\/.+?\.a//g' \ + sed -ri -e 's/\-Wl,\-\-no\-undefined.*//' \ + -e 's/ \-l\/.+?\.a//g' \ + -e 's/ \-lasound//g' \ "$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc - echo 'Requires: xxf86vm xscrnsaver xrandr xfixes xi xinerama xcursor' >> "$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc + echo 'Requires: alsa xxf86vm xscrnsaver xrandr xfixes xi xinerama xcursor' >> "$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc elif [[ $TARGET == win* ]]; then sed -ri -e 's/\-Wl,\-\-no\-undefined.*//' \ -e 's/ \-mwindows//g' \