Run native binaries for extracting / packing various archives if they are installed in the native chroot when using the crossdirect compilation method, instead of having them go through QEMU. The resulting extracted/packed files should always be the same but this is significantly faster. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6763
19 lines
655 B
Bash
19 lines
655 B
Bash
#!/bin/sh -e
|
|
# Execute the binary from the native chroot if it is installed there. This is
|
|
# done for archiver tools such as unxz, so they don't need to go through QEMU.
|
|
|
|
# Try /native first, then the foreign arch paths. Never try
|
|
# /native/usr/lib/crossdirect as this would result in a loop.
|
|
UNWRAPPED_PATH="/native/usr/bin:/native/usr/sbin:/native/sbin:/native/bin:/usr/bin:/usr/sbin:/sbin:/bin"
|
|
|
|
BASENAME="$(basename "$0")"
|
|
UNWRAPPED_BIN="$(PATH="$UNWRAPPED_PATH" command -v "$BASENAME")"
|
|
|
|
case "$UNWRAPPED_BIN" in
|
|
/native/*)
|
|
export LD_LIBRARY_PATH="/native/usr/lib:/native/lib"
|
|
export PATH="$UNWRAPPED_PATH"
|
|
;;
|
|
esac
|
|
|
|
exec "$UNWRAPPED_BIN" "$@"
|