mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-30 17:48:36 -04:00
110 lines
3.6 KiB
YAML
110 lines
3.6 KiB
YAML
name: Build static rsync for Android
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- '.github/workflows/*.yml'
|
|
- '!.github/workflows/android-static-build.yml'
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
paths-ignore:
|
|
- '.github/workflows/*.yml'
|
|
- '!.github/workflows/android-static-build.yml'
|
|
schedule:
|
|
- cron: '42 8 * * 1'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
ANDROID_API: 24
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
name: ${{ matrix.abi }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- abi: arm64-v8a # modern phones
|
|
triple: aarch64-linux-android
|
|
qemu: qemu-aarch64-static
|
|
- abi: armeabi-v7a # older 32-bit phones
|
|
triple: armv7a-linux-androideabi
|
|
qemu: qemu-arm-static
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Install build prerequisites
|
|
run: sudo apt-get update && sudo apt-get install -y autoconf automake gawk qemu-user-static
|
|
|
|
- name: Configure and build (${{ matrix.abi }})
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
NDK="${ANDROID_NDK_LATEST_HOME:-$ANDROID_NDK_ROOT}"
|
|
TC="$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
|
export CC="$TC/${{ matrix.triple }}${ANDROID_API}-clang"
|
|
export AR="$TC/llvm-ar" RANLIB="$TC/llvm-ranlib" STRIP="$TC/llvm-strip"
|
|
export CFLAGS="-O2" LDFLAGS="-static"
|
|
|
|
# Bionic hides lchmod and lutimes before API 36; cross-builds cannot run probes
|
|
export ac_cv_func_lchmod=no ac_cv_func_lutimes=no \
|
|
rsync_cv_HAVE_SOCKETPAIR=yes \
|
|
rsync_cv_MKNOD_CREATES_FIFOS=yes \
|
|
rsync_cv_MKNOD_CREATES_SOCKETS=yes
|
|
|
|
./configure --host=${{ matrix.triple }} --build=x86_64-pc-linux-gnu \
|
|
--enable-ipv6 \
|
|
--disable-zstd --disable-lz4 --disable-xxhash --disable-openssl --disable-idn \
|
|
--disable-iconv --disable-iconv-open \
|
|
--disable-acl-support --disable-xattr-support \
|
|
--disable-md2man --disable-roll-simd \
|
|
--with-included-popt --with-included-zlib
|
|
|
|
# Generate shared headers before the parallel build
|
|
make proto.h
|
|
make -j"$(nproc)" rsync
|
|
"$STRIP" rsync
|
|
|
|
- name: Verify binary
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
file rsync
|
|
file rsync | grep -q "statically linked"
|
|
if file rsync | grep -q "dynamically linked"; then
|
|
echo "ERROR: binary is not static" >&2; exit 1
|
|
fi
|
|
${{ matrix.qemu }} ./rsync --version | head -3 || \
|
|
echo "WARNING: qemu smoke test did not run cleanly (check on a real device)"
|
|
|
|
- name: Package
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
VER=$(sed -n 's/.*RSYNC_VERSION "\([^"]*\)".*/\1/p' version.h)
|
|
out="rsync-${VER}-android-${{ matrix.abi }}"
|
|
mkdir -p dist
|
|
cp rsync "dist/$out"
|
|
( cd dist && sha256sum "$out" > "$out.sha256" )
|
|
echo "ARTIFACT_NAME=rsync-android-${{ matrix.abi }}" >>"$GITHUB_ENV"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
retention-days: 45
|
|
name: ${{ env.ARTIFACT_NAME }}
|
|
path: dist/
|