--- trunk/core/include/haskell.sminc 2010/07/01 15:12:33 5536 +++ trunk/core/include/haskell.sminc 2010/07/01 15:22:06 5537 @@ -21,10 +21,57 @@ mirror://${PNAME}/${SRCFILE} ) +# possible features which are supported atm +HASKELL_POSSIBLE_FEATURES="split-objs shared register haddock" +# default haskell features +HASKELL_FEATURES="split-objs shared register" + HASKELL_PNAME="${PNAME}" -SPECIAL_VARS="HASKELL_PNAME" +SPECIAL_VARS="${SPECIAL_VARS} HASKELL_PNAME" SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} haskell_preinstall haskell_postinstall haskell_preremove haskell_postremove" +haskell_feature() +{ + local search="$1" + local feature + for feature in ${HASKELL_FEATURES} + do + # feature was found + [[ ${search} = ${feature} ]] && return 0 + done + + # feature was *not* found + return 1 +} + +haskell_feature_is_supported() +{ + local search="$1" + local feature + for feature in ${HASKELL_POSSIBLE_FEATURES} + do + # feature was found + [[ ${search} = ${feature} ]] && return 0 + done + + # feature was *not* found + return 1 +} + +haskell_disable_feature() +{ + local feature="$1" + haskell_feature_is_supported || die "haskell feature '${feature}' not supported!" + export HASKELL_FEATURES="${HASKELL_FEATURES/${feature}/}" +} + +haskell_enable_feature() +{ + local feature="$1" + haskell_feature_is_supported || die "haskell feature '${feature}' not supported!" + export HASKELL_FEATURES+=" ${feature}" +} + haskell_ghc_version() { local ver @@ -67,8 +114,8 @@ { local configure_opts="$@" - configure_opts+=" --enable-split-objs" - configure_opts+=" --enable-shared" + haskell_feature split-objs && configure_opts+=" --enable-split-objs" + haskell_feature shared && configure_opts+=" --enable-shared" runhaskell $(haskell_ghc_setup_script) configure \ --ghc \ @@ -91,11 +138,10 @@ haskell_src_install() { cd ${SRCDIR} - runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die # create register scripts - haskell_install_register || die + haskell_feature register && haskell_install_register || die # install docs local i