/[gentoo-x86]/dev-lang/ghc/ghc-6.12.3-r2.ebuild
Gentoo

Contents of /dev-lang/ghc/ghc-6.12.3-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Sat Feb 15 08:52:36 2014 UTC (5 months, 1 week ago) by slyfox
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +3 -1 lines
Mark as QA_PREBUILT everything in USE=binary mode (bug #431650 by Agostino Sarubbo).

(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 611FF3AA)

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

  ViewVC Help
Powered by ViewVC 1.1.20