termux-packages/scripts/build/setup/termux_setup_cmake.sh

43 lines
1.6 KiB
Bash
Raw Normal View History

termux_setup_cmake() {
2021-11-28 11:34:41 +01:00
local TERMUX_CMAKE_MAJORVESION=3.22
2021-12-09 17:36:10 +01:00
local TERMUX_CMAKE_MINORVERSION=1
local TERMUX_CMAKE_VERSION=$TERMUX_CMAKE_MAJORVESION.$TERMUX_CMAKE_MINORVERSION
2021-05-02 10:21:58 +02:00
local TERMUX_CMAKE_TARNAME=cmake-${TERMUX_CMAKE_VERSION}-linux-x86_64.tar.gz
local TERMUX_CMAKE_TARFILE=$TERMUX_PKG_TMPDIR/$TERMUX_CMAKE_TARNAME
local TERMUX_CMAKE_FOLDER
if [ "${TERMUX_PACKAGES_OFFLINE-false}" = "true" ]; then
TERMUX_CMAKE_FOLDER=$TERMUX_SCRIPTDIR/build-tools/cmake-$TERMUX_CMAKE_VERSION
else
TERMUX_CMAKE_FOLDER=$TERMUX_COMMON_CACHEDIR/cmake-$TERMUX_CMAKE_VERSION
fi
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
if [ ! -d "$TERMUX_CMAKE_FOLDER" ]; then
termux_download https://cmake.org/files/v$TERMUX_CMAKE_MAJORVESION/$TERMUX_CMAKE_TARNAME \
"$TERMUX_CMAKE_TARFILE" \
2021-12-09 17:36:10 +01:00
73565c72355c6652e9db149249af36bcab44d9d478c5546fd926e69ad6b43640
2021-05-02 10:21:58 +02:00
rm -Rf "$TERMUX_PKG_TMPDIR/cmake-${TERMUX_CMAKE_VERSION}-linux-x86_64"
tar xf "$TERMUX_CMAKE_TARFILE" -C "$TERMUX_PKG_TMPDIR"
2021-05-02 10:21:58 +02:00
mv "$TERMUX_PKG_TMPDIR/cmake-${TERMUX_CMAKE_VERSION}-linux-x86_64" \
"$TERMUX_CMAKE_FOLDER"
fi
export PATH=$TERMUX_CMAKE_FOLDER/bin:$PATH
else
if [[ "$TERMUX_MAIN_PACKAGE_FORMAT" = "debian" && "$(dpkg-query -W -f '${db:Status-Status}\n' cmake 2>/dev/null)" != "installed" ]] ||
[[ "$TERMUX_MAIN_PACKAGE_FORMAT" = "pacman" && ! "$(pacman -Q cmake 2>/dev/null)" ]]; then
echo "Package 'cmake' is not installed."
echo "You can install it with"
echo
echo " pkg install cmake"
echo
echo " pacman -S cmake"
echo
exit 1
fi
fi
export CMAKE_INSTALL_ALWAYS=1
}