commit: 013f84e17cc06001b2a1c5ba20e680e757c4741a Author: Miezhiko <Miezhiko <AT> gmail <DOT> com> AuthorDate: Wed Sep 14 09:48:57 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Thu Sep 15 11:18:56 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=013f84e1
haskell-cabal.eclass: synchronize with gentoo-haskell overlay Closes: https://github.com/gentoo/gentoo/pull/27252 Signed-off-by: Sam James <sam <AT> gentoo.org> eclass/haskell-cabal.eclass | 51 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass index 0f7f67a244d7..5c0fcba0ebe1 100644 --- a/eclass/haskell-cabal.eclass +++ b/eclass/haskell-cabal.eclass @@ -180,7 +180,6 @@ fi # ) : ${CABAL_CHDEPS:=} - # @ECLASS_VARIABLE: CABAL_LIVE_VERSION # @PRE_INHERIT # @DEFAULT_UNSET @@ -188,6 +187,16 @@ fi # Set this to any value to prevent SRC_URI from being set automatically. : ${CABAL_LIVE_VERSION:=} +# @ECLASS_VARIABLE: GHC_BOOTSTRAP_PACKAGES +# @DEFAULT_UNSET +# @DESCRIPTION: +# Extra packages that need to be exposed when compiling Setup.hs +# @EXAMPLE: +# GHC_BOOTSTRAP_PACKAGES=( +# cabal-doctest +# ) +: ${GHC_BOOTSTRAP_PACKAGES:=} + # 'dev-haskell/cabal' passes those options with ./configure-based # configuration, but most packages don't need/don't accept it: # #515362, #515362 @@ -269,6 +278,10 @@ cabal-version() { # We ask portage, not ghc, so that we only pick up # portage-installed cabal versions. _CABAL_VERSION_CACHE="$(ghc-extract-pm-version dev-haskell/cabal)" + # exception for live (9999) version + if [[ "${_CABAL_VERSION_CACHE}" == 9999 ]]; then + _CABAL_VERSION_CACHE="$(ghc-cabal-version)" + fi fi fi echo "${_CABAL_VERSION_CACHE}" @@ -301,8 +314,42 @@ cabal-bootstrap() { setup_bootstrap_args+=(-threaded) fi + # The packages available when compiling Setup.hs need to be controlled, + # otherwise module name collisions are possible. + local -a bootstrap_pkg_args=(-hide-all-packages) + + # Expose common packages bundled with GHC + # See: <https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history> + local default_exposed_pkgs=" + Cabal + base + binary + bytestring + containers + deepseq + directory + exceptions + filepath + haskeline + mtl + parsec + pretty + process + stm + template-haskell + terminfo + text + transformers + unix + xhtml + " + + for pkg in $default_exposed_pkgs ${GHC_BOOTSTRAP_PACKAGES[*]}; do + bootstrap_pkg_args+=(-package "$pkg") + done + make_setup() { - set -- -package "${cabalpackage}" --make "${setupmodule}" \ + set -- "${bootstrap_pkg_args[@]}" --make "${setupmodule}" \ $(ghc-make-args) \ "${setup_bootstrap_args[@]}" \ ${HCFLAGS} \