From 38ef474451991904fb039b06a2e2bafbef9d9a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Thebault?= Date: Sun, 11 Aug 2024 18:00:22 +0200 Subject: [PATCH] CI build pipewire --- buildscripts/ci/linux/setup.sh | 95 +++++++++++++++++++- buildscripts/ci/linux/tools/make_appimage.sh | 16 ++++ 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/buildscripts/ci/linux/setup.sh b/buildscripts/ci/linux/setup.sh index a2c0a25320efd..e371d73d2c867 100644 --- a/buildscripts/ci/linux/setup.sh +++ b/buildscripts/ci/linux/setup.sh @@ -116,12 +116,18 @@ apt_packages_ffmpeg=( libswscale-dev ) +apt_packages_pw_deps=( + libdbus-1-dev + libudev-dev +) + sudo apt-get update sudo apt-get install -y --no-install-recommends \ "${apt_packages_basic[@]}" \ "${apt_packages_standard[@]}" \ "${apt_packages_runtime[@]}" \ - "${apt_packages_ffmpeg[@]}" + "${apt_packages_ffmpeg[@]}" \ + "${apt_packages_pw_deps[@]}" ########################################################################## # GET QT @@ -198,9 +204,96 @@ if [[ ! -d "$ninja_dir" ]]; then chmod +x $ninja_dir/ninja fi echo export PATH="${ninja_dir}:\${PATH}" >> ${ENV_FILE} +export PATH="${ninja_dir}:${PATH}" # needed to compile pipewire echo "ninja version" $ninja_dir/ninja --version +# MESON +# Get recent version of Meson (to build pipewire) +meson_version="1.1.1" +sudo python3 -m pip install meson==${meson_version} + +########################################################################## +# BUILD PIPWIRE +########################################################################## + +pw_version="1.0.4" +pw_src_dir="$BUILD_TOOLS/pw-src-${pw_version}" +pw_dist_dir="$BUILD_TOOLS/pw-dist-${pw_version}" +pw_url="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${pw_version}/pipewire-${pw_version}.tar.gz" +if [[ ! -d "${pw_src_dir}" ]]; then + mkdir -p "${pw_src_dir}" + wget -q --show-progress -O pw.tar.gz "${pw_url}" + tar -xzf pw.tar.gz -C "${pw_src_dir}" --strip-components=1 + rm pw.tar.gz + pushd "${pw_src_dir}" + + meson setup builddir \ + --buildtype=debug \ + --prefix=/usr \ + --libdir=/usr/lib \ + -Dexamples=disabled \ + -Dtests=disabled \ + -Dgstreamer=disabled \ + -Dgstreamer-device-provider=disabled \ + -Dsystemd=disabled \ + -Dselinux=disabled \ + -Dpipewire-alsa=disabled \ + -Dpipewire-jack=disabled \ + -Dpipewire-v4l2=disabled \ + -Djack-devel=false \ + -Dalsa=disabled \ + -Daudiomixer=disabled \ + -Daudioconvert=enabled \ + -Dbluez5=disabled \ + -Dcontrol=disabled \ + -Daudiotestsrc=disabled \ + -Djack=disabled \ + -Dsupport=enabled \ + -Devl=disabled \ + -Dv4l2=disabled \ + -Dvideoconvert=disabled \ + -Dvideotestsrc=disabled \ + -Dpw-cat=disabled \ + -Dudev=disabled \ + -Dsdl2=disabled \ + -Dsndfile=disabled \ + -Dlibmysofa=disabled \ + -Dlibpulse=disabled \ + -Droc=disabled \ + -Decho-cancel-webrtc=disabled \ + -Dlibusb=disabled \ + -Dsession-managers=[] \ + -Draop=disabled \ + -Dlv2=disabled \ + -Dx11=disabled \ + -Dlibcanberra=disabled \ + -Dlegacy-rtkit=false \ + -Davb=disabled \ + -Dflatpak=disabled \ + -Dreadline=disabled \ + -Dgsettings=disabled \ + -Dcompress-offload=disabled \ + -Drlimits-install=false \ + -Dopus=disabled \ + -Dlibffado=disabled \ + + meson compile -C builddir + popd +fi +echo "Built pipewire in ${pw_src_dir}/builddir" +if [[ ! -d "${pw_dist_dir}" ]]; then + pushd ${pw_src_dir} + DESTDIR=${pw_dist_dir} meson install -C builddir + popd +fi +echo "Installed pipewire to ${pw_dist_dir}/usr" + +echo export PW_DIST_DIR="${pw_dist_dir}" >> ${ENV_FILE} +echo export LIBRARY_PATH="${pw_dist_dir}/usr/lib:\${LIBRARY_PATH}" >> ${ENV_FILE} +echo export PKG_CONFIG_PATH="${pw_dist_dir}/usr/lib/pkgconfig:\${PKG_CONFIG_PATH}" >> ${ENV_FILE} +echo export LD_LIBRARY_PATH="${pw_dist_dir}/usr/lib:\${LD_LIBRARY_PATH}" >> ${ENV_FILE} + ########################################################################## # OTHER ########################################################################## diff --git a/buildscripts/ci/linux/tools/make_appimage.sh b/buildscripts/ci/linux/tools/make_appimage.sh index e1c1533e2f553..7d25f7d137420 100644 --- a/buildscripts/ci/linux/tools/make_appimage.sh +++ b/buildscripts/ci/linux/tools/make_appimage.sh @@ -224,6 +224,13 @@ additional_qt_components=( plugins/wayland-shell-integration ) +# Include needed pipewire plugins +# linuxdeploy has no specific support for pipewire, so plugins must be copied manually +pipewire_plugins=( + 'spa-0.2/audioconvert/libspa-audioconvert.so' + 'spa-0.2/support/libspa-support.so' +) + # ADDITIONAL LIBRARIES # linuxdeploy may have missed some libraries that we need # Report new additions at https://github.com/linuxdeploy/linuxdeploy/issues @@ -266,6 +273,15 @@ for file in "${additional_qt_components[@]}"; do cp -Lr "${QT_PATH}/${file}" "${appdir}/${file}" done +if [[ -d "${PW_DIST_DIR}" ]]; then + for P in ${pipewire_plugins[@]}; do + mkdir -pv "${appdir}/usr/lib/${P%/*}" + cp -rv "${PW_DIST_DIR}/usr/lib/${P}" "${appdir}/usr/lib/${P}" + done +else + echo -e "Pipewire not found, skipping pipewire plugins" +fi + for lib in "${additional_libraries[@]}"; do full_path="$(find_library "${lib}")" cp -L "${full_path}" "${appdir}/lib/${lib}"