1 |
commit: 0fdbbebbdc4b18e4078870a6a579834c64177219 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Aug 27 22:24:35 2015 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Aug 27 22:24:49 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0fdbbebb |
7 |
|
8 |
dev-lang/ghc: get rid of ncurses runtime dependency, bug #557478 |
9 |
|
10 |
Recently gentoo updated ncurses to sys-libs/ncurses-6.0. |
11 |
It changed ABI from libncursesw.so.5 to libncursesw.so.6 |
12 |
in an incompatible way. |
13 |
|
14 |
The change disables ncurses backend for haskeline for |
15 |
booter binary (USE=ghcmakebinary). |
16 |
|
17 |
Bug: https://bugs.gentoo.org/show_bug.cgi?id=557478 |
18 |
|
19 |
Package-Manager: portage-2.2.20 |
20 |
|
21 |
dev-lang/ghc/Manifest | 2 + |
22 |
dev-lang/ghc/ghc-7.10.2-r1.ebuild | 651 ++++++++++++++++++++++++++++++++++++++ |
23 |
2 files changed, 653 insertions(+) |
24 |
|
25 |
diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest |
26 |
index 7406de3..24c2cab 100644 |
27 |
--- a/dev-lang/ghc/Manifest |
28 |
+++ b/dev-lang/ghc/Manifest |
29 |
@@ -6,6 +6,8 @@ DIST ghc-7.8.3-src.tar.xz 9160092 SHA256 b0cd96a549ba3b5e512847a4a8cd1a3174e4b2b |
30 |
DIST ghc-7.8.4-ia64-CLOSUREs-regenerated.patch.gz 13268 SHA256 3bdff22e654aee6f942d43edf1bf6cf70404c0152c4fcf89276f10d2c4c5b4b9 SHA512 a655713e06324b56f0041edf70837487e296d28e6f3ee35fe116b9938765aaf3469d25e92645e0940655ed3607dff27d3826fe0f995c84e81b51bfc956816e7d WHIRLPOOL d2cb53bdc6debc0278d554168ea3ab22b0fd8314adac81444637278a92d21b766280fedfb4b7d1b4540c7381c7962dec6b13a799ab2fee4d456fe2875d5c6a5b |
31 |
DIST ghc-7.8.4-src.tar.bz2 10600755 SHA256 59e3bd514a1820cc1c03e1808282205c0b8518369acae12645ceaf839e6f114b SHA512 079a53891d8ebd8d9b88da96170e60981608a619f8282e4b7948f35244e99bd87277649ac7fcebc227a61a4d21960db8d5e5b9e92f2c69c82d8d68d7fd0a41d3 WHIRLPOOL a9be7641adbd237ed6e0f644c312e655e98be9566097aee5e2c0022e8756d5b2236e42dd86d76c638a001b5ca3f67307e89ec0cd003a92cd112a5d6d3e3d8467 |
32 |
DIST ghc-bin-7.10.2-amd64.tbz2 112028560 SHA256 536297ac402da44ec1aafb1a937960883d12d192db16715ca34ab6469773a4c7 SHA512 207d8032c99d52bf4215ddeea2dbcd5816bb8d4caf2c3c31190e3ca92b49667d98a4f97aaf4cd6b40090f150854d520f75b5420dfe1ade7f036cf35d3dcb5100 WHIRLPOOL 8e43956a61c2c0fead242e3b179cde4918c04f3db7dbb27cc986f00f981261d98028ead82548b87d183d8da928635d5db4aa62ff1161f4077e5370483530a316 |
33 |
+DIST ghc-bin-7.10.2-r1-amd64.tbz2 111915962 SHA256 3c5972b69be650bc2d3a07ff8a6be97a2d8fd07387aee155183960ebcd7bd60c SHA512 e87c7c177cbfac7e8206c3ad94ab36d568d3b294311b60df5db50e3c6d46e0b5fae77b8b74701b6920f419c0bc7f763fe478760f14b00c1fc18fb79e9b17bb4f WHIRLPOOL b5be3ef924d729e77626ce69859ffa8952e1f5053a36672cef5713aa60b7167ab9d3886cc8052cacfdb6756d50db444b3f80bca77a932719a16cc9b4583e8319 |
34 |
+DIST ghc-bin-7.10.2-r1-x86.tbz2 113566669 SHA256 d0ff86c34d009e7980d3b1ea85b24dfe3854d85cf2aece36dbad38078283a382 SHA512 a2bfef656603db15147399424733f1f97867b0ad883880ee8912bbbad7fe42646caf6023a17653119ad7ea246ffe3f2ecff5b924c6912c41fb601d51c032c2ce WHIRLPOOL 2f2d4accbbaa3202754a9463dc321d0b830bc4710db36c5ca4dcf3ae00882f34db16bf613ba52712671aee69bb5ae2747d12a29a520a29fd057c86ec20e53286 |
35 |
DIST ghc-bin-7.10.2-x86.tbz2 113900477 SHA256 eefb7a3002e3dcdd6d936b2b2826eadf3cd100352babad4c9a355b944064240a SHA512 61dae4b9c80bfef6b1e0550c77b70f25d11f4a9fbe3b57d6c4ad451b4b584884432405d39dc32b9f85f3a5ad9d02657356ae0ebd99518848f3d330314c74b595 WHIRLPOOL da0d7eb62d2ee2aeb80a3f495da2ff123e29151b7517fbcd212f83ab3722638f10019511f4f237e8e001c68dd957ed2817fb0f1a2b42c2710239343f1d801496 |
36 |
DIST ghc-bin-7.4.2-alpha.tbz2 130483507 SHA256 cd8e72e569574f137bf10fcdb4337bb0dc320deb2a2c4d72529a821735c53ae6 SHA512 6fb99dea706965afa60f4aeb68da3da1c69dda477f5fcfb4e67b73d75b78583193148ce9f623a356679a57f1a740f8010f28a22f08e56ace50f3fcd42142f83f WHIRLPOOL e5ec69ab24dc963ac709f13928c0e35931d5d50ca6b21dfb0aa79f9088c0ce1196b64bb4d9668e35d73dcdf9e2df9c3da59c95eaf3db8b793a6bb65b1f4ba6c0 |
37 |
DIST ghc-bin-7.4.2-amd64-stable-glibc.tbz2 93139900 SHA256 f06dff00585cc1a8ecc8ac29aeca7fdc601d272eed29d7613f7a2f2924cad585 SHA512 9b725f2613dd9013851a16eaea4000ea424c51cbafa97d3860f120fdb9936247f8c65208775a80a2f49b74946ddda2e843a54dec00b78c521197374aa3dd2d50 WHIRLPOOL 9e2630b1de40a059c324be38a1fe68b16ea484bc7afc2a397ea05192263d1964aed1d29fde543622ceab12ed2df111204576fdc72b7e35b2bbf9c6b9519901d1 |
38 |
|
39 |
diff --git a/dev-lang/ghc/ghc-7.10.2-r1.ebuild b/dev-lang/ghc/ghc-7.10.2-r1.ebuild |
40 |
new file mode 100644 |
41 |
index 0000000..d830880 |
42 |
--- /dev/null |
43 |
+++ b/dev-lang/ghc/ghc-7.10.2-r1.ebuild |
44 |
@@ -0,0 +1,651 @@ |
45 |
+# Copyright 1999-2015 Gentoo Foundation |
46 |
+# Distributed under the terms of the GNU General Public License v2 |
47 |
+# $Id$ |
48 |
+ |
49 |
+EAPI=5 |
50 |
+ |
51 |
+# to make make a crosscompiler use crossdev and symlink ghc tree into |
52 |
+# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc' |
53 |
+# |
54 |
+# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass' |
55 |
+export CTARGET=${CTARGET:-${CHOST}} |
56 |
+if [[ ${CTARGET} = ${CHOST} ]] ; then |
57 |
+ if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then |
58 |
+ export CTARGET=${CATEGORY/cross-} |
59 |
+ fi |
60 |
+fi |
61 |
+ |
62 |
+inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package |
63 |
+inherit multilib pax-utils toolchain-funcs versionator |
64 |
+ |
65 |
+DESCRIPTION="The Glasgow Haskell Compiler" |
66 |
+HOMEPAGE="http://www.haskell.org/ghc/" |
67 |
+ |
68 |
+# we don't have any binaries yet |
69 |
+arch_binaries="" |
70 |
+ |
71 |
+# sorted! |
72 |
+#arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )" |
73 |
+#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )" |
74 |
+arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PVR}-amd64.tbz2 )" |
75 |
+#arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )" |
76 |
+#arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )" |
77 |
+#arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )" |
78 |
+#arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )" |
79 |
+arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PVR}-x86.tbz2 )" |
80 |
+ |
81 |
+# various ports: |
82 |
+#arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )" |
83 |
+ |
84 |
+# 0 - yet |
85 |
+yet_binary() { |
86 |
+ case "${ARCH}" in |
87 |
+ #alpha) return 0 ;; |
88 |
+ #arm) |
89 |
+ # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution." |
90 |
+ # return 0 |
91 |
+ #;; |
92 |
+ amd64) return 0 ;; |
93 |
+ #ia64) return 0 ;; |
94 |
+ #ppc) return 0 ;; |
95 |
+ #ppc64) return 0 ;; |
96 |
+ #sparc) return 0 ;; |
97 |
+ x86) return 0 ;; |
98 |
+ *) return 1 ;; |
99 |
+ esac |
100 |
+} |
101 |
+ |
102 |
+GHC_PV=${PV} |
103 |
+#GHC_PV=7.10.1.20150630 # uncomment only for -rc ebuilds |
104 |
+GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct |
105 |
+ |
106 |
+#SRC_URI="!binary? ( http://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.bz2 )" |
107 |
+# Upstream tarball was repackaged and inplace-updated. CDN cached old version for |
108 |
+# many users |
109 |
+SRC_URI="!binary? ( http://dev.gentoo.org/~slyfox/distfiles/${GHC_P}-src.tar.bz2 )" |
110 |
+S="${WORKDIR}"/${GHC_P} |
111 |
+ |
112 |
+[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )" |
113 |
+ |
114 |
+BUMP_LIBRARIES=( |
115 |
+ # "hackage-name hackage-version" |
116 |
+ "binary 0.7.5.0" |
117 |
+ "hoopl 3.10.1.0" |
118 |
+ "transformers 0.4.3.0" |
119 |
+) |
120 |
+ |
121 |
+LICENSE="BSD" |
122 |
+SLOT="0/${PV}" |
123 |
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" |
124 |
+IUSE="doc ghcbootstrap ghcmakebinary +gmp" |
125 |
+IUSE+=" binary" |
126 |
+IUSE+=" elibc_glibc" # system stuff |
127 |
+ |
128 |
+RDEPEND=" |
129 |
+ >=dev-lang/perl-5.6.1 |
130 |
+ >=dev-libs/gmp-5:= |
131 |
+ sys-libs/ncurses:=[unicode] |
132 |
+ !ghcmakebinary? ( virtual/libffi:= ) |
133 |
+ !kernel_Darwin? ( >=sys-devel/gcc-2.95.3:* ) |
134 |
+ kernel_linux? ( >=sys-devel/binutils-2.17:* ) |
135 |
+ kernel_SunOS? ( >=sys-devel/binutils-2.17:* ) |
136 |
+" |
137 |
+ |
138 |
+# force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to |
139 |
+# that we want the binaries to use the latest versioun available, and not to be |
140 |
+# built against gmp-4 |
141 |
+ |
142 |
+# similar for glibc. we have bootstrapped binaries against glibc-2.17 |
143 |
+DEPEND="${RDEPEND} |
144 |
+ doc? ( app-text/docbook-xml-dtd:4.2 |
145 |
+ app-text/docbook-xml-dtd:4.5 |
146 |
+ app-text/docbook-xsl-stylesheets |
147 |
+ >=dev-libs/libxslt-1.1.2 ) |
148 |
+ !ghcbootstrap? ( !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) ) )" |
149 |
+ |
150 |
+PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )" |
151 |
+ |
152 |
+REQUIRED_USE="?? ( ghcbootstrap binary )" |
153 |
+ |
154 |
+# yeah, top-level 'use' sucks. I'd like to have it in 'src_install()' |
155 |
+use binary && QA_PREBUILT="*" |
156 |
+ |
157 |
+# haskell libraries built with cabal in configure mode, #515354 |
158 |
+QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc" |
159 |
+ |
160 |
+is_crosscompile() { |
161 |
+ [[ ${CHOST} != ${CTARGET} ]] |
162 |
+} |
163 |
+ |
164 |
+append-ghc-cflags() { |
165 |
+ local persistent compile assemble link |
166 |
+ local flag ghcflag |
167 |
+ |
168 |
+ for flag in $*; do |
169 |
+ case ${flag} in |
170 |
+ persistent) persistent="yes";; |
171 |
+ compile) compile="yes";; |
172 |
+ assemble) assemble="yes";; |
173 |
+ link) link="yes";; |
174 |
+ *) |
175 |
+ [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" && |
176 |
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}" |
177 |
+ [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" && |
178 |
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}" |
179 |
+ [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" && |
180 |
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}" |
181 |
+ ;; |
182 |
+ esac |
183 |
+ done |
184 |
+} |
185 |
+ |
186 |
+# $1 - lib name (under libraries/) |
187 |
+# $2 - lib version |
188 |
+# example: bump_lib "transformers" "0.4.2.0" |
189 |
+bump_lib() { |
190 |
+ local pn=$1 pv=$2 |
191 |
+ local p=${pn}-${pv} |
192 |
+ local f |
193 |
+ |
194 |
+ einfo "Bumping ${pn} up to ${pv}" |
195 |
+ |
196 |
+ for f in ghc.mk GNUmakefile; do |
197 |
+ mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die |
198 |
+ done |
199 |
+ mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die |
200 |
+ mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die |
201 |
+} |
202 |
+ |
203 |
+update_SRC_URI() { |
204 |
+ local p pn pv |
205 |
+ for p in "${BUMP_LIBRARIES[@]}"; do |
206 |
+ set -- $p |
207 |
+ pn=$1 pv=$2 |
208 |
+ |
209 |
+ SRC_URI+=" mirror://hackage/package/${pn}/${pn}-${pv}.tar.gz" |
210 |
+ done |
211 |
+} |
212 |
+ |
213 |
+update_SRC_URI |
214 |
+ |
215 |
+bump_libs() { |
216 |
+ local p pn pv |
217 |
+ for p in "${BUMP_LIBRARIES[@]}"; do |
218 |
+ set -- $p |
219 |
+ pn=$1 pv=$2 |
220 |
+ |
221 |
+ bump_lib "${pn}" "${pv}" |
222 |
+ done |
223 |
+} |
224 |
+ |
225 |
+ghc_setup_cflags() { |
226 |
+ if is_crosscompile; then |
227 |
+ export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"} |
228 |
+ export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"} |
229 |
+ einfo "Crosscompiling mode:" |
230 |
+ einfo " CHOST: ${CHOST}" |
231 |
+ einfo " CTARGET: ${CTARGET}" |
232 |
+ einfo " CFLAGS: ${CFLAGS}" |
233 |
+ einfo " LDFLAGS: ${LDFLAGS}" |
234 |
+ return |
235 |
+ fi |
236 |
+ # We need to be very careful with the CFLAGS we ask ghc to pass through to |
237 |
+ # gcc. There are plenty of flags which will make gcc produce output that |
238 |
+ # breaks ghc in various ways. The main ones we want to pass through are |
239 |
+ # -mcpu / -march flags. These are important for arches like alpha & sparc. |
240 |
+ # We also use these CFLAGS for building the C parts of ghc, ie the rts. |
241 |
+ strip-flags |
242 |
+ strip-unsupported-flags |
243 |
+ |
244 |
+ # Cmm can't parse line numbers #482086 |
245 |
+ replace-flags -ggdb[3-9] -ggdb2 |
246 |
+ |
247 |
+ GHC_FLAGS="" |
248 |
+ GHC_PERSISTENT_FLAGS="" |
249 |
+ for flag in ${CFLAGS}; do |
250 |
+ case ${flag} in |
251 |
+ |
252 |
+ # Ignore extra optimisation (ghc passes -O to gcc anyway) |
253 |
+ # -O2 and above break on too many systems |
254 |
+ -O*) ;; |
255 |
+ |
256 |
+ # Arch and ABI flags are what we're really after |
257 |
+ -m*) append-ghc-cflags compile assemble ${flag};; |
258 |
+ |
259 |
+ # Sometimes it's handy to see backtrace of RTS |
260 |
+ # to get an idea what happens there |
261 |
+ -g*) append-ghc-cflags compile ${flag};; |
262 |
+ |
263 |
+ # Ignore all other flags, including all -f* flags |
264 |
+ esac |
265 |
+ done |
266 |
+ |
267 |
+ for flag in ${LDFLAGS}; do |
268 |
+ append-ghc-cflags link ${flag} |
269 |
+ done |
270 |
+ |
271 |
+ # hardened-gcc needs to be disabled, because the mangler doesn't accept |
272 |
+ # its output. |
273 |
+ gcc-specs-pie && append-ghc-cflags persistent compile link -nopie |
274 |
+ gcc-specs-ssp && append-ghc-cflags persistent compile -fno-stack-protector |
275 |
+ |
276 |
+ # prevent from failind building unregisterised ghc: |
277 |
+ # http://www.mail-archive.com/debian-bugs-dist@××××××××××××.org/msg171602.html |
278 |
+ use ppc64 && append-ghc-cflags persistent compile -mminimal-toc |
279 |
+ # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data |
280 |
+ # currently ghc fails to build haddock |
281 |
+ # http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html |
282 |
+ use ia64 && append-ghc-cflags persistent compile -G0 |
283 |
+} |
284 |
+ |
285 |
+# substitutes string $1 to $2 in files $3 $4 ... |
286 |
+relocate_path() { |
287 |
+ local from=$1 |
288 |
+ local to=$2 |
289 |
+ shift 2 |
290 |
+ local file= |
291 |
+ for file in "$@" |
292 |
+ do |
293 |
+ sed -i -e "s|$from|$to|g" \ |
294 |
+ "$file" || die "path relocation failed for '$file'" |
295 |
+ done |
296 |
+} |
297 |
+ |
298 |
+# changes hardcoded ghc paths and updates package index |
299 |
+# $1 - new absolute root path |
300 |
+relocate_ghc() { |
301 |
+ local to=$1 |
302 |
+ |
303 |
+ # libdir for prebuilt binary and for current system may mismatch |
304 |
+ # It does for prefix installation for example: bug #476998 |
305 |
+ local bin_ghc_prefix=${WORKDIR}/usr |
306 |
+ local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*) |
307 |
+ local bin_libdir=${bin_libpath#${bin_ghc_prefix}/} |
308 |
+ |
309 |
+ # backup original script to use it later after relocation |
310 |
+ local gp_back="${T}/ghc-pkg-${GHC_PV}-orig" |
311 |
+ cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper" |
312 |
+ |
313 |
+ if [[ ${bin_libdir} != $(get_libdir) ]]; then |
314 |
+ einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)" |
315 |
+ # moving the dir itself is not strictly needed |
316 |
+ # but then USE=binary would result in installing |
317 |
+ # in '${bin_libdir}' |
318 |
+ mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die |
319 |
+ |
320 |
+ relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \ |
321 |
+ "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \ |
322 |
+ "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \ |
323 |
+ "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \ |
324 |
+ "${WORKDIR}/usr/bin/hsc2hs" \ |
325 |
+ "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \ |
326 |
+ "$gp_back" \ |
327 |
+ "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"* |
328 |
+ fi |
329 |
+ |
330 |
+ # Relocate from /usr to ${EPREFIX}/usr |
331 |
+ relocate_path "/usr" "${to}/usr" \ |
332 |
+ "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \ |
333 |
+ "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \ |
334 |
+ "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \ |
335 |
+ "${WORKDIR}/usr/bin/hsc2hs" \ |
336 |
+ "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \ |
337 |
+ "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"* |
338 |
+ |
339 |
+ # this one we will use to regenerate cache |
340 |
+ # so it should point to current tree location |
341 |
+ relocate_path "/usr" "${WORKDIR}/usr" "$gp_back" |
342 |
+ |
343 |
+ if use prefix; then |
344 |
+ # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree |
345 |
+ # TODO: add the same for darwin's CHOST and it's DYLD_ |
346 |
+ local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH' |
347 |
+ sed -i -e '2i'"$new_ldpath" \ |
348 |
+ "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \ |
349 |
+ "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \ |
350 |
+ "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \ |
351 |
+ "${WORKDIR}/usr/bin/hsc2hs" \ |
352 |
+ "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \ |
353 |
+ "$gp_back" \ |
354 |
+ "${WORKDIR}/usr/bin/hsc2hs" \ |
355 |
+ || die "Adding LD_LIBRARY_PATH for wrappers failed" |
356 |
+ fi |
357 |
+ |
358 |
+ # regenerate the binary package cache |
359 |
+ "$gp_back" recache || die "failed to update cache after relocation" |
360 |
+ rm "$gp_back" |
361 |
+} |
362 |
+ |
363 |
+pkg_setup() { |
364 |
+ [[ ${MERGE_TYPE} == binary ]] && return |
365 |
+ |
366 |
+ if use ghcbootstrap; then |
367 |
+ ewarn "You requested ghc bootstrapping, this is usually only used" |
368 |
+ ewarn "by Gentoo developers to make binary .tbz2 packages." |
369 |
+ |
370 |
+ [[ -z $(type -P ghc) ]] && \ |
371 |
+ die "Could not find a ghc to bootstrap with." |
372 |
+ else |
373 |
+ if ! yet_binary; then |
374 |
+ eerror "Please try emerging with USE=ghcbootstrap and report build" |
375 |
+ eerror "sucess or failure to the haskell team (haskell@g.o)" |
376 |
+ die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap" |
377 |
+ fi |
378 |
+ fi |
379 |
+} |
380 |
+ |
381 |
+src_unpack() { |
382 |
+ # Create the ${S} dir if we're using the binary version |
383 |
+ use binary && mkdir "${S}" |
384 |
+ |
385 |
+ # the Solaris and Darwin binaries from ghc (maeder) need to be |
386 |
+ # unpacked separately, so prevent them from being unpacked |
387 |
+ local ONLYA=${A} |
388 |
+ case ${CHOST} in |
389 |
+ *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;; |
390 |
+ esac |
391 |
+ unpack ${ONLYA} |
392 |
+ |
393 |
+ if [[ -d "${S}"/libraries/dph ]]; then |
394 |
+ # Sometimes dph libs get accidentally shipped with ghc |
395 |
+ # but they are not installed unless user requests it. |
396 |
+ # We never install them. |
397 |
+ elog "Removing 'libraries/dph'" |
398 |
+ rm -rf "${S}"/libraries/dph |
399 |
+ fi |
400 |
+} |
401 |
+ |
402 |
+src_prepare() { |
403 |
+ ghc_setup_cflags |
404 |
+ |
405 |
+ if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then |
406 |
+ # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS. |
407 |
+ # See bug #313635. |
408 |
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \ |
409 |
+ "${WORKDIR}/usr/bin/ghc-${GHC_PV}" |
410 |
+ |
411 |
+ # allow hardened users use vanilla binary to bootstrap ghc |
412 |
+ # ghci uses mmap with rwx protection at it implements dynamic |
413 |
+ # linking on it's own (bug #299709) |
414 |
+ pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc" |
415 |
+ fi |
416 |
+ |
417 |
+ if use binary; then |
418 |
+ if use prefix; then |
419 |
+ relocate_ghc "${EPREFIX}" |
420 |
+ fi |
421 |
+ |
422 |
+ # Move unpacked files to the expected place |
423 |
+ mv "${WORKDIR}/usr" "${S}" |
424 |
+ else |
425 |
+ if ! use ghcbootstrap; then |
426 |
+ case ${CHOST} in |
427 |
+ *-darwin* | *-solaris*) |
428 |
+ # UPDATE ME for ghc-7 |
429 |
+ mkdir "${WORKDIR}"/ghc-bin-installer || die |
430 |
+ pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die |
431 |
+ use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2 |
432 |
+ use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2 |
433 |
+ use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2 |
434 |
+ use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2 |
435 |
+ popd > /dev/null |
436 |
+ |
437 |
+ pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die |
438 |
+ # fix the binaries so they run, on Solaris we need an |
439 |
+ # LD_LIBRARY_PATH which has our prefix libdirs, on |
440 |
+ # Darwin we need to replace the frameworks with our libs |
441 |
+ # from the prefix fix before installation, because some |
442 |
+ # of the tools are actually used during configure/make |
443 |
+ if [[ ${CHOST} == *-solaris* ]] ; then |
444 |
+ export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}" |
445 |
+ elif [[ ${CHOST} == *-darwin* ]] ; then |
446 |
+ local readline_framework=GNUreadline.framework/GNUreadline |
447 |
+ local gmp_framework=/opt/local/lib/libgmp.10.dylib |
448 |
+ local ncurses_file=/opt/local/lib/libncurses.5.dylib |
449 |
+ for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do |
450 |
+ install_name_tool -change \ |
451 |
+ ${readline_framework} \ |
452 |
+ "${EPREFIX}"/lib/libreadline.dylib \ |
453 |
+ ${binary} || die |
454 |
+ install_name_tool -change \ |
455 |
+ ${gmp_framework} \ |
456 |
+ "${EPREFIX}"/usr/lib/libgmp.dylib \ |
457 |
+ ${binary} || die |
458 |
+ install_name_tool -change \ |
459 |
+ ${ncurses_file} \ |
460 |
+ "${EPREFIX}"/usr/lib/libncurses.dylib \ |
461 |
+ ${binary} || die |
462 |
+ done |
463 |
+ # we don't do frameworks! |
464 |
+ sed -i \ |
465 |
+ -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \ |
466 |
+ -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \ |
467 |
+ rts/package.conf.in || die |
468 |
+ fi |
469 |
+ |
470 |
+ # it is autoconf, but we really don't want to give it too |
471 |
+ # much arguments, in fact we do the make in-place anyway |
472 |
+ ./configure --prefix="${WORKDIR}"/usr || die |
473 |
+ make install || die |
474 |
+ popd > /dev/null |
475 |
+ ;; |
476 |
+ *) |
477 |
+ relocate_ghc "${WORKDIR}" |
478 |
+ ;; |
479 |
+ esac |
480 |
+ fi |
481 |
+ |
482 |
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \ |
483 |
+ "${S}/ghc/ghc.wrapper" |
484 |
+ |
485 |
+ cd "${S}" # otherwise epatch will break |
486 |
+ |
487 |
+ epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch |
488 |
+ |
489 |
+ epatch "${FILESDIR}"/${PN}-7.8.2-cgen-constify.patch |
490 |
+ epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch |
491 |
+ epatch "${FILESDIR}"/${PN}-7.10.1-rc3-ghc-7.10-bootstrap.patch |
492 |
+ epatch "${FILESDIR}"/${PN}-7.10.1-T10590-dequeue.patch |
493 |
+ # Since ${S}/packages does not include base, etc. add them to gen_contents_index |
494 |
+ sed -e 's@\(for REPO in .*\)@\1 base integer-gmp integer-gmp2 integer-simple template-haskell@' \ |
495 |
+ -i libraries/gen_contents_index || die |
496 |
+ |
497 |
+ if use prefix; then |
498 |
+ # Make configure find docbook-xsl-stylesheets from Prefix |
499 |
+ sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \ |
500 |
+ -i utils/haddock/doc/configure.ac || die |
501 |
+ fi |
502 |
+ |
503 |
+ bump_libs |
504 |
+ |
505 |
+ # as we have changed the build system |
506 |
+ eautoreconf |
507 |
+ fi |
508 |
+} |
509 |
+ |
510 |
+src_configure() { |
511 |
+ if ! use binary; then |
512 |
+ # initialize build.mk |
513 |
+ echo '# Gentoo changes' > mk/build.mk |
514 |
+ |
515 |
+ # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV} |
516 |
+ echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk |
517 |
+ echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk |
518 |
+ |
519 |
+ # We also need to use the GHC_FLAGS flags when building ghc itself |
520 |
+ echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk |
521 |
+ echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk |
522 |
+ echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk |
523 |
+ |
524 |
+ # We can't depend on haddock except when bootstrapping when we |
525 |
+ # must build docs and include them into the binary .tbz2 package |
526 |
+ # app-text/dblatex is not in portage, can not build PDF or PS |
527 |
+ echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk |
528 |
+ echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk |
529 |
+ if use doc; then |
530 |
+ echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk |
531 |
+ else |
532 |
+ echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk |
533 |
+ fi |
534 |
+ |
535 |
+ # this controls presence on 'xhtml' and 'haddock' in final install |
536 |
+ echo "HADDOCK_DOCS = YES" >> mk/build.mk |
537 |
+ |
538 |
+ # allows overriding build flavours for libraries: |
539 |
+ # v - vanilla (static libs) |
540 |
+ # p - profiled |
541 |
+ # dyn - shared libraries |
542 |
+ # example: GHC_LIBRARY_WAYS="v dyn" |
543 |
+ if [[ -n ${GHC_LIBRARY_WAYS} ]]; then |
544 |
+ echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk |
545 |
+ fi |
546 |
+ |
547 |
+ # Get ghc from the unpacked binary .tbz2 |
548 |
+ # except when bootstrapping we just pick ghc up off the path |
549 |
+ if ! use ghcbootstrap; then |
550 |
+ export PATH="${WORKDIR}/usr/bin:${PATH}" |
551 |
+ fi |
552 |
+ |
553 |
+ if use gmp; then |
554 |
+ echo "INTEGER_LIBRARY=integer-gmp2" >> mk/build.mk |
555 |
+ else |
556 |
+ echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk |
557 |
+ fi |
558 |
+ |
559 |
+ # don't strip anything. Very useful when stage2 SIGSEGVs on you |
560 |
+ echo "STRIP_CMD = :" >> mk/build.mk |
561 |
+ |
562 |
+ local econf_args=() |
563 |
+ |
564 |
+ # GHC embeds 'gcc' it was built by and uses it later. |
565 |
+ # Don't allow things like ccache or versioned binary slip. |
566 |
+ # We use stable thing across gcc upgrades. |
567 |
+ is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc) |
568 |
+ |
569 |
+ if use ghcmakebinary; then |
570 |
+ # When building booting libary we are trying to |
571 |
+ # bundle or restrict most of external depends |
572 |
+ # with unstable ABI: |
573 |
+ # - embed libffi (default GHC behaviour) |
574 |
+ # - disable ncurses support for ghci (via haskeline) |
575 |
+ # https://bugs.gentoo.org/557478 |
576 |
+ echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk |
577 |
+ else |
578 |
+ econf_args+=(--with-system-libffi) |
579 |
+ econf_args+=(--with-ffi-includes=$(pkg-config libffi --cflags-only-I | sed -e 's@^-I@@')) |
580 |
+ fi |
581 |
+ |
582 |
+ elog "Final mk/build.mk:" |
583 |
+ cat mk/build.mk || die |
584 |
+ |
585 |
+ econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot |
586 |
+ |
587 |
+ if [[ ${PV} == *9999* ]]; then |
588 |
+ GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')" |
589 |
+ GHC_P=${PN}-${GHC_PV} |
590 |
+ fi |
591 |
+ GHC_TPF="$(grep 'S\[\"TargetPlatformFull\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')" |
592 |
+ fi # ! use binary |
593 |
+} |
594 |
+ |
595 |
+src_compile() { |
596 |
+ if ! use binary; then |
597 |
+ # 1. build compiler binary first |
598 |
+ emake ghc/stage2/build/tmp/ghc-stage2 |
599 |
+ # 2. pax-mark (bug #516430) |
600 |
+ pax-mark -m ghc/stage2/build/tmp/ghc-stage2 |
601 |
+ # 3. and then all the rest |
602 |
+ emake all |
603 |
+ fi # ! use binary |
604 |
+} |
605 |
+ |
606 |
+src_install() { |
607 |
+ if use binary; then |
608 |
+ use prefix && mkdir -p "${ED}" |
609 |
+ mv "${S}/usr" "${ED}" |
610 |
+ else |
611 |
+ |
612 |
+ emake -j1 install DESTDIR="${D}" |
613 |
+ dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION" |
614 |
+ |
615 |
+ # rename ghc-shipped files to avoid collision |
616 |
+ # of external packages. Motivating example: |
617 |
+ # user had installed: |
618 |
+ # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0) |
619 |
+ # dev-haskell/transformers-0.4.2.0 |
620 |
+ # then user tried to update to |
621 |
+ # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0) |
622 |
+ # this will lead to single .conf file collision. |
623 |
+ local shipped_conf renamed_conf |
624 |
+ local package_confdir="${ED}/usr/$(get_libdir)/${GHC_P}/package.conf.d" |
625 |
+ for shipped_conf in "${package_confdir}"/*.conf; do |
626 |
+ # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf' |
627 |
+ renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf |
628 |
+ mv "${shipped_conf}" "${renamed_conf}" || die |
629 |
+ done |
630 |
+ |
631 |
+ # remove link, but leave 'haddock-${GHC_P}' |
632 |
+ rm -f "${ED}"/usr/bin/haddock |
633 |
+ |
634 |
+ if [[ ! -f "${S}/VERSION" ]]; then |
635 |
+ echo "${GHC_PV}" > "${S}/VERSION" \ |
636 |
+ || die "Could not create file ${S}/VERSION" |
637 |
+ fi |
638 |
+ newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg |
639 |
+ newbashcomp utils/completion/ghc.bash ghc |
640 |
+ fi |
641 |
+ |
642 |
+ # path to the package.cache |
643 |
+ local package_confdir="${ED}/usr/$(get_libdir)/${GHC_P}/package.conf.d" |
644 |
+ PKGCACHE="${package_confdir}"/package.cache |
645 |
+ # copy the package.conf.d, including timestamp, save it so we can help |
646 |
+ # users that have a broken package.conf.d |
647 |
+ cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d" |
648 |
+ |
649 |
+ # copy the package.conf, including timestamp, save it so we later can put it |
650 |
+ # back before uninstalling, or when upgrading. |
651 |
+ cp -p "${PKGCACHE}"{,.shipped} \ |
652 |
+ || die "failed to copy package.conf.d/package.cache" |
653 |
+} |
654 |
+ |
655 |
+pkg_preinst() { |
656 |
+ # have we got an earlier version of ghc installed? |
657 |
+ if has_version "<${CATEGORY}/${PF}"; then |
658 |
+ haskell_updater_warn="1" |
659 |
+ fi |
660 |
+} |
661 |
+ |
662 |
+pkg_postinst() { |
663 |
+ ghc-reregister |
664 |
+ |
665 |
+ # path to the package.cache |
666 |
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache" |
667 |
+ |
668 |
+ # give the cache a new timestamp, it must be as recent as |
669 |
+ # the package.conf.d directory. |
670 |
+ touch "${PKGCACHE}" |
671 |
+ |
672 |
+ if [[ "${haskell_updater_warn}" == "1" ]]; then |
673 |
+ ewarn |
674 |
+ ewarn "\e[1;31m************************************************************************\e[0m" |
675 |
+ ewarn |
676 |
+ ewarn "You have just upgraded from an older version of GHC." |
677 |
+ ewarn "You may have to run" |
678 |
+ ewarn " 'haskell-updater'" |
679 |
+ ewarn "to rebuild all ghc-based Haskell libraries." |
680 |
+ ewarn |
681 |
+ ewarn "\e[1;31m************************************************************************\e[0m" |
682 |
+ ewarn |
683 |
+ fi |
684 |
+} |
685 |
+ |
686 |
+pkg_prerm() { |
687 |
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache" |
688 |
+ rm -rf "${PKGCACHE}" |
689 |
+ |
690 |
+ cp -p "${PKGCACHE}"{.shipped,} |
691 |
+} |
692 |
+ |
693 |
+pkg_postrm() { |
694 |
+ ghc-package_pkg_postrm |
695 |
+} |