Watch
1
0
Fork
You've already forked souveraine
0

ci: make the upower cross build actually work

The upower steps were added after the last green release and had never
run successfully — the Jul 13 edge release contains no upower package at
all. Six defects, each hiding the next, found by reproducing the steps on
the runner:

- SOUVERAINE_AARCH64_SYSROOT was exported in the binaries step, not this
  one; steps do not share environment, so the pkg-config wrapper fell back
  to /usr/aarch64-linux-gnu and glib was not found.
- c_link_args had --sysroot but no -L, so ld could not resolve the bare
  paths inside the sysroot linker scripts (libm, libmvec).
- PKG_CONFIG_LIBDIR covered only lib/pkgconfig; udev.pc lives in
  share/pkgconfig. Fixed in the wrapper, which overrides the caller.
- introspection ran g-ir-scanner against an aarch64 build and failed;
  disabled for the cross build only (the phone ships no UPowerGlib
  typelib and quickshell's UPower module is native Qt).
- gtk-doc/man default on, but gtkdoc-scan is absent from the runner, so
  the x86_64 native build would have failed at the same point.
- the aarch64 sanity check tested usr/lib/upowerd; it installs to
  usr/libexec/upowerd, so the check failed even on a good build.

Verified on archdev: aarch64 56/56 targets, upowerd is aarch64, built
from 628283f with the charge-type fix; x86_64 58/58 native.
This commit is contained in:
Fimeg 2026-07-24 20:55:33 -04:00
commit a799bf1cde
2 changed files with 32 additions and 5 deletions

View file

@ -6,6 +6,9 @@
# probe in the tree (alsa-sys today, any future -sys crate) goes through it.
SYSROOT="${SOUVERAINE_AARCH64_SYSROOT:-/usr/aarch64-linux-gnu}"
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_LIBDIR="$SYSROOT/usr/lib/pkgconfig"
# Both dirs: udev.pc (and other systemd-shipped .pc files) live in
# share/pkgconfig, not lib/pkgconfig. This wrapper OVERRIDES whatever the
# caller exported, so widening it here is the only fix that takes effect.
export PKG_CONFIG_LIBDIR="$SYSROOT/usr/lib/pkgconfig:$SYSROOT/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
exec /usr/bin/pkg-config "$@"

View file

@ -132,13 +132,21 @@ jobs:
git -C "$GITHUB_WORKSPACE/src/upower" checkout "$UPOWER_SHA"
SYSROOT="$HOME/aarch64-sysroot"
# .cargo/aarch64-pkg-config reads SOUVERAINE_AARCH64_SYSROOT and falls
# back to /usr/aarch64-linux-gnu, which has no glib. Steps do not share
# environment, so exporting it in the binaries step does not reach here.
export SOUVERAINE_AARCH64_SYSROOT="$SYSROOT"
# --- x86_64: native build on the archdev host ---
(
cd "$GITHUB_WORKSPACE/src/upower"
# gtkdoc-scan is not installed on the runner, so gtk-doc=true fails
# here too; man needs the same toolchain. Introspection is left ON
# for the native build — it works, and costs nothing.
meson setup build-x86_64 \
--prefix=/usr --sysconfdir=/etc --localstatedir=/var \
-Dsystemdsystemunitdir=/usr/lib/systemd/system
-Dsystemdsystemunitdir=/usr/lib/systemd/system \
-Dgtk-doc=false -Dman=false
meson compile -C build-x86_64
DESTDIR="$GITHUB_WORKSPACE/src/upower/dest-x86_64" meson install -C build-x86_64
)
@ -154,11 +162,19 @@ jobs:
ar = 'aarch64-linux-gnu-ar'
strip = 'aarch64-linux-gnu-strip'
pkgconfig = '$PWD/.cargo/aarch64-pkg-config'
# gobject-introspection is on by default and RUNS the aarch64 binary
# it just built (g-ir-scanner). qemu needs -L to find the aarch64
# loader; binfmt is registered on the Proxmox host so this works
# inside the unprivileged archdev container.
exe_wrapper = ['qemu-aarch64-static', '-L', '$SYSROOT']
[built-in options]
c_args = ['--sysroot=$SYSROOT']
cpp_args = ['--sysroot=$SYSROOT']
c_link_args = ['--sysroot=$SYSROOT']
cpp_link_args = ['--sysroot=$SYSROOT']
# -L as well as --sysroot: libc.so/libbsd.so in the sysroot are linker
# SCRIPTS naming bare paths (libm, libmvec, -lmd), which ld resolves
# against its own prefix and misses without an explicit search dir.
c_link_args = ['--sysroot=$SYSROOT', '-L$SYSROOT/usr/lib']
cpp_link_args = ['--sysroot=$SYSROOT', '-L$SYSROOT/usr/lib']
[host_machine]
system = 'linux'
cpu_family = 'aarch64'
@ -170,15 +186,23 @@ jobs:
PKG_CONFIG_ALLOW_CROSS=1 \
PKG_CONFIG_LIBDIR="$SYSROOT/usr/lib/pkgconfig" \
PKG_CONFIG_SYSROOT_DIR="$SYSROOT" \
# gtk-doc/man need host doc tooling, and introspection needs a
# g-ir-scanner that can scan an aarch64 build (the host copy reads
# its data files out of the sysroot and fails). None of the three
# ship anything the phone uses — quickshell's UPower module is
# native Qt, and the device carries no UPowerGlib typelib.
meson setup build-aarch64 \
--prefix=/usr --sysconfdir=/etc --localstatedir=/var \
-Dsystemdsystemunitdir=/usr/lib/systemd/system \
-Dgtk-doc=false -Dman=false -Dintrospection=disabled \
--cross-file "$CROSS"
meson compile -C build-aarch64
DESTDIR="$GITHUB_WORKSPACE/src/upower/dest-aarch64" meson install -C build-aarch64
)
# Sanity: the aarch64 upowerd must actually be aarch64.
file "$GITHUB_WORKSPACE/src/upower/dest-aarch64/usr/lib/upowerd" \
# It installs to libexec/, not lib/ — the old path made this check
# fail even on a good build.
file "$GITHUB_WORKSPACE/src/upower/dest-aarch64/usr/libexec/upowerd" \
| grep -q aarch64 || { echo "aarch64 upowerd is not aarch64" >&2; exit 1; }
tar -C "$GITHUB_WORKSPACE/src/upower/dest-aarch64" \
-cf "$GITHUB_WORKSPACE/src/Souveraine/upower-tree-aarch64.tar" .