From 977629ec3effeaeab698fcc4f42c7827c2b181ed Mon Sep 17 00:00:00 2001 From: jsvk <850037+jsvk@users.noreply.github.com> Date: Wed, 1 Jul 2026 00:00:00 +0000 Subject: native: pick the NDK host toolchain tag by build host The NDK names its prebuilt toolchain directory after the build host, not the target. Hardcoding linux-x86_64 broke rsync/build.sh and rsh/build.sh on macOS, which ships the toolchain under darwin-x86_64 (x86_64 binaries, run under Rosetta on Apple Silicon). Detect the host with uname and fail loud on anything else. Link: https://codeberg.org/0xlena/rsend/pulls/1 --- rsh/build.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'rsh/build.sh') diff --git a/rsh/build.sh b/rsh/build.sh index 88cdf9c..a3b2cad 100755 --- a/rsh/build.sh +++ b/rsh/build.sh @@ -21,7 +21,19 @@ if [ -z "$ndk" ] || [ ! -d "$ndk" ]; then echo "rsh: Android NDK not found; set ANDROID_NDK_HOME" >&2 exit 1 fi -tc="$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin" +# NDK prebuilt toolchains are named by build host, not target. Pick the tag +# matching this machine (macOS ships an x86_64 clang that runs under Rosetta on +# Apple Silicon); the target ABI is selected separately below. +case "$(uname -s)" in +Linux) host_tag=linux-x86_64 ;; +Darwin) host_tag=darwin-x86_64 ;; +*) echo "rsh: unsupported build host $(uname -s)" >&2; exit 1 ;; +esac +tc="$ndk/toolchains/llvm/prebuilt/$host_tag/bin" +if [ ! -d "$tc" ]; then + echo "rsh: NDK toolchain not found at $tc" >&2 + exit 1 +fi ldflags="-s -w -buildid=" -- cgit v1.2.3