diff options
| author | Lena <lena@omega> | 2026-08-23 00:00:00 +0000 |
|---|---|---|
| committer | Lena <lena@omega> | 2026-08-23 00:00:00 +0000 |
| commit | 174521e494159bb0e65c551b440fe732767bdd6d (patch) | |
| tree | 8323555e10813107f776d05afb536344c0503d61 | |
| parent | 8a3746d71661df97615d004c353a183408c3e910 (diff) | |
| download | rsend-174521e494159bb0e65c551b440fe732767bdd6d.tar.gz | |
build: pin the build host and the shipped ABIs
The native scripts picked an NDK host tag for macOS as well, but
ci/setup-toolchain.sh provisions nothing outside Linux x86_64 and no
pipeline exercises the other branch. Fail with the message setup already
gives instead of naming a toolchain nobody can obtain here.
The armeabi-v7a and x86 cases were never reachable either: ABIS ships
arm64-v8a and x86_64, and ci/verify-apk.sh has no machine check for the
other two, so adding one to ABIS failed the build it was meant to
enable. Record what a new ABI actually costs instead of inviting a
one-line edit that cannot work.
| -rwxr-xr-x | rsh/build.sh | 25 | ||||
| -rwxr-xr-x | rsync/build.sh | 23 | ||||
| -rw-r--r-- | versions | 5 |
3 files changed, 24 insertions, 29 deletions
diff --git a/rsh/build.sh b/rsh/build.sh index f91343a..0363553 100755 --- a/rsh/build.sh +++ b/rsh/build.sh @@ -27,15 +27,14 @@ if [ -z "$ndk" ] || [ ! -d "$ndk" ]; then echo "rsh: Android NDK not found; set ANDROID_NDK_HOME" >&2 exit 1 fi -# 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" +# NDK prebuilt toolchains are named by build host, not target; the target ABI is +# selected separately below. ci/setup-toolchain.sh provisions Linux x86_64 only, +# so that is the only host tag worth naming here. +if [ "$(uname -s)" != Linux ] || [ "$(uname -m)" != x86_64 ]; then + echo "rsh: only Linux x86_64 build hosts are supported" >&2 + exit 1 +fi +tc="$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin" if [ ! -d "$tc" ]; then echo "rsh: NDK toolchain not found at $tc" >&2 exit 1 @@ -56,17 +55,15 @@ cd "$root/rsh" for abi in $ABIS; do case "$abi" in - arm64-v8a) goarch=arm64 goarm='' cc="aarch64-linux-android${ANDROID_MIN_SDK}-clang" ;; - armeabi-v7a) goarch=arm goarm=7 cc="armv7a-linux-androideabi${ANDROID_MIN_SDK}-clang" ;; - x86_64) goarch=amd64 goarm='' cc="x86_64-linux-android${ANDROID_MIN_SDK}-clang" ;; - x86) goarch=386 goarm='' cc="i686-linux-android${ANDROID_MIN_SDK}-clang" ;; + arm64-v8a) goarch=arm64 cc="aarch64-linux-android${ANDROID_MIN_SDK}-clang" ;; + x86_64) goarch=amd64 cc="x86_64-linux-android${ANDROID_MIN_SDK}-clang" ;; *) echo "rsh: unknown ABI $abi" >&2; exit 1 ;; esac dest="$root/app/src/main/jniLibs/$abi" mkdir -p "$dest" echo "rsh: building $abi (android/$goarch)" output="$dest/libxrsh.so.part.$$" - CGO_ENABLED=1 GOOS=android GOARCH="$goarch" GOARM="$goarm" \ + CGO_ENABLED=1 GOOS=android GOARCH="$goarch" \ CC="$tc/$cc" GOFLAGS=-trimpath \ CGO_CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=$root=." \ go build -buildvcs=false -buildmode=pie -ldflags "$android_ldflags" -o "$output" . diff --git a/rsync/build.sh b/rsync/build.sh index 1af7fbb..ae4026a 100755 --- a/rsync/build.sh +++ b/rsync/build.sh @@ -23,15 +23,14 @@ if [ -z "$ndk" ] || [ ! -d "$ndk" ]; then echo "rsync: Android NDK not found; set ANDROID_NDK_HOME" >&2 exit 1 fi -# 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" +# NDK prebuilt toolchains are named by build host, not target; the target ABI is +# selected separately below. ci/setup-toolchain.sh provisions Linux x86_64 only, +# so that is the only host tag worth naming here. +if [ "$(uname -s)" != Linux ] || [ "$(uname -m)" != x86_64 ]; then + echo "rsync: only Linux x86_64 build hosts are supported" >&2 + exit 1 +fi +tc="$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin" if [ ! -d "$tc" ]; then echo "rsync: NDK toolchain not found at $tc" >&2 exit 1 @@ -71,10 +70,8 @@ echo "rsync: verifying sha256" for abi in $ABIS; do case "$abi" in - arm64-v8a) host=aarch64-linux-android cc="aarch64-linux-android${ANDROID_MIN_SDK}-clang" ;; - armeabi-v7a) host=arm-linux-androideabi cc="armv7a-linux-androideabi${ANDROID_MIN_SDK}-clang" ;; - x86_64) host=x86_64-linux-android cc="x86_64-linux-android${ANDROID_MIN_SDK}-clang" ;; - x86) host=i686-linux-android cc="i686-linux-android${ANDROID_MIN_SDK}-clang" ;; + arm64-v8a) host=aarch64-linux-android cc="aarch64-linux-android${ANDROID_MIN_SDK}-clang" ;; + x86_64) host=x86_64-linux-android cc="x86_64-linux-android${ANDROID_MIN_SDK}-clang" ;; *) echo "rsync: unknown ABI $abi" >&2; exit 1 ;; esac @@ -47,6 +47,7 @@ ANDROID_CMDLINE_TOOLS_SHA256=7ec965280a073311c339e571cd5de778b9975026cfcbe79f2b1 GRADLE_SHA256=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab # Native ABIs to build, and to ship in the APK. arm64-v8a is every current -# phone; x86_64 covers x86 Android devices and the emulator. Add armeabi-v7a to -# support 32-bit phones. Keep this in step with abiFilters in app/build.gradle. +# phone; x86_64 covers x86 Android devices and the emulator. Another ABI needs a +# case in rsync/build.sh, rsh/build.sh, and ci/verify-apk.sh, and abiFilters in +# app/build.gradle kept in step with this line. ABIS="arm64-v8a x86_64" |