2019-02-26 20:36:42 +00:00
termux_step_setup_variables( ) {
: " ${ TERMUX_ARCH : = "aarch64" } " # arm, aarch64, i686 or x86_64.
2021-09-10 16:10:02 +00:00
: " ${ TERMUX_OUTPUT_DIR : = " ${ TERMUX_SCRIPTDIR } /output " } "
2021-08-21 14:50:05 +00:00
: " ${ TERMUX_DEBUG_BUILD : = "false" } "
2021-08-21 14:46:47 +00:00
: " ${ TERMUX_FORCE_BUILD : = "false" } "
2023-01-03 15:04:40 +00:00
: " ${ TERMUX_FORCE_BUILD_DEPENDENCIES : = "false" } "
2021-08-21 14:46:47 +00:00
: " ${ TERMUX_INSTALL_DEPS : = "false" } "
: " ${ TERMUX_MAKE_PROCESSES : = " $( nproc) " } "
2019-02-26 20:36:42 +00:00
: " ${ TERMUX_NO_CLEAN : = "false" } "
2021-08-21 14:46:47 +00:00
: " ${ TERMUX_PKG_API_LEVEL : = "24" } "
2021-08-21 16:08:57 +00:00
: " ${ TERMUX_CONTINUE_BUILD : = "false" } "
2019-02-26 20:36:42 +00:00
: " ${ TERMUX_QUIET_BUILD : = "false" } "
2023-09-01 18:28:13 +00:00
: " ${ TERMUX_WITHOUT_DEPVERSION_BINDING : = "false" } "
2019-02-26 20:36:42 +00:00
: " ${ TERMUX_SKIP_DEPCHECK : = "false" } "
2023-08-30 20:40:08 +00:00
: " ${ TERMUX_GLOBAL_LIBRARY : = "false" } "
2021-08-21 14:46:47 +00:00
: " ${ TERMUX_TOPDIR : = " $HOME /.termux-build " } "
2021-09-10 16:10:02 +00:00
: " ${ TERMUX_PACMAN_PACKAGE_COMPRESSION : = "xz" } "
2019-02-26 20:36:42 +00:00
2022-05-22 18:00:24 +00:00
if [ -z " ${ TERMUX_PACKAGE_FORMAT - } " ] ; then
if [ " $TERMUX_ON_DEVICE_BUILD " = "true" ] && [ -n " ${ TERMUX_APP_PACKAGE_MANAGER - } " ] ; then
TERMUX_PACKAGE_FORMAT = " $( [ " ${ TERMUX_APP_PACKAGE_MANAGER - } " = "apt" ] && echo "debian" || echo " ${ TERMUX_APP_PACKAGE_MANAGER - } " ) "
else
TERMUX_PACKAGE_FORMAT = "debian"
fi
fi
case " ${ TERMUX_PACKAGE_FORMAT - } " in
2022-08-10 06:52:16 +00:00
debian) export TERMUX_PACKAGE_MANAGER = "apt" ; ;
pacman) export TERMUX_PACKAGE_MANAGER = "pacman" ; ;
2022-05-22 18:00:24 +00:00
*) termux_error_exit " Unsupported package format \" ${ TERMUX_PACKAGE_FORMAT - } \". Only 'debian' and 'pacman' formats are supported " ; ;
esac
2023-08-30 20:40:08 +00:00
# Default package library base
if [ -z " ${ TERMUX_PACKAGE_LIBRARY - } " ] ; then
export TERMUX_PACKAGE_LIBRARY = "bionic"
fi
if [ " $TERMUX_PACKAGE_LIBRARY " = "glibc" ] ; then
export TERMUX_PREFIX = " $TERMUX_PREFIX /glibc "
if ! package__is_package_name_have_glibc_prefix " $TERMUX_PKG_NAME " ; then
2023-09-09 14:22:47 +00:00
TERMUX_PKG_NAME = " $( package__add_prefix_glibc_to_package_name ${ TERMUX_PKG_NAME } ) "
2023-08-30 20:40:08 +00:00
fi
fi
2019-08-12 21:16:07 +00:00
if [ " $TERMUX_ON_DEVICE_BUILD " = "true" ] ; then
2019-08-06 12:39:42 +00:00
# For on-device builds cross-compiling is not supported so we can
# store information about built packages under $TERMUX_TOPDIR.
TERMUX_BUILT_PACKAGES_DIRECTORY = " $TERMUX_TOPDIR /.built-packages "
2019-08-09 22:18:42 +00:00
TERMUX_NO_CLEAN = "true"
2019-08-09 22:23:17 +00:00
2023-08-30 20:40:08 +00:00
if [ " $TERMUX_PACKAGE_LIBRARY " = "bionic" ] ; then
# On-device builds without termux-exec are unsupported.
if ! grep -q " ${ TERMUX_PREFIX } /lib/libtermux-exec.so " <<< " ${ LD_PRELOAD -x } " ; then
termux_error_exit "On-device builds without termux-exec are not supported."
fi
2019-08-09 23:01:22 +00:00
fi
2019-08-06 12:39:42 +00:00
else
TERMUX_BUILT_PACKAGES_DIRECTORY = "/data/data/.built-packages"
fi
2020-12-20 13:16:34 +00:00
# TERMUX_PKG_MAINTAINER should be explicitly set in build.sh of the package.
: " ${ TERMUX_PKG_MAINTAINER : = "default" } "
2019-02-26 20:36:42 +00:00
if [ "x86_64" = " $TERMUX_ARCH " ] || [ "aarch64" = " $TERMUX_ARCH " ] ; then
TERMUX_ARCH_BITS = 64
else
TERMUX_ARCH_BITS = 32
fi
2023-08-30 20:40:08 +00:00
if [ " $TERMUX_PACKAGE_LIBRARY " = "bionic" ] ; then
TERMUX_HOST_PLATFORM = " ${ TERMUX_ARCH } -linux-android "
else
TERMUX_HOST_PLATFORM = " ${ TERMUX_ARCH } -linux-gnu "
2019-02-26 20:36:42 +00:00
fi
2023-08-30 20:40:08 +00:00
if [ " $TERMUX_ARCH " = "arm" ] ; then
TERMUX_HOST_PLATFORM = " ${ TERMUX_HOST_PLATFORM } eabi "
if [ " $TERMUX_PACKAGE_LIBRARY " = "glibc" ] ; then
TERMUX_HOST_PLATFORM = " ${ TERMUX_HOST_PLATFORM } hf "
fi
fi
if [ " $TERMUX_PACKAGE_LIBRARY " = "bionic" ] ; then
if [ " $TERMUX_ON_DEVICE_BUILD " = "false" ] && [ ! -d " $NDK " ] ; then
termux_error_exit 'NDK not pointing at a directory!'
fi
2019-08-06 12:39:42 +00:00
2023-08-30 20:40:08 +00:00
if [ " $TERMUX_ON_DEVICE_BUILD " = "false" ] && ! grep -s -q " Pkg.Revision = $TERMUX_NDK_VERSION_NUM " " $NDK /source.properties " ; then
termux_error_exit " Wrong NDK version - we need $TERMUX_NDK_VERSION "
fi
elif [ " $TERMUX_PACKAGE_LIBRARY " = "glibc" ] ; then
if [ " $TERMUX_ON_DEVICE_BUILD " = "true" ] ; then
if [ -n " ${ LD_PRELOAD - } " ] ; then
unset LD_PRELOAD
fi
2023-09-13 12:18:12 +00:00
if ! $( echo " $PATH " | grep -q " ^ $TERMUX_PREFIX /bin " ) ; then
2023-08-30 20:40:08 +00:00
if [ -d " ${ TERMUX_PREFIX } /bin " ] ; then
export PATH = " ${ TERMUX_PREFIX } /bin: ${ PATH } "
else
termux_error_exit "Glibc components are not installed, run './scripts/setup-termux-glibc.sh'"
fi
fi
else
2023-09-13 12:18:12 +00:00
if [ ! -d " ${ CGCT_DIR } / ${ TERMUX_ARCH } /bin " ] ; then
termux_error_exit "The cgct tools were not found, run './scripts/setup-cgct.sh'"
2023-08-30 20:40:08 +00:00
fi
fi
2019-02-26 20:36:42 +00:00
fi
# The build tuple that may be given to --build configure flag:
TERMUX_BUILD_TUPLE = $( sh " $TERMUX_SCRIPTDIR /scripts/config.guess " )
# We do not put all of build-tools/$TERMUX_ANDROID_BUILD_TOOLS_VERSION/ into PATH
# to avoid stuff like arm-linux-androideabi-ld there to conflict with ones from
# the standalone toolchain.
TERMUX_D8 = $ANDROID_HOME /build-tools/$TERMUX_ANDROID_BUILD_TOOLS_VERSION /d8
TERMUX_COMMON_CACHEDIR = " $TERMUX_TOPDIR /_cache "
TERMUX_ELF_CLEANER = $TERMUX_COMMON_CACHEDIR /termux-elf-cleaner
export prefix = ${ TERMUX_PREFIX }
export PREFIX = ${ TERMUX_PREFIX }
2022-12-21 20:36:04 +00:00
# Explicitly export in case the default was set.
export TERMUX_ARCH = ${ TERMUX_ARCH }
2020-10-22 21:27:56 +00:00
if [ " ${ TERMUX_PACKAGES_OFFLINE -false } " = "true" ] ; then
# In "offline" mode store/pick cache from directory with
# build.sh script.
TERMUX_PKG_CACHEDIR = $TERMUX_PKG_BUILDER_DIR /cache
else
TERMUX_PKG_CACHEDIR = $TERMUX_TOPDIR /$TERMUX_PKG_NAME /cache
fi
2021-08-21 14:46:47 +00:00
TERMUX_CMAKE_BUILD = Ninja # Which cmake generator to use
2023-03-15 21:55:42 +00:00
TERMUX_PKG_ANTI_BUILD_DEPENDS = "" # This cannot be used to "resolve" circular dependencies
2021-08-21 14:46:47 +00:00
TERMUX_PKG_BREAKS = "" # https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
2019-02-26 20:36:42 +00:00
TERMUX_PKG_BUILDDIR = $TERMUX_TOPDIR /$TERMUX_PKG_NAME /build
2021-08-21 14:46:47 +00:00
TERMUX_PKG_BUILD_DEPENDS = ""
2019-08-12 15:28:41 +00:00
TERMUX_PKG_BUILD_IN_SRC = false
2021-08-21 14:46:47 +00:00
TERMUX_PKG_CONFFILES = ""
TERMUX_PKG_CONFLICTS = "" # https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
2019-02-26 20:36:42 +00:00
TERMUX_PKG_DEPENDS = ""
TERMUX_PKG_DESCRIPTION = "FIXME:Add description"
2022-10-21 23:14:51 +00:00
TERMUX_PKG_DISABLE_GIR = false # termux_setup_gir
2023-03-28 06:09:53 +00:00
TERMUX_PKG_ENABLE_CLANG16_PORTING = true
2019-08-12 15:28:41 +00:00
TERMUX_PKG_ESSENTIAL = false
2021-08-21 14:46:47 +00:00
TERMUX_PKG_EXTRA_CONFIGURE_ARGS = ""
TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS = ""
TERMUX_PKG_EXTRA_MAKE_ARGS = ""
2024-04-27 04:09:32 +00:00
TERMUX_PKG_EXTRA_UNDEF_SYMBOLS_TO_CHECK = "" # space-separated undefined symbols to check in termux_step_massaging
2019-08-12 15:28:41 +00:00
TERMUX_PKG_FORCE_CMAKE = false # if the package has autotools as well as cmake, then set this to prefer cmake
2021-08-21 14:46:47 +00:00
TERMUX_PKG_GIT_BRANCH = "" # branch defaults to 'v$TERMUX_PKG_VERSION' unless this variable is defined
2023-03-08 12:35:57 +00:00
TERMUX_PKG_GO_USE_OLDER = false # set to true to use the older supported release of Go.
2019-08-12 15:28:41 +00:00
TERMUX_PKG_HAS_DEBUG = true # set to false if debug build doesn't exist or doesn't work, for example for python based packages
2021-08-21 14:46:47 +00:00
TERMUX_PKG_HOMEPAGE = ""
TERMUX_PKG_HOSTBUILD = false # Set if a host build should be done in TERMUX_PKG_HOSTBUILD_DIR:
TERMUX_PKG_HOSTBUILD_DIR = $TERMUX_TOPDIR /$TERMUX_PKG_NAME /host-build
TERMUX_PKG_LICENSE_FILE = "" # Relative path from $TERMUX_PKG_SRCDIR to LICENSE file. It is installed to $TERMUX_PREFIX/share/$TERMUX_PKG_NAME.
TERMUX_PKG_MASSAGEDIR = $TERMUX_TOPDIR /$TERMUX_PKG_NAME /massage
2019-08-14 17:29:58 +00:00
TERMUX_PKG_METAPACKAGE = false
2020-10-01 16:33:58 +00:00
TERMUX_PKG_NO_ELF_CLEANER = false # set this to true to disable running of termux-elf-cleaner on built binaries
2023-01-31 02:51:30 +00:00
TERMUX_PKG_NO_SHEBANG_FIX = false # if true, skip fixing shebang accordingly to TERMUX_PREFIX
2023-10-27 10:24:00 +00:00
TERMUX_PKG_NO_SHEBANG_FIX_FILES = "" # files to be excluded from fixing shebang
2023-01-31 02:51:30 +00:00
TERMUX_PKG_NO_STRIP = false # set this to true to disable stripping binaries
2021-08-21 14:46:47 +00:00
TERMUX_PKG_NO_STATICSPLIT = false
2022-03-07 10:33:00 +00:00
TERMUX_PKG_STATICSPLIT_EXTRA_PATTERNS = ""
2021-08-21 14:46:47 +00:00
TERMUX_PKG_PACKAGEDIR = $TERMUX_TOPDIR /$TERMUX_PKG_NAME /package
TERMUX_PKG_PLATFORM_INDEPENDENT = false
TERMUX_PKG_PRE_DEPENDS = ""
TERMUX_PKG_PROVIDES = "" #https://www.debian.org/doc/debian-policy/#virtual-packages-provides
TERMUX_PKG_RECOMMENDS = "" # https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
TERMUX_PKG_REPLACES = ""
TERMUX_PKG_REVISION = "0" # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
TERMUX_PKG_RM_AFTER_INSTALL = ""
TERMUX_PKG_SHA256 = ""
TERMUX_PKG_SRCDIR = $TERMUX_TOPDIR /$TERMUX_PKG_NAME /src
TERMUX_PKG_SUGGESTS = ""
TERMUX_PKG_TMPDIR = $TERMUX_TOPDIR /$TERMUX_PKG_NAME /tmp
2024-04-27 04:09:32 +00:00
TERMUX_PKG_UNDEF_SYMBOLS_FILES = "" # maintainer acknowledges these files have undefined symbols will not result in broken packages, eg: all, *.elf, ./path/to/file. "error" to always print results as errors
2021-08-21 14:46:47 +00:00
TERMUX_PKG_SERVICE_SCRIPT = ( ) # Fill with entries like: ("daemon name" 'script to execute'). Script is echoed with -e so can contain \n for multiple lines
2021-09-28 09:48:55 +00:00
TERMUX_PKG_GROUPS = "" # https://wiki.archlinux.org/title/Pacman#Installing_package_groups
2023-01-03 15:04:40 +00:00
TERMUX_PKG_ON_DEVICE_BUILD_NOT_SUPPORTED = false # if the package does not support compilation on a device, then this package should not be compiled on devices
2023-01-12 12:08:41 +00:00
TERMUX_PKG_SETUP_PYTHON = false # setting python to compile a package
2024-04-13 11:55:19 +00:00
TERMUX_PYTHON_VERSION = $( . $TERMUX_SCRIPTDIR /$( test " ${ TERMUX_PACKAGE_LIBRARY } " = "bionic" && echo "packages" || echo "gpkg" ) /python/build.sh; echo $_MAJOR_VERSION ) # get the latest version of python
2023-01-12 12:08:41 +00:00
TERMUX_PKG_PYTHON_TARGET_DEPS = "" # python modules to be installed via pip3
TERMUX_PKG_PYTHON_BUILD_DEPS = "" # python modules to be installed via build-pip
TERMUX_PKG_PYTHON_COMMON_DEPS = "" # python modules to be installed via pip3 or build-pip
2023-03-24 08:11:45 +00:00
TERMUX_PYTHON_CROSSENV_PREFIX = " $TERMUX_TOPDIR /python-crossenv-prefix- $TERMUX_ARCH " # python modules dependency location (only used in non-devices)
2023-01-18 07:04:28 +00:00
TERMUX_PYTHON_HOME = $TERMUX_PREFIX /lib/python${ TERMUX_PYTHON_VERSION } # location of python libraries
2023-12-14 10:54:16 +00:00
TERMUX_PKG_MESON_NATIVE = false
2024-03-04 20:39:22 +00:00
TERMUX_PKG_CMAKE_CROSSCOMPILING = true
2019-02-26 20:36:42 +00:00
unset CFLAGS CPPFLAGS LDFLAGS CXXFLAGS
2023-05-07 16:10:03 +00:00
unset TERMUX_MESON_ENABLE_SOVERSION # setenv to enable SOVERSION suffix for shared libs built with Meson
2019-02-26 20:36:42 +00:00
}