feat(build scripts): add steps for haskell packages

Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>

refactor(termux_step_get_dependencies): move haskell build steps from here
This commit is contained in:
Aditya Alok 2022-03-12 10:25:41 +05:30 committed by Henrik Grimler
parent e63a8b36a8
commit 39bf6e9835
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
3 changed files with 34 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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