diff --git a/nym-vpn-android/scripts/fdroid-prebuild.sh b/nym-vpn-android/scripts/fdroid-prebuild.sh new file mode 100644 index 0000000000..3ab26ffb76 --- /dev/null +++ b/nym-vpn-android/scripts/fdroid-prebuild.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -eux + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +REPO_DIR="$SCRIPT_DIR/../../" + +# Install Rust +curl -sf -L https://sh.rustup.rs > /tmp/rustup.sh +chmod +x /tmp/rustup.sh +/tmp/rustup.sh -y +# shellcheck source=/dev/null +source "$HOME/.cargo/env" +rustup set profile minimal +rustup target add \ + i686-linux-android \ + x86_64-linux-android \ + aarch64-linux-android \ + armv7-linux-androideabi + +# Install golang +GOLANG_VERSION="1.21.3" +# Checksum from: https://golang.org/dl/ +GOLANG_HASH="1241381b2843fae5a9707eec1f8fb2ef94d827990582c7c7c32f5bdfbfd420c8" +cd "$HOME" +curl -sf -L -o go.tgz https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz +echo "$GOLANG_HASH go.tgz" | sha256sum -c +tar -xzvf go.tgz +patch -p1 -f -N -r- -d "$HOME/go" < "$REPO_DIR/wireguard/libwg/goruntime-boottime-over-monotonic.diff" + +# Ensure Go compiler is accessible +export GOROOT="$HOME/go" +export PATH="$PATH:$GOROOT/bin" + +# install cargo dependencies +cargo install cargo-ndk cargo-license --locked + +# install other dependencies +sudo apt-get update && sudo apt-get install -y libdbus-1-dev libmnl-dev libnftnl-dev protobuf-compiler git curl gcc g++ make unzip