diff options
| author | jsvk <850037+jsvk@users.noreply.github.com> | 2026-07-01 00:00:00 +0000 |
|---|---|---|
| committer | Lena <lena@omega> | 2026-07-01 00:00:00 +0000 |
| commit | 977629ec3effeaeab698fcc4f42c7827c2b181ed (patch) | |
| tree | 38648f74328796a2caea0cca7e87cd0134e86bc2 | |
| parent | 44ebf6db6cf2725e18f0e1129f4005fd456b03dc (diff) | |
| download | rsend-977629ec3effeaeab698fcc4f42c7827c2b181ed.tar.gz | |
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
| -rwxr-xr-x | rsh/build.sh | 14 | ||||
| -rwxr-xr-x | rsync/build.sh | 14 |
2 files changed, 26 insertions, 2 deletions
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=" diff --git a/rsync/build.sh b/rsync/build.sh index 1160e74..0a7fcda 100755 --- a/rsync/build.sh +++ b/rsync/build.sh @@ -17,7 +17,19 @@ if [ -z "$ndk" ] || [ ! -d "$ndk" ]; then echo "rsync: 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 "rsync: unsupported build host $(uname -s)" >&2; exit 1 ;; +esac +tc="$ndk/toolchains/llvm/prebuilt/$host_tag/bin" +if [ ! -d "$tc" ]; then + echo "rsync: NDK toolchain not found at $tc" >&2 + exit 1 +fi work="$root/rsync/work" tarball="$root/rsync/rsync-${RSYNC_VERSION}.tar.gz" |