build-package.sh: better support for metapackages

This commit is contained in:
Leonid Pliushch 2019-08-14 20:29:58 +03:00
parent e803bdd3ef
commit 5493481c5c
13 changed files with 29 additions and 5 deletions

View File

@ -1,4 +1,6 @@
termux_step_configure() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
if [ "$TERMUX_PKG_FORCE_CMAKE" = "false" ] && [ -f "$TERMUX_PKG_SRCDIR/configure" ]; then
termux_step_configure_autotools
elif [ -f "$TERMUX_PKG_SRCDIR/CMakeLists.txt" ]; then

View File

@ -8,7 +8,7 @@ termux_step_create_datatar() {
termux_error_exit "Package contains hard links: $HARDLINKS"
fi
if [ "${TERMUX_PKG_METAPACKAGE-false}" = "true" ]; then
if [ "$TERMUX_PKG_METAPACKAGE" = "true" ]; then
# Metapackage doesn't have data inside.
rm -rf data
else

View File

@ -1,5 +1,5 @@
termux_step_extract_package() {
if [ -z "${TERMUX_PKG_SRCURL:=""}" ] || [ "${TERMUX_PKG_SKIP_SRC_EXTRACT-false}" = "true" ]; then
if [ -z "${TERMUX_PKG_SRCURL:=""}" ] || [ "${TERMUX_PKG_SKIP_SRC_EXTRACT-false}" = "true" ] || [ "$TERMUX_PKG_METAPACKAGE" = "true" ]; then
mkdir -p "$TERMUX_PKG_SRCDIR"
return
fi

View File

@ -1,5 +1,6 @@
termux_step_handle_hostbuild() {
if [ "$TERMUX_PKG_HOSTBUILD" = "false" ]; then return; fi
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
[ "$TERMUX_PKG_HOSTBUILD" = "false" ] && return
cd "$TERMUX_PKG_SRCDIR"
for patch in $TERMUX_PKG_BUILDER_DIR/*.patch.beforehostbuild; do

View File

@ -1,4 +1,6 @@
termux_step_install_license() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
mkdir -p "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME"
if [ ! "${TERMUX_PKG_LICENSE_FILE}" = "" ]; then

View File

@ -1,4 +1,6 @@
termux_step_make() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
local QUIET_BUILD=
if [ "$TERMUX_QUIET_BUILD" = true ]; then
QUIET_BUILD="-s"

View File

@ -1,4 +1,6 @@
termux_step_make_install() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
if test -f build.ninja; then
ninja -w dupbuild=warn -j $TERMUX_MAKE_PROCESSES install
elif ls ./*akefile &> /dev/null || [ -n "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then

View File

@ -1,4 +1,6 @@
termux_step_massage() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
cd "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
# Remove lib/charset.alias which is installed by gettext-using packages:

View File

@ -1,4 +1,6 @@
termux_step_patch_package() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
cd "$TERMUX_PKG_SRCDIR"
local DEBUG_PATCHES=""
if [ "$TERMUX_DEBUG" = "true" ]; then

View File

@ -1,4 +1,6 @@
termux_step_replace_guess_scripts() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
cd "$TERMUX_PKG_SRCDIR"
find . -name config.sub -exec chmod u+w '{}' \; -exec cp "$TERMUX_SCRIPTDIR/scripts/config.sub" '{}' \;
find . -name config.guess -exec chmod u+w '{}' \; -exec cp "$TERMUX_SCRIPTDIR/scripts/config.guess" '{}' \;

View File

@ -1,4 +1,6 @@
termux_step_setup_toolchain() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
export CFLAGS=""
export LDFLAGS="-L${TERMUX_PREFIX}/lib"

View File

@ -131,6 +131,7 @@ termux_step_setup_variables() {
TERMUX_PKG_FORCE_CMAKE=false # if the package has autotools as well as cmake, then set this to prefer cmake
TERMUX_CMAKE_BUILD=Ninja # Which cmake generator to use
TERMUX_PKG_HAS_DEBUG=true # set to false if debug build doesn't exist or doesn't work, for example for python based packages
TERMUX_PKG_METAPACKAGE=false
unset CFLAGS CPPFLAGS LDFLAGS CXXFLAGS
}

View File

@ -2,6 +2,12 @@ termux_step_start_build() {
# shellcheck source=/dev/null
source "$TERMUX_PKG_BUILDER_SCRIPT"
if [ "$TERMUX_PKG_METAPACKAGE" = "true" ]; then
# Metapackage has no sources and therefore platform-independent.
TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true
fi
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_COMMON_CACHEDIR/android-r${TERMUX_NDK_VERSION}-api-${TERMUX_PKG_API_LEVEL}"
# Bump the below version if a change is made in toolchain setup to ensure
# that everyone gets an updated toolchain:
@ -41,7 +47,7 @@ termux_step_start_build() {
fi
fi
if [ "$TERMUX_SKIP_DEPCHECK" = false ] && [ "$TERMUX_INSTALL_DEPS" = true ]; then
if [ "$TERMUX_SKIP_DEPCHECK" = false ] && [ "$TERMUX_INSTALL_DEPS" = true ] && [ "$TERMUX_PKG_METAPACKAGE" = "false" ]; then
# Download repo files
termux_get_repo_files
@ -87,7 +93,7 @@ termux_step_start_build() {
mkdir -p $TERMUX_BUILT_PACKAGES_DIRECTORY
echo "$DEP_VERSION" > "$TERMUX_BUILT_PACKAGES_DIRECTORY/$PKG"
done<<<$(./scripts/buildorder.py -i "$TERMUX_PKG_BUILDER_DIR" $TERMUX_PACKAGES_DIRECTORIES || echo "ERROR")
elif [ "$TERMUX_SKIP_DEPCHECK" = false ] && [ "$TERMUX_INSTALL_DEPS" = false ]; then
elif [ "$TERMUX_SKIP_DEPCHECK" = false ] && [ "$TERMUX_INSTALL_DEPS" = false ] && [ "$TERMUX_PKG_METAPACKAGE" = "false" ]; then
# Build dependencies
while read PKG PKG_DIR; do
if [ -z $PKG ]; then