1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 # to make make a crosscompiler use crossdev and symlink ghc tree into
7 # cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
9 # 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
10 export CTARGET=${CTARGET:-${CHOST}}
11 if [[ ${CTARGET} = ${CHOST} ]] ; then
12 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
13 export CTARGET=${CATEGORY/cross-}
17 inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
18 inherit multilib pax-utils toolchain-funcs versionator prefix
20 DESCRIPTION="The Glasgow Haskell Compiler"
21 HOMEPAGE="https://www.haskell.org/ghc/"
23 # we don't have any binaries yet
27 arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
28 #arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-arm.tbz2 )"
29 arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PVR}-amd64.tbz2 )"
30 arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64.tbz2 )"
31 arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
32 arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
33 arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
34 arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PVR}-x86.tbz2 )"
37 #arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
44 # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
58 #GHC_PV=7.10.2.20151030 # uncomment only for -rc ebuilds
59 GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
61 SRC_URI="!binary? ( https://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.bz2 )"
62 S="${WORKDIR}"/${GHC_P}
64 [[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
67 # "hackage-name hackage-version"
70 "transformers 0.4.3.0"
75 KEYWORDS="amd64 ~ia64 ~ppc ~ppc64 x86 ~amd64-linux ~x86-linux"
76 IUSE="doc ghcbootstrap ghcmakebinary +gmp"
78 IUSE+=" elibc_glibc" # system stuff
83 sys-libs/ncurses:0=[unicode]
84 !ghcmakebinary? ( dev-libs/libffi:= )
87 # This set of dependencies is needed to run
88 # prebuilt ghc. We specifically avoid ncurses
90 # utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
91 PREBUILT_BINARY_DEPENDS="
92 !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
94 # This set of dependencies is needed to install
95 # ghc[binary] in system. terminfo package is linked
97 PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
98 sys-libs/ncurses-compat:5
101 RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
104 doc? ( app-text/docbook-xml-dtd:4.2
105 app-text/docbook-xml-dtd:4.5
106 app-text/docbook-xsl-stylesheets
107 >=dev-libs/libxslt-1.1.2 )
108 !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
110 PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
112 REQUIRED_USE="?? ( ghcbootstrap binary )"
114 # haskell libraries built with cabal in configure mode, #515354
115 QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
118 [[ ${CHOST} != ${CTARGET} ]]
121 # returns tool prefix for crosscompiler.
123 # CTARGET=armv7a-unknown-linux-gnueabi
124 # CHOST=x86_64-pc-linux-gnu
125 # "armv7a-unknown-linux-gnueabi-"
128 # Used in tools and library prefix:
129 # "${ED}"/usr/bin/$(cross)haddock
130 # "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
133 if is_crosscompile; then
140 append-ghc-cflags() {
141 local persistent compile assemble link
146 persistent) persistent="yes";;
147 compile) compile="yes";;
148 assemble) assemble="yes";;
151 [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
152 [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
153 [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
154 [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
155 [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
156 [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
162 # $1 - lib name (under libraries/)
164 # example: bump_lib "transformers" "0.4.2.0"
170 einfo "Bumping ${pn} up to ${pv}"
172 for f in ghc.mk GNUmakefile; do
173 mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
175 mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
176 mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
181 for p in "${BUMP_LIBRARIES[@]}"; do
185 SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
193 for p in "${BUMP_LIBRARIES[@]}"; do
197 bump_lib "${pn}" "${pv}"
202 if is_crosscompile; then
203 export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
204 export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
205 einfo "Crosscompiling mode:"
206 einfo " CHOST: ${CHOST}"
207 einfo " CTARGET: ${CTARGET}"
208 einfo " CFLAGS: ${CFLAGS}"
209 einfo " LDFLAGS: ${LDFLAGS}"
210 einfo " prefix: $(cross)"
213 # We need to be very careful with the CFLAGS we ask ghc to pass through to
214 # gcc. There are plenty of flags which will make gcc produce output that
215 # breaks ghc in various ways. The main ones we want to pass through are
216 # -mcpu / -march flags. These are important for arches like alpha & sparc.
217 # We also use these CFLAGS for building the C parts of ghc, ie the rts.
219 strip-unsupported-flags
221 # Cmm can't parse line numbers #482086
222 replace-flags -ggdb[3-9] -ggdb2
225 GHC_PERSISTENT_FLAGS=""
226 for flag in ${CFLAGS}; do
229 # Ignore extra optimisation (ghc passes -O to gcc anyway)
230 # -O2 and above break on too many systems
233 # Arch and ABI flags are what we're really after
234 -m*) append-ghc-cflags compile assemble ${flag};;
236 # Sometimes it's handy to see backtrace of RTS
237 # to get an idea what happens there
238 -g*) append-ghc-cflags compile ${flag};;
240 # Ignore all other flags, including all -f* flags
244 for flag in ${LDFLAGS}; do
245 append-ghc-cflags link ${flag}
248 # hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
249 # are not built with fPIC, bug #606666
250 gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
251 tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
252 # gcc-6.3 has support for -no-pie upstream, but spelling differs from
253 # gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
254 # hardened users try '-pie' in USE=ghcbootstrap mode.
255 append-ghc-cflags compile link -no-pie
257 gcc-specs-ssp && append-ghc-cflags persistent compile -fno-stack-protector
259 # prevent from failind building unregisterised ghc:
260 # https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
261 use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
262 # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
263 # currently ghc fails to build haddock
264 # https://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
265 use ia64 && append-ghc-cflags persistent compile -G0
268 # substitutes string $1 to $2 in files $3 $4 ...
276 sed -i -e "s|$from|$to|g" \
277 "$file" || die "path relocation failed for '$file'"
281 # changes hardcoded ghc paths and updates package index
282 # $1 - new absolute root path
286 # libdir for prebuilt binary and for current system may mismatch
287 # It does for prefix installation for example: bug #476998
288 local bin_ghc_prefix=${WORKDIR}/usr
289 local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
290 local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
292 # backup original script to use it later after relocation
293 local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
294 cp "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
296 if [[ ${bin_libdir} != $(get_libdir) ]]; then
297 einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
298 # moving the dir itself is not strictly needed
299 # but then USE=binary would result in installing
301 mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
303 relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
304 "${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
305 "${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
306 "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
307 "${WORKDIR}/usr/bin/$(cross)hsc2hs" \
308 "${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
310 "${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/"*
313 # Relocate from /usr to ${EPREFIX}/usr
314 relocate_path "/usr" "${to}/usr" \
315 "${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}" \
316 "${WORKDIR}/usr/bin/$(cross)ghci-${GHC_PV}" \
317 "${WORKDIR}/usr/bin/$(cross)ghc-pkg-${GHC_PV}" \
318 "${WORKDIR}/usr/bin/$(cross)hsc2hs" \
319 "${WORKDIR}/usr/bin/$(cross)runghc-${GHC_PV}" \
320 "${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/"*
322 # this one we will use to regenerate cache
323 # so it should point to current tree location
324 relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
327 hprefixify "${bin_libpath}"/${PN}*/settings
330 # regenerate the binary package cache
331 "$gp_back" recache || die "failed to update cache after relocation"
336 # quiet portage about prebuilt binaries
337 use binary && QA_PREBUILT="*"
339 [[ ${MERGE_TYPE} == binary ]] && return
341 if use ghcbootstrap; then
342 ewarn "You requested ghc bootstrapping, this is usually only used"
343 ewarn "by Gentoo developers to make binary .tbz2 packages."
345 [[ -z $(type -P ghc) ]] && \
346 die "Could not find a ghc to bootstrap with."
348 if ! yet_binary; then
349 eerror "Please try emerging with USE=ghcbootstrap and report build"
350 eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
351 die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
357 # Create the ${S} dir if we're using the binary version
358 use binary && mkdir "${S}"
360 # the Solaris and Darwin binaries from ghc (maeder) need to be
361 # unpacked separately, so prevent them from being unpacked
364 *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;;
368 if [[ -d "${S}"/libraries/dph ]]; then
369 # Sometimes dph libs get accidentally shipped with ghc
370 # but they are not installed unless user requests it.
371 # We never install them.
372 elog "Removing 'libraries/dph'"
373 rm -rf "${S}"/libraries/dph
380 if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
381 # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
383 sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
384 "${WORKDIR}/usr/bin/$(cross)ghc-${GHC_PV}"
386 # allow hardened users use vanilla binary to bootstrap ghc
387 # ghci uses mmap with rwx protection at it implements dynamic
388 # linking on it's own (bug #299709)
389 pax-mark -m "${WORKDIR}/usr/$(get_libdir)/$(cross)${GHC_P}/bin/ghc"
394 relocate_ghc "${EPREFIX}"
397 # Move unpacked files to the expected place
398 mv "${WORKDIR}/usr" "${S}"
400 if ! use ghcbootstrap; then
402 *-darwin* | *-solaris*)
403 # UPDATE ME for ghc-7
404 mkdir "${WORKDIR}"/ghc-bin-installer || die
405 pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
406 use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
407 use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
408 use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
409 use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
412 pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
413 # fix the binaries so they run, on Solaris we need an
414 # LD_LIBRARY_PATH which has our prefix libdirs, on
415 # Darwin we need to replace the frameworks with our libs
416 # from the prefix fix before installation, because some
417 # of the tools are actually used during configure/make
418 if [[ ${CHOST} == *-solaris* ]] ; then
419 export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
420 elif [[ ${CHOST} == *-darwin* ]] ; then
421 local readline_framework=GNUreadline.framework/GNUreadline
422 local gmp_framework=/opt/local/lib/libgmp.10.dylib
423 local ncurses_file=/opt/local/lib/libncurses.5.dylib
424 for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
425 install_name_tool -change \
426 ${readline_framework} \
427 "${EPREFIX}"/lib/libreadline.dylib \
429 install_name_tool -change \
431 "${EPREFIX}"/usr/lib/libgmp.dylib \
433 install_name_tool -change \
435 "${EPREFIX}"/usr/lib/libncurses.dylib \
438 # we don't do frameworks!
440 -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
441 -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
442 rts/package.conf.in || die
445 # it is autoconf, but we really don't want to give it too
446 # much arguments, in fact we do the make in-place anyway
447 ./configure --prefix="${WORKDIR}"/usr || die
452 relocate_ghc "${WORKDIR}"
457 sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
458 "${S}/ghc/ghc.wrapper"
460 cd "${S}" # otherwise epatch will break
462 epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
464 epatch "${FILESDIR}"/${PN}-7.8.2-cgen-constify.patch
465 epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
466 epatch "${FILESDIR}"/${PN}-7.10.1-rc3-ghc-7.10-bootstrap.patch
467 epatch "${FILESDIR}"/${PN}-7.10.3-relnotes.patch
468 epatch "${FILESDIR}"/${PN}-7.10.3-hardfloat.patch
470 # Since ${S}/packages does not include base, etc. add them to gen_contents_index
471 sed -e 's@\(for REPO in .*\)@\1 base integer-gmp integer-gmp2 integer-simple template-haskell@' \
472 -i libraries/gen_contents_index || die
475 # Make configure find docbook-xsl-stylesheets from Prefix
476 sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
477 -i utils/haddock/doc/configure.ac || die
482 # as we have changed the build system
488 if ! use binary; then
489 # initialize build.mk
490 echo '# Gentoo changes' > mk/build.mk
492 # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
493 echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
494 echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
496 # We also need to use the GHC_FLAGS flags when building ghc itself
497 echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
498 echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
499 echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
501 # We can't depend on haddock except when bootstrapping when we
502 # must build docs and include them into the binary .tbz2 package
503 # app-text/dblatex is not in portage, can not build PDF or PS
504 echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
505 echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
507 echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
509 echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
512 # this controls presence on 'xhtml' and 'haddock' in final install
513 echo "HADDOCK_DOCS = YES" >> mk/build.mk
515 # allows overriding build flavours for libraries:
516 # v - vanilla (static libs)
518 # dyn - shared libraries
519 # example: GHC_LIBRARY_WAYS="v dyn"
520 if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
521 echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
524 # Get ghc from the unpacked binary .tbz2
525 # except when bootstrapping we just pick ghc up off the path
526 if ! use ghcbootstrap; then
527 export PATH="${WORKDIR}/usr/bin:${PATH}"
531 echo "INTEGER_LIBRARY=integer-gmp2" >> mk/build.mk
533 echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
536 # don't strip anything. Very useful when stage2 SIGSEGVs on you
537 echo "STRIP_CMD = :" >> mk/build.mk
541 # GHC embeds 'gcc' it was built by and uses it later.
542 # Don't allow things like ccache or versioned binary slip.
543 # We use stable thing across gcc upgrades.
544 is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc)
546 if use ghcmakebinary; then
547 # When building booting libary we are trying to
548 # bundle or restrict most of external depends
550 # - embed libffi (default GHC behaviour)
551 # - disable ncurses support for ghci (via haskeline)
552 # https://bugs.gentoo.org/557478
553 # - disable ncurses support for ghc-pkg
554 echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
555 echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
557 econf_args+=(--with-system-libffi)
558 econf_args+=(--with-ffi-includes=$(pkg-config libffi --cflags-only-I | sed -e 's@^-I@@'))
561 elog "Final mk/build.mk:"
562 cat mk/build.mk || die
564 econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
566 if [[ ${PV} == *9999* ]]; then
567 GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
568 GHC_P=${PN}-${GHC_PV}
574 if ! use binary; then
575 # 1. build compiler binary first
576 emake ghc/stage2/build/tmp/ghc-stage2
577 # 2. pax-mark (bug #516430)
578 pax-mark -m ghc/stage2/build/tmp/ghc-stage2
579 # 3. and then all the rest
586 use prefix && mkdir -p "${ED}"
587 mv "${S}/usr" "${ED}"
590 emake -j1 install DESTDIR="${D}"
591 dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
593 # rename ghc-shipped files to avoid collision
594 # of external packages. Motivating example:
595 # user had installed:
596 # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
597 # dev-haskell/transformers-0.4.2.0
598 # then user tried to update to
599 # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
600 # this will lead to single .conf file collision.
601 local shipped_conf renamed_conf
602 local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
603 for shipped_conf in "${package_confdir}"/*.conf; do
604 # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
605 renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
606 mv "${shipped_conf}" "${renamed_conf}" || die
609 # remove link, but leave 'haddock-${GHC_P}'
610 rm -f "${ED}"/usr/bin/$(cross)haddock
612 if [[ ! -f "${S}/VERSION" ]]; then
613 echo "${GHC_PV}" > "${S}/VERSION" \
614 || die "Could not create file ${S}/VERSION"
616 if ! is_crosscompile; then
617 newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
618 newbashcomp utils/completion/ghc.bash ghc
622 # path to the package.cache
623 local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
624 PKGCACHE="${package_confdir}"/package.cache
625 # copy the package.conf.d, including timestamp, save it so we can help
626 # users that have a broken package.conf.d
627 cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
629 # copy the package.conf, including timestamp, save it so we later can put it
630 # back before uninstalling, or when upgrading.
631 cp -p "${PKGCACHE}"{,.shipped} \
632 || die "failed to copy package.conf.d/package.cache"
636 # have we got an earlier version of ghc installed?
637 if has_version "<${CATEGORY}/${PF}"; then
638 haskell_updater_warn="1"
645 # path to the package.cache
646 PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
648 # give the cache a new timestamp, it must be as recent as
649 # the package.conf.d directory.
652 if [[ "${haskell_updater_warn}" == "1" ]]; then
654 ewarn "\e[1;31m************************************************************************\e[0m"
656 ewarn "You have just upgraded from an older version of GHC."
657 ewarn "You may have to run"
658 ewarn " 'haskell-updater'"
659 ewarn "to rebuild all ghc-based Haskell libraries."
661 ewarn "\e[1;31m************************************************************************\e[0m"
667 PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
670 cp -p "${PKGCACHE}"{.shipped,}
674 ghc-package_pkg_postrm