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.
This commit is contained in:
Barnabás Pőcze 2025-05-10 12:49:06 +02:00 committed by Wim Taymans
parent 9438df8d30
commit 0fcabdbd0c
2 changed files with 140 additions and 0 deletions

View file

@ -31,6 +31,9 @@ include:
- project: 'freedesktop/ci-templates' - project: 'freedesktop/ci-templates'
ref: *templates_sha ref: *templates_sha
file: '/templates/alpine.yml' file: '/templates/alpine.yml'
- project: 'freedesktop/ci-templates'
ref: *templates_sha
file: '/templates/debian.yml'
.fedora: .fedora:
variables: variables:
@ -141,6 +144,30 @@ include:
# FDO_DISTRIBUTION_EXEC: >- # FDO_DISTRIBUTION_EXEC: >-
# pip3 install meson # 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: .alpine:
variables: variables:
# Update this tag when you want to trigger a rebuild # Update this tag when you want to trigger a rebuild
@ -229,6 +256,18 @@ container_ubuntu:
variables: variables:
GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image 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: container_fedora:
extends: extends:
- .fedora - .fedora
@ -267,6 +306,44 @@ build_on_ubuntu:
variables: variables:
MESON_OPTIONS: "-Dsession-managers=[] -Dsnap=enabled" 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: .build_on_fedora:
extends: extends:
- .fedora - .fedora

View file

@ -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"