2015-06-13 01:03:31 +02:00
|
|
|
#!/bin/bash
|
2018-08-27 22:27:42 +02:00
|
|
|
# shellcheck disable=SC1117
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
set -e -o pipefail -u
|
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# Utility function to log an error message and exit with an error code.
|
2019-02-26 21:25:56 +01:00
|
|
|
source scripts/build/termux_error_exit.sh
|
2017-12-07 03:19:46 +01:00
|
|
|
|
2018-08-21 00:35:50 +02:00
|
|
|
# Utility function to download a resource with an expected checksum.
|
2019-02-26 21:29:01 +01:00
|
|
|
source scripts/build/termux_download.sh
|
2017-01-06 02:37:45 +01:00
|
|
|
|
|
|
|
# Utility function for golang-using packages to setup a go toolchain.
|
2019-02-26 21:30:03 +01:00
|
|
|
source scripts/build/setup/termux_setup_golang.sh
|
2017-01-06 02:37:45 +01:00
|
|
|
|
2018-09-03 23:57:26 +02:00
|
|
|
# Utility function for rust-using packages to setup a rust toolchain.
|
2019-02-26 21:33:42 +01:00
|
|
|
source scripts/build/setup/termux_setup_rust.sh
|
2018-09-03 23:57:26 +02:00
|
|
|
|
2017-11-07 02:26:49 +01:00
|
|
|
# Utility function to setup a current ninja build system.
|
2019-02-26 21:34:02 +01:00
|
|
|
source scripts/build/setup/termux_setup_ninja.sh
|
2017-07-29 02:11:04 +02:00
|
|
|
|
2017-11-07 02:26:49 +01:00
|
|
|
# Utility function to setup a current meson build system.
|
2019-02-26 21:34:34 +01:00
|
|
|
source scripts/build/setup/termux_setup_meson.sh
|
2017-07-29 02:11:04 +02:00
|
|
|
|
2017-11-07 02:26:49 +01:00
|
|
|
# Utility function to setup a current cmake build system
|
2019-02-26 21:35:27 +01:00
|
|
|
source scripts/build/setup/termux_setup_cmake.sh
|
2017-01-11 18:21:58 +01:00
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# First step is to handle command-line arguments. Not to be overridden by packages.
|
2019-02-26 21:36:00 +01:00
|
|
|
source scripts/build/termux_step_handle_arguments.sh
|
2017-01-06 02:37:45 +01:00
|
|
|
|
|
|
|
# Setup variables used by the build. Not to be overridden by packages.
|
2019-02-26 21:36:42 +01:00
|
|
|
source scripts/build/termux_step_setup_variables.sh
|
2017-01-06 02:37:45 +01:00
|
|
|
|
|
|
|
# Save away and restore build setups which may change between builds.
|
2019-02-26 21:37:26 +01:00
|
|
|
source scripts/build/termux_step_handle_buildarch.sh
|
2016-05-31 01:25:12 +02:00
|
|
|
|
2018-12-29 11:56:40 +01:00
|
|
|
# Function to get TERMUX_PKG_VERSION from build.sh
|
2019-02-26 21:39:17 +01:00
|
|
|
source scripts/build/termux_extract_dep_info.sh
|
2018-12-29 11:56:40 +01:00
|
|
|
|
2019-02-26 21:39:58 +01:00
|
|
|
# Function that downloads a .deb (using the termux_download function)
|
|
|
|
source scripts/build/termux_download_deb.sh
|
2018-12-29 14:50:27 +01:00
|
|
|
|
2019-01-01 21:56:42 +01:00
|
|
|
# Script to download InRelease, verify it's signature and then download Packages.xz by hash
|
2019-03-03 12:32:22 +01:00
|
|
|
source scripts/build/termux_get_repo_files.sh
|
2019-01-01 21:56:42 +01:00
|
|
|
|
|
|
|
# Source the package build script and start building. No to be overridden by packages.
|
2019-02-26 21:41:19 +01:00
|
|
|
source scripts/build/termux_step_start_build.sh
|
2017-01-06 02:37:45 +01:00
|
|
|
|
|
|
|
# Run just after sourcing $TERMUX_PKG_BUILDER_SCRIPT. May be overridden by packages.
|
2019-02-26 21:42:19 +01:00
|
|
|
source scripts/build/termux_step_extract_package.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# Hook for packages to act just after the package has been extracted.
|
2017-01-10 09:14:35 +01:00
|
|
|
# Invoked in $TERMUX_PKG_SRCDIR.
|
2017-01-10 12:35:05 +01:00
|
|
|
termux_step_post_extract_package() {
|
2019-02-12 09:23:21 +01:00
|
|
|
return
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# Optional host build. Not to be overridden by packages.
|
2019-02-26 21:27:00 +01:00
|
|
|
source scripts/build/termux_step_handle_hostbuild.sh
|
2017-01-06 02:37:45 +01:00
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
# Perform a host build. Will be called in $TERMUX_PKG_HOSTBUILD_DIR.
|
|
|
|
# After termux_step_post_extract_package() and before termux_step_patch_package()
|
2019-02-26 21:28:04 +01:00
|
|
|
source scripts/build/termux_step_host_build.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# Setup a standalone Android NDK toolchain. Not to be overridden by packages.
|
2019-02-27 19:37:27 +01:00
|
|
|
source scripts/build/termux_step_setup_toolchain.sh
|
2017-01-06 02:37:45 +01:00
|
|
|
|
2017-01-07 06:38:04 +01:00
|
|
|
# Apply all *.patch files for the package. Not to be overridden by packages.
|
2019-02-27 19:38:58 +01:00
|
|
|
source scripts/build/termux_step_patch_package.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2017-03-05 11:40:50 +01:00
|
|
|
# Replace autotools build-aux/config.{sub,guess} with ours to add android targets.
|
2019-02-27 19:39:41 +01:00
|
|
|
source scripts/build/termux_step_replace_guess_scripts.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# For package scripts to override. Called in $TERMUX_PKG_BUILDDIR.
|
2017-01-10 12:35:05 +01:00
|
|
|
termux_step_pre_configure() {
|
2017-01-06 02:37:45 +01:00
|
|
|
return
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
2019-02-27 19:40:34 +01:00
|
|
|
# Setup configure args and run $TERMUX_PKG_SRCDIR/configure. This function is called from termux_step_configure
|
|
|
|
source scripts/build/configure/termux_step_configure_autotools.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2019-02-27 19:47:03 +01:00
|
|
|
# Setup configure args and run cmake. This function is called from termux_step_configure
|
|
|
|
source scripts/build/configure/termux_step_configure_cmake.sh
|
2017-01-15 13:48:05 +01:00
|
|
|
|
2019-02-27 19:48:46 +01:00
|
|
|
# Setup configure args and run meson. This function is called from termux_step_configure
|
|
|
|
source scripts/build/configure/termux_step_configure_meson.sh
|
2017-07-29 02:11:04 +02:00
|
|
|
|
2019-02-27 19:49:12 +01:00
|
|
|
# Configure the package
|
|
|
|
source scripts/build/configure/termux_step_configure.sh
|
2017-01-15 13:48:05 +01:00
|
|
|
|
2019-02-27 20:01:08 +01:00
|
|
|
# Hook for packages after configure step
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_post_configure() {
|
2017-01-06 02:37:45 +01:00
|
|
|
return
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
2019-02-27 19:49:39 +01:00
|
|
|
# Make package, either with ninja or make
|
|
|
|
source scripts/build/termux_step_make.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2019-02-27 19:50:20 +01:00
|
|
|
# Make install, either with ninja, make of cargo
|
|
|
|
source scripts/build/termux_step_make_install.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# Hook function for package scripts to override.
|
2017-01-10 12:35:05 +01:00
|
|
|
termux_step_post_make_install() {
|
2017-01-06 02:37:45 +01:00
|
|
|
return
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
2019-02-27 19:53:53 +01:00
|
|
|
# Function to cp (through tar) installed files to massage dir
|
|
|
|
source scripts/build/termux_step_extract_into_massagedir.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2019-02-27 19:58:17 +01:00
|
|
|
# Function to run various cleanup/fixes
|
|
|
|
source scripts/build/termux_step_massage.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2019-02-27 20:01:08 +01:00
|
|
|
# Hook for packages after massage step
|
2017-01-10 12:35:05 +01:00
|
|
|
termux_step_post_massage() {
|
2017-01-06 02:37:45 +01:00
|
|
|
return
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# Create data.tar.gz with files to package. Not to be overridden by package scripts.
|
2019-02-27 19:58:49 +01:00
|
|
|
source scripts/build/termux_step_create_datatar.sh
|
2016-01-11 01:45:41 +01:00
|
|
|
|
2019-02-27 20:01:08 +01:00
|
|
|
# Hook function to create {pre,post}install, {pre,post}rm-scripts and similar
|
2017-01-10 12:35:05 +01:00
|
|
|
termux_step_create_debscripts() {
|
2017-01-06 02:37:45 +01:00
|
|
|
return
|
2015-12-20 18:02:59 +01:00
|
|
|
}
|
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# Create the build deb file. Not to be overridden by package scripts.
|
2019-02-27 19:59:31 +01:00
|
|
|
source scripts/build/termux_step_create_debfile.sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
# Finish the build. Not to be overridden by package scripts.
|
2019-02-27 20:00:42 +01:00
|
|
|
source scripts/build/termux_step_finish_build.sh
|
2016-09-25 01:30:20 +02:00
|
|
|
|
2017-01-06 02:37:45 +01:00
|
|
|
termux_step_handle_arguments "$@"
|
|
|
|
termux_step_setup_variables
|
|
|
|
termux_step_handle_buildarch
|
|
|
|
termux_step_start_build
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_extract_package
|
2017-01-10 09:14:35 +01:00
|
|
|
cd "$TERMUX_PKG_SRCDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_post_extract_package
|
2017-01-06 02:37:45 +01:00
|
|
|
termux_step_handle_hostbuild
|
|
|
|
termux_step_setup_toolchain
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_patch_package
|
2017-03-05 11:40:50 +01:00
|
|
|
termux_step_replace_guess_scripts
|
2017-05-11 01:01:20 +02:00
|
|
|
cd "$TERMUX_PKG_SRCDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_pre_configure
|
2017-01-06 02:37:45 +01:00
|
|
|
cd "$TERMUX_PKG_BUILDDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_configure
|
2017-01-06 02:37:45 +01:00
|
|
|
cd "$TERMUX_PKG_BUILDDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_post_configure
|
2017-01-06 02:37:45 +01:00
|
|
|
cd "$TERMUX_PKG_BUILDDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_make
|
2017-01-06 02:37:45 +01:00
|
|
|
cd "$TERMUX_PKG_BUILDDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_make_install
|
2017-01-06 02:37:45 +01:00
|
|
|
cd "$TERMUX_PKG_BUILDDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_post_make_install
|
2017-01-06 02:37:45 +01:00
|
|
|
cd "$TERMUX_PKG_MASSAGEDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_extract_into_massagedir
|
2017-01-06 02:37:45 +01:00
|
|
|
cd "$TERMUX_PKG_MASSAGEDIR"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_massage
|
2017-01-06 02:37:45 +01:00
|
|
|
cd "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
|
2015-06-13 01:03:31 +02:00
|
|
|
termux_step_post_massage
|
2017-01-06 02:37:45 +01:00
|
|
|
termux_step_create_datatar
|
|
|
|
termux_step_create_debfile
|
|
|
|
termux_step_finish_build
|