bczhc / some-tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tools

some-tools Shitcode

Android CI

commit activity commit activity commit activity

languages repo size closed issues Percentage of issues still open

Build

TODO: DOCUMENTATION OUTDATED

Basic requirements

  • cURL
  • JDK (>=1.8)
  • Ruby

Set build targets

First we set a "target string" in the format <ABI>-<API>. The possible values of ABI are armeabi-v7a, arm64-v8a, x86 and x86_64, and you can refer to Android supported ABIs. The API value is an integer, you can refer to Platform codenames, versions, API levels, and NDK releases. Ensure that the NDK compiler for the specified target exists. Its path is: $NDK_TOOLCHAIN_BIN_DIR/<target-triple><API>-clang[++] (e.g. $SDK_DIR/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang).

Now add a property with the key ndk.target in config.properties (create it if not existing), and its value is the "target string". If multiple build targets are required, join them together with commas.

Examples:

ndk.target=arm64-v8a-29

or

ndk.target=armeabi-v7a-19,arm64-v8a-29,x86-29

Configure SDK path

Add property sdk.dir=SDK_PATH (replace SDK_PATH with your Android SDK path) to file local.properties at the project root (create it if doesn't exist).

The NDK is expected to be detected automatically, or you can also specify it using ndk.dir property. Try running ./gradlew to check, and it's expected to have these messages printed:

...
Build environment info:
SDK path: ...
NDK path: ...
NDK version: ...
CMake version: ...
NDK targets: [...]
Rust build extra env: ...
...

NDK dependencies requirements:

  • CMake (>=3.10.0)

Compile OpenSSL and set up the path

First clone OpenSSL from its GitHub repository: https://github.com/openssl/openssl, and checkout the tag openssl-3.0.1.

These commands below should work:

git clone https://github.com/openssl/openssl --depth 1
cd openssl
git fetch --unshallow
git fetch origin openssl-3.0
git fetch --all
git checkout openssl-3.0.1

Then go back into this project and run ./tools/build-openssl <openssl-path> with a path to OpenSSL project root, and it will cross-compile OpenSSL libraries in the targets defined in config.properties.

After compilation, the compiled libraries are stored in <openssl-dir>/libs/<Android-ABI>/.

Now you need to set opensslLib.dir=<openssl-dir> property in config.properties.

Configure Rust

If you don't have Rust installed, you can install it first by running:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Note: This installation method is recommended, since it has a good Rust toolchain manager rustup.

Add Rust cross-compilation targets

Run ./tools/configure-rust. Here rustup is required.

Extra config.properties configurations

  • build.disable-rust=true

    Note: This will cause all functions related to JNI written in Rust unusable, and the app will crash when using them.

  • ndk.keepDebugSymbols=true

    Keep Rust library debug symbols

Build Project

Run ./gradlew :app:assembleDebug or ./gradlew asD for debug build.

Run ./gradlew :app:assembleRelease or ./gradlew asR for release build.

About

License:GNU General Public License v3.0


Languages

Language:Kotlin 61.1%Language:Java 24.6%Language:Rust 7.8%Language:C++ 3.7%Language:Groovy 1.4%Language:Ruby 0.4%Language:Dockerfile 0.4%Language:Scala 0.2%Language:CMake 0.2%Language:C 0.2%