diff --git a/scripts/build/configure/termux_step_configure.sh b/scripts/build/configure/termux_step_configure.sh index 7eba25e59..2e8093a97 100644 --- a/scripts/build/configure/termux_step_configure.sh +++ b/scripts/build/configure/termux_step_configure.sh @@ -1,9 +1,15 @@ termux_step_configure() { [ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return - if [ "$TERMUX_PKG_FORCE_CMAKE" = "false" ] && [ -f "$TERMUX_PKG_SRCDIR/configure" ]; then + # This check should be above autotools check as haskell package too makes use of configure scripts which + # should be executed by its own build system. + if ls ./*.cabal &>/dev/null; then + [ "$TERMUX_CONTINUE_BUILD" == "true" ] && return + termux_setup_ghc + termux_step_configure_haskell_build + elif [ "$TERMUX_PKG_FORCE_CMAKE" = "false" ] && [ -f "$TERMUX_PKG_SRCDIR/configure" ]; then if [ "$TERMUX_CONTINUE_BUILD" == "true" ]; then - return; + return fi termux_step_configure_autotools elif [ "$TERMUX_PKG_FORCE_CMAKE" = "true" ] || [ -f "$TERMUX_PKG_SRCDIR/CMakeLists.txt" ]; then @@ -16,13 +22,13 @@ termux_step_configure() { # internally, but cannot be configured with our # termux_step_configure_cmake function (CMakeLists.txt # is not in src dir) - if [ -f "$TERMUX_PKG_SRCDIR/CMakeLists.txt" ] && \ + if [ -f "$TERMUX_PKG_SRCDIR/CMakeLists.txt" ] && [ "$TERMUX_CONTINUE_BUILD" == "false" ]; then termux_step_configure_cmake fi elif [ -f "$TERMUX_PKG_SRCDIR/meson.build" ]; then if [ "$TERMUX_CONTINUE_BUILD" == "true" ]; then - return; + return fi termux_step_configure_meson fi diff --git a/scripts/build/termux_step_make.sh b/scripts/build/termux_step_make.sh index 65a31bb3c..67c35a33a 100644 --- a/scripts/build/termux_step_make.sh +++ b/scripts/build/termux_step_make.sh @@ -8,7 +8,9 @@ termux_step_make() { if test -f build.ninja; then ninja -w dupbuild=warn -j $TERMUX_MAKE_PROCESSES - elif ls ./*akefile &> /dev/null || [ ! -z "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then + elif ls ./*.cabal &>/dev/null; then + runhaskell Setup -j$TERMUX_MAKE_PROCESSES build + elif ls ./*akefile &>/dev/null || [ ! -z "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then if [ -z "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then make -j $TERMUX_MAKE_PROCESSES $QUIET_BUILD else diff --git a/scripts/build/termux_step_make_install.sh b/scripts/build/termux_step_make_install.sh index 95456c411..d30974e99 100644 --- a/scripts/build/termux_step_make_install.sh +++ b/scripts/build/termux_step_make_install.sh @@ -3,7 +3,27 @@ termux_step_make_install() { if test -f build.ninja; then ninja -w dupbuild=warn -j $TERMUX_MAKE_PROCESSES install - elif ls ./*akefile &> /dev/null || [ -n "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then + elif ls ./*.cabal &>/dev/null; then + runhaskell Setup copy + if [ "${TERMUX_PKG_IS_HASKELL_LIB}" = true ]; then + runhaskell Setup register --gen-script + runhaskell Setup unregister --gen-script + + install -Dm744 register.sh "${TERMUX_PREFIX}"/share/haskell/register/"${TERMUX_PKG_NAME}".sh + install -Dm744 unregister.sh "${TERMUX_PREFIX}"/share/haskell/unregister/"${TERMUX_PKG_NAME}".sh + + sed -i -r -e "s|$(command -v termux-ghc-pkg)|${TERMUX_PREFIX}/bin/ghc-pkg|g" \ + -e "s|ghc-pkg.*update[^ ]* |&'--force' |" \ + -e "s|export PATH=.*||g" \ + "${TERMUX_PREFIX}"/share/haskell/register/"${TERMUX_PKG_NAME}".sh + + sed -i -r -e "s|$(command -v termux-ghc-pkg)|${TERMUX_PREFIX}/bin/ghc-pkg|g" \ + -e "s|export PATH=.*||g" \ + -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" \ + "${TERMUX_PREFIX}"/share/haskell/unregister/"${TERMUX_PKG_NAME}".sh + fi + + elif ls ./*akefile &>/dev/null || [ -n "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then : "${TERMUX_PKG_MAKE_INSTALL_TARGET:="install"}" # Some packages have problem with parallell install, and it does not buy much, so use -j 1. if [ -z "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then