3# F-Droid prebuild step.
5# The fdroiddata recipe invokes this as
6# ../prebuild_fdroid.sh <additional-build-number> <app-id> <app-hash>
7# with the app module (the recipe's `subdir:`) as the working directory.
9# Everything the recipe used to spell out as a list of `sed` commands lives here instead: a new
10# build entry then stays short, and the patching travels in the same commit as the sources it
11# patches, so a change to the jni build scripts can never drift away from the sed that fixes them.
15if [ ! -d ../TMessagesProj/jni ]; then
16 echo "prebuild_fdroid.sh: run me from the app module directory (the recipe's subdir:)" >&2
20vars=../gradle.properties
22# Java 21, and drop what cannot ship on F-Droid (Play Services, GMS captcha).
23sed -i -e '/JavaVersion/s/17/21/' {../TMessagesProj,.}/build.gradle
24sed -i -e '/com\.google\.android\.play/d' -e '/play-services/d' ../TMessagesProj/build.gradle
25sed -i -e '/gms/d' ../TMessagesProj/src/main/java/org/telegram/messenger/CaptchaController.java
27# Build flags the recipe passes in.
28echo "DUMMY_CONST=0" >> $vars
29echo "ADDITIONAL_BUILD_NUMBER=$1" >> $vars
30echo "APP_ID=$2" >> $vars
31echo "APP_HASH=$3" >> $vars
32echo "F_DROID=1" >> $vars
33echo "org.gradle.workers.max=1" >> $vars
35# tlottie's build script wants `stable` by name; the recipe pins its own toolchain.
36# prepare.py does `git checkout -- prebuild` right before building, so patch prepare.py.
37rust_toolchain=$(rustup show active-toolchain 2>/dev/null | awk 'NR == 1 { print $1 }')
38if ! rustup run "$rust_toolchain" rustc --version >/dev/null 2>&1; then
40 rust_toolchain=$(rustup show active-toolchain | awk 'NR == 1 { print $1 }')
41 rustup run "$rust_toolchain" rustc --version >/dev/null
43rustup target add --toolchain "$rust_toolchain" \
44 aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
45prep=../TMessagesProj/jni/prepare.py
46grep -q '\./prebuild/build_all\.sh' $prep || { echo "$prep: prebuild entry point moved" >&2; exit 1; }
47sed -i -e "s|\./prebuild/build_all\.sh|TLOTTIE_RUST_TOOLCHAIN=$rust_toolchain &|" $prep
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list