summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiezhiko <Miezhiko@gmail.com>2022-09-14 13:48:57 +0400
committerSam James <sam@gentoo.org>2022-09-15 12:18:56 +0100
commit013f84e17cc06001b2a1c5ba20e680e757c4741a (patch)
tree897f5029311d26f78d5daabad353d10e86e340d8 /eclass/haskell-cabal.eclass
parentsys-kernel/vanilla-sources: add 4.19.258, drop 4.19.257 (diff)
downloadgentoo-013f84e17cc06001b2a1c5ba20e680e757c4741a.tar.gz
gentoo-013f84e17cc06001b2a1c5ba20e680e757c4741a.tar.bz2
gentoo-013f84e17cc06001b2a1c5ba20e680e757c4741a.zip
haskell-cabal.eclass: synchronize with gentoo-haskell overlay
Closes: https://github.com/gentoo/gentoo/pull/27252 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass/haskell-cabal.eclass')
-rw-r--r--eclass/haskell-cabal.eclass51
1 files 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} \