1 |
commit: 013f84e17cc06001b2a1c5ba20e680e757c4741a |
2 |
Author: Miezhiko <Miezhiko <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Sep 14 09:48:57 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 15 11:18:56 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=013f84e1 |
7 |
|
8 |
haskell-cabal.eclass: synchronize with gentoo-haskell overlay |
9 |
|
10 |
Closes: https://github.com/gentoo/gentoo/pull/27252 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
eclass/haskell-cabal.eclass | 51 +++++++++++++++++++++++++++++++++++++++++++-- |
14 |
1 file changed, 49 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass |
17 |
index 0f7f67a244d7..5c0fcba0ebe1 100644 |
18 |
--- a/eclass/haskell-cabal.eclass |
19 |
+++ b/eclass/haskell-cabal.eclass |
20 |
@@ -180,7 +180,6 @@ fi |
21 |
# ) |
22 |
: ${CABAL_CHDEPS:=} |
23 |
|
24 |
- |
25 |
# @ECLASS_VARIABLE: CABAL_LIVE_VERSION |
26 |
# @PRE_INHERIT |
27 |
# @DEFAULT_UNSET |
28 |
@@ -188,6 +187,16 @@ fi |
29 |
# Set this to any value to prevent SRC_URI from being set automatically. |
30 |
: ${CABAL_LIVE_VERSION:=} |
31 |
|
32 |
+# @ECLASS_VARIABLE: GHC_BOOTSTRAP_PACKAGES |
33 |
+# @DEFAULT_UNSET |
34 |
+# @DESCRIPTION: |
35 |
+# Extra packages that need to be exposed when compiling Setup.hs |
36 |
+# @EXAMPLE: |
37 |
+# GHC_BOOTSTRAP_PACKAGES=( |
38 |
+# cabal-doctest |
39 |
+# ) |
40 |
+: ${GHC_BOOTSTRAP_PACKAGES:=} |
41 |
+ |
42 |
# 'dev-haskell/cabal' passes those options with ./configure-based |
43 |
# configuration, but most packages don't need/don't accept it: |
44 |
# #515362, #515362 |
45 |
@@ -269,6 +278,10 @@ cabal-version() { |
46 |
# We ask portage, not ghc, so that we only pick up |
47 |
# portage-installed cabal versions. |
48 |
_CABAL_VERSION_CACHE="$(ghc-extract-pm-version dev-haskell/cabal)" |
49 |
+ # exception for live (9999) version |
50 |
+ if [[ "${_CABAL_VERSION_CACHE}" == 9999 ]]; then |
51 |
+ _CABAL_VERSION_CACHE="$(ghc-cabal-version)" |
52 |
+ fi |
53 |
fi |
54 |
fi |
55 |
echo "${_CABAL_VERSION_CACHE}" |
56 |
@@ -301,8 +314,42 @@ cabal-bootstrap() { |
57 |
setup_bootstrap_args+=(-threaded) |
58 |
fi |
59 |
|
60 |
+ # The packages available when compiling Setup.hs need to be controlled, |
61 |
+ # otherwise module name collisions are possible. |
62 |
+ local -a bootstrap_pkg_args=(-hide-all-packages) |
63 |
+ |
64 |
+ # Expose common packages bundled with GHC |
65 |
+ # See: <https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history> |
66 |
+ local default_exposed_pkgs=" |
67 |
+ Cabal |
68 |
+ base |
69 |
+ binary |
70 |
+ bytestring |
71 |
+ containers |
72 |
+ deepseq |
73 |
+ directory |
74 |
+ exceptions |
75 |
+ filepath |
76 |
+ haskeline |
77 |
+ mtl |
78 |
+ parsec |
79 |
+ pretty |
80 |
+ process |
81 |
+ stm |
82 |
+ template-haskell |
83 |
+ terminfo |
84 |
+ text |
85 |
+ transformers |
86 |
+ unix |
87 |
+ xhtml |
88 |
+ " |
89 |
+ |
90 |
+ for pkg in $default_exposed_pkgs ${GHC_BOOTSTRAP_PACKAGES[*]}; do |
91 |
+ bootstrap_pkg_args+=(-package "$pkg") |
92 |
+ done |
93 |
+ |
94 |
make_setup() { |
95 |
- set -- -package "${cabalpackage}" --make "${setupmodule}" \ |
96 |
+ set -- "${bootstrap_pkg_args[@]}" --make "${setupmodule}" \ |
97 |
$(ghc-make-args) \ |
98 |
"${setup_bootstrap_args[@]}" \ |
99 |
${HCFLAGS} \ |