aboutsummaryrefslogtreecommitdiff
path: root/rsync
diff options
context:
space:
mode:
authorLena <lena@omega>2026-01-01 00:00:00 +0000
committerLena <lena@omega>2026-01-01 00:00:00 +0000
commit7e04941bccb2683f8a6e3ee38a99c50129234dd1 (patch)
tree471227fa437291e7a6b499e3de6c106c54eaf311 /rsync
downloadrsend-7e04941bccb2683f8a6e3ee38a99c50129234dd1.tar.gz
rsend: push phone folders to a home SSH host over rsync
A small Android app for one-way folder backup, a KISS alternative to Syncthing. It bundles rsync (built from pinned source via the NDK) and a pure-Go SSH transport, both shipped in the APK as lib*.so and run from the native library directory. rsend pins the host key, stores the ed25519 identity Keystore-encrypted, pushes each folder additively or as a mirror, and runs on demand or on a WiFi-only schedule. The build is self-contained and reproducible: make setup provisions the toolchain, make builds rsync, rsh, and the APK.
Diffstat (limited to 'rsync')
-rwxr-xr-xrsync/build.sh67
-rw-r--r--rsync/rsync-3.4.1.tar.gz.sha2561
2 files changed, 68 insertions, 0 deletions
diff --git a/rsync/build.sh b/rsync/build.sh
new file mode 100755
index 0000000..1160e74
--- /dev/null
+++ b/rsync/build.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+# Build rsync for each Android ABI from pinned source via the NDK. Output is a
+# stripped PIE executable named lib*.so, packaged inside the APK and exec'd from
+# nativeLibraryDir. Optional dependencies are disabled so the binary needs
+# nothing outside Bionic; zlib and popt come from rsync's bundled copies.
+set -eu
+
+root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+. "$root/versions"
+
+# Locate the NDK toolchain.
+ndk=${ANDROID_NDK_HOME:-${ANDROID_NDK_ROOT:-}}
+if [ -z "$ndk" ] && [ -n "${ANDROID_HOME:-}" ]; then
+ ndk="$ANDROID_HOME/ndk/$ANDROID_NDK"
+fi
+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"
+
+work="$root/rsync/work"
+tarball="$root/rsync/rsync-${RSYNC_VERSION}.tar.gz"
+src="$work/rsync-${RSYNC_VERSION}"
+
+# Fetch and verify the pinned source tarball.
+mkdir -p "$work"
+if [ ! -f "$tarball" ]; then
+ echo "rsync: fetching $RSYNC_URL"
+ curl -fsSL "$RSYNC_URL" -o "$tarball"
+fi
+echo "rsync: verifying sha256"
+( cd "$root/rsync" && sha256sum -c "rsync-${RSYNC_VERSION}.tar.gz.sha256" )
+
+# No system libraries, no docs (md2man needs python3), no iconv.
+flags="--disable-md2man --disable-openssl --disable-xxhash --disable-zstd \
+--disable-lz4 --disable-iconv --disable-acl-support --disable-xattr-support \
+--with-included-popt --with-included-zlib"
+
+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" ;;
+ *) echo "rsync: unknown ABI $abi" >&2; exit 1 ;;
+ esac
+
+ # Fresh build tree per ABI.
+ rm -rf "$src"
+ tar xzf "$tarball" -C "$work"
+
+ echo "rsync: configuring $abi"
+ ( cd "$src" && \
+ CC="$tc/$cc" AR="$tc/llvm-ar" RANLIB="$tc/llvm-ranlib" \
+ CFLAGS="-O2 -fPIE -ffile-prefix-map=$src=." LDFLAGS="-pie" \
+ ./configure --host="$host" $flags >/dev/null )
+
+ echo "rsync: building $abi"
+ ( cd "$src" && make -s rsync )
+
+ dest="$root/app/src/main/jniLibs/$abi"
+ mkdir -p "$dest"
+ cp "$src/rsync" "$dest/libxrsync.so"
+ "$tc/llvm-strip" "$dest/libxrsync.so"
+ echo "rsync: $abi -> jniLibs/$abi/libxrsync.so"
+done
diff --git a/rsync/rsync-3.4.1.tar.gz.sha256 b/rsync/rsync-3.4.1.tar.gz.sha256
new file mode 100644
index 0000000..1c230fd
--- /dev/null
+++ b/rsync/rsync-3.4.1.tar.gz.sha256
@@ -0,0 +1 @@
+2924bcb3a1ed8b551fc101f740b9f0fe0a202b115027647cf69850d65fd88c52 rsync-3.4.1.tar.gz