2019-02-26 21:34:02 +01:00
|
|
|
termux_setup_ninja() {
|
2020-12-07 23:32:01 +01:00
|
|
|
local NINJA_VERSION=1.10.2
|
2020-10-22 21:45:33 +02:00
|
|
|
local NINJA_FOLDER
|
|
|
|
|
|
|
|
if [ "${TERMUX_PACKAGES_OFFLINE-false}" = "true" ]; then
|
|
|
|
NINJA_FOLDER=${TERMUX_SCRIPTDIR}/build-tools/ninja-${NINJA_VERSION}
|
|
|
|
else
|
|
|
|
NINJA_FOLDER=${TERMUX_COMMON_CACHEDIR}/ninja-$NINJA_VERSION
|
|
|
|
fi
|
2019-08-06 14:39:42 +02:00
|
|
|
|
2019-08-12 23:16:07 +02:00
|
|
|
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
|
2019-08-06 14:39:42 +02:00
|
|
|
if [ ! -x "$NINJA_FOLDER/ninja" ]; then
|
|
|
|
mkdir -p "$NINJA_FOLDER"
|
|
|
|
local NINJA_ZIP_FILE=$TERMUX_PKG_TMPDIR/ninja-$NINJA_VERSION.zip
|
|
|
|
termux_download https://github.com/ninja-build/ninja/releases/download/v$NINJA_VERSION/ninja-linux.zip \
|
|
|
|
"$NINJA_ZIP_FILE" \
|
2020-12-07 23:32:01 +01:00
|
|
|
763464859c7ef2ea3a0a10f4df40d2025d3bb9438fcb1228404640410c0ec22d
|
2019-08-06 14:39:42 +02:00
|
|
|
unzip "$NINJA_ZIP_FILE" -d "$NINJA_FOLDER"
|
|
|
|
chmod 755 $NINJA_FOLDER/ninja
|
|
|
|
fi
|
|
|
|
export PATH=$NINJA_FOLDER:$PATH
|
|
|
|
else
|
2019-08-11 11:07:03 +02:00
|
|
|
local NINJA_PKG_VERSION=$(bash -c ". $TERMUX_SCRIPTDIR/packages/ninja/build.sh; echo \$TERMUX_PKG_VERSION")
|
|
|
|
if ([ ! -e "$TERMUX_BUILT_PACKAGES_DIRECTORY/ninja" ] ||
|
|
|
|
[ "$(cat "$TERMUX_BUILT_PACKAGES_DIRECTORY/ninja")" != "$NINJA_PKG_VERSION" ]) &&
|
2022-02-02 15:45:36 +01:00
|
|
|
([[ "$TERMUX_MAIN_PACKAGE_FORMAT" = "debian" && "$(dpkg-query -W -f '${db:Status-Status}\n' ninja 2>/dev/null)" != "installed" ]] ||
|
|
|
|
[[ "$TERMUX_MAIN_PACKAGE_FORMAT" = "pacman" && ! "$(pacman -Q ninja 2>/dev/null)" ]]); then
|
2019-08-06 14:39:42 +02:00
|
|
|
echo "Package 'ninja' is not installed."
|
|
|
|
echo "You can install it with"
|
|
|
|
echo
|
|
|
|
echo " pkg install ninja"
|
|
|
|
echo
|
2022-01-14 14:16:37 +01:00
|
|
|
echo " pacman -S ninja"
|
|
|
|
echo
|
2019-08-06 14:39:42 +02:00
|
|
|
echo "or build it from source with"
|
|
|
|
echo
|
|
|
|
echo " ./build-package.sh ninja"
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-02-26 21:34:02 +01:00
|
|
|
fi
|
|
|
|
}
|