style: lint with shellcheck
Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
This commit is contained in:
parent
5dfa5ccbd0
commit
a5f9e8199a
@ -1,12 +1,14 @@
|
||||
termux_step_configure_haskell_build() {
|
||||
termux_setup_jailbreak_cabal
|
||||
printf "%s" "Jailbreaking Cabal file..."
|
||||
jailbreak-cabal "${TERMUX_PKG_SRCDIR}"/*.cabal && echo "done." || {
|
||||
if jailbreak-cabal "${TERMUX_PKG_SRCDIR}"/*.cabal; then
|
||||
echo "done."
|
||||
else
|
||||
termux_error_exit "failed."
|
||||
}
|
||||
fi
|
||||
|
||||
ENABLE_SHARED="--enable-shared"
|
||||
if [ "$TERMUX_PKG_EXTRA_CONFIGURE_ARGS" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-shared/}" ]; then
|
||||
if [[ "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS}" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-shared/}" ]]; then
|
||||
ENABLE_SHARED=""
|
||||
fi
|
||||
|
||||
@ -15,37 +17,37 @@ termux_step_configure_haskell_build() {
|
||||
--enable-executable-dynamic
|
||||
--disable-library-vanilla
|
||||
"
|
||||
if [ "$TERMUX_PKG_EXTRA_CONFIGURE_ARGS" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-executable-dynamic/}" ]; then
|
||||
if [[ "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS}" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-executable-dynamic/}" ]]; then
|
||||
DYNAMIC_EXECUTABLE=""
|
||||
fi
|
||||
|
||||
HOST_FLAG="--host=$TERMUX_HOST_PLATFORM"
|
||||
if [ "$TERMUX_PKG_EXTRA_CONFIGURE_ARGS" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--host=/}" ]; then
|
||||
HOST_FLAG="--host=${TERMUX_HOST_PLATFORM}"
|
||||
if [[ "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS}" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--host=/}" ]]; then
|
||||
HOST_FLAG=""
|
||||
fi
|
||||
|
||||
LIBEXEC_FLAG="--libexecdir=$TERMUX_PREFIX/libexec"
|
||||
if [ "$TERMUX_PKG_EXTRA_CONFIGURE_ARGS" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--libexecdir=/}" ]; then
|
||||
LIBEXEC_FLAG="--libexecdir=${TERMUX_PREFIX}/libexec"
|
||||
if [[ "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS}" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--libexecdir=/}" ]]; then
|
||||
LIBEXEC_FLAG=""
|
||||
fi
|
||||
|
||||
QUIET_BUILD=
|
||||
if [ "$TERMUX_QUIET_BUILD" = true ]; then
|
||||
if [[ "${TERMUX_QUIET_BUILD}" = true ]]; then
|
||||
QUIET_BUILD="-v0"
|
||||
fi
|
||||
|
||||
LIB_STRIPPING="--enable-library-stripping"
|
||||
if [ "$TERMUX_PKG_EXTRA_CONFIGURE_ARGS" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-library-stripping=/}" ] || [ "$TERMUX_DEBUG_BUILD" = "true" ]; then
|
||||
if [[ "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS}" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-library-stripping=/}" ]] || [[ "${TERMUX_DEBUG_BUILD}" = true ]]; then
|
||||
LIB_STRIPPING=""
|
||||
fi
|
||||
|
||||
EXECUTABLE_STRIPPING="--enable-executable-stripping"
|
||||
if [ "$TERMUX_PKG_EXTRA_CONFIGURE_ARGS" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-executable-stripping=/}" ] || [ "$TERMUX_DEBUG_BUILD" = "true" ]; then
|
||||
if [[ "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS}" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-executable-stripping=/}" ]] || [[ "${TERMUX_DEBUG_BUILD}" = true ]]; then
|
||||
EXECUTABLE_STRIPPING=""
|
||||
fi
|
||||
|
||||
SPLIT_SECTIONS="--enable-split-sections"
|
||||
if [ "$TERMUX_PKG_EXTRA_CONFIGURE_ARGS" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-split-sections=/}" ]; then
|
||||
if [[ "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS}" != "${TERMUX_PKG_EXTRA_CONFIGURE_ARGS/--disable-split-sections=/}" ]]; then
|
||||
SPLIT_SECTIONS=""
|
||||
fi
|
||||
|
||||
@ -107,6 +109,7 @@ termux_step_configure_haskell_build() {
|
||||
|
||||
# NOTE: We do not want to quote AVOID_GNULIB as we want word expansion.
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2250,SC2154,SC2248,SC2312
|
||||
env $AVOID_GNULIB termux-ghc-setup configure \
|
||||
$TERMUX_HASKELL_OPTIMISATION \
|
||||
--prefix=$TERMUX_PREFIX \
|
||||
@ -115,16 +118,16 @@ termux_step_configure_haskell_build() {
|
||||
--configure-option=--host=$HOST_FLAG \
|
||||
--ghc-option=-optl-Wl,-rpath=$TERMUX_PREFIX/lib \
|
||||
--ghc-option=-optl-Wl,--enable-new-dtags \
|
||||
--with-compiler=$(command -v termux-ghc) \
|
||||
--with-ghc-pkg=$(command -v termux-ghc-pkg) \
|
||||
--with-hsc2hs=$(command -v termux-hsc2hs) \
|
||||
--with-compiler="$(command -v termux-ghc)" \
|
||||
--with-ghc-pkg="$(command -v termux-ghc-pkg)" \
|
||||
--with-hsc2hs="$(command -v termux-hsc2hs)" \
|
||||
--hsc2hs-option=--cross-compile \
|
||||
--with-ld=$LD \
|
||||
--with-strip=$STRIP \
|
||||
--with-ar=$AR \
|
||||
--with-pkg-config=$PKG_CONFIG \
|
||||
--with-happy=$(command -v happy) \
|
||||
--with-alex=$(command -v alex) \
|
||||
--with-happy="$(command -v happy)" \
|
||||
--with-alex="$(command -v alex)" \
|
||||
--extra-include-dirs=$TERMUX_PREFIX/include \
|
||||
--extra-lib-dirs=$TERMUX_PREFIX/lib \
|
||||
--disable-tests \
|
||||
|
@ -1,11 +1,11 @@
|
||||
termux_setup_cabal() {
|
||||
if [ "${TERMUX_ON_DEVICE_BUILD}" = "false" ]; then
|
||||
if [[ "${TERMUX_ON_DEVICE_BUILD}" == "false" ]]; then
|
||||
local TERMUX_CABAL_VERSION=3.6.2.0
|
||||
local TERMUX_CABAL_TAR="${TERMUX_COMMON_CACHEDIR}/cabal-${TERMUX_CABAL_VERSION}.tar.xz"
|
||||
|
||||
local TERMUX_CABAL_RUNTIME_FOLDER
|
||||
|
||||
if [ "${TERMUX_PACKAGES_OFFLINE-false}" = "true" ]; then
|
||||
if [[ "${TERMUX_PACKAGES_OFFLINE-false}" == "true" ]]; then
|
||||
TERMUX_CABAL_RUNTIME_FOLDER="${TERMUX_SCRIPTDIR}/build-tools/cabal-${TERMUX_CABAL_VERSION}-runtime"
|
||||
else
|
||||
TERMUX_CABAL_RUNTIME_FOLDER="${TERMUX_COMMON_CACHEDIR}/cabal-${TERMUX_CABAL_VERSION}-runtime"
|
||||
@ -13,7 +13,7 @@ termux_setup_cabal() {
|
||||
|
||||
export PATH="${TERMUX_CABAL_RUNTIME_FOLDER}:${PATH}"
|
||||
|
||||
[ -d "${TERMUX_CABAL_RUNTIME_FOLDER}" ] && return
|
||||
[[ -d "${TERMUX_CABAL_RUNTIME_FOLDER}" ]] && return
|
||||
|
||||
termux_download "https://github.com/MrAdityaAlok/ghc-cross-tools/releases/download/cabal-install-v${TERMUX_CABAL_VERSION}/cabal-install-${TERMUX_CABAL_VERSION}.tar.xz" \
|
||||
"${TERMUX_CABAL_TAR}" \
|
||||
@ -26,8 +26,8 @@ termux_setup_cabal() {
|
||||
cabal update
|
||||
|
||||
else
|
||||
if [[ "$TERMUX_MAIN_PACKAGE_FORMAT" = "debian" && "$(dpkg-query -W -f '${db:Status-Status}\n' cabal-install 2>/dev/null)" != "installed" ]] ||
|
||||
[[ "$TERMUX_MAIN_PACKAGE_FORMAT" = "pacman" && ! "$(pacman -Q cabal-install 2>/dev/null)" ]]; then
|
||||
if [[ "${TERMUX_MAIN_PACKAGE_FORMAT}" == "debian" ]] && "$(dpkg-query -W -f '${db:Status-Status}\n' cabal-install 2>/dev/null)" != "installed" ||
|
||||
[[ "${TERMUX_MAIN_PACKAGE_FORMAT}" == "pacman" ]] && ! "$(pacman -Q cabal-install 2>/dev/null)"; then
|
||||
echo "Package 'cabal-install' is not installed."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -16,8 +16,8 @@ __termux_haskell_register_packages() {
|
||||
|
||||
__termux_haskell_eval_custom_build() {
|
||||
local bin="$1"
|
||||
if ! $(cat "${TERMUX_PKG_SRCDIR}"/*.cabal | grep -wq "^[bB]uild-type:") ||
|
||||
$(cat "${TERMUX_PKG_SRCDIR}"/*.cabal | grep -wq '^[bB]uild-type:\s*[Ss]imple$'); then
|
||||
if ! cat "${TERMUX_PKG_SRCDIR}"/*.cabal | grep -wq "^[bB]uild-type:" ||
|
||||
cat "${TERMUX_PKG_SRCDIR}"/*.cabal | grep -wq '^[bB]uild-type:\s*[Ss]imple$'; then
|
||||
return
|
||||
fi
|
||||
# Now, it must be a custom build.
|
||||
@ -29,10 +29,10 @@ __termux_haskell_eval_custom_build() {
|
||||
termux_setup_ghc_cross_compiler() {
|
||||
local TERMUX_GHC_VERSION="8.10.7"
|
||||
local GHC_PREFIX="ghc-cross-${TERMUX_GHC_VERSION}-${TERMUX_ARCH}"
|
||||
if [ "${TERMUX_ON_DEVICE_BUILD}" = "false" ]; then
|
||||
if [[ "${TERMUX_ON_DEVICE_BUILD}" == "false" ]]; then
|
||||
local TERMUX_GHC_RUNTIME_FOLDER
|
||||
|
||||
if [ "${TERMUX_PACKAGES_OFFLINE-false}" = "true" ]; then
|
||||
if [[ "${TERMUX_PACKAGES_OFFLINE-false}" == "true" ]]; then
|
||||
TERMUX_GHC_RUNTIME_FOLDER="${TERMUX_SCRIPTDIR}/build-tools/${GHC_PREFIX}-runtime"
|
||||
else
|
||||
TERMUX_GHC_RUNTIME_FOLDER="${TERMUX_COMMON_CACHEDIR}/${GHC_PREFIX}-runtime"
|
||||
@ -48,7 +48,7 @@ termux_setup_ghc_cross_compiler() {
|
||||
|
||||
__termux_haskell_register_packages
|
||||
|
||||
if [ -d "${TERMUX_GHC_RUNTIME_FOLDER}" ]; then
|
||||
if [[ -d "${TERMUX_GHC_RUNTIME_FOLDER}" ]]; then
|
||||
__termux_haskell_eval_custom_build "${TERMUX_GHC_RUNTIME_FOLDER}/bin/${TERMUX_ARCH}"
|
||||
return
|
||||
fi
|
||||
@ -79,7 +79,7 @@ termux_setup_ghc_cross_compiler() {
|
||||
|
||||
for tool in ghc ghc-pkg hsc2hs hp2ps ghci; do
|
||||
_tool="${tool}"
|
||||
[ "${tool}" = "ghci" ] && _tool="ghc"
|
||||
[[ "${tool}" == "ghci" ]] && _tool="ghc"
|
||||
sed -i "s|\$executablename|${TERMUX_GHC_RUNTIME_FOLDER}/lib/ghc-${TERMUX_GHC_VERSION}/bin/${_tool}|g" \
|
||||
"${TERMUX_GHC_RUNTIME_FOLDER}/bin/${TERMUX_ARCH}/termux-${tool}"
|
||||
done
|
||||
@ -95,8 +95,8 @@ termux_setup_ghc_cross_compiler() {
|
||||
rm "${TERMUX_GHC_TAR}"
|
||||
else
|
||||
|
||||
if [[ "$TERMUX_MAIN_PACKAGE_FORMAT" = "debian" && "$(dpkg-query -W -f '${db:Status-Status}\n' ghc 2>/dev/null)" != "installed" ]] ||
|
||||
[[ "$TERMUX_MAIN_PACKAGE_FORMAT" = "pacman" && ! "$(pacman -Q ghc 2>/dev/null)" ]]; then
|
||||
if [[ "${TERMUX_MAIN_PACKAGE_FORMAT}" == "debian" ]] && "$(dpkg-query -W -f '${db:Status-Status}\n' ghc 2>/dev/null)" != "installed" ||
|
||||
[[ "${TERMUX_MAIN_PACKAGE_FORMAT}" == "pacman" ]] && ! "$(pacman -Q ghc 2>/dev/null)"; then
|
||||
echo "Package 'ghc' is not installed."
|
||||
exit 1
|
||||
else
|
||||
@ -105,7 +105,7 @@ termux_setup_ghc_cross_compiler() {
|
||||
|
||||
__termux_haskell_register_packages
|
||||
|
||||
if [ -d "${ON_DEVICE_GHC_BIN}" ]; then
|
||||
if [[ -d "${ON_DEVICE_GHC_BIN}" ]]; then
|
||||
__termux_haskell_eval_custom_build "${ON_DEVICE_GHC_BIN}"
|
||||
return
|
||||
fi
|
||||
|
@ -1,12 +1,12 @@
|
||||
# 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() {
|
||||
if [ "${TERMUX_ON_DEVICE_BUILD}" = "false" ]; then
|
||||
if [[ "${TERMUX_ON_DEVICE_BUILD}" == "false" ]]; then
|
||||
local TERMUX_JAILBREAK_VERSION=1.3.5
|
||||
local TERMUX_JAILBREAK_TAR="${TERMUX_COMMON_CACHEDIR}/jailbreak-cabal-${TERMUX_JAILBREAK_VERSION}.tar.gz"
|
||||
local TERMUX_JAILBREAK_RUNTIME_FOLDER
|
||||
|
||||
if [ "${TERMUX_PACKAGES_OFFLINE-false}" = "true" ]; then
|
||||
if [[ "${TERMUX_PACKAGES_OFFLINE-false}" == "true" ]]; then
|
||||
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"
|
||||
@ -14,7 +14,7 @@ termux_setup_jailbreak_cabal() {
|
||||
|
||||
export PATH="${TERMUX_JAILBREAK_RUNTIME_FOLDER}:${PATH}"
|
||||
|
||||
[ -d "${TERMUX_JAILBREAK_RUNTIME_FOLDER}" ] && return
|
||||
[[ -d "${TERMUX_JAILBREAK_RUNTIME_FOLDER}" ]] && return
|
||||
|
||||
termux_download "https://github.com/MrAdityaAlok/ghc-cross-tools/releases/download/jailbreak-cabal-v${TERMUX_JAILBREAK_VERSION}/jailbreak-cabal-${TERMUX_JAILBREAK_VERSION}.tar.xz" \
|
||||
"${TERMUX_JAILBREAK_TAR}" \
|
||||
@ -25,8 +25,8 @@ termux_setup_jailbreak_cabal() {
|
||||
|
||||
rm "${TERMUX_JAILBREAK_TAR}"
|
||||
else
|
||||
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
|
||||
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
|
||||
echo "Package 'jailbreak-cabal' is not installed."
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user