Add PulseAudio support

This commit is contained in:
BtbN 2021-12-18 00:21:43 +01:00
parent 1466a4d8de
commit 4bb38fd65a
2 changed files with 69 additions and 1 deletions

65
scripts.d/45-pulseaudio.sh Executable file
View file

@ -0,0 +1,65 @@
#!/bin/bash
PULSEAUDIO_REPO="https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git"
PULSEAUDIO_COMMIT="c95ba1f07f8f4cf219920693488c77b9a60e3348"
ffbuild_enabled() {
[[ $TARGET == linux* ]] || return 1
return 0
}
ffbuild_dockerbuild() {
git clone --filter=blob:none "$PULSEAUDIO_REPO" pa
cd pa
git checkout "$PULSEAUDIO_COMMIT"
# Kill build of utils and their sndfile dep
echo > src/utils/meson.build
echo > src/pulsecore/sndfile-util.c
echo > src/pulsecore/sndfile-util.h
sed -ri -e 's/(sndfile_dep = .*)\)/\1, required : false)/' meson.build
sed -ri -e 's/shared_library/static_library/g' src/meson.build src/pulse/meson.build
sed -ri -e '/const (pretty_|)table/i static' src/pulse/channelmap.c
mkdir build && cd build
local myconf=(
--prefix="$FFBUILD_PREFIX"
--buildtype=release
--default-library=shared
-Ddaemon=false
-Dclient=true
-Ddoxygen=false
-Dgcov=false
-Dman=false
-Dtests=false
-Dipv6=true
-Dopenssl=enabled
)
if [[ $TARGET == linux* ]]; then
myconf+=(
--cross-file=/cross.meson
)
else
echo "Unknown target"
return -1
fi
meson "${myconf[@]}" ..
ninja -j"$(nproc)"
ninja install
rm -r "$FFBUILD_PREFIX"/share
echo "Libs.private: -ldl -lrt" >> "$FFBUILD_PREFIX"/lib/pkgconfig/libpulse.pc
echo "Libs.private: -ldl -lrt" >> "$FFBUILD_PREFIX"/lib/pkgconfig/libpulse-simple.pc
}
ffbuild_configure() {
echo --enable-libpulse
}
ffbuild_unconfigure() {
echo --disable-libpulse
}

View file

@ -26,6 +26,9 @@ ffbuild_dockerbuild() {
-DSDL_X11_SHARED=OFF -DSDL_X11_SHARED=OFF
-DHAVE_XGENERICEVENT=TRUE -DHAVE_XGENERICEVENT=TRUE
-DSDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM=1 -DSDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM=1
-DSDL_PULSEAUDIO=ON
-DSDL_PULSEAUDIO_SHARED=OFF
) )
fi fi
@ -38,7 +41,7 @@ ffbuild_dockerbuild() {
sed -ri -e 's/\-Wl,\-\-no\-undefined.*//' \ sed -ri -e 's/\-Wl,\-\-no\-undefined.*//' \
-e 's/ \-l\/.+?\.a//g' \ -e 's/ \-l\/.+?\.a//g' \
"$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc "$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc
echo 'Requires: xxf86vm xscrnsaver xrandr xfixes xi xinerama xcursor' >> "$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc echo 'Requires: libpulse-simple xxf86vm xscrnsaver xrandr xfixes xi xinerama xcursor' >> "$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc
elif [[ $TARGET == win* ]]; then elif [[ $TARGET == win* ]]; then
sed -ri -e 's/\-Wl,\-\-no\-undefined.*//' \ sed -ri -e 's/\-Wl,\-\-no\-undefined.*//' \
-e 's/ \-mwindows//g' \ -e 's/ \-mwindows//g' \