1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 # to make make a crosscompiler use crossdev and symlink ghc tree into
8 # cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
10 # 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
11 export CTARGET=${CTARGET:-${CHOST}}
12 if [[ ${CTARGET} = ${CHOST} ]] ; then
13 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
14 export CTARGET=${CATEGORY/cross-}
18 inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
19 inherit multilib pax-utils toolchain-funcs versionator
21 DESCRIPTION="The Glasgow Haskell Compiler"
22 HOMEPAGE="http://www.haskell.org/ghc/"
24 # we don't have any binaries yet
28 #arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )"
29 #arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )"
30 arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PVR}-amd64.tbz2 )"
31 #arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
32 #arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )"
33 #arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )"
34 #arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )"
35 arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PVR}-x86.tbz2 )"
38 #arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )"
45 # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
59 #GHC_PV=7.10.2.20151030 # uncomment only for -rc ebuilds
60 GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
62 SRC_URI="!binary? ( http://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.bz2 )"
63 S="${WORKDIR}"/${GHC_P}
65 [[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
68 # "hackage-name hackage-version"
71 "transformers 0.4.3.0"
76 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
77 IUSE="doc ghcbootstrap ghcmakebinary +gmp"
79 IUSE+=" elibc_glibc" # system stuff
84 sys-libs/ncurses:=[unicode]
85 !ghcmakebinary? ( virtual/libffi:= )
86 !kernel_Darwin? ( >=sys-devel/gcc-2.95.3:* )
87 kernel_linux? ( >=sys-devel/binutils-2.17:* )
88 kernel_SunOS? ( >=sys-devel/binutils-2.17:* )
91 # force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to
92 # that we want the binaries to use the latest versioun available, and not to be
95 # similar for glibc. we have bootstrapped binaries against glibc-2.17
97 doc? ( app-text/docbook-xml-dtd:4.2
98 app-text/docbook-xml-dtd:4.5
99 app-text/docbook-xsl-stylesheets
100 >=dev-libs/libxslt-1.1.2 )
101 !ghcbootstrap? ( !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) ) )"
103 PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
105 REQUIRED_USE="?? ( ghcbootstrap binary )"
107 # haskell libraries built with cabal in configure mode, #515354
108 QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
111 [[ ${CHOST} != ${CTARGET} ]]
114 # returns tool prefix for crosscompiler.
116 # CTARGET=armv7a-unknown-linux-gnueabi
117 # CHOST=x86_64-pc-linux-gnu
118 # "armv7a-unknown-linux-gnueabi-"
121 # Used in tools and library prefix:
122 # "${ED}"/usr/bin/$(cross)haddock
123 # "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
126 if is_crosscompile; then
133 append-ghc-cflags() {
134 local persistent compile assemble link
139 persistent) persistent="yes";;
140 compile) compile="yes";;
141 assemble) assemble="yes";;
144 [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
145 [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
146 [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
147 [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
148 [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
149 [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
155 # $1 - lib name (under libraries/)
157 # example: bump_lib "transformers" "0.4.2.0"
163 einfo "Bumping ${pn} up to ${pv}"
165 for f in ghc.mk GNUmakefile; do
166 mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
168 mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
169 mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
174 for p in "${BUMP_LIBRARIES[@]}"; do
178 SRC_URI+=" mirror://hackage/package/${pn}/${pn}-${pv}.tar.gz"
186 for p in "${BUMP_LIBRARIES[@]}"; do
190 bump_lib "${pn}" "${pv}"
195 if is_crosscompile; then
196 export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
197 export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
198 einfo "Crosscompiling mode:"
199 einfo " CHOST: ${CHOST}"
200 einfo " CTARGET: ${CTARGET}"
201 einfo " CFLAGS: ${CFLAGS}"
202 einfo " LDFLAGS: ${LDFLAGS}"
203 einfo " prefix: $(cross)"
206 # We need to be very careful with the CFLAGS we ask ghc to pass through to
207 # gcc. There are plenty of flags which will make gcc produce output that
208 # breaks ghc in various ways. The main ones we want to pass through are
209 # -mcpu / -march flags. These are important for arches like alpha & sparc.
210 # We also use these CFLAGS for building the C parts of ghc, ie the rts.
212 strip-unsupported-flags
214 # Cmm can't parse line numbers #482086
215 replace-flags -ggdb[3-9] -ggdb2
218 GHC_PERSISTENT_FLAGS=""
219 for flag in ${CFLAGS}; do
222 # Ignore extra optimisation (ghc passes -O to gcc anyway)
223 # -O2 and above break on too many systems
226 # Arch and ABI flags are what we're really after
227 -m*) append-ghc-cflags compile assemble ${flag};;
229 # Sometimes it's handy to see backtrace of RTS
230 # to get an idea what happens there
231 -g*) append-ghc-cflags compile ${flag};;
233 # Ignore all other flags, including all -f* flags
237 for flag in ${LDFLAGS}; do
238 append-ghc-cflags link ${flag}
241 # hardened-gcc needs to be disabled, because the mangler doesn't accept
243 gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
244 gcc-specs-ssp && append-ghc-cflags persistent compile -fno-stack-protector
246 # prevent from failind building unregisterised ghc:
247 # http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
248 use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
249 # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
250 # currently ghc fails to build haddock
251 # http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
252 use ia64 && append-ghc-cflags persistent compile -G0
255 # substitutes string $1 to $2 in files $3 $4 ...
263 sed -i -e "s|$from|$to|g" \
264 "$file" || die "path relocation failed for '$file'"
268 # changes hardcoded ghc paths and updates package index
269 # $1 - new absolute root path
273 # libdir for prebuilt binary and for current system may mismatch
274 # It does for prefix installation for example: bug #476998
275 local bin_ghc_prefix=${WORKDIR}/usr
276 local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
277 local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
279 # backup original script to use it later after relocation
280 local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
281 cp "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
283 if [[ ${bin_libdir} != $(get_libdir) ]]; then
284 einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
285 # moving the dir itself is not strictly needed
286 # but then USE=binary would result in installing
288 mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
290 relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
291 "${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
292 "${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
293 "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
294 "${WORKDIR}/usr/bin/$(cross)hsc2hs" \
295 "${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
297 "${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/"*
300 # Relocate from /usr to ${EPREFIX}/usr
301 relocate_path "/usr" "${to}/usr" \
302 "${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
303 "${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
304 "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
305 "${WORKDIR}/usr/bin/$(cross)hsc2hs" \
306 "${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
307 "${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/"*
309 # this one we will use to regenerate cache
310 # so it should point to current tree location
311 relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
314 # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree
315 # TODO: add the same for darwin's CHOST and it's DYLD_
316 local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH'
317 sed -i -e '2i'"$new_ldpath" \
318 "${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
319 "${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
320 "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
321 "${WORKDIR}/usr/bin/$(cross)hsc2hs" \
322 "${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
324 || die "Adding LD_LIBRARY_PATH for wrappers failed"
327 # regenerate the binary package cache
328 "$gp_back" recache || die "failed to update cache after relocation"
333 # quiet portage about prebuilt binaries
334 use binary && QA_PREBUILT="*"
336 [[ ${MERGE_TYPE} == binary ]] && return
338 if use ghcbootstrap; then
339 ewarn "You requested ghc bootstrapping, this is usually only used"
340 ewarn "by Gentoo developers to make binary .tbz2 packages."
342 [[ -z $(type -P ghc) ]] && \
343 die "Could not find a ghc to bootstrap with."
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@gentoo.org)"
348 die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
354 # Create the ${S} dir if we're using the binary version
355 use binary && mkdir "${S}"
357 # the Solaris and Darwin binaries from ghc (maeder) need to be
358 # unpacked separately, so prevent them from being unpacked
361 *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;;
365 if [[ -d "${S}"/libraries/dph ]]; then
366 # Sometimes dph libs get accidentally shipped with ghc
367 # but they are not installed unless user requests it.
368 # We never install them.
369 elog "Removing 'libraries/dph'"
370 rm -rf "${S}"/libraries/dph
377 if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
378 # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
380 sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
381 "${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}"
383 # allow hardened users use vanilla binary to bootstrap ghc
384 # ghci uses mmap with rwx protection at it implements dynamic
385 # linking on it's own (bug #299709)
386 pax-mark -m "${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/bin/ghc"
391 relocate_ghc "${EPREFIX}"
394 # Move unpacked files to the expected place
395 mv "${WORKDIR}/usr" "${S}"
397 if ! use ghcbootstrap; then
399 *-darwin* | *-solaris*)
400 # UPDATE ME for ghc-7
401 mkdir "${WORKDIR}"/ghc-bin-installer || die
402 pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
403 use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
404 use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
405 use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
406 use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
409 pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
410 # fix the binaries so they run, on Solaris we need an
411 # LD_LIBRARY_PATH which has our prefix libdirs, on
412 # Darwin we need to replace the frameworks with our libs
413 # from the prefix fix before installation, because some
414 # of the tools are actually used during configure/make
415 if [[ ${CHOST} == *-solaris* ]] ; then
416 export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
417 elif [[ ${CHOST} == *-darwin* ]] ; then
418 local readline_framework=GNUreadline.framework/GNUreadline
419 local gmp_framework=/opt/local/lib/libgmp.10.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 \
426 install_name_tool -change \
428 "${EPREFIX}"/usr/lib/libgmp.dylib \
430 install_name_tool -change \
432 "${EPREFIX}"/usr/lib/libncurses.dylib \
435 # we don't do frameworks!
437 -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
438 -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
439 rts/package.conf.in || die
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
449 relocate_ghc "${WORKDIR}"
454 sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
455 "${S}/ghc/ghc.wrapper"
457 cd "${S}" # otherwise epatch will break
459 epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
461 epatch "${FILESDIR}"/${PN}-7.8.2-cgen-constify.patch
462 epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
463 epatch "${FILESDIR}"/${PN}-7.10.1-rc3-ghc-7.10-bootstrap.patch
464 epatch "${FILESDIR}"/${PN}-7.10.3-relnotes.patch
465 epatch "${FILESDIR}"/${PN}-7.10.3-hardfloat.patch
467 # Since ${S}/packages does not include base, etc. add them to gen_contents_index
468 sed -e 's@\(for REPO in .*\)@\1 base integer-gmp integer-gmp2 integer-simple template-haskell@' \
469 -i libraries/gen_contents_index || die
472 # Make configure find docbook-xsl-stylesheets from Prefix
473 sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
474 -i utils/haddock/doc/configure.ac || die
479 # as we have changed the build system
485 if ! use binary; then
486 # initialize build.mk
487 echo '# Gentoo changes' > mk/build.mk
489 # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
490 echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
491 echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
493 # We also need to use the GHC_FLAGS flags when building ghc itself
494 echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
495 echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
496 echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
498 # We can't depend on haddock except when bootstrapping when we
499 # must build docs and include them into the binary .tbz2 package
500 # app-text/dblatex is not in portage, can not build PDF or PS
501 echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
502 echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
504 echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
506 echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
509 # this controls presence on 'xhtml' and 'haddock' in final install
510 echo "HADDOCK_DOCS = YES" >> mk/build.mk
512 # allows overriding build flavours for libraries:
513 # v - vanilla (static libs)
515 # dyn - shared libraries
516 # example: GHC_LIBRARY_WAYS="v dyn"
517 if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
518 echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
521 # Get ghc from the unpacked binary .tbz2
522 # except when bootstrapping we just pick ghc up off the path
523 if ! use ghcbootstrap; then
524 export PATH="${WORKDIR}/usr/bin:${PATH}"
528 echo "INTEGER_LIBRARY=integer-gmp2" >> mk/build.mk
530 echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
533 # don't strip anything. Very useful when stage2 SIGSEGVs on you
534 echo "STRIP_CMD = :" >> mk/build.mk
538 # GHC embeds 'gcc' it was built by and uses it later.
539 # Don't allow things like ccache or versioned binary slip.
540 # We use stable thing across gcc upgrades.
541 is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc)
543 if use ghcmakebinary; then
544 # When building booting libary we are trying to
545 # bundle or restrict most of external depends
547 # - embed libffi (default GHC behaviour)
548 # - disable ncurses support for ghci (via haskeline)
549 # https://bugs.gentoo.org/557478
550 # - disable ncurses support for ghc-pkg
551 echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
552 echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
554 econf_args+=(--with-system-libffi)
555 econf_args+=(--with-ffi-includes=$(pkg-config libffi --cflags-only-I | sed -e 's@^-I@@'))
558 elog "Final mk/build.mk:"
559 cat mk/build.mk || die
561 econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
563 if [[ ${PV} == *9999* ]]; then
564 GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
565 GHC_P=${PN}-${GHC_PV}
571 if ! use binary; then
572 # 1. build compiler binary first
573 emake ghc/stage2/build/tmp/ghc-stage2
574 # 2. pax-mark (bug #516430)
575 pax-mark -m ghc/stage2/build/tmp/ghc-stage2
576 # 3. and then all the rest
583 use prefix && mkdir -p "${ED}"
584 mv "${S}/usr" "${ED}"
587 emake -j1 install DESTDIR="${D}"
588 dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
590 # rename ghc-shipped files to avoid collision
591 # of external packages. Motivating example:
592 # user had installed:
593 # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
594 # dev-haskell/transformers-0.4.2.0
595 # then user tried to update to
596 # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
597 # this will lead to single .conf file collision.
598 local shipped_conf renamed_conf
599 local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
600 for shipped_conf in "${package_confdir}"/*.conf; do
601 # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
602 renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
603 mv "${shipped_conf}" "${renamed_conf}" || die
606 # remove link, but leave 'haddock-${GHC_P}'
607 rm -f "${ED}"/usr/bin/$(cross)haddock
609 if [[ ! -f "${S}/VERSION" ]]; then
610 echo "${GHC_PV}" > "${S}/VERSION" \
611 || die "Could not create file ${S}/VERSION"
613 if ! is_crosscompile; then
614 newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
615 newbashcomp utils/completion/ghc.bash ghc
619 # path to the package.cache
620 local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
621 PKGCACHE="${package_confdir}"/package.cache
622 # copy the package.conf.d, including timestamp, save it so we can help
623 # users that have a broken package.conf.d
624 cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
626 # copy the package.conf, including timestamp, save it so we later can put it
627 # back before uninstalling, or when upgrading.
628 cp -p "${PKGCACHE}"{,.shipped} \
629 || die "failed to copy package.conf.d/package.cache"
633 # have we got an earlier version of ghc installed?
634 if has_version "<${CATEGORY}/${PF}"; then
635 haskell_updater_warn="1"
642 # path to the package.cache
643 PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
645 # give the cache a new timestamp, it must be as recent as
646 # the package.conf.d directory.
649 if [[ "${haskell_updater_warn}" == "1" ]]; then
651 ewarn "\e[1;31m************************************************************************\e[0m"
653 ewarn "You have just upgraded from an older version of GHC."
654 ewarn "You may have to run"
655 ewarn " 'haskell-updater'"
656 ewarn "to rebuild all ghc-based Haskell libraries."
658 ewarn "\e[1;31m************************************************************************\e[0m"
664 PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
667 cp -p "${PKGCACHE}"{.shipped,}
671 ghc-package_pkg_postrm