Browse Source

build-package.sh: use absolute paths when sourcing parts from scripts/build/

+ some fixes for shellcheck.
emacs-27
Leonid Plyushch 5 years ago
parent
commit
147d317e26
No known key found for this signature in database GPG Key ID: 45F2964132545795
  1. 99
      build-package.sh

99
build-package.sh

@ -34,49 +34,64 @@ fi
: "${TERMUX_BUILD_IGNORE_LOCK:=false}" : "${TERMUX_BUILD_IGNORE_LOCK:=false}"
# Utility function to log an error message and exit with an error code. # Utility function to log an error message and exit with an error code.
source scripts/build/termux_error_exit.sh # shellcheck source=scripts/build/termux_error_exit.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_error_exit.sh"
# Utility function to download a resource with an expected checksum. # Utility function to download a resource with an expected checksum.
source scripts/build/termux_download.sh # shellcheck source=scripts/build/termux_download.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_download.sh"
# Utility function for golang-using packages to setup a go toolchain. # Utility function for golang-using packages to setup a go toolchain.
source scripts/build/setup/termux_setup_golang.sh # shellcheck source=scripts/build/setup/termux_setup_golang.sh
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_golang.sh"
# Utility function for rust-using packages to setup a rust toolchain. # Utility function for rust-using packages to setup a rust toolchain.
source scripts/build/setup/termux_setup_rust.sh # shellcheck source=scripts/build/setup/termux_setup_rust.sh
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_rust.sh"
# Utility function to setup a current ninja build system. # Utility function to setup a current ninja build system.
source scripts/build/setup/termux_setup_ninja.sh # shellcheck source=scripts/build/setup/termux_setup_ninja.sh
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_ninja.sh"
# Utility function to setup a current meson build system. # Utility function to setup a current meson build system.
source scripts/build/setup/termux_setup_meson.sh # shellcheck source=scripts/build/setup/termux_setup_meson.sh
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_meson.sh"
# Utility function to setup a current cmake build system # Utility function to setup a current cmake build system
source scripts/build/setup/termux_setup_cmake.sh # shellcheck source=scripts/build/setup/termux_setup_cmake.sh
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_cmake.sh"
# Utility function to setup protobuf: # Utility function to setup protobuf:
source scripts/build/setup/termux_setup_protobuf.sh # shellcheck source=scripts/build/setup/termux_setup_protobuf.sh
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_protobuf.sh"
# Setup variables used by the build. Not to be overridden by packages. # Setup variables used by the build. Not to be overridden by packages.
source scripts/build/termux_step_setup_variables.sh # shellcheck source=scripts/build/termux_step_setup_variables.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_setup_variables.sh"
# Save away and restore build setups which may change between builds. # Save away and restore build setups which may change between builds.
source scripts/build/termux_step_handle_buildarch.sh # shellcheck source=scripts/build/termux_step_handle_buildarch.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_handle_buildarch.sh"
# Function to get TERMUX_PKG_VERSION from build.sh # Function to get TERMUX_PKG_VERSION from build.sh
source scripts/build/termux_extract_dep_info.sh # shellcheck source=scripts/build/termux_extract_dep_info.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_extract_dep_info.sh"
# Function that downloads a .deb (using the termux_download function) # Function that downloads a .deb (using the termux_download function)
source scripts/build/termux_download_deb.sh # shellcheck source=scripts/build/termux_download_deb.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_download_deb.sh"
# Script to download InRelease, verify it's signature and then download Packages.xz by hash # Script to download InRelease, verify it's signature and then download Packages.xz by hash
source scripts/build/termux_get_repo_files.sh # shellcheck source=scripts/build/termux_get_repo_files.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_get_repo_files.sh"
# Source the package build script and start building. No to be overridden by packages. # Source the package build script and start building. No to be overridden by packages.
source scripts/build/termux_step_start_build.sh # shellcheck source=scripts/build/termux_step_start_build.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_start_build.sh"
# Run just after sourcing $TERMUX_PKG_BUILDER_SCRIPT. May be overridden by packages. # Run just after sourcing $TERMUX_PKG_BUILDER_SCRIPT. May be overridden by packages.
source scripts/build/termux_step_extract_package.sh # shellcheck source=scripts/build/termux_step_extract_package.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_extract_package.sh"
# Hook for packages to act just after the package has been extracted. # Hook for packages to act just after the package has been extracted.
# Invoked in $TERMUX_PKG_SRCDIR. # Invoked in $TERMUX_PKG_SRCDIR.
@ -85,20 +100,25 @@ termux_step_post_extract_package() {
} }
# Optional host build. Not to be overridden by packages. # Optional host build. Not to be overridden by packages.
source scripts/build/termux_step_handle_hostbuild.sh # shellcheck source=scripts/build/termux_step_handle_hostbuild.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_handle_hostbuild.sh"
# Perform a host build. Will be called in $TERMUX_PKG_HOSTBUILD_DIR. # Perform a host build. Will be called in $TERMUX_PKG_HOSTBUILD_DIR.
# After termux_step_post_extract_package() and before termux_step_patch_package() # After termux_step_post_extract_package() and before termux_step_patch_package()
source scripts/build/termux_step_host_build.sh # shellcheck source=scripts/build/termux_step_host_build.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_host_build.sh"
# Setup a standalone Android NDK toolchain. Not to be overridden by packages. # Setup a standalone Android NDK toolchain. Not to be overridden by packages.
source scripts/build/termux_step_setup_toolchain.sh # shellcheck source=scripts/build/termux_step_setup_toolchain.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_setup_toolchain.sh"
# Apply all *.patch files for the package. Not to be overridden by packages. # Apply all *.patch files for the package. Not to be overridden by packages.
source scripts/build/termux_step_patch_package.sh # shellcheck source=scripts/build/termux_step_patch_package.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_patch_package.sh"
# Replace autotools build-aux/config.{sub,guess} with ours to add android targets. # Replace autotools build-aux/config.{sub,guess} with ours to add android targets.
source scripts/build/termux_step_replace_guess_scripts.sh # shellcheck source=scripts/build/termux_step_replace_guess_scripts.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_replace_guess_scripts.sh"
# For package scripts to override. Called in $TERMUX_PKG_BUILDDIR. # For package scripts to override. Called in $TERMUX_PKG_BUILDDIR.
termux_step_pre_configure() { termux_step_pre_configure() {
@ -106,16 +126,20 @@ termux_step_pre_configure() {
} }
# Setup configure args and run $TERMUX_PKG_SRCDIR/configure. This function is called from termux_step_configure # 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 # shellcheck source=scripts/build/configure/termux_step_configure_autotools.sh
source "$TERMUX_SCRIPTDIR/scripts/build/configure/termux_step_configure_autotools.sh"
# Setup configure args and run cmake. This function is called from termux_step_configure # Setup configure args and run cmake. This function is called from termux_step_configure
source scripts/build/configure/termux_step_configure_cmake.sh # shellcheck source=scripts/build/configure/termux_step_configure_cmake.sh
source "$TERMUX_SCRIPTDIR/scripts/build/configure/termux_step_configure_cmake.sh"
# Setup configure args and run meson. This function is called from termux_step_configure # Setup configure args and run meson. This function is called from termux_step_configure
source scripts/build/configure/termux_step_configure_meson.sh # shellcheck source=scripts/build/configure/termux_step_configure_meson.sh
source "$TERMUX_SCRIPTDIR/scripts/build/configure/termux_step_configure_meson.sh"
# Configure the package # Configure the package
source scripts/build/configure/termux_step_configure.sh # shellcheck source=scripts/build/configure/termux_step_configure.sh
source "$TERMUX_SCRIPTDIR/scripts/build/configure/termux_step_configure.sh"
# Hook for packages after configure step # Hook for packages after configure step
termux_step_post_configure() { termux_step_post_configure() {
@ -123,10 +147,12 @@ termux_step_post_configure() {
} }
# Make package, either with ninja or make # Make package, either with ninja or make
source scripts/build/termux_step_make.sh # shellcheck source=scripts/build/termux_step_make.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_make.sh"
# Make install, either with ninja, make of cargo # Make install, either with ninja, make of cargo
source scripts/build/termux_step_make_install.sh # shellcheck source=scripts/build/termux_step_make_install.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_make_install.sh"
# Hook function for package scripts to override. # Hook function for package scripts to override.
termux_step_post_make_install() { termux_step_post_make_install() {
@ -134,16 +160,20 @@ termux_step_post_make_install() {
} }
# Link/copy the LICENSE for the package to $TERMUX_PREFIX/share/$TERMUX_PKG_NAME/ # Link/copy the LICENSE for the package to $TERMUX_PREFIX/share/$TERMUX_PKG_NAME/
source scripts/build/termux_step_install_license.sh # shellcheck source=scripts/build/termux_step_install_license.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_install_license.sh"
# Function to cp (through tar) installed files to massage dir # Function to cp (through tar) installed files to massage dir
source scripts/build/termux_step_extract_into_massagedir.sh # shellcheck source=scripts/build/termux_step_extract_into_massagedir.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_extract_into_massagedir.sh"
# Create all subpackages. Run from termux_step_massage # Create all subpackages. Run from termux_step_massage
source scripts/build/termux_create_subpackages.sh # shellcheck source=scripts/build/termux_create_subpackages.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_create_subpackages.sh"
# Function to run various cleanup/fixes # Function to run various cleanup/fixes
source scripts/build/termux_step_massage.sh # shellcheck source=scripts/build/termux_step_massage.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_massage.sh"
# Hook for packages after massage step # Hook for packages after massage step
termux_step_post_massage() { termux_step_post_massage() {
@ -151,7 +181,8 @@ termux_step_post_massage() {
} }
# Create data.tar.gz with files to package. Not to be overridden by package scripts. # Create data.tar.gz with files to package. Not to be overridden by package scripts.
source scripts/build/termux_step_create_datatar.sh # shellcheck source=scripts/build/termux_step_create_datatar.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_create_datatar.sh"
# Hook function to create {pre,post}install, {pre,post}rm-scripts and similar # Hook function to create {pre,post}install, {pre,post}rm-scripts and similar
termux_step_create_debscripts() { termux_step_create_debscripts() {
@ -159,10 +190,12 @@ termux_step_create_debscripts() {
} }
# Create the build deb file. Not to be overridden by package scripts. # Create the build deb file. Not to be overridden by package scripts.
source scripts/build/termux_step_create_debfile.sh # shellcheck source=scripts/build/termux_step_create_debfile.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_create_debfile.sh"
# Finish the build. Not to be overridden by package scripts. # Finish the build. Not to be overridden by package scripts.
source scripts/build/termux_step_finish_build.sh # shellcheck source=scripts/build/termux_step_finish_build.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_finish_build.sh"
################################################################################ ################################################################################

Loading…
Cancel
Save