ci: Simplify musl build setup

No need to setup symlink farms, we can just use the host's /usr/include
now.
This commit is contained in:
Daan De Meyer
2026-02-19 20:04:06 +01:00
committed by Daan De Meyer
parent 5ab8bba2b0
commit 59a83c37bf
3 changed files with 9 additions and 110 deletions
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
if ! command -v musl-gcc >/dev/null; then
echo "musl-gcc is not installed, skipping the test."
exit 77
fi
TMPDIR=$(mktemp -d)
cleanup() (
set +e
if [[ -d "$TMPDIR" ]]; then
rm -rf "$TMPDIR"
fi
)
trap cleanup EXIT ERR INT TERM
tools/setup-musl-build.sh "${TMPDIR}/build"
ninja -v -C "${TMPDIR}/build"
+9 -1
View File
@@ -81,4 +81,12 @@ jobs:
run: mkosi box -- meson test -C build --suite=clang-tidy --print-errorlogs --no-stdsplit --quiet
- name: Build with musl
run: mkosi box -- .github/workflows/build-test-musl.sh
run: |
mkosi box -- \
env \
CC=musl-gcc \
CXX=musl-gcc \
CFLAGS="-idirafter /usr/include" \
CXXFLAGS="-idirafter /usr/include" \
meson setup -Dlibc=musl -Ddbus-interfaces-dir=no musl
mkosi box -- ninja -C musl
-85
View File
@@ -1,85 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
# Usage:
# tools/setup-musl-build.sh <build-directory> <options…>
# E.g.
# tools/setup-musl-build.sh build-musl -Dbuildtype=debugoptimized && ninja -C build-musl
set -eux
BUILD_DIR="${1:?}"
shift
SETUP_DIR="${BUILD_DIR}/extra"
LINKS=(
acl
archive.h
archive_entry.h
asm
asm-generic
audit-records.h
audit_logging.h
bpf
bzlib.h
curl
dwarf.h
elfutils
fido.h
gcrypt.h
gelf.h
gnutls
gpg-error.h
idn2.h
libaudit.h
libcryptsetup.h
libelf.h
libkmod.h
linux
lz4.h
lz4frame.h
lz4hc.h
lzma
lzma.h
microhttpd.h
mtd
openssl
pcre2.h
pwquality.h
qrencode.h
seccomp-syscalls.h
seccomp.h
security
selinux
sys/acl.h
tss2
xen
xkbcommon
zconf.h
zlib.h
zstd.h
zstd_errors.h
)
rm -rf "${SETUP_DIR}"
for t in "${LINKS[@]}"; do
[[ -e /usr/include/"$t" ]]
link="${SETUP_DIR}/usr/include/${t}"
mkdir -p "${link%/*}"
ln -s /usr/include/"$t" "$link"
done
# Use an absolute path so that when we chdir into the build directory,
# the path still works. This is easier than figuring out the relative path.
[[ "${SETUP_DIR}" =~ ^/ ]] || SETUP_DIR="${PWD}/${SETUP_DIR}"
CFLAGS="-idirafter ${SETUP_DIR}/usr/include"
set -x
env \
CC=musl-gcc \
CXX=musl-gcc \
CFLAGS="$CFLAGS" \
CXXFLAGS="$CFLAGS" \
meson setup --reconfigure -Ddbus-interfaces-dir=no -Dlibc=musl "${BUILD_DIR}" "${@}"