1 |
commit: b855b628d2d613e95f5702d6bb269320ac12e8fc |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 28 18:42:42 2021 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 28 18:43:04 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b855b628 |
7 |
|
8 |
dev-lang/ghc: bump up to 8.10.4 (no keywords yet) |
9 |
|
10 |
Package-Manager: Portage-3.0.16, Repoman-3.0.2 |
11 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
12 |
|
13 |
dev-lang/ghc/Manifest | 4 + |
14 |
dev-lang/ghc/files/ghc-8.10.3-C99-typo-ac270.patch | 12 + |
15 |
dev-lang/ghc/ghc-8.10.4.ebuild | 799 +++++++++++++++++++++ |
16 |
3 files changed, 815 insertions(+) |
17 |
|
18 |
diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest |
19 |
index 9ec9e69c069..ed19e2f59d9 100644 |
20 |
--- a/dev-lang/ghc/Manifest |
21 |
+++ b/dev-lang/ghc/Manifest |
22 |
@@ -9,6 +9,8 @@ DIST ghc-8.10.2-src.tar.xz 21880680 BLAKE2B 0c1b67c1576cfd1067d11838301f96041cab |
23 |
DIST ghc-8.10.2-testsuite.tar.xz 2101788 BLAKE2B 0d4528223471dfd68cadcda47931d53508c9eafa415716ca5990ea519eb89bfa2bdd444280057be33467382dd3d178887262d54ef633aa8ce88ea91eb9d58ece SHA512 043faaf2f0dc34a868c481b284b94afd78aa1ec1a4056d1f3c97ca3f7dadb3e9cff0517a4cfb378fe5187389db7c9027763bf066328e7dcfd264b737f6d09e41 |
24 |
DIST ghc-8.10.3-src.tar.xz 19872356 BLAKE2B 043f41a21becc826b3cd13ee81b138cf2edfa18484f98361dc85b12f784df85571522347d5fafe40a19ea8ddf12390cd766db8fc21cf4971e797bc61404304cc SHA512 6f3248e728d3677dfddf2f02609167c67a194750418f2a5e34ed68f1135960761c5a5768255bfc8b2ef5640395609424878375184d2dde8e2d69021a3baf9ec8 |
25 |
DIST ghc-8.10.3-testsuite.tar.xz 2261376 BLAKE2B cd03d569c30637d531d9a13fa926a28f854a37d48ef0d4e2fde684664ae000f3c941b5113ccafd42fec019428bafb5344b1ddf8f84a71b21bca8831ed4784907 SHA512 4c9d20a27ed71eb7c73bd86c1049ea5adcc8a0b12040386b7d0dddb46b3cf704c52a3392e19ae4ff1c76b8868665c599391d47e47dba516fcadf8abbc30e28df |
26 |
+DIST ghc-8.10.4-src.tar.xz 19818108 BLAKE2B 069dd8436c373ccf73c20d8b577243792ffdd3a031e869edd612fe1e273126e60803326542695012dbe62e57654ada18af9342bbe1a741b2bebb41cdb0d86035 SHA512 9bb078cb72535a352243b83b671c871392564efd09e478549f27ae58fc6f46e337a0782f5500d26d5704ad96eace22e77bb36031a1fe9b7e175f265b0b9c028b |
27 |
+DIST ghc-8.10.4-testsuite.tar.xz 2236932 BLAKE2B 17d0520ad5c6daa0cc60530279ae7e617e4d79328b9f436abbe75e72f0803d9a997fb9e1ae61425326b070f45794a488d8507957fec9a6ed49eea86d30a1e579 SHA512 1bf129c8d872e3ceff7c19929605adc5d68daab9ded9aa2e5109b0de162089631472c66f04993adf8481291f8128bf804fe64a9d344c81e257f1b962ba5e382c |
28 |
DIST ghc-8.2.1-src.tar.xz 10736016 BLAKE2B 60993cfc9569e83b0c383591ef30a7280e0138fbb7bd696ad62d87e68dcbccf31c0b8ba211b6647922b8595c7aec2c783648f12c67da53e0766b71c7d7c923fc SHA512 d9aa2aa7f9414db8f4e51d6c275694b46df515e68331a1a2b6018256333a2c63ebd877b75ee90407ecce5be672ec9afc6bebd62aadbf8ae06b94f1760d1736be |
29 |
DIST ghc-8.2.2-src.tar.xz 10753272 BLAKE2B 6fd792390d3df20f84836466705c3f3c931ba2d594dcbe2b808ea0ae284460000b443df8aae74903eabf05ff9064d68a303086cf888ea68222eb1c60959c8f21 SHA512 6549416f470b599973d409fa45f59c25b07e6a94798cef1a19ad432547dc225338cf4dbc4a4793114b4a417798a3b59b122b92b020251074405c5302b7ffe799 |
30 |
DIST ghc-8.4.1-src.tar.xz 11301528 BLAKE2B 6dcf467d04cace856b68315c85b80f19b517dcbc8ae6e2a08c60afa141c9e0261e012738452c9ca208f9fc40c48bd1a0817e5e0fe9f4737383cd7b44ca65c8d9 SHA512 f8ae11f498bf2911fb92635534c6906c96f1fbe5072c7b7447bd3f69e408026b674564515af02a8aaddc57ee6905ce78d10005b12478a39c220580aaec13a9f7 |
31 |
@@ -53,6 +55,8 @@ DIST ghc-bin-8.10.2-i686-pc-linux-gnu.tbz2 123683156 BLAKE2B a486076ea6e67f124c8 |
32 |
DIST ghc-bin-8.10.2-x86_64-pc-linux-gnu.tbz2 122818630 BLAKE2B 030a68e2aca0eb0a273e0d48a3e180d92b219b2d1826d1d58fa133d0a6cae1316b3ccceadb55a4fa5870f87c3df85df2998e7611b93dbc1fea592437748b2daf SHA512 23bf47ee45fae54a843de9e6991b67fccb79c14ad8d08eff9f38a68a3530496c8ce4bc8cae8a731bb690ddd6cd0bf36d6d5bf37eb68ddae8ce646a0bf3916d8f |
33 |
DIST ghc-bin-8.10.3-i686-pc-linux-gnu.tbz2 123802832 BLAKE2B a770dd43bee7a1d60fec2eb9aaa7de715eed01c19d9514e04678801827879977a5c91f5e191d026ca83aa5e5fc5f518593053b2e78b27b08df64b39058dbaec3 SHA512 f810432a56ddcd773e6118f038cdacd2f5e3a508d87bfa468ee861aef0cfc434ec5766a8a74360d8cec6cb9c664928290901c025496100e7c8465408635227f5 |
34 |
DIST ghc-bin-8.10.3-x86_64-pc-linux-gnu.tbz2 122993247 BLAKE2B e3395ebc7e87b4ae8f66dbbd9441c214c4d9535e55bfb14f78ebb92d30b1e100efc4893b3cdc65564d47bd53a21cb30106572b3fce13be022946171112c3218e SHA512 2ea4295bcaf6e3fd0db54ba67465e979cd85d3370c6c49f2381478ae9824ad89df53d7d93ccf06bdff5f4849f14306c9f50c13e6f6ba45f79e5b8c13ad63ae4f |
35 |
+DIST ghc-bin-8.10.4-i686-pc-linux-gnu.tbz2 123831294 BLAKE2B 1ca4c1b5c34c948011049a73d409c741db89658d10e311cffbe464c631c3733278fc7dede6ad27474832295ded2c26fd4d6419c760505255e29f7cb232a670a4 SHA512 1f87cf63651f7c0e5f7f55d1f4d7d7c48b0a911cc6673a899d4b92190d765b359f9c7d73c329969c1b76f1af102b7e2c18a80382c81d5dade9ac7dd57de4ef65 |
36 |
+DIST ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 122558873 BLAKE2B 9f07c7bdc3beccfa629d28b2524ccd2f4688a5c0036a45408f5ace2d530a2a0e42f95b3cda5037ebb365317999e1ae776c6f9d21692867abfe85e33f2892b1be SHA512 68bd70f94961547746a696aa2839e156c95858fda0c7ec5b2ecf802070724ab7102b0aa86bcbf93432170d521cce4af10f46b851b470e5dc49dfa5b07380f46d |
37 |
DIST ghc-bin-8.2.1-i686-pc-linux-gnu.tbz2 96157437 BLAKE2B 2b9608845db8cea78db07209fa054b3b05085d5c3ac07cbe3de02a93c87fb0cff12b1820f08757221c59c8a0a9e7a5563c44266b181525d916825e5cf5bac34c SHA512 e891e76557fa61853e28829b8bedc4a6abb92954f90cc1ebcf22a13cc137556bbe9262e7398b7e1aedbabeb997916b008bf1561a52f16a569f3d58ea9404f41e |
38 |
DIST ghc-bin-8.2.1-x86_64-pc-linux-gnu.tbz2 97490496 BLAKE2B 3666ea70cb8b3645db071040d2069fe244042c11954b34e5d92aaa90132d2316c0ee8c176cd4e674772bea3b99df150404f62bd8745c046cdaf102ecf0a0fa54 SHA512 52630a185d0eab56bce0469a612a54109895bfee041ec362ced59a9b35ba3b9c185e86bc7dbf0a5939081d3626baa19fbb3306e36d1857530248a7b9bfc100bb |
39 |
DIST ghc-bin-8.2.2-i686-pc-linux-gnu.tbz2 96638908 BLAKE2B b470f838e77330969f162196b0f1035fa764f5d123687fbf67c14323280bfe55216af0e16f8b79c62f290905d96abc8bfafee650f8d27c81608853e78329b2c9 SHA512 15b1525890477539878385efc15ce5f1cf2f126cc785c42923be958cabe3298cebe73526a2370cf4c630124160a7ca0f0f9062aebbf035dce807a0374eaddd14 |
40 |
|
41 |
diff --git a/dev-lang/ghc/files/ghc-8.10.3-C99-typo-ac270.patch b/dev-lang/ghc/files/ghc-8.10.3-C99-typo-ac270.patch |
42 |
new file mode 100644 |
43 |
index 00000000000..762622a07e0 |
44 |
--- /dev/null |
45 |
+++ b/dev-lang/ghc/files/ghc-8.10.3-C99-typo-ac270.patch |
46 |
@@ -0,0 +1,12 @@ |
47 |
+autoconf-2.70 does not allow macros with underscores. |
48 |
+--- a/aclocal.m4 |
49 |
++++ b/aclocal.m4 |
50 |
+@@ -673,7 +673,7 @@ AC_DEFUN([FP_SET_CFLAGS_C99], |
51 |
+ CPPFLAGS="$$3" |
52 |
+ unset ac_cv_prog_cc_c99 |
53 |
+ dnl perform detection |
54 |
+- _AC_PROG_CC_C99 |
55 |
++ AC_PROG_CC_C99 |
56 |
+ fp_cc_c99="$ac_cv_prog_cc_c99" |
57 |
+ case "x$ac_cv_prog_cc_c99" in |
58 |
+ x) ;; # noop |
59 |
|
60 |
diff --git a/dev-lang/ghc/ghc-8.10.4.ebuild b/dev-lang/ghc/ghc-8.10.4.ebuild |
61 |
new file mode 100644 |
62 |
index 00000000000..a0a3d692f58 |
63 |
--- /dev/null |
64 |
+++ b/dev-lang/ghc/ghc-8.10.4.ebuild |
65 |
@@ -0,0 +1,799 @@ |
66 |
+# Copyright 1999-2021 Gentoo Authors |
67 |
+# Distributed under the terms of the GNU General Public License v2 |
68 |
+ |
69 |
+EAPI=7 |
70 |
+ |
71 |
+# to make make a crosscompiler use crossdev and symlink ghc tree into |
72 |
+# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc' |
73 |
+export CBUILD=${CBUILD:-${CHOST}} |
74 |
+export CTARGET=${CTARGET:-${CHOST}} |
75 |
+if [[ ${CTARGET} = ${CHOST} ]] ; then |
76 |
+ if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then |
77 |
+ export CTARGET=${CATEGORY/cross-} |
78 |
+ fi |
79 |
+fi |
80 |
+ |
81 |
+inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package |
82 |
+inherit multilib multiprocessing pax-utils toolchain-funcs prefix |
83 |
+inherit check-reqs |
84 |
+DESCRIPTION="The Glasgow Haskell Compiler" |
85 |
+HOMEPAGE="https://www.haskell.org/ghc/" |
86 |
+ |
87 |
+# we don't have any binaries yet |
88 |
+arch_binaries="" |
89 |
+ |
90 |
+BIN_PV=${PV} |
91 |
+# sorted! |
92 |
+#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )" |
93 |
+#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )" |
94 |
+#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )" |
95 |
+arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )" |
96 |
+#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )" |
97 |
+#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )" |
98 |
+#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )" |
99 |
+#arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )" |
100 |
+#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )" |
101 |
+arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )" |
102 |
+ |
103 |
+# various ports: |
104 |
+#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )" |
105 |
+ |
106 |
+# 0 - yet |
107 |
+yet_binary() { |
108 |
+ case "${ARCH}" in |
109 |
+ #alpha) return 0 ;; |
110 |
+ #arm64) return 0 ;; |
111 |
+ #arm) return 0 ;; |
112 |
+ amd64) return 0 ;; |
113 |
+ #ia64) return 0 ;; |
114 |
+ #ppc) return 0 ;; |
115 |
+ #ppc64) |
116 |
+ # use big-endian && return 0 |
117 |
+ # return 0 |
118 |
+ # ;; |
119 |
+ #sparc) return 0 ;; |
120 |
+ x86) return 0 ;; |
121 |
+ *) return 1 ;; |
122 |
+ esac |
123 |
+} |
124 |
+ |
125 |
+GHC_PV=${PV} |
126 |
+#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds |
127 |
+GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct |
128 |
+ |
129 |
+SRC_URI="!binary? ( |
130 |
+ https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz |
131 |
+ test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz ) |
132 |
+)" |
133 |
+S="${WORKDIR}"/${GHC_P} |
134 |
+ |
135 |
+[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )" |
136 |
+ |
137 |
+BUMP_LIBRARIES=( |
138 |
+ # "hackage-name hackage-version" |
139 |
+) |
140 |
+ |
141 |
+LICENSE="BSD" |
142 |
+SLOT="0/${PV}" |
143 |
+# no binaries yet |
144 |
+#KEYWORDS="~amd64 ~x86" |
145 |
+IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test" |
146 |
+IUSE+=" binary" |
147 |
+RESTRICT="!test? ( test )" |
148 |
+ |
149 |
+RDEPEND=" |
150 |
+ >=dev-lang/perl-5.6.1 |
151 |
+ dev-libs/gmp:0= |
152 |
+ sys-libs/ncurses:0=[unicode] |
153 |
+ elfutils? ( dev-libs/elfutils ) |
154 |
+ !ghcmakebinary? ( dev-libs/libffi:= ) |
155 |
+ numa? ( sys-process/numactl ) |
156 |
+" |
157 |
+ |
158 |
+# This set of dependencies is needed to run |
159 |
+# prebuilt ghc. We specifically avoid ncurses |
160 |
+# dependency with: |
161 |
+# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING |
162 |
+PREBUILT_BINARY_DEPENDS=" |
163 |
+ !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) ) |
164 |
+" |
165 |
+# This set of dependencies is needed to install |
166 |
+# ghc[binary] in system. terminfo package is linked |
167 |
+# against ncurses. |
168 |
+PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS} |
169 |
+ sys-libs/ncurses:0/6 |
170 |
+" |
171 |
+ |
172 |
+RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )" |
173 |
+ |
174 |
+DEPEND="${RDEPEND} |
175 |
+ doc? ( app-text/docbook-xml-dtd:4.2 |
176 |
+ app-text/docbook-xml-dtd:4.5 |
177 |
+ app-text/docbook-xsl-stylesheets |
178 |
+ dev-python/sphinx |
179 |
+ >=dev-libs/libxslt-1.1.2 ) |
180 |
+ !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )" |
181 |
+ |
182 |
+# we build binaries without profiling support |
183 |
+REQUIRED_USE=" |
184 |
+ ?? ( ghcbootstrap binary ) |
185 |
+ ?? ( profile binary ) |
186 |
+" |
187 |
+ |
188 |
+# haskell libraries built with cabal in configure mode, #515354 |
189 |
+QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc" |
190 |
+ |
191 |
+is_crosscompile() { |
192 |
+ [[ ${CHOST} != ${CTARGET} ]] |
193 |
+} |
194 |
+ |
195 |
+is_native() { |
196 |
+ [[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]] |
197 |
+} |
198 |
+ |
199 |
+if ! is_crosscompile; then |
200 |
+ PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )" |
201 |
+fi |
202 |
+ |
203 |
+# returns tool prefix for crosscompiler. |
204 |
+# Example: |
205 |
+# CTARGET=armv7a-unknown-linux-gnueabi |
206 |
+# CHOST=x86_64-pc-linux-gnu |
207 |
+# "armv7a-unknown-linux-gnueabi-" |
208 |
+# CTARGET=${CHOST} |
209 |
+# "" |
210 |
+# Used in tools and library prefix: |
211 |
+# "${ED}"/usr/bin/$(cross)haddock |
212 |
+# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d" |
213 |
+ |
214 |
+cross() { |
215 |
+ if is_crosscompile; then |
216 |
+ echo "${CTARGET}-" |
217 |
+ else |
218 |
+ echo "" |
219 |
+ fi |
220 |
+} |
221 |
+ |
222 |
+append-ghc-cflags() { |
223 |
+ local persistent compile assemble link |
224 |
+ local flag ghcflag |
225 |
+ |
226 |
+ for flag in $*; do |
227 |
+ case ${flag} in |
228 |
+ persistent) persistent="yes";; |
229 |
+ compile) compile="yes";; |
230 |
+ assemble) assemble="yes";; |
231 |
+ link) link="yes";; |
232 |
+ *) |
233 |
+ [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" && |
234 |
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}" |
235 |
+ [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" && |
236 |
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}" |
237 |
+ [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" && |
238 |
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}" |
239 |
+ ;; |
240 |
+ esac |
241 |
+ done |
242 |
+} |
243 |
+ |
244 |
+# $1 - lib name (under libraries/) |
245 |
+# $2 - lib version |
246 |
+# example: bump_lib "transformers" "0.4.2.0" |
247 |
+bump_lib() { |
248 |
+ local pn=$1 pv=$2 |
249 |
+ local p=${pn}-${pv} |
250 |
+ local f |
251 |
+ |
252 |
+ einfo "Bumping ${pn} up to ${pv}" |
253 |
+ |
254 |
+ for f in ghc.mk GNUmakefile; do |
255 |
+ mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die |
256 |
+ done |
257 |
+ mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die |
258 |
+ mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die |
259 |
+} |
260 |
+ |
261 |
+update_SRC_URI() { |
262 |
+ local p pn pv |
263 |
+ for p in "${BUMP_LIBRARIES[@]}"; do |
264 |
+ set -- $p |
265 |
+ pn=$1 pv=$2 |
266 |
+ |
267 |
+ SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz" |
268 |
+ done |
269 |
+} |
270 |
+ |
271 |
+update_SRC_URI |
272 |
+ |
273 |
+bump_libs() { |
274 |
+ local p pn pv |
275 |
+ for p in "${BUMP_LIBRARIES[@]}"; do |
276 |
+ set -- $p |
277 |
+ pn=$1 pv=$2 |
278 |
+ |
279 |
+ bump_lib "${pn}" "${pv}" |
280 |
+ done |
281 |
+} |
282 |
+ |
283 |
+ghc_setup_cflags() { |
284 |
+ # TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N> |
285 |
+ if ! is_native; then |
286 |
+ export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"} |
287 |
+ export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"} |
288 |
+ einfo "Crosscompiling mode:" |
289 |
+ einfo " CHOST: ${CHOST}" |
290 |
+ einfo " CTARGET: ${CTARGET}" |
291 |
+ einfo " CFLAGS: ${CFLAGS}" |
292 |
+ einfo " LDFLAGS: ${LDFLAGS}" |
293 |
+ einfo " prefix: $(cross)" |
294 |
+ return |
295 |
+ fi |
296 |
+ # We need to be very careful with the CFLAGS we ask ghc to pass through to |
297 |
+ # gcc. There are plenty of flags which will make gcc produce output that |
298 |
+ # breaks ghc in various ways. The main ones we want to pass through are |
299 |
+ # -mcpu / -march flags. These are important for arches like alpha & sparc. |
300 |
+ # We also use these CFLAGS for building the C parts of ghc, ie the rts. |
301 |
+ strip-flags |
302 |
+ strip-unsupported-flags |
303 |
+ |
304 |
+ # Cmm can't parse line numbers #482086 |
305 |
+ replace-flags -ggdb[3-9] -ggdb2 |
306 |
+ |
307 |
+ GHC_FLAGS="" |
308 |
+ GHC_PERSISTENT_FLAGS="" |
309 |
+ for flag in ${CFLAGS}; do |
310 |
+ case ${flag} in |
311 |
+ |
312 |
+ # Ignore extra optimisation (ghc passes -O to gcc anyway) |
313 |
+ # -O2 and above break on too many systems |
314 |
+ -O*) ;; |
315 |
+ |
316 |
+ # Arch and ABI flags are what we're really after |
317 |
+ -m*) append-ghc-cflags compile assemble ${flag};; |
318 |
+ |
319 |
+ # Sometimes it's handy to see backtrace of RTS |
320 |
+ # to get an idea what happens there |
321 |
+ -g*) append-ghc-cflags compile ${flag};; |
322 |
+ |
323 |
+ # Ignore all other flags, including all -f* flags |
324 |
+ esac |
325 |
+ done |
326 |
+ |
327 |
+ for flag in ${LDFLAGS}; do |
328 |
+ append-ghc-cflags link ${flag} |
329 |
+ done |
330 |
+ |
331 |
+ # GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build. |
332 |
+ # Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported |
333 |
+ # options to gcc. |
334 |
+ if is_native; then |
335 |
+ # prevent from failing to build unregisterised ghc: |
336 |
+ # https://www.mail-archive.com/debian-bugs-dist@××××××××××××.org/msg171602.html |
337 |
+ use ppc64 && append-ghc-cflags persistent compile -mminimal-toc |
338 |
+ fi |
339 |
+} |
340 |
+ |
341 |
+# substitutes string $1 to $2 in files $3 $4 ... |
342 |
+relocate_path() { |
343 |
+ local from=$1 |
344 |
+ local to=$2 |
345 |
+ shift 2 |
346 |
+ local file= |
347 |
+ for file in "$@" |
348 |
+ do |
349 |
+ sed -i -e "s|$from|$to|g" \ |
350 |
+ "$file" || die "path relocation failed for '$file'" |
351 |
+ done |
352 |
+} |
353 |
+ |
354 |
+# changes hardcoded ghc paths and updates package index |
355 |
+# $1 - new absolute root path |
356 |
+relocate_ghc() { |
357 |
+ local to=$1 ghc_v=${BIN_PV} |
358 |
+ |
359 |
+ # libdir for prebuilt binary and for current system may mismatch |
360 |
+ # It does for prefix installation for example: bug #476998 |
361 |
+ local bin_ghc_prefix=${WORKDIR}/usr |
362 |
+ local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*) |
363 |
+ local bin_libdir=${bin_libpath#${bin_ghc_prefix}/} |
364 |
+ |
365 |
+ # backup original script to use it later after relocation |
366 |
+ local gp_back="${T}/ghc-pkg-${ghc_v}-orig" |
367 |
+ cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper" |
368 |
+ |
369 |
+ if [[ ${bin_libdir} != $(get_libdir) ]]; then |
370 |
+ einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)" |
371 |
+ # moving the dir itself is not strictly needed |
372 |
+ # but then USE=binary would result in installing |
373 |
+ # in '${bin_libdir}' |
374 |
+ mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die |
375 |
+ |
376 |
+ relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \ |
377 |
+ "${WORKDIR}/usr/bin/ghc-${ghc_v}" \ |
378 |
+ "${WORKDIR}/usr/bin/ghci-${ghc_v}" \ |
379 |
+ "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \ |
380 |
+ "${WORKDIR}/usr/bin/hsc2hs" \ |
381 |
+ "${WORKDIR}/usr/bin/runghc-${ghc_v}" \ |
382 |
+ "$gp_back" \ |
383 |
+ "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"* |
384 |
+ fi |
385 |
+ |
386 |
+ # Relocate from /usr to ${EPREFIX}/usr |
387 |
+ relocate_path "/usr" "${to}/usr" \ |
388 |
+ "${WORKDIR}/usr/bin/ghc-${ghc_v}" \ |
389 |
+ "${WORKDIR}/usr/bin/ghci-${ghc_v}" \ |
390 |
+ "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \ |
391 |
+ "${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \ |
392 |
+ "${WORKDIR}/usr/bin/hp2ps" \ |
393 |
+ "${WORKDIR}/usr/bin/hpc" \ |
394 |
+ "${WORKDIR}/usr/bin/hsc2hs" \ |
395 |
+ "${WORKDIR}/usr/bin/runghc-${ghc_v}" \ |
396 |
+ "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"* |
397 |
+ |
398 |
+ # this one we will use to regenerate cache |
399 |
+ # so it should point to current tree location |
400 |
+ relocate_path "/usr" "${WORKDIR}/usr" "$gp_back" |
401 |
+ |
402 |
+ if use prefix; then |
403 |
+ hprefixify "${bin_libpath}"/${PN}*/settings |
404 |
+ fi |
405 |
+ |
406 |
+ # regenerate the binary package cache |
407 |
+ "$gp_back" recache || die "failed to update cache after relocation" |
408 |
+ rm "$gp_back" |
409 |
+} |
410 |
+ |
411 |
+ghc-check-reqs() { |
412 |
+ # These are pessimistic values (slightly bigger than worst-case) |
413 |
+ # Worst case is UNREG USE=profile ia64. See bug #611866 for some |
414 |
+ # numbers on various arches. |
415 |
+ CHECKREQS_DISK_BUILD=8G |
416 |
+ CHECKREQS_DISK_USR=2G |
417 |
+ # USE=binary roughly takes |
418 |
+ use binary && CHECKREQS_DISK_BUILD=4G |
419 |
+ |
420 |
+ "$@" |
421 |
+} |
422 |
+ |
423 |
+pkg_pretend() { |
424 |
+ ghc-check-reqs check-reqs_pkg_pretend |
425 |
+} |
426 |
+ |
427 |
+pkg_setup() { |
428 |
+ ghc-check-reqs check-reqs_pkg_setup |
429 |
+ |
430 |
+ # quiet portage about prebuilt binaries |
431 |
+ use binary && QA_PREBUILT="*" |
432 |
+ |
433 |
+ [[ ${MERGE_TYPE} == binary ]] && return |
434 |
+ |
435 |
+ if use ghcbootstrap; then |
436 |
+ ewarn "You requested ghc bootstrapping, this is usually only used" |
437 |
+ ewarn "by Gentoo developers to make binary .tbz2 packages." |
438 |
+ |
439 |
+ [[ -z $(type -P ghc) ]] && \ |
440 |
+ die "Could not find a ghc to bootstrap with." |
441 |
+ else |
442 |
+ if ! yet_binary; then |
443 |
+ eerror "Please try emerging with USE=ghcbootstrap and report build" |
444 |
+ eerror "sucess or failure to the haskell team (haskell@g.o)" |
445 |
+ die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap" |
446 |
+ fi |
447 |
+ fi |
448 |
+} |
449 |
+ |
450 |
+src_unpack() { |
451 |
+ # Create the ${S} dir if we're using the binary version |
452 |
+ use binary && mkdir "${S}" |
453 |
+ |
454 |
+ # the Solaris and Darwin binaries from ghc (maeder) need to be |
455 |
+ # unpacked separately, so prevent them from being unpacked |
456 |
+ local ONLYA=${A} |
457 |
+ case ${CHOST} in |
458 |
+ *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;; |
459 |
+ esac |
460 |
+ unpack ${ONLYA} |
461 |
+} |
462 |
+ |
463 |
+src_prepare() { |
464 |
+ ghc_setup_cflags |
465 |
+ |
466 |
+ if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then |
467 |
+ # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS. |
468 |
+ # See bug #313635. |
469 |
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \ |
470 |
+ "${WORKDIR}/usr/bin/ghc-${BIN_PV}" |
471 |
+ |
472 |
+ # allow hardened users use vanilla binary to bootstrap ghc |
473 |
+ # ghci uses mmap with rwx protection at it implements dynamic |
474 |
+ # linking on it's own (bug #299709) |
475 |
+ pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc" |
476 |
+ fi |
477 |
+ |
478 |
+ if use binary; then |
479 |
+ if use prefix; then |
480 |
+ relocate_ghc "${EPREFIX}" |
481 |
+ fi |
482 |
+ |
483 |
+ # Move unpacked files to the expected place |
484 |
+ mv "${WORKDIR}/usr" "${S}" |
485 |
+ eapply_user |
486 |
+ else |
487 |
+ if ! use ghcbootstrap; then |
488 |
+ case ${CHOST} in |
489 |
+ *-darwin* | *-solaris*) |
490 |
+ # UPDATE ME for ghc-7 |
491 |
+ mkdir "${WORKDIR}"/ghc-bin-installer || die |
492 |
+ pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die |
493 |
+ use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2 |
494 |
+ use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2 |
495 |
+ use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2 |
496 |
+ use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2 |
497 |
+ popd > /dev/null |
498 |
+ |
499 |
+ pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die |
500 |
+ # fix the binaries so they run, on Solaris we need an |
501 |
+ # LD_LIBRARY_PATH which has our prefix libdirs, on |
502 |
+ # Darwin we need to replace the frameworks with our libs |
503 |
+ # from the prefix fix before installation, because some |
504 |
+ # of the tools are actually used during configure/make |
505 |
+ if [[ ${CHOST} == *-solaris* ]] ; then |
506 |
+ export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}" |
507 |
+ elif [[ ${CHOST} == *-darwin* ]] ; then |
508 |
+ local readline_framework=GNUreadline.framework/GNUreadline |
509 |
+ local gmp_framework=/opt/local/lib/libgmp.10.dylib |
510 |
+ local ncurses_file=/opt/local/lib/libncurses.5.dylib |
511 |
+ for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do |
512 |
+ install_name_tool -change \ |
513 |
+ ${readline_framework} \ |
514 |
+ "${EPREFIX}"/lib/libreadline.dylib \ |
515 |
+ ${binary} || die |
516 |
+ install_name_tool -change \ |
517 |
+ ${gmp_framework} \ |
518 |
+ "${EPREFIX}"/usr/lib/libgmp.dylib \ |
519 |
+ ${binary} || die |
520 |
+ install_name_tool -change \ |
521 |
+ ${ncurses_file} \ |
522 |
+ "${EPREFIX}"/usr/lib/libncurses.dylib \ |
523 |
+ ${binary} || die |
524 |
+ done |
525 |
+ # we don't do frameworks! |
526 |
+ sed -i \ |
527 |
+ -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \ |
528 |
+ -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \ |
529 |
+ rts/package.conf.in || die |
530 |
+ fi |
531 |
+ |
532 |
+ # it is autoconf, but we really don't want to give it too |
533 |
+ # many arguments, in fact we do the make in-place anyway |
534 |
+ ./configure --prefix="${WORKDIR}"/usr || die |
535 |
+ make install || die |
536 |
+ popd > /dev/null |
537 |
+ ;; |
538 |
+ *) |
539 |
+ relocate_ghc "${WORKDIR}" |
540 |
+ ;; |
541 |
+ esac |
542 |
+ fi |
543 |
+ |
544 |
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \ |
545 |
+ "${S}/ghc/ghc.wrapper" |
546 |
+ |
547 |
+ cd "${S}" # otherwise eapply will break |
548 |
+ |
549 |
+ eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch |
550 |
+ eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch |
551 |
+ eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch |
552 |
+ eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch |
553 |
+ eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch |
554 |
+ eapply "${FILESDIR}"/${PN}-8.10.3-C99-typo-ac270.patch |
555 |
+ |
556 |
+ # a bunch of crosscompiler patches |
557 |
+ # needs newer version: |
558 |
+ #eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch |
559 |
+ |
560 |
+ # mingw32 target |
561 |
+ pushd "${S}/libraries/Win32" |
562 |
+ eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround |
563 |
+ popd |
564 |
+ |
565 |
+ bump_libs |
566 |
+ |
567 |
+ eapply_user |
568 |
+ # as we have changed the build system |
569 |
+ eautoreconf |
570 |
+ fi |
571 |
+} |
572 |
+ |
573 |
+src_configure() { |
574 |
+ if ! use binary; then |
575 |
+ # initialize build.mk |
576 |
+ echo '# Gentoo changes' > mk/build.mk |
577 |
+ |
578 |
+ # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV} |
579 |
+ echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk |
580 |
+ echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk |
581 |
+ |
582 |
+ # We also need to use the GHC_FLAGS flags when building ghc itself |
583 |
+ echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk |
584 |
+ echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk |
585 |
+ echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk |
586 |
+ # Speed up initial Cabal bootstrap |
587 |
+ echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk |
588 |
+ |
589 |
+ # We can't depend on haddock except when bootstrapping when we |
590 |
+ # must build docs and include them into the binary .tbz2 package |
591 |
+ # app-text/dblatex is not in portage, can not build PDF or PS |
592 |
+ echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk |
593 |
+ echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk |
594 |
+ echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk |
595 |
+ |
596 |
+ # this controls presence on 'xhtml' and 'haddock' in final install |
597 |
+ echo "HADDOCK_DOCS = YES" >> mk/build.mk |
598 |
+ |
599 |
+ # not used outside of ghc's test |
600 |
+ if [[ -n ${GHC_BUILD_DPH} ]]; then |
601 |
+ echo "BUILD_DPH = YES" >> mk/build.mk |
602 |
+ else |
603 |
+ echo "BUILD_DPH = NO" >> mk/build.mk |
604 |
+ fi |
605 |
+ |
606 |
+ # Any non-native build has to skip as it needs |
607 |
+ # target haddock binary to be runnabine. |
608 |
+ if ! is_native; then |
609 |
+ # disable docs generation as it requires running stage2 |
610 |
+ echo "HADDOCK_DOCS=NO" >> mk/build.mk |
611 |
+ echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk |
612 |
+ echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk |
613 |
+ fi |
614 |
+ |
615 |
+ if is_crosscompile; then |
616 |
+ # Install ghc-stage1 crosscompiler instead of |
617 |
+ # ghc-stage2 cross-built compiler. |
618 |
+ echo "Stage1Only=YES" >> mk/build.mk |
619 |
+ fi |
620 |
+ |
621 |
+ # allows overriding build flavours for libraries: |
622 |
+ # v - vanilla (static libs) |
623 |
+ # p - profiled |
624 |
+ # dyn - shared libraries |
625 |
+ # example: GHC_LIBRARY_WAYS="v dyn" |
626 |
+ if [[ -n ${GHC_LIBRARY_WAYS} ]]; then |
627 |
+ echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk |
628 |
+ fi |
629 |
+ echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk |
630 |
+ |
631 |
+ # Get ghc from the unpacked binary .tbz2 |
632 |
+ # except when bootstrapping we just pick ghc up off the path |
633 |
+ if ! use ghcbootstrap; then |
634 |
+ export PATH="${WORKDIR}/usr/bin:${PATH}" |
635 |
+ fi |
636 |
+ |
637 |
+ echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk |
638 |
+ |
639 |
+ # don't strip anything. Very useful when stage2 SIGSEGVs on you |
640 |
+ echo "STRIP_CMD = :" >> mk/build.mk |
641 |
+ |
642 |
+ local econf_args=() |
643 |
+ |
644 |
+ # GHC embeds toolchain it was built by and uses it later. |
645 |
+ # Don't allow things like ccache or versioned binary slip. |
646 |
+ # We use stable thing across gcc upgrades. |
647 |
+ # User can use EXTRA_ECONF=CC=... to override this default. |
648 |
+ econf_args+=( |
649 |
+ AR=${CTARGET}-ar |
650 |
+ CC=${CTARGET}-gcc |
651 |
+ # these should be inferred by GHC but ghc defaults |
652 |
+ # to using bundled tools on windows. |
653 |
+ Windres=${CTARGET}-windres |
654 |
+ DllWrap=${CTARGET}-dllwrap |
655 |
+ # we set the linker explicitly below |
656 |
+ --disable-ld-override |
657 |
+ ) |
658 |
+ case ${CTARGET} in |
659 |
+ arm*) |
660 |
+ # ld.bfd-2.28 does not work for ghc. Force ld.gold |
661 |
+ # instead. This should be removed once gentoo gets |
662 |
+ # a fix for R_ARM_COPY bug: https://sourceware.org/PR16177 |
663 |
+ econf_args+=(LD=${CTARGET}-ld.gold) |
664 |
+ ;; |
665 |
+ sparc*) |
666 |
+ # ld.gold-2.28 does not work for ghc. Force ld.bfd |
667 |
+ # instead. This should be removed once gentoo gets |
668 |
+ # a fix for missing --no-relax support bug: |
669 |
+ # https://sourceware.org/ml/binutils/2017-07/msg00183.html |
670 |
+ econf_args+=(LD=${CTARGET}-ld.bfd) |
671 |
+ ;; |
672 |
+ *) |
673 |
+ econf_args+=(LD=${CTARGET}-ld) |
674 |
+ esac |
675 |
+ |
676 |
+ if [[ ${CBUILD} != ${CHOST} ]]; then |
677 |
+ # GHC bug: ghc claims not to support cross-building. |
678 |
+ # It does, but does not distinct --host= value |
679 |
+ # for stage1 and stage2 compiler. |
680 |
+ econf_args+=(--host=${CBUILD}) |
681 |
+ fi |
682 |
+ |
683 |
+ if use ghcmakebinary; then |
684 |
+ # When building booting libary we are trying to |
685 |
+ # bundle or restrict most of external depends |
686 |
+ # with unstable ABI: |
687 |
+ # - embed libffi (default GHC behaviour) |
688 |
+ # - disable ncurses support for ghci (via haskeline) |
689 |
+ # https://bugs.gentoo.org/557478 |
690 |
+ # - disable ncurses support for ghc-pkg |
691 |
+ echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk |
692 |
+ echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk |
693 |
+ elif is_native; then |
694 |
+ # using ${GTARGET}'s libffi is not supported yet: |
695 |
+ # GHC embeds full path for ffi includes without /usr/${CTARGET} account. |
696 |
+ econf_args+=(--with-system-libffi) |
697 |
+ econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@')) |
698 |
+ fi |
699 |
+ |
700 |
+ einfo "Final mk/build.mk:" |
701 |
+ cat mk/build.mk || die |
702 |
+ |
703 |
+ econf ${econf_args[@]} \ |
704 |
+ --enable-bootstrap-with-devel-snapshot \ |
705 |
+ $(use_enable elfutils dwarf-unwind) \ |
706 |
+ $(use_enable numa) |
707 |
+ |
708 |
+ if [[ ${PV} == *9999* ]]; then |
709 |
+ GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')" |
710 |
+ GHC_P=${PN}-${GHC_PV} |
711 |
+ fi |
712 |
+ fi # ! use binary |
713 |
+} |
714 |
+ |
715 |
+src_compile() { |
716 |
+ if ! use binary; then |
717 |
+ # Stage1Only crosscompiler does not build stage2 |
718 |
+ if ! is_crosscompile; then |
719 |
+ # 1. build/pax-mark compiler binary first |
720 |
+ emake ghc/stage2/build/tmp/ghc-stage2 |
721 |
+ # 2. pax-mark (bug #516430) |
722 |
+ pax-mark -m ghc/stage2/build/tmp/ghc-stage2 |
723 |
+ # 2. build/pax-mark haddock using ghc-stage2 |
724 |
+ if is_native; then |
725 |
+ # non-native build does not build haddock |
726 |
+ # due to HADDOCK_DOCS=NO, but it could. |
727 |
+ emake utils/haddock/dist/build/tmp/haddock |
728 |
+ pax-mark -m utils/haddock/dist/build/tmp/haddock |
729 |
+ fi |
730 |
+ fi |
731 |
+ # 3. and then all the rest |
732 |
+ emake all |
733 |
+ fi # ! use binary |
734 |
+} |
735 |
+ |
736 |
+src_test() { |
737 |
+ # TODO: deal with: |
738 |
+ # - sandbox (pollutes environment) |
739 |
+ # - extra packages (to extend testsuite coverage) |
740 |
+ # bits are taken from 'validate' |
741 |
+ local make_test_target='test' # can be fulltest |
742 |
+ # not 'emake' as testsuite uses '$MAKE' without jobserver available |
743 |
+ make $make_test_target stage=2 THREADS=$(makeopts_jobs) |
744 |
+} |
745 |
+ |
746 |
+src_install() { |
747 |
+ if use binary; then |
748 |
+ use prefix && mkdir -p "${ED}" |
749 |
+ mv "${S}/usr" "${ED}" |
750 |
+ else |
751 |
+ [[ -f VERSION ]] || emake VERSION |
752 |
+ |
753 |
+ # -j1 due to a rare race in install script: |
754 |
+ # make --no-print-directory -f ghc.mk phase=final install |
755 |
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \ |
756 |
+ # -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include" |
757 |
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \ |
758 |
+ # "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404" |
759 |
+ # /usr/bin/install: cannot create regular file \ |
760 |
+ # '/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404': No such file or directory |
761 |
+ emake -j1 install DESTDIR="${D}" |
762 |
+ |
763 |
+ # Skip for cross-targets as they all share target location: |
764 |
+ # /usr/share/doc/ghc-9999/ |
765 |
+ if ! is_crosscompile; then |
766 |
+ dodoc "distrib/README" "LICENSE" "VERSION" |
767 |
+ fi |
768 |
+ |
769 |
+ # rename ghc-shipped files to avoid collision |
770 |
+ # of external packages. Motivating example: |
771 |
+ # user had installed: |
772 |
+ # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0) |
773 |
+ # dev-haskell/transformers-0.4.2.0 |
774 |
+ # then user tried to update to |
775 |
+ # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0) |
776 |
+ # this will lead to single .conf file collision. |
777 |
+ local shipped_conf renamed_conf |
778 |
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d" |
779 |
+ for shipped_conf in "${package_confdir}"/*.conf; do |
780 |
+ # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf' |
781 |
+ renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf |
782 |
+ mv "${shipped_conf}" "${renamed_conf}" || die |
783 |
+ done |
784 |
+ |
785 |
+ # remove link, but leave 'haddock-${GHC_P}' |
786 |
+ rm -f "${ED}"/usr/bin/$(cross)haddock |
787 |
+ |
788 |
+ if ! is_crosscompile; then |
789 |
+ newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg |
790 |
+ newbashcomp utils/completion/ghc.bash ghc |
791 |
+ fi |
792 |
+ fi |
793 |
+ |
794 |
+ # path to the package.cache |
795 |
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d" |
796 |
+ PKGCACHE="${package_confdir}"/package.cache |
797 |
+ # copy the package.conf.d, including timestamp, save it so we can help |
798 |
+ # users that have a broken package.conf.d |
799 |
+ cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d" |
800 |
+ |
801 |
+ # copy the package.conf, including timestamp, save it so we later can put it |
802 |
+ # back before uninstalling, or when upgrading. |
803 |
+ cp -p "${PKGCACHE}"{,.shipped} \ |
804 |
+ || die "failed to copy package.conf.d/package.cache" |
805 |
+ |
806 |
+ if is_crosscompile; then |
807 |
+ # When we build a cross-compiler the layout is the following: |
808 |
+ # usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries |
809 |
+ # but |
810 |
+ # usr/lib/${CTARGET}-ghc-${VER}/bin/ directory |
811 |
+ # containst host binaries (modulo bugs). |
812 |
+ |
813 |
+ # Portage's stripping mechanism does not skip stripping |
814 |
+ # foreign binaries. This frequently causes binaries to be |
815 |
+ # broken. |
816 |
+ # |
817 |
+ # Thus below we disable stripping of target libraries and allow |
818 |
+ # stripping hosts executables. |
819 |
+ dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}" |
820 |
+ dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin" |
821 |
+ fi |
822 |
+} |
823 |
+ |
824 |
+pkg_preinst() { |
825 |
+ # have we got an earlier version of ghc installed? |
826 |
+ if has_version "<${CATEGORY}/${PF}"; then |
827 |
+ haskell_updater_warn="1" |
828 |
+ fi |
829 |
+} |
830 |
+ |
831 |
+pkg_postinst() { |
832 |
+ ghc-reregister |
833 |
+ |
834 |
+ # path to the package.cache |
835 |
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache" |
836 |
+ |
837 |
+ # give the cache a new timestamp, it must be as recent as |
838 |
+ # the package.conf.d directory. |
839 |
+ touch "${PKGCACHE}" |
840 |
+ |
841 |
+ if [[ "${haskell_updater_warn}" == "1" ]]; then |
842 |
+ ewarn |
843 |
+ ewarn "\e[1;31m************************************************************************\e[0m" |
844 |
+ ewarn |
845 |
+ ewarn "You have just upgraded from an older version of GHC." |
846 |
+ ewarn "You may have to run" |
847 |
+ ewarn " 'haskell-updater'" |
848 |
+ ewarn "to rebuild all ghc-based Haskell libraries." |
849 |
+ ewarn |
850 |
+ ewarn "\e[1;31m************************************************************************\e[0m" |
851 |
+ ewarn |
852 |
+ fi |
853 |
+} |
854 |
+ |
855 |
+pkg_prerm() { |
856 |
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache" |
857 |
+ rm -rf "${PKGCACHE}" |
858 |
+ |
859 |
+ cp -p "${PKGCACHE}"{.shipped,} |
860 |
+} |
861 |
+ |
862 |
+pkg_postrm() { |
863 |
+ ghc-package_pkg_postrm |
864 |
+} |