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