build: fix !pmb:crossdirect (MR 2291)

With the !pmb:crossdirect option, the crossdirect compilation method
gets disabled. This means there is no /native directory mounted inside
the foreign arch chroot, all binaries inside the foreign arch chroot are
supposed to run in QEMU. Handle this in the apk_wrapper.sh script that
we use to redirect abuild-apk to /native/usr/bin/abuild-apk.

Fix for (currently with master_staging_systemd branch):
  >>> upower: Analyzing dependencies...
  /usr/local/bin/abuild-apk: line 11: /native/usr/bin/abuild-apk: not found
This commit is contained in:
Oliver Smith 2024-04-06 10:57:03 +02:00
parent b473f8786e
commit ae75f3b884
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -67,6 +67,14 @@ def init(args, suffix="native"):
with open(chroot + "/tmp/apk_wrapper.sh", "w") as handle:
content = f"""
#!/bin/sh
# With !pmb:crossdirect, cross compilation is entriely done
# in QEMU, no /native dir gets mounted inside the foreign arch
# chroot.
if ! [ -d /native ]; then
exec /usr/bin/abuild-apk "$@"
fi
export LD_PRELOAD_PATH=/native/usr/lib:/native/lib
args=""
for arg in "$@"; do