Skip to content

For maintainers

agnostic-apollo edited this page Feb 8, 2022 · 17 revisions

Utilities

  • ./build-all.sh: Build all packages in the correct order (using ./scripts/buildorder.py).

  • ./clean.sh: Cleaning build environment.

  • ./scripts/check-built-packages.py: Compare local (git) and remote (apt) package versions.

  • ./scripts/check-pie.sh: Verify that all binaries are using PIE, which is required for Android 5+.

  • ./scripts/check-versions.sh: Check for package updates.

  • ./scripts/ldd: Print list of required shared libraries for given binary.

  • ./scripts/lint-packages.sh: Do basic checks for problems in build.sh scripts.

  • ./scripts/list-packages.sh: List all packages with a one-line summary.

  • ./scripts/generate-bootstraps.sh: Generate bootstrap archive for Termux app from published apt repo.

  • ./scripts/build-bootstraps.sh: Build bootstrap archive for Termux app from local package sources.

Generating bootstrap archives

Bootstrap archives is a zip archives of $TERMUX_PREFIX with basic packages preinstalled and used to create a minimal working environment on first start of Termux application.

Normally, bootstrap zip archives are being generated by executing the generate-bootstraps.sh script:

./scripts/generate-bootstraps.sh

Built archives will be available in the current working directory.

Please note that you must have an apt repository deployed on the web server in order to be able to generate bootstrap archives.

Default script configuration is

Architectures: aarch64 arm i686 x86_64
Repository URL: https://packages.termux.org/apt/termux-main/

so if you want to generate bootstraps for custom repository, consider using following command line options:

  • --architectures - Comma separated list of architectures for which bootstraps should be generated.

  • --repository - URL of your APT repository. Offline bootstrap generation is not supported.

Build bootstrap archives

The build-bootstraps.sh is a script to build bootstrap archives for the termux-app from local package sources instead of debs published in apt repo like done by generate-bootstrap.sh. It allows bootstrap archives to be easily built for (forked) termux apps without having to publish an apt repo first. Run build-bootstrap.sh --help for more info.

The package name/prefix that the bootstrap is built for is defined by TERMUX_APP_PACKAGE in 'scrips/properties.sh'. It defaults to com.termux. If package name is changed, make sure to run ./scripts/run-docker.sh ./clean.sh or pass -f to force rebuild of packages.

Examples

Build default bootstrap archives for all supported archs: ./scripts/run-docker.sh ./scripts/build-bootstraps.sh &> build.log

Build default bootstrap archive for aarch64 arch only: ./scripts/run-docker.sh ./scripts/build-bootstraps.sh --architectures aarch64 &> build.log

Build bootstrap archive with additionall openssh package for aarch64 arch only: ./scripts/run-docker.sh ./scripts/build-bootstraps.sh --architectures aarch64 --add openssh &> build.log

Build Termux App

The termux-app/app/build.gradle downloads the bootstrap archives published by Generate bootstrap archives to termux-packages releases and verifies the checksums when building the app.

If you want to build termux-app with the custom bootstrap build, run Build -> Clean Project in Android Studio, then replace/place the built bootstrap zips in termux-app/app/src/main/cpp. Add a return statement in first line of downloadBootstrap() function in termux-app/app/build.gradle to prevent function from running so that the custom bootstrap-*.zip files don't get replaced with downloaded ones and then sync project with gradle files and build the apk.

Clone this wiki locally