2022-03-15 20:39:21 +01:00
|
|
|
# shellcheck shell=bash
|
2022-03-12 05:42:33 +01:00
|
|
|
# Utility script to setup jailbreak-cabal script. It is used by haskell build system to remove version
|
|
|
|
# constraints in cabal files.
|
|
|
|
termux_setup_jailbreak_cabal() {
|
2022-03-13 17:32:51 +01:00
|
|
|
if [[ "${TERMUX_ON_DEVICE_BUILD}" == "false" ]]; then
|
2022-03-12 05:42:33 +01:00
|
|
|
local TERMUX_JAILBREAK_VERSION=1.3.5
|
2022-03-10 19:08:53 +01:00
|
|
|
local TERMUX_JAILBREAK_TAR="${TERMUX_COMMON_CACHEDIR}/jailbreak-cabal-${TERMUX_JAILBREAK_VERSION}.tar.gz"
|
2022-03-12 05:42:33 +01:00
|
|
|
local TERMUX_JAILBREAK_RUNTIME_FOLDER
|
|
|
|
|
2022-03-13 17:32:51 +01:00
|
|
|
if [[ "${TERMUX_PACKAGES_OFFLINE-false}" == "true" ]]; then
|
2022-03-12 05:42:33 +01:00
|
|
|
TERMUX_JAILBREAK_RUNTIME_FOLDER="${TERMUX_SCRIPTDIR}/build-tools/jailbreak-cabal-${TERMUX_JAILBREAK_VERSION}-runtime"
|
|
|
|
else
|
|
|
|
TERMUX_JAILBREAK_RUNTIME_FOLDER="${TERMUX_COMMON_CACHEDIR}/jailbreak-cabal-${TERMUX_JAILBREAK_VERSION}-runtime"
|
|
|
|
fi
|
|
|
|
|
2022-03-10 19:08:53 +01:00
|
|
|
export PATH="${TERMUX_JAILBREAK_RUNTIME_FOLDER}:${PATH}"
|
2022-03-12 05:42:33 +01:00
|
|
|
|
2022-03-13 17:32:51 +01:00
|
|
|
[[ -d "${TERMUX_JAILBREAK_RUNTIME_FOLDER}" ]] && return
|
2022-03-12 05:42:33 +01:00
|
|
|
|
2022-03-10 19:08:53 +01:00
|
|
|
termux_download "https://github.com/MrAdityaAlok/ghc-cross-tools/releases/download/jailbreak-cabal-v${TERMUX_JAILBREAK_VERSION}/jailbreak-cabal-${TERMUX_JAILBREAK_VERSION}.tar.xz" \
|
2022-03-12 05:42:33 +01:00
|
|
|
"${TERMUX_JAILBREAK_TAR}" \
|
2022-03-10 19:08:53 +01:00
|
|
|
"8d1a8b8fadf48f4abf42da025d5cf843bd68e1b3c18ecacdc0cd0c9bd470c64e"
|
2022-03-12 05:42:33 +01:00
|
|
|
|
2022-03-10 19:08:53 +01:00
|
|
|
mkdir -p "${TERMUX_JAILBREAK_RUNTIME_FOLDER}"
|
|
|
|
tar xf "${TERMUX_JAILBREAK_TAR}" -C "${TERMUX_JAILBREAK_RUNTIME_FOLDER}"
|
2022-03-12 05:42:33 +01:00
|
|
|
|
|
|
|
rm "${TERMUX_JAILBREAK_TAR}"
|
|
|
|
else
|
2022-03-13 17:32:51 +01:00
|
|
|
if [[ "${TERMUX_MAIN_PACKAGE_FORMAT}" == "debian" ]] && "$(dpkg-query -W -f '${db:Status-Status}\n' jailbreak-cabal 2>/dev/null)" != "installed" ||
|
|
|
|
[[ "${TERMUX_MAIN_PACKAGE_FORMAT}" = "pacman" ]] && ! "$(pacman -Q jailbreak-cabal 2>/dev/null)"; then
|
2022-03-12 05:42:33 +01:00
|
|
|
echo "Package 'jailbreak-cabal' is not installed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|