Gentoo Archives: gentoo-commits

From: "Mark Wright (gienah)" <gienah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/ghc: ghc-7.4.1.ebuild ChangeLog ghc-7.0.4.ebuild
Date: Sun, 04 Mar 2012 05:50:11
Message-Id: 20120304054954.D5D7F2004B@flycatcher.gentoo.org
1 gienah 12/03/04 05:49:54
2
3 Modified: ChangeLog ghc-7.0.4.ebuild
4 Added: ghc-7.4.1.ebuild
5 Log:
6 Bump ghc to 7.4.1
7
8 (Portage version: 2.1.10.49/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.211 dev-lang/ghc/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ChangeLog?rev=1.211&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ChangeLog?rev=1.211&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ChangeLog?r1=1.210&r2=1.211
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v
20 retrieving revision 1.210
21 retrieving revision 1.211
22 diff -u -r1.210 -r1.211
23 --- ChangeLog 28 Dec 2011 08:47:34 -0000 1.210
24 +++ ChangeLog 4 Mar 2012 05:49:54 -0000 1.211
25 @@ -1,6 +1,13 @@
26 # ChangeLog for dev-lang/ghc
27 -# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.210 2011/12/28 08:47:34 josejx Exp $
29 +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
30 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.211 2012/03/04 05:49:54 gienah Exp $
31 +
32 +*ghc-7.4.1 (04 Mar 2012)
33 +
34 + 04 Mar 2012; Mark Wright <gienah@g.o> ghc-7.0.4.ebuild,
35 + +files/ghc-7.2.1-freebsd-CHOST.patch,
36 + +files/ghc-7.4-rc2-macos-prefix-respect-gcc.patch, +ghc-7.4.1.ebuild:
37 + Bump ghc to 7.4.1
38
39 28 Dec 2011; Joseph Jezak <josejx@g.o> ghc-7.0.4.ebuild,
40 +files/ghc-7.0.4-fix-ppc-linker.patch:
41
42
43
44 1.5 dev-lang/ghc/ghc-7.0.4.ebuild
45
46 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ghc-7.0.4.ebuild?rev=1.5&view=markup
47 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ghc-7.0.4.ebuild?rev=1.5&content-type=text/plain
48 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ghc-7.0.4.ebuild?r1=1.4&r2=1.5
49
50 Index: ghc-7.0.4.ebuild
51 ===================================================================
52 RCS file: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-7.0.4.ebuild,v
53 retrieving revision 1.4
54 retrieving revision 1.5
55 diff -u -r1.4 -r1.5
56 --- ghc-7.0.4.ebuild 28 Dec 2011 08:47:34 -0000 1.4
57 +++ ghc-7.0.4.ebuild 4 Mar 2012 05:49:54 -0000 1.5
58 @@ -1,6 +1,6 @@
59 -# Copyright 1999-2011 Gentoo Foundation
60 +# Copyright 1999-2012 Gentoo Foundation
61 # Distributed under the terms of the GNU General Public License v2
62 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-7.0.4.ebuild,v 1.4 2011/12/28 08:47:34 josejx Exp $
63 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-7.0.4.ebuild,v 1.5 2012/03/04 05:49:54 gienah Exp $
64
65 # Brief explanation of the bootstrap logic:
66 #
67 @@ -193,7 +193,7 @@
68 for file in "$@"
69 do
70 sed -i -e "s|$from|$to|g" \
71 - "$file" || die "path relocation failed for '$file'"
72 + "$file" || die "path relocation failed for '$file'"
73 done
74 }
75
76
77
78
79 1.1 dev-lang/ghc/ghc-7.4.1.ebuild
80
81 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ghc-7.4.1.ebuild?rev=1.1&view=markup
82 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ghc-7.4.1.ebuild?rev=1.1&content-type=text/plain
83
84 Index: ghc-7.4.1.ebuild
85 ===================================================================
86 # Copyright 1999-2012 Gentoo Foundation
87 # Distributed under the terms of the GNU General Public License v2
88 # $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-7.4.1.ebuild,v 1.1 2012/03/04 05:49:54 gienah Exp $
89
90 # Brief explanation of the bootstrap logic:
91 #
92 # Previous ghc ebuilds have been split into two: ghc and ghc-bin,
93 # where ghc-bin was primarily used for bootstrapping purposes.
94 # From now on, these two ebuilds have been combined, with the
95 # binary USE flag used to determine whether or not the pre-built
96 # binary package should be emerged or whether ghc should be compiled
97 # from source. If the latter, then the relevant ghc-bin for the
98 # arch in question will be used in the working directory to compile
99 # ghc from source.
100 #
101 # This solution has the advantage of allowing us to retain the one
102 # ebuild for both packages, and thus phase out virtual/ghc.
103
104 # Note to users of hardened gcc-3.x:
105 #
106 # If you emerge ghc with hardened gcc it should work fine (because we
107 # turn off the hardened features that would otherwise break ghc).
108 # However, emerging ghc while using a vanilla gcc and then switching to
109 # hardened gcc (using gcc-config) will leave you with a broken ghc. To
110 # fix it you would need to either switch back to vanilla gcc or re-emerge
111 # ghc (or ghc-bin). Note that also if you are using hardened gcc-3.x and
112 # you switch to gcc-4.x that this will also break ghc and you'll need to
113 # re-emerge ghc (or ghc-bin). People using vanilla gcc can switch between
114 # gcc-3.x and 4.x with no problems.
115
116 EAPI="4"
117
118 inherit base autotools bash-completion-r1 eutils flag-o-matic multilib toolchain-funcs ghc-package versionator pax-utils
119
120 DESCRIPTION="The Glasgow Haskell Compiler"
121 HOMEPAGE="http://www.haskell.org/ghc/"
122
123 # we don't have any binaries yet
124 arch_binaries=""
125
126 # sorted!
127 #arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )"
128 #arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )"
129 #arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PV}-amd64.tbz2 )"
130 #arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
131 #arch_binaries="$arch_binaries ppc? ( mirror://gentoo/ghc-bin-${PV}-ppc.tbz2 )"
132 #arch_binaries="$arch_binaries ppc64? ( mirror://gentoo/ghc-bin-${PV}-ppc64.tbz2 )"
133 #arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )"
134 #arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PV}-x86.tbz2 )"
135
136 # various ports:
137 #arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )"
138
139 # 0 - yet
140 yet_binary() {
141 case "${ARCH}" in
142 #alpha)
143 # return 0
144 # ;;
145 #arm)
146 # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
147 # return 0
148 # ;;
149 #amd64)
150 # return 0
151 # ;;
152 ##sparc)
153 # return 0
154 # ;;
155 #x86)
156 # return 0
157 # ;;
158 *)
159 return 1
160 ;;
161 esac
162 }
163
164 SRC_URI="!binary? ( http://www.haskell.org/ghc/dist/${PV}/${P}-src.tar.bz2 )"
165 [[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
166 LICENSE="BSD"
167 SLOT="0"
168 # ghc on ia64 needs gcc to support -mcmodel=medium (or some dark hackery) to avoid TOC overflow
169 KEYWORDS="~alpha ~amd64 -ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
170 IUSE="doc ghcbootstrap llvm"
171 IUSE+=" binary" # don't forget about me later!
172
173 RDEPEND="
174 !kernel_Darwin? ( >=sys-devel/gcc-2.95.3 )
175 kernel_linux? ( >=sys-devel/binutils-2.17 )
176 kernel_SunOS? ( >=sys-devel/binutils-2.17 )
177 >=dev-lang/perl-5.6.1
178 >=dev-libs/gmp-5
179 !<dev-haskell/haddock-2.4.2
180 sys-libs/ncurses[unicode]"
181 # earlier versions than 2.4.2 of haddock only works with older ghc releases
182
183 # force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to
184 # that we want the binaries to use the latest versioun available, and not to be
185 # built against gmp-4
186
187 DEPEND="${RDEPEND}
188 ghcbootstrap? ( >=dev-haskell/alex-2.3
189 >=dev-haskell/happy-1.18
190 doc? ( app-text/docbook-xml-dtd:4.2
191 app-text/docbook-xml-dtd:4.5
192 app-text/docbook-xsl-stylesheets
193 >=dev-libs/libxslt-1.1.2 ) )"
194 # In the ghcbootstrap case we rely on the developer having
195 # >=ghc-5.04.3 on their $PATH already
196
197 PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
198 PDEPEND="
199 ${PDEPEND}
200 dev-haskell/random
201 dev-haskell/syb
202 llvm? ( sys-devel/llvm )"
203
204 append-ghc-cflags() {
205 local flag compile assemble link
206 for flag in $*; do
207 case ${flag} in
208 compile) compile="yes";;
209 assemble) assemble="yes";;
210 link) link="yes";;
211 *)
212 [[ ${compile} ]] && GHC_FLAGS="${GHC_FLAGS} -optc${flag}" CFLAGS="${CFLAGS} ${flag}"
213 [[ ${assemble} ]] && GHC_FLAGS="${GHC_FLAGS} -opta${flag}" CFLAGS="${CFLAGS} ${flag}"
214 [[ ${link} ]] && GHC_FLAGS="${GHC_FLAGS} -optl${flag}" FILTERED_LDFLAGS="${FILTERED_LDFLAGS} ${flag}";;
215 esac
216 done
217 }
218
219 ghc_setup_cflags() {
220 # We need to be very careful with the CFLAGS we ask ghc to pass through to
221 # gcc. There are plenty of flags which will make gcc produce output that
222 # breaks ghc in various ways. The main ones we want to pass through are
223 # -mcpu / -march flags. These are important for arches like alpha & sparc.
224 # We also use these CFLAGS for building the C parts of ghc, ie the rts.
225 strip-flags
226 strip-unsupported-flags
227
228 GHC_FLAGS=""
229 for flag in ${CFLAGS}; do
230 case ${flag} in
231
232 # Ignore extra optimisation (ghc passes -O to gcc anyway)
233 # -O2 and above break on too many systems
234 -O*) ;;
235
236 # Arch and ABI flags are what we're really after
237 -m*) append-ghc-cflags compile assemble ${flag};;
238
239 # Debugging flags don't help either. You can't debug Haskell code
240 # at the C source level and the mangler discards the debug info.
241 -g*) ;;
242
243 # Ignore all other flags, including all -f* flags
244 esac
245 done
246
247 FILTERED_LDFLAGS=""
248 for flag in ${LDFLAGS}; do
249 case ${flag} in
250 # Pass the canary. we don't quite respect LDFLAGS, but we have an excuse!
251 "-Wl,--hash-style="*) append-ghc-cflags link ${flag};;
252
253 # Ignore all other flags
254 esac
255 done
256
257 # hardened-gcc needs to be disabled, because the mangler doesn't accept
258 # its output.
259 gcc-specs-pie && append-ghc-cflags compile link -nopie
260 gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector
261
262 # prevent from failind building unregisterised ghc:
263 # http://www.mail-archive.com/debian-bugs-dist@××××××××××××.org/msg171602.html
264 use ppc64 && append-ghc-cflags compile -mminimal-toc
265 # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
266 # currently ghc fails to build haddock
267 # http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
268 use ia64 && append-ghc-cflags compile -G0
269
270 # Unfortunately driver/split/ghc-split.lprl is dumb
271 # enough to preserve stack marking for each split object
272 # and it flags stack marking violation:
273 # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__1.o
274 # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__2.o
275 # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__3.o
276 case $($(tc-getAS) -v 2>&1 </dev/null) in
277 *"GNU Binutils"*) # GNU ld
278 append-ghc-cflags compile assemble -Wa,--noexecstack
279 ;;
280 esac
281 }
282
283 # substitutes string $1 to $2 in files $3 $4 ...
284 relocate_path() {
285 local from=$1
286 local to=$2
287 shift 2
288 local file=
289 for file in "$@"
290 do
291 sed -i -e "s|$from|$to|g" \
292 "$file" || die "path relocation failed for '$file'"
293 done
294 }
295
296 # changes hardcoded ghc paths and updates package index
297 # $1 - new absolute root path
298 relocate_ghc() {
299 local to=$1
300
301 # backup original script to use it later after relocation
302 local gp_back="${T}/ghc-pkg-${PV}-orig"
303 cp "${WORKDIR}/usr/bin/ghc-pkg-${PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
304
305 # Relocate from /usr to ${EPREFIX}/usr
306 relocate_path "/usr" "${to}/usr" \
307 "${WORKDIR}/usr/bin/ghc-${PV}" \
308 "${WORKDIR}/usr/bin/ghci-${PV}" \
309 "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
310 "${WORKDIR}/usr/bin/hsc2hs" \
311 "${WORKDIR}/usr/$(get_libdir)/${P}/package.conf.d/"*
312
313 # this one we will use to regenerate cache
314 # so it shoult point to current tree location
315 relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
316
317 if use prefix; then
318 # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree
319 # TODO: add the same for darwin's CHOST and it's DYLD_
320 local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH'
321 sed -i -e '2i'"$new_ldpath" \
322 "${WORKDIR}/usr/bin/ghc-${PV}" \
323 "${WORKDIR}/usr/bin/ghci-${PV}" \
324 "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
325 "$gp_back" \
326 "${WORKDIR}/usr/bin/hsc2hs" \
327 || die "Adding LD_LIBRARY_PATH for wrappers failed"
328 fi
329
330 # regenerate the binary package cache
331 "$gp_back" recache || die "failed to update cache after relocation"
332 rm "$gp_back"
333 }
334
335 pkg_setup() {
336 if use ghcbootstrap; then
337 ewarn "You requested ghc bootstrapping, this is usually only used"
338 ewarn "by Gentoo developers to make binary .tbz2 packages for"
339 ewarn "use with the ghc ebuild's USE=\"binary\" feature."
340 use binary && \
341 die "USE=\"ghcbootstrap binary\" is not a valid combination."
342 [[ -z $(type -P ghc) ]] && \
343 die "Could not find a ghc to bootstrap with."
344 else
345 if ! yet_binary; then
346 eerror "Please try emerging with USE=ghcbootstrap and report build"
347 eerror "sucess or failure to the haskell team (haskell@g.o)"
348 die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
349 fi
350 fi
351 }
352
353 src_unpack() {
354 # Create the ${S} dir if we're using the binary version
355 use binary && mkdir "${S}"
356
357 # the Solaris and Darwin binaries from ghc (maeder) need to be
358 # unpacked separately, so prevent them from being unpacked
359 local ONLYA=${A}
360 case ${CHOST} in
361 *-darwin* | *-solaris*) ONLYA=${P}-src.tar.bz2 ;;
362 esac
363 unpack ${ONLYA}
364 }
365
366 src_prepare() {
367 [[ ${CHOST} != *-darwin* ]] && \
368 source "${FILESDIR}/ghc-apply-gmp-hack" "$(get_libdir)"
369
370 ghc_setup_cflags
371
372 if ! use ghcbootstrap; then
373 # Modify the wrapper script from the binary tarball to use GHC_FLAGS.
374 # See bug #313635.
375 sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_FLAGS}|" \
376 "${WORKDIR}/usr/bin/ghc-${PV}"
377
378 # allow hardened users use vanilla binary to bootstrap ghc
379 # ghci uses mmap with rwx protection at it implements dynamic
380 # linking on it's own (bug #299709)
381 pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${P}/ghc"
382 fi
383
384 if use binary; then
385 if use prefix; then
386 relocate_ghc "${EPREFIX}"
387 fi
388
389 # Move unpacked files to the expected place
390 mv "${WORKDIR}/usr" "${S}"
391 else
392 if ! use ghcbootstrap; then
393 case ${CHOST} in
394 *-darwin* | *-solaris*)
395 # UPDATE ME for ghc-7
396 mkdir "${WORKDIR}"/ghc-bin-installer || die
397 pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
398 use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
399 use x86-solaris && unpack ghc-6.10.4-i386-unknown-solaris2.tar.bz2
400 use ppc-macos && unpack ghc-6.10.1-powerpc-apple-darwin.tar.bz2
401 use x86-macos && unpack ghc-6.10.1-i386-apple-darwin.tar.bz2
402 popd > /dev/null
403
404 pushd "${WORKDIR}"/ghc-bin-installer/ghc-6.10.? > /dev/null || die
405 # fix the binaries so they run, on Solaris we need an
406 # LD_LIBRARY_PATH which has our prefix libdirs, on
407 # Darwin we need to replace the frameworks with our libs
408 # from the prefix fix before installation, because some
409 # of the tools are actually used during configure/make
410 if [[ ${CHOST} == *-solaris* ]] ; then
411 export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
412 elif [[ ${CHOST} == *-darwin* ]] ; then
413 # http://hackage.haskell.org/trac/ghc/ticket/2942
414 pushd utils/haddock/dist-install/build > /dev/null
415 ln -s Haddock haddock >& /dev/null # fails on IN-sensitive
416 popd > /dev/null
417
418 local readline_framework=GNUreadline.framework/GNUreadline
419 local gmp_framework=/opt/local/lib/libgmp.3.dylib
420 local ncurses_file=/opt/local/lib/libncurses.5.dylib
421 for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
422 install_name_tool -change \
423 ${readline_framework} \
424 "${EPREFIX}"/lib/libreadline.dylib \
425 ${binary} || die
426 install_name_tool -change \
427 ${gmp_framework} \
428 "${EPREFIX}"/usr/lib/libgmp.dylib \
429 ${binary} || die
430 install_name_tool -change \
431 ${ncurses_file} \
432 "${EPREFIX}"/usr/lib/libncurses.dylib \
433 ${binary} || die
434 done
435 # we don't do frameworks!
436 sed -i \
437 -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
438 -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
439 rts/package.conf.in || die
440 fi
441
442 # it is autoconf, but we really don't want to give it too
443 # much arguments, in fact we do the make in-place anyway
444 ./configure --prefix="${WORKDIR}"/usr || die
445 make install || die
446 popd > /dev/null
447 ;;
448 *)
449 relocate_ghc "${WORKDIR}"
450 ;;
451 esac
452 fi
453
454 sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_FLAGS}|" \
455 "${S}/ghc/ghc.wrapper"
456
457 cd "${S}" # otherwise epatch will break
458
459 epatch "${FILESDIR}/ghc-7.0.4-CHOST-prefix.patch"
460
461 epatch "${FILESDIR}"/${PN}-7.0.4-darwin8.patch
462 # failed to apply. FIXME
463 #epatch "${FILESDIR}"/${PN}-6.12.3-mach-o-relocation-limit.patch
464
465 epatch "${FILESDIR}"/${PN}-7.4-rc2-macos-prefix-respect-gcc.patch
466 epatch "${FILESDIR}"/${PN}-7.2.1-freebsd-CHOST.patch
467
468 if use prefix; then
469 # Make configure find docbook-xsl-stylesheets from Prefix
470 sed -i -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' utils/haddock/doc/configure.ac || die
471 fi
472
473 # as we have changed the build system
474 eautoreconf
475 fi
476 }
477
478 src_configure() {
479 if ! use binary; then
480
481 # initialize build.mk
482 echo '# Gentoo changes' > mk/build.mk
483
484 # Put docs into the right place, ie /usr/share/doc/ghc-${PV}
485 echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
486 echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
487
488 # We also need to use the GHC_FLAGS flags when building ghc itself
489 echo "SRC_HC_OPTS+=${GHC_FLAGS}" >> mk/build.mk
490 echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
491 echo "SRC_LD_OPTS+=${FILTERED_LDFLAGS}" >> mk/build.mk
492
493 # We can't depend on haddock except when bootstrapping when we
494 # must build docs and include them into the binary .tbz2 package
495 if use ghcbootstrap && use doc; then
496 echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
497 echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
498 echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
499 echo "HADDOCK_DOCS = YES" >> mk/build.mk
500 else
501 echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
502 echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
503 echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
504 echo "HADDOCK_DOCS = NO" >> mk/build.mk
505 fi
506
507 # circumvent a very strange bug that seems related with ghc producing
508 # too much output while being filtered through tee (e.g. due to
509 # portage logging) reported as bug #111183
510 echo "SRC_HC_OPTS+=-w" >> mk/build.mk
511
512 # some arches do not support ELF parsing for ghci module loading
513 # PPC64: never worked (should be easy to implement)
514 # alpha: never worked
515 # arm: unimplemented or never worked
516 if use alpha || use ppc64 || use arm; then
517 echo "GhcWithInterpreter=NO" >> mk/build.mk
518 fi
519
520 # we have to tell it to build unregisterised on some arches
521 # ppc64: EvilMangler currently does not understand some TOCs
522 # ia64: EvilMangler bitrot
523 if use alpha || use ia64 || use ppc64; then
524 echo "GhcUnregisterised=YES" >> mk/build.mk
525 echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
526 echo "SplitObjs=NO" >> mk/build.mk
527 echo "GhcRTSWays := debug" >> mk/build.mk
528 echo "GhcNotThreaded=YES" >> mk/build.mk
529 fi
530
531 # arm: no EvilMangler support, no NCG support
532 if use arm; then
533 echo "GhcUnregisterised=YES" >> mk/build.mk
534 echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
535 fi
536
537 # Have "ld -r --relax" problem with split-objs on sparc:
538 if use sparc; then
539 echo "SplitObjs=NO" >> mk/build.mk
540 fi
541
542 if ! use llvm; then
543 echo "GhcWithLlvmCodeGen=NO" >> mk/build.mk
544 fi
545
546 # Get ghc from the unpacked binary .tbz2
547 # except when bootstrapping we just pick ghc up off the path
548 if ! use ghcbootstrap; then
549 export PATH="${WORKDIR}/usr/bin:${PATH}"
550 fi
551
552 # Since GHC 6.12.2 the GHC wrappers store which GCC version GHC was
553 # compiled with, by saving the path to it. The purpose is to make sure
554 # that GHC will use the very same gcc version when it compiles haskell
555 # sources, as the extra-gcc-opts files contains extra gcc options which
556 # match only this GCC version.
557 # However, this is not required in Gentoo, as only modern GCCs are used
558 # (>4).
559 # Instead, this causes trouble when for example ccache is used during
560 # compilation, but we don't want the wrappers to point to ccache.
561 # Due to the above, we simply set GCC to be "gcc". When compiling ghc it
562 # might point to ccache, once installed it will point to the users
563 # regular gcc.
564
565 econf --with-gcc=gcc || die "econf failed"
566 fi # ! use binary
567 }
568
569 src_compile() {
570 if ! use binary; then
571 emake all || die "make failed"
572 fi # ! use binary
573 }
574
575 src_install() {
576 if use binary; then
577 use prefix && mkdir -p "${ED}"
578 mv "${S}/usr" "${ED}"
579
580 # Remove the docs if not requested
581 if ! use doc; then
582 rm -rf "${ED}/usr/share/doc/${P}/*/" \
583 "${ED}/usr/share/doc/${P}/*.html" \
584 || die "could not remove docs (P vs PF revision mismatch?)"
585 fi
586 else
587 local insttarget="install"
588
589 # We only built docs if we were bootstrapping, otherwise
590 # we copy them out of the unpacked binary .tbz2
591 if use doc; then
592 if ! use ghcbootstrap; then
593 mkdir -p "${ED}/usr/share/doc"
594 mv "${WORKDIR}/usr/share/doc/${P}" "${ED}/usr/share/doc" \
595 || die "failed to copy docs"
596 fi
597 fi
598
599 emake -j1 ${insttarget} \
600 DESTDIR="${D}" \
601 || die "make ${insttarget} failed"
602
603 # remove wrapper and linker
604 rm -f "${ED}"/usr/bin/haddock*
605
606 # ghci uses mmap with rwx protection at it implements dynamic
607 # linking on it's own (bug #299709)
608 # so mark resulting binary
609 pax-mark -m "${ED}/usr/$(get_libdir)/${P}/ghc"
610
611 dodoc "${S}/README" "${S}/ANNOUNCE" "${S}/LICENSE" "${S}/VERSION"
612
613 dobashcompletion "${FILESDIR}/ghc-bash-completion"
614
615 fi
616
617 # path to the package.cache
618 PKGCACHE="${ED}/usr/$(get_libdir)/${P}/package.conf.d/package.cache"
619
620 # copy the package.conf, including timestamp, save it so we later can put it
621 # back before uninstalling, or when upgrading.
622 cp -p "${PKGCACHE}"{,.shipped} \
623 || die "failed to copy package.conf.d/package.cache"
624 }
625
626 pkg_preinst() {
627 # have we got an earlier version of ghc installed?
628 if has_version "<${CATEGORY}/${PF}"; then
629 haskell_updater_warn="1"
630 fi
631 }
632
633 pkg_postinst() {
634 ghc-reregister
635
636 # path to the package.cache
637 PKGCACHE="${EROOT}/usr/$(get_libdir)/${P}/package.conf.d/package.cache"
638
639 # give the cache a new timestamp, it must be as recent as
640 # the package.conf.d directory.
641 touch "${PKGCACHE}"
642
643 if [[ "${haskell_updater_warn}" == "1" ]]; then
644 ewarn
645 ewarn "\e[1;31m************************************************************************\e[0m"
646 ewarn
647 ewarn "You have just upgraded from an older version of GHC."
648 ewarn "You may have to run"
649 ewarn " 'haskell-updater --upgrade'"
650 ewarn "to rebuild all ghc-based Haskell libraries."
651 ewarn
652 ewarn "\e[1;31m************************************************************************\e[0m"
653 ewarn
654 fi
655
656 bash-completion_pkg_postinst
657 }
658
659 pkg_prerm() {
660 # Be very careful here... Call order when upgrading is (according to PMS):
661 # * src_install for new package
662 # * pkg_preinst for new package
663 # * pkg_postinst for new package
664 # * pkg_prerm for the package being replaced
665 # * pkg_postrm for the package being replaced
666 # so you'll actually be touching the new packages files, not the one you
667 # uninstall, due to that or installation directory ${P} will be the same for
668 # both packages.
669
670 # Call order for reinstalling is (according to PMS):
671 # * src_install
672 # * pkg_preinst
673 # * pkg_prerm for the package being replaced
674 # * pkg_postrm for the package being replaced
675 # * pkg_postinst
676
677 # Overwrite the modified package.cache with a copy of the
678 # original one, so that it will be removed during uninstall.
679
680 PKGCACHE="${EROOT}/usr/$(get_libdir)/${P}/package.conf.d/package.cache"
681 rm -rf "${PKGCACHE}"
682
683 cp -p "${PKGCACHE}"{.shipped,}
684 }