Files
wehub-resource-sync 680845cb1c
Linux build / Determine Swift version (push) Waiting to run
Linux build / Linux compile check (push) Blocked by required conditions
Build containerization / Verify commit signatures (push) Has been skipped
Build containerization / containerization (push) Successful in 0s
chore: import upstream snapshot with attribution
2026-07-13 12:25:30 +08:00

32 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Wrapper that dispatches to `zig cc -target x86_64-linux-gnu.2.35`.
# Mirrors x86_64-linux-musl-gcc but pins a glibc 2.35 baseline; the
# resulting binaries run on any host with glibc >= 2.35.
#
# Intercepts `-print-prog-name=ld` and returns our cross-ld wrapper —
# libtool uses that query to discover the linker before probing it
# with `-m elf_x86_64` to decide whether shared library builds are
# supported. zig cc passes the query through to the host `/usr/bin/ld`,
# which is aarch64-only and rejects the x86_64 emulation mode, causing
# libtool to silently disable shared-lib emission. Pointing libtool at
# our ld.lld-backed wrapper makes the probe succeed.
case " $* " in
*" -print-prog-name=ld "*)
echo /usr/local/bin/x86_64-linux-gnu-ld
exit 0
;;
esac
# Filters out `--target=<rust-triple>` args that cc-rs (Rust build
# scripts like libseccomp-sys, capng-sys) adds — cc-rs emits the
# Rust-form triple (x86_64-unknown-linux-gnu) which Zig can't parse.
# We always pass our own -target below, so cc-rs's is redundant.
args=()
for arg in "$@"; do
case "$arg" in
--target=*) ;;
*) args+=("$arg") ;;
esac
done
exec /opt/zig/zig cc -target x86_64-linux-gnu.2.35 "${args[@]}"