#!/bin/bash cabal_sane_check() { Quiet ghc -V || Die "This is a cabal recipe and you don't seem to have GHC installed." } cabal_init() { create_dirs_first="yes" post_install_message="Package registered via ghc-pkg; manual update required on package changes (InstallPackage, RemoveProgram, etc.)" [ "$runhaskell" ] || runhaskell="runhaskell" } cabal_do_configuration(){ if [ ! "$override_default_options" = "yes" ] then cabal_options=( "${cabal_options[@]}" "--prefix=$target" ) fi Add_Use_Flags_Options_To_Array cabal_options if [ ! -z "$goboIndex" ] then cabal_options=(`echo ${cabal_options[@]} | sed "s,$target,$goboIndex,g"`) fi for f in Setup.lhs Setup.hs ; do [ -e ${sourcedir}/${f} ] && cabal_setup="$f"; done [ ! -z "$cabal_setup" ] || Die "Cabal Setup.hs or Setup.lhs not found" $runhaskell "$cabal_setup" configure "${cabal_options[@]}" || wrap_fail "Configure failed" } cabal_do_build() { $runhaskell "$cabal_setup" build "${build_variables[@]}" || wrap_fail "Build failed." } cabal_do_install() { # The package db should really be moved outside of ghc installation and functions should be added to Scripts to udpate the db pkg_dbloc=$(dirname `ghc-pkg list | head -n 1 | cut -f1 -d:`) SandboxInstall $verbose ${unmanagedlist:+--unmanaged-files "${unmanagedlist}"} ${sandboxopts:+"${sandboxopts[@]}"} -a $pkg_dbloc -c $runhaskell "$appname" "$versionnumber" -- "$cabal_setup" install "${install_variables[@]}" || wrap_fail "Installation failed." }