From 0fcabdbd0c618825bf2bd95758d440cc8262b9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 10 May 2025 12:49:06 +0200 Subject: [PATCH] ci: cross compile on debian 13 to multiple architectures Debian supports many architectures, and it is relatively easy to work with multiarch packages, and finally `meson env2mfile` supports generating cross files with the `--debarch` option. Previously only native builds were done in the CI, so use debian to build pipewire for multiple architectures. Some packages are unfortunately not multiarch compatible, so a separate container is built for every architecture. --- .gitlab-ci.yml | 77 ++++++++++++++++++++++ .gitlab/ci/setup-debian-cross-container.sh | 63 ++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100755 .gitlab/ci/setup-debian-cross-container.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e381b7c64..b8a703ab6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,9 @@ include: - project: 'freedesktop/ci-templates' ref: *templates_sha file: '/templates/alpine.yml' + - project: 'freedesktop/ci-templates' + ref: *templates_sha + file: '/templates/debian.yml' .fedora: variables: @@ -141,6 +144,30 @@ include: # FDO_DISTRIBUTION_EXEC: >- # pip3 install meson +.debian: + variables: + # Update this tag when you want to trigger a rebuild + BASE_TAG: '2025-08-10.0' + FDO_DISTRIBUTION_VERSION: 'trixie' + FDO_DISTRIBUTION_PACKAGES: >- + build-essential + dpkg-dev + findutils + git + meson + +.debian-archictectures: + parallel: + matrix: + - ARCH: + - amd64 + - arm64 + - armhf + - i386 + - ppc64el + - riscv64 + - s390x + .alpine: variables: # Update this tag when you want to trigger a rebuild @@ -229,6 +256,18 @@ container_ubuntu: variables: GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image +container_debian: + extends: + - .debian + - .debian-archictectures + - .fdo.container-build@debian + stage: container + variables: + GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image + FDO_DISTRIBUTION_TAG: "$BASE_TAG-$ARCH" + FDO_DISTRIBUTION_EXEC: >- + ./.gitlab/ci/setup-debian-cross-container.sh "$ARCH" + container_fedora: extends: - .fedora @@ -267,6 +306,44 @@ build_on_ubuntu: variables: MESON_OPTIONS: "-Dsession-managers=[] -Dsnap=enabled" +build_on_debian: + extends: + - .debian + - .debian-archictectures + - .not_coverity + - .fdo.distribution-image@debian + - .build + stage: build + needs: + - job: container_debian + artifacts: false + # ideally + # parallel: + # matrix: + # - ARCH: "$ARCH" + # however https://gitlab.com/gitlab-org/gitlab/-/issues/423553 + # ("Expand variables in `needs:parallel:matrix`") + variables: + FDO_DISTRIBUTION_TAG: "$BASE_TAG-$ARCH" + # see /.gitlab/ci/setup-debian-cross-container.sh for installed packages + MESON_OPTIONS: >- + --cross-file /opt/meson-$ARCH.cross + -D c_args=['-UFASTPATH'] + -D cpp_args=['-UFASTPATH'] + -D auto_features=enabled + -D session-managers=[] + -D bluez5-backend-native-mm=enabled + -D bluez5-codec-lc3plus=disabled + -D bluez5-codec-ldac=disabled + -D bluez5-codec-ldac-dec=disabled + -D libcamera=disabled + -D roc=disabled + -D snap=disabled + -D systemd-user-service=disabled + -D systemd-system-service=disabled + -D onnxruntime=disabled + -D vulkan=enabled + .build_on_fedora: extends: - .fedora diff --git a/.gitlab/ci/setup-debian-cross-container.sh b/.gitlab/ci/setup-debian-cross-container.sh new file mode 100755 index 000000000..616971803 --- /dev/null +++ b/.gitlab/ci/setup-debian-cross-container.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +set -ex + +packages=( + # libapparmor-dev + libasound2-dev + libavahi-client-dev + libavcodec-dev + libavfilter-dev + libavformat-dev + libbluetooth-dev + libcanberra-dev + libdbus-1-dev + libebur128-dev + libfdk-aac-dev + libffado-dev + libfftw3-dev + libfreeaptx-dev + libglib2.0-dev + libgstreamer1.0-dev + libgstreamer-plugins-base1.0-dev + libjack-jackd2-dev + liblc3-dev + liblilv-dev + libmysofa-dev + libopus-dev + libpulse-dev + libreadline-dev + libsbc-dev + libsdl2-dev + # libsnapd-glib-dev + libsndfile1-dev + libspandsp-dev + libssl-dev + libsystemd-dev + libudev-dev + libusb-1.0-0-dev + libvulkan-dev + libwebrtc-audio-processing-dev + libx11-dev + modemmanager-dev +) + +arch="$1" + +export DEBIAN_FRONTEND=noninteractive + +sed -i \ + 's/^Components:.*$/Components: main contrib non-free non-free-firmware/' \ + /etc/apt/sources.list.d/debian.sources + +dpkg --add-architecture "$arch" +apt update -y + +pkgs=( "crossbuild-essential-$arch" ) +for pkg in "${packages[@]}"; do + pkgs+=( "$pkg:$arch" ) +done + +apt install -y "${pkgs[@]}" + +meson env2mfile --cross --debarch "$arch" -o "/opt/meson-$arch.cross"