termux-packages/scripts/build/termux_extract_dep_info.sh
Henrik Grimler 10fdf172d5 build-package: download dependencies recursively when fast-building
Use scripts/buildorder.py with a new -i flag to get all dependencies
(including subpackages). The script now also spits out both package
name and package dir, to make it easier to build packages from another
repo.
2019-03-03 01:40:22 +02:00

42 lines
1.3 KiB
Bash
Executable File

termux_extract_dep_info() {
PKG=$1
PKG_DIR=$2
if [ "$PKG" != "$(basename ${PKG_DIR})" ]; then
# We are dealing with a subpackage
TERMUX_ARCH=$(
# set TERMUX_SUBPKG_PLATFORM_INDEPENDENT to parent package's value and override if needed
TERMUX_PKG_PLATFORM_INDEPENDENT=""
source ${PKG_DIR}/build.sh
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=$TERMUX_PKG_PLATFORM_INDEPENDENT
source ${PKG_DIR}/${PKG}.subpackage.sh
if [ "$TERMUX_SUBPKG_PLATFORM_INDEPENDENT" = yes ]; then
echo all
else
echo $TERMUX_ARCH
fi
)
elif [ "${PKG/-dev/}-dev" == "${PKG}" ]; then
# dev package
PKG=${PKG/-dev/}
fi
(
# Reset TERMUX_PKG_PLATFORM_INDEPENDENT and TERMUX_PKG_REVISION since these aren't
# mandatory in a build.sh. Otherwise these will equal the main package's values for
# deps that should have the default values
TERMUX_PKG_PLATFORM_INDEPENDENT=""
TERMUX_PKG_REVISION="0"
source ${PKG_DIR}/build.sh
if [ "$TERMUX_PKG_PLATFORM_INDEPENDENT" = yes ]; then TERMUX_ARCH=all; fi
if [ "$TERMUX_PKG_REVISION" != "0" ] || [ "$TERMUX_PKG_VERSION" != "${TERMUX_PKG_VERSION/-/}" ]; then
TERMUX_PKG_VERSION+="-$TERMUX_PKG_REVISION"
fi
echo ${TERMUX_ARCH} ${TERMUX_PKG_VERSION}
)
}
# Make script standalone executable as well as sourceable
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
termux_extract_dep_info "$@"
fi