Gentoo Archives: gentoo-commits

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