Gentoo Archives: gentoo-commits

From: "Duncan Coutts (dcoutts)" <dcoutts@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/ghc: ghc-6.4.2.ebuild ChangeLog ghc-6.2.2.ebuild
Date: Mon, 05 Nov 2007 10:28:01
Message-Id: E1IozBN-0002ch-OB@stork.gentoo.org
1 dcoutts 07/11/05 10:27:49
2
3 Modified: ghc-6.4.2.ebuild ChangeLog ghc-6.2.2.ebuild
4 Log:
5 Use new unified ghc ebuild for 6.2.2 and 6.4.2.
6 (Portage version: 2.1.3.16)
7
8 Revision Changes Path
9 1.23 dev-lang/ghc/ghc-6.4.2.ebuild
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ghc-6.4.2.ebuild?rev=1.23&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ghc-6.4.2.ebuild?rev=1.23&content-type=text/plain
13 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ghc-6.4.2.ebuild?r1=1.22&r2=1.23
14
15 Index: ghc-6.4.2.ebuild
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.4.2.ebuild,v
18 retrieving revision 1.22
19 retrieving revision 1.23
20 diff -u -r1.22 -r1.23
21 --- ghc-6.4.2.ebuild 5 Nov 2007 02:18:21 -0000 1.22
22 +++ ghc-6.4.2.ebuild 5 Nov 2007 10:27:49 -0000 1.23
23 @@ -1,18 +1,20 @@
24 # Copyright 1999-2007 Gentoo Foundation
25 # Distributed under the terms of the GNU General Public License v2
26 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.4.2.ebuild,v 1.22 2007/11/05 02:18:21 dcoutts Exp $
27 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.4.2.ebuild,v 1.23 2007/11/05 10:27:49 dcoutts Exp $
28
29 # Brief explanation of the bootstrap logic:
30 #
31 -# ghc requires ghc-bin to bootstrap.
32 -# Therefore,
33 -# (1) both ghc-bin and ghc provide virtual/ghc
34 -# (2) virtual/ghc *must* default to ghc-bin
35 -# (3) ghc depends on virtual/ghc
36 +# Previous ghc ebuilds have been split into two: ghc and ghc-bin,
37 +# where ghc-bin was primarily used for bootstrapping purposes.
38 +# From now on, these two ebuilds have been combined, with the
39 +# binary USE flag used to determine whether or not the pre-built
40 +# binary package should be emerged or whether ghc should be compiled
41 +# from source. If the latter, then the relevant ghc-bin for the
42 +# arch in question will be used in the working directory to compile
43 +# ghc from source.
44 #
45 -# This solution has the advantage that the binary distribution
46 -# can be removed once an forall after the first succesful install
47 -# of ghc.
48 +# This solution has the advantage of allowing us to retain the one
49 +# ebuild for both packages, and thus phase out virtual/ghc.
50
51 # Note to users of hardened gcc-3.x:
52 #
53 @@ -26,7 +28,7 @@
54 # re-emerge ghc (or ghc-bin). People using vanilla gcc can switch between
55 # gcc-3.x and 4.x with no problems.
56
57 -inherit base eutils flag-o-matic toolchain-funcs autotools ghc-package check-reqs
58 +inherit base eutils flag-o-matic toolchain-funcs autotools ghc-package
59
60 DESCRIPTION="The Glasgow Haskell Compiler"
61 HOMEPAGE="http://www.haskell.org/ghc/"
62 @@ -38,60 +40,49 @@
63 EXTRA_SRC_URI="${MY_PV}"
64 [[ -z "${IS_SNAPSHOT}" ]] && EXTRA_SRC_URI="stable/dist"
65
66 -SRC_URI="http://www.haskell.org/ghc/dist/${EXTRA_SRC_URI}/${MY_P}-src.tar.bz2
67 - test? ( http://haskell.org/ghc/dist/ghc-testsuite-${MY_PV}.tar.gz )
68 - mirror://gentoo/${P}-alut.patch.gz"
69 +SRC_URI="!binary? ( http://haskell.org/ghc/dist/${EXTRA_SRC_URI}/${MY_P}-src.tar.bz2 )
70 + doc? ( mirror://gentoo/${P}-libraries.tar.gz
71 + mirror://gentoo/${P}-users_guide.tar.gz )
72 + alpha? ( mirror://gentoo/ghc-bin-${PV}-alpha.tbz2 )
73 + amd64? ( mirror://gentoo/ghc-bin-${PV}-amd64.tbz2 )
74 + hppa? ( mirror://gentoo/ghc-bin-${PV}-hppa.tbz2 )
75 + ia64? ( mirror://gentoo/ghc-bin-${PV}-ia64.tbz2 )
76 + ppc? ( mirror://gentoo/ghc-bin-${PV}-ppc.tbz2 )
77 + ppc64? ( mirror://gentoo/ghc-bin-${PV}-ppc64.tbz2 )
78 + sparc? ( mirror://gentoo/ghc-bin-${PV}-sparc.tbz2 )
79 + x86? ( mirror://gentoo/ghc-bin-${PV}-x86.tbz2 )
80 + x86-fbsd? ( mirror://gentoo/ghc-bin-${PV}-x86-fbsd.tbz2 )
81 + test? ( http://haskell.org/ghc/dist/ghc-testsuite-${MY_PV}.tar.gz )
82 + mirror://gentoo/${P}-alut.patch.gz"
83
84 -LICENSE="as-is"
85 +LICENSE="BSD"
86 SLOT="0"
87 KEYWORDS="~alpha amd64 hppa ~ia64 ppc ppc64 sparc x86 ~x86-fbsd"
88 -IUSE="test doc X opengl openal"
89 +IUSE="binary doc ghcbootstrap test X opengl openal"
90
91 +LOC="/opt/ghc" # location for installation of binary version
92 S="${WORKDIR}/${MY_P}"
93
94 PROVIDE="virtual/ghc"
95
96 RDEPEND="
97 + !dev-lang/ghc-bin
98 >=sys-devel/gcc-2.95.3
99 >=sys-devel/binutils-2.17
100 >=dev-lang/perl-5.6.1
101 >=dev-libs/gmp-4.1
102 - >=sys-libs/readline-4.2
103 - X? ( x11-libs/libX11 )
104 + =sys-libs/readline-5*
105 + X? ( || ( x11-libs/libX11 virtual/x11 ) )
106 opengl? ( virtual/opengl
107 virtual/glu virtual/glut
108 openal? ( media-libs/openal media-libs/freealut ) )"
109
110 -# ghc cannot usually be bootstrapped using later versions ...
111 -DEPEND="${RDEPEND}
112 - <virtual/ghc-6.5
113 - !>=virtual/ghc-6.6
114 - doc? ( ~app-text/docbook-xml-dtd-4.2
115 - app-text/docbook-xsl-stylesheets
116 - >=dev-libs/libxslt-1.1.2
117 - >=dev-haskell/haddock-0.6-r2 )"
118 +DEPEND="${RDEPEND}"
119 +# In the ghcbootstrap case we rely on the developer having
120 +# >=ghc-5.04.3 on their $PATH already
121
122 PDEPEND=">=dev-haskell/cabal-1.1.4"
123
124 -pkg_setup() {
125 - if use openal && ! use opengl; then
126 - ewarn "The OpenAL bindings require the OpenGL bindings, however"
127 - ewarn "USE=\"-opengl\" so the OpenAL bindings will not be built."
128 - ewarn "To build the OpenAL bindings emerge with USE=\"openal opengl\""
129 - fi
130 -
131 - # Portage's resolution of virtuals fails on virtual/ghc in some Portage
132 - # releases, the following function causes the build to fail with an
133 - # informative error message in such a case.
134 - #if ! has_version virtual/ghc; then
135 - # eerror "This ebuild needs a version of GHC to bootstrap from."
136 - # eerror "Please emerge dev-lang/ghc-bin to get a binary version."
137 - # eerror "You can either use the binary version directly or emerge"
138 - # eerror "dev-lang/ghc afterwards."
139 - # die "virtual/ghc version required to build"
140 - #fi
141 -}
142 -
143 append-ghc-cflags() {
144 local flag compile assemble link
145 for flag in $*; do
146 @@ -146,130 +137,220 @@
147 append-ghc-cflags assemble "-Wa,--noexecstack"
148 }
149
150 -ghc_setup_wrapper() {
151 - echo '#!/bin/sh'
152 - echo "GHCBIN=\"$(ghc-libdir)/ghc-$1\";"
153 - echo "TOPDIROPT=\"-B$(ghc-libdir)\";"
154 - echo "GHC_CFLAGS=\"${GHC_CFLAGS}\";"
155 - echo '# Mini-driver for GHC'
156 - echo 'exec $GHCBIN $TOPDIROPT $GHC_CFLAGS ${1+"$@"}'
157 +pkg_setup() {
158 + if use ghcbootstrap; then
159 + ewarn "You requested ghc bootstrapping, this is usually only used"
160 + ewarn "by Gentoo developers to make binary .tbz2 packages for"
161 + ewarn "use with the ghc ebuild's USE=\"binary\" feature."
162 + use binary && \
163 + die "USE=\"ghcbootstrap binary\" is not a valid combination."
164 + use doc && \
165 + die "USE=\"ghcbootstrap doc\" is not a valid combination"
166 + [[ -z $(type -P ghc) ]] && \
167 + die "Could not find a ghc to bootstrap with."
168 + fi
169 +
170 + if use openal && ! use opengl; then
171 + ewarn "The OpenAL bindings require the OpenGL bindings, however"
172 + ewarn "USE=\"-opengl\" so the OpenAL bindings will not be built."
173 + ewarn "To build the OpenAL bindings emerge with USE=\"openal opengl\""
174 + fi
175 +
176 + if use binary; then
177 + if use opengl || use openal || use X || use test; then
178 + ewarn "The binary build does not include the X, OpenGL"
179 + ewarn "or OpenAL bindings and does not support the testsuite."
180 + ewarn "If you want those features, emerge with USE=\"-binary\""
181 + fi
182 + fi
183 +
184 + set_config
185 +}
186 +
187 +set_config() {
188 + # make this a separate function and call it several times as portage doesn't
189 + # remember the variables properly between the fuctions.
190 + use binary && GHC_PREFIX="/opt/ghc" || GHC_PREFIX="/usr"
191 }
192
193 src_unpack() {
194 + # Create the ${S} dir if we're using the binary version
195 + use binary && mkdir "${S}"
196 +
197 base_src_unpack
198 ghc_setup_cflags
199
200 - cd "${S}"
201 - epatch "${WORKDIR}/${P}-alut.patch"
202 - epatch "${FILESDIR}/${P}-sparc32plus.patch"
203 - epatch "${FILESDIR}/${P}-sparcmangler.patch"
204 -
205 - # Modify the ghc driver script to use GHC_CFLAGS
206 - echo "SCRIPT_SUBST_VARS += GHC_CFLAGS" >> "${S}/ghc/driver/ghc/Makefile"
207 - echo "GHC_CFLAGS = ${GHC_CFLAGS}" >> "${S}/ghc/driver/ghc/Makefile"
208 - sed -i -e 's|$TOPDIROPT|$TOPDIROPT $GHC_CFLAGS|' "${S}/ghc/driver/ghc/ghc.sh"
209 -
210 - # If we're using the testsuite then move it to into the build tree
211 - use test && mv "${WORKDIR}/testsuite" "${S}/"
212 -
213 - # Patch to fix a mis-compilation in the rts due to strict aliasing,
214 - # should be fixed upstream for 6.4.3 and 6.6. Fixes bug #135651.
215 - echo 'GC_HC_OPTS += -optc-fno-strict-aliasing' >> "${S}/ghc/rts/Makefile"
216 + if use binary; then
217 +
218 + # Move unpacked files to the expected place
219 + mv "${WORKDIR}/usr" "${S}"
220
221 - # Don't strip binaries on install. See QA warnings in bug #140369.
222 - sed -i -e 's/SRC_INSTALL_BIN_OPTS += -s//' "${S}/mk/config.mk.in"
223 + # Relocate from /usr to /opt/ghc
224 + sed -i -e "s|/usr|${LOC}|g" \
225 + "${S}/usr/bin/ghc-${PV}" \
226 + "${S}/usr/bin/ghci-${PV}" \
227 + "${S}/usr/bin/ghc-pkg-${PV}" \
228 + "${S}/usr/bin/hsc2hs" \
229 + "${S}/usr/$(get_libdir)/${P}/package.conf" \
230 + || die "Relocating ghc from /usr to /opt/ghc failed"
231 +
232 +
233 + # fix docs
234 + if use doc; then
235 + # correct the documentation and .haddock files path
236 + sed -i -e \
237 + "s|/opt/ghc/share/doc/${P}/html/libraries|/usr/share/doc/${P}/html/libraries|g" \
238 + "${S}/usr/$(get_libdir)/${P}/package.conf"
239 + else
240 + # remove all doc stuff from package.conf
241 + sed -i \
242 + -e 's|haddockInterfaces = \[[^]]*\]|haddockInterfaces = \[\]|g' \
243 + -e "s|haddockHTMLs = \[[^]]*\]|haddockHTMLs = \[\]|g" \
244 + "${S}/usr/$(get_libdir)/${P}/package.conf"
245 + fi
246 +
247 + sed -i -e "s|/usr/$(get_libdir)|${LOC}/$(get_libdir)|" \
248 + "${S}/usr/bin/ghcprof"
249 +
250 + else
251 +
252 + cd "${S}"
253 + epatch "${WORKDIR}/${P}-alut.patch"
254 + epatch "${FILESDIR}/${P}-sparc32plus.patch"
255 + epatch "${FILESDIR}/${P}-sparcmangler.patch"
256 +
257 + # Modify the ghc driver script to use GHC_CFLAGS
258 + echo "SCRIPT_SUBST_VARS += GHC_CFLAGS" >> "${S}/ghc/driver/ghc/Makefile"
259 + echo "GHC_CFLAGS = ${GHC_CFLAGS}" >> "${S}/ghc/driver/ghc/Makefile"
260 + sed -i -e 's|$TOPDIROPT|$TOPDIROPT $GHC_CFLAGS|' "${S}/ghc/driver/ghc/ghc.sh"
261 +
262 + if ! use ghcbootstrap; then
263 + # Relocate from /usr to ${WORKDIR}/usr
264 + sed -i -e "s|/usr|${WORKDIR}/usr|g" \
265 + "${WORKDIR}/usr/bin/ghc-${PV}" \
266 + "${WORKDIR}/usr/bin/ghci-${PV}" \
267 + "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
268 + "${WORKDIR}/usr/bin/hsc2hs" \
269 + "${WORKDIR}/usr/$(get_libdir)/${P}/package.conf" \
270 + || die "Relocating ghc from /usr to workdir failed"
271 + fi
272 +
273 + # If we're using the testsuite then move it to into the build tree
274 + use test && mv "${WORKDIR}/testsuite" "${S}/"
275 +
276 + # Patch to fix a mis-compilation in the rts due to strict aliasing,
277 + # should be fixed upstream for 6.4.3 and 6.6. Fixes bug #135651.
278 + echo 'GC_HC_OPTS += -optc-fno-strict-aliasing' >> "${S}/ghc/rts/Makefile"
279 +
280 + # Don't strip binaries on install. See QA warnings in bug #140369.
281 + sed -i -e 's/SRC_INSTALL_BIN_OPTS += -s//' "${S}/mk/config.mk.in"
282 + fi
283 }
284
285 src_compile() {
286 - # initialize build.mk
287 - echo '# Gentoo changes' > mk/build.mk
288 + if ! use binary; then
289
290 - # We also need to use the GHC_CFLAGS flags when building ghc itself
291 - echo "SRC_HC_OPTS+=${GHC_CFLAGS}" >> mk/build.mk
292 - echo "SRC_CC_OPTS+=${CFLAGS} -Wa,--noexecstack" >> mk/build.mk
293 -
294 - # If you need to do a quick build then enable this bit and add debug to IUSE
295 - #if use debug; then
296 - # echo "SRC_HC_OPTS = -H32m -O0" >> mk/build.mk
297 - # echo "GhcStage1HcOpts =" >> mk/build.mk
298 - # echo "GhcLibHcOpts =" >> mk/build.mk
299 - # echo "GhcLibWays =" >> mk/build.mk
300 - # echo "SplitObjs = NO" >> mk/build.mk
301 - #fi
302 + # initialize build.mk
303 + echo '# Gentoo changes' > mk/build.mk
304
305 - # determine what to do with documentation
306 - if use doc; then
307 - echo XMLDocWays="html" >> mk/build.mk
308 - else
309 - echo XMLDocWays="" >> mk/build.mk
310 + # We also need to use the GHC_CFLAGS flags when building ghc itself
311 + echo "SRC_HC_OPTS+=${GHC_CFLAGS}" >> mk/build.mk
312 + echo "SRC_CC_OPTS+=${CFLAGS} -Wa,--noexecstack" >> mk/build.mk
313 +
314 + # If you need to do a quick build then enable this bit and add debug to IUSE
315 + #if use debug; then
316 + # echo "SRC_HC_OPTS = -H32m -O -fasm" >> mk/build.mk
317 + # echo "GhcLibHcOpts =" >> mk/build.mk
318 + # echo "GhcLibWays =" >> mk/build.mk
319 + # echo "SplitObjs = NO" >> mk/build.mk
320 + #fi
321 +
322 + # We can't depend on haddock so we never build docs
323 + # and we rely on pre-built ones instead
324 + echo SGMLDocWays="" >> mk/build.mk
325 # needed to prevent haddock from being called
326 echo NO_HADDOCK_DOCS=YES >> mk/build.mk
327 - fi
328 -
329 - # circumvent a very strange bug that seems related with ghc producing too much
330 - # output while being filtered through tee (e.g. due to portage logging)
331 - # reported as bug #111183
332 - echo "SRC_HC_OPTS+=-fno-warn-deprecations" >> mk/build.mk
333 -
334 - # And some arches used to work ok, but bork with recent gcc versions
335 - # See bug #145466 for ppc64.
336 - if use ia64 || use ppc64; then
337 - echo "GhcUnregisterised=YES" >> mk/build.mk
338 - echo "GhcRTSWays := debug" >> mk/build.mk
339 - fi
340
341 - GHC_CFLAGS="" ghc_setup_wrapper $(ghc-version) > "${T}/ghc.sh"
342 - chmod +x "${T}/ghc.sh"
343 + # circumvent a very strange bug that seems related with ghc producing too much
344 + # output while being filtered through tee (e.g. due to portage logging)
345 + # reported as bug #111183
346 + echo "SRC_HC_OPTS+=-fno-warn-deprecations" >> mk/build.mk
347 +
348 + # And some arches used to work ok, but bork with recent gcc versions
349 + # See bug #145466 for ppc64.
350 + if use ia64 || use ppc64; then
351 + echo "GhcUnregisterised=YES" >> mk/build.mk
352 + echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
353 + echo "GhcWithInterpreter=NO" >> mk/build.mk
354 + echo "SplitObjs=NO" >> mk/build.mk
355 + echo "GhcRTSWays := debug" >> mk/build.mk
356 + fi
357
358 - # We've patched some configure.ac files to fix the OpenAL/ALUT bindings.
359 - # So we need to autoreconf.
360 - eautoreconf
361 -
362 - econf \
363 - --with-ghc="${T}/ghc.sh" \
364 - $(use_enable opengl opengl) \
365 - $(use_enable opengl glut) \
366 - $(use openal && use opengl \
367 - && echo --enable-openal --enable-alut \
368 - || echo --disable-openal --disable-alut) \
369 - $(use_enable X x11) \
370 - $(use_enable X hgl) \
371 - || die "econf failed"
372 -
373 - emake all datadir="/usr/share/doc/${PF}" || die "make failed"
374 - # the explicit datadir is required to make the haddock entries
375 - # in the package.conf file point to the right place ...
376 + # We've patched some configure.ac files to fix the OpenAL/ALUT bindings.
377 + # So we need to autoreconf.
378 + eautoreconf
379 +
380 + # Get ghc from the unpacked binary .tbz2
381 + # except when bootstrapping we just pick ghc up off the path
382 + use ghcbootstrap || \
383 + export PATH="${WORKDIR}/usr/bin:${PATH}"
384 +
385 + econf \
386 + $(use_enable opengl opengl) \
387 + $(use_enable opengl glut) \
388 + $(use openal && use opengl \
389 + && echo --enable-openal --enable-alut \
390 + || echo --disable-openal --disable-alut) \
391 + $(use_enable X x11) \
392 + $(use_enable X hgl) \
393 + || die "econf failed"
394 +
395 + emake all datadir="/usr/share/doc/${P}" || die "make failed"
396 + # the explicit datadir is required to make the haddock entries
397 + # in the package.conf file point to the right place ...
398
399 + fi # ! use binary
400 }
401
402 -src_install () {
403 - local insttarget
404 +src_install() {
405 + if use binary; then
406 + mkdir "${D}/opt"
407 + mv "${S}/usr" "${D}/opt/ghc"
408
409 - insttarget="install"
410 - use doc && insttarget="${insttarget} install-docs"
411 + cp -p "${D}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"{,.shipped} \
412 + || die "failed to copy package.conf"
413
414 - # the libdir0 setting is needed for amd64, and does not
415 - # harm for other arches
416 - emake -j1 ${insttarget} \
417 - prefix="${D}/usr" \
418 - datadir="${D}/usr/share/doc/${PF}" \
419 - infodir="${D}/usr/share/info" \
420 - mandir="${D}/usr/share/man" \
421 - libdir0="${D}/usr/$(get_libdir)" \
422 - || die "make ${insttarget} failed"
423 -
424 - #need to remove ${D} from ghcprof script
425 - # TODO: does this actually work?
426 - cd "${D}/usr/bin"
427 - mv ghcprof ghcprof-orig
428 - sed -e 's:$FPTOOLS_TOP_ABS:#$FPTOOLS_TOP_ABS:' ghcprof-orig > ghcprof
429 - chmod a+x ghcprof
430 - rm -f ghcprof-orig
431 + doenvd "${FILESDIR}/10ghc"
432 + else
433 + # the libdir0 setting is needed for amd64, and does not
434 + # harm for other arches
435 + #TODO: are any of these overrides still required? isn't econf enough?
436 + emake -j1 install \
437 + prefix="${D}/usr" \
438 + datadir="${D}/usr/share/doc/${PF}" \
439 + infodir="${D}/usr/share/info" \
440 + mandir="${D}/usr/share/man" \
441 + libdir0="${D}/usr/$(get_libdir)" \
442 + || die "make install failed"
443 +
444 + cd "${S}/ghc"
445 + dodoc README ANNOUNCE LICENSE VERSION
446
447 - cd "${S}/ghc"
448 - dodoc README ANNOUNCE LICENSE VERSION
449 + dosbin "${FILESDIR}/ghc-updater"
450
451 - dosbin "${FILESDIR}/ghc-updater"
452 + cp -p "${D}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"{,.shipped} \
453 + || die "failed to copy package.conf"
454 + fi
455 +
456 + if use doc; then
457 + docinto "html/libraries"
458 + dohtml -A haddock -r "${WORKDIR}/libraries/"* \
459 + || die "installing library docs failed"
460 + docinto "html/users_guide"
461 + dohtml -r "${WORKDIR}/users_guide/"* \
462 + || die "installing user guide failed"
463 + docinto ""
464 + fi
465 }
466
467 pkg_postinst () {
468 @@ -277,16 +358,39 @@
469 $(ghc-getghcpkg) unregister Cabal > /dev/null
470 eend $?
471 ghc-reregister
472 - elog "If you have dev-lang/ghc-bin installed, you might"
473 - elog "want to unmerge it. It is no longer needed."
474 - elog
475 +
476 + if use binary; then
477 + elog "The envirenment has been set to use the binary distribution of"
478 + elog "GHC. In order to activate it please run:"
479 + elog " env-update && source /etc/profile"
480 + elog "Otherwise this setting will become active the next time you login"
481 + fi
482 +
483 ewarn "IMPORTANT:"
484 ewarn "If you have upgraded from another version of ghc or"
485 - ewarn "if you have switched from ghc-bin to ghc, please run:"
486 - ewarn " /usr/sbin/ghc-updater"
487 + ewarn "if you have switched between binary and source versions"
488 + ewarn "of ghc, please run:"
489 + if use binary; then
490 + ewarn " /opt/ghc/sbin/ghc-updater"
491 + else
492 + ewarn " /usr/sbin/ghc-updater"
493 + fi
494 ewarn "to re-merge all ghc-based Haskell libraries."
495 }
496
497 +pkg_prerm() {
498 + # Overwrite the (potentially) modified package.conf with a copy of the
499 + # original one, so that it will be removed during uninstall.
500 +
501 + set_config # load GHC_PREFIX
502 +
503 + PKG="${ROOT}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"
504 +
505 + cp -p "${PKG}"{.shipped,}
506 +
507 + [[ -f ${PKG}.old ]] && rm "${PKG}.old"
508 +}
509 +
510 src_test() {
511 if use test; then
512 local summary
513
514
515
516 1.140 dev-lang/ghc/ChangeLog
517
518 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ChangeLog?rev=1.140&view=markup
519 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ChangeLog?rev=1.140&content-type=text/plain
520 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ChangeLog?r1=1.139&r2=1.140
521
522 Index: ChangeLog
523 ===================================================================
524 RCS file: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v
525 retrieving revision 1.139
526 retrieving revision 1.140
527 diff -u -r1.139 -r1.140
528 --- ChangeLog 5 Nov 2007 02:18:21 -0000 1.139
529 +++ ChangeLog 5 Nov 2007 10:27:49 -0000 1.140
530 @@ -1,6 +1,12 @@
531 # ChangeLog for dev-lang/ghc
532 # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
533 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.139 2007/11/05 02:18:21 dcoutts Exp $
534 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.140 2007/11/05 10:27:49 dcoutts Exp $
535 +
536 + 05 Nov 2007; Duncan Coutts <dcoutts@g.o> ghc-6.2.2.ebuild,
537 + ghc-6.4.2.ebuild:
538 + Use new unified ghc ebuild for 6.2.2 and 6.4.2. This merges the
539 + functionality of ghc-bin into the ghc ebuild and eliminates virtual/ghc.
540 + To get the binary version emerge with the "binary" USE flag.
541
542 05 Nov 2007; Duncan Coutts <dcoutts@g.o> ghc-6.6.1.ebuild:
543 Add sparc and ppc binaries. Also fix some var quoting QA warnings.
544
545
546
547 1.25 dev-lang/ghc/ghc-6.2.2.ebuild
548
549 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ghc-6.2.2.ebuild?rev=1.25&view=markup
550 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ghc-6.2.2.ebuild?rev=1.25&content-type=text/plain
551 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ghc-6.2.2.ebuild?r1=1.24&r2=1.25
552
553 Index: ghc-6.2.2.ebuild
554 ===================================================================
555 RCS file: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.2.2.ebuild,v
556 retrieving revision 1.24
557 retrieving revision 1.25
558 diff -u -r1.24 -r1.25
559 --- ghc-6.2.2.ebuild 5 Nov 2007 02:18:21 -0000 1.24
560 +++ ghc-6.2.2.ebuild 5 Nov 2007 10:27:49 -0000 1.25
561 @@ -1,18 +1,20 @@
562 # Copyright 1999-2007 Gentoo Foundation
563 # Distributed under the terms of the GNU General Public License v2
564 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.2.2.ebuild,v 1.24 2007/11/05 02:18:21 dcoutts Exp $
565 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.2.2.ebuild,v 1.25 2007/11/05 10:27:49 dcoutts Exp $
566
567 # Brief explanation of the bootstrap logic:
568 #
569 -# ghc requires ghc-bin to bootstrap.
570 -# Therefore,
571 -# (1) both ghc-bin and ghc provide virtual/ghc
572 -# (2) virtual/ghc *must* default to ghc-bin
573 -# (3) ghc depends on virtual/ghc
574 +# Previous ghc ebuilds have been split into two: ghc and ghc-bin,
575 +# where ghc-bin was primarily used for bootstrapping purposes.
576 +# From now on, these two ebuilds have been combined, with the
577 +# binary USE flag used to determine whether or not the pre-built
578 +# binary package should be emerged or whether ghc should be compiled
579 +# from source. If the latter, then the relevant ghc-bin for the
580 +# arch in question will be used in the working directory to compile
581 +# ghc from source.
582 #
583 -# This solution has the advantage that the binary distribution
584 -# can be removed once an forall after the first succesful install
585 -# of ghc.
586 +# This solution has the advantage of allowing us to retain the one
587 +# ebuild for both packages, and thus phase out virtual/ghc.
588
589 # Note to users of hardened gcc-3.x:
590 #
591 @@ -31,42 +33,35 @@
592 DESCRIPTION="The Glasgow Haskell Compiler"
593 HOMEPAGE="http://www.haskell.org/ghc/"
594
595 -SRC_URI="http://www.haskell.org/ghc/dist/${PV}/ghc-${PV}-src.tar.bz2"
596 +SRC_URI="!binary? ( http://haskell.org/ghc/dist/${PV}/${P}-src.tar.bz2 )
597 + doc? ( mirror://gentoo/${P}-libraries.tar.gz
598 + mirror://gentoo/${P}-users_guide.tar.gz )
599 + ppc? ( mirror://gentoo/ghc-bin-${PV}-r1-ppc.tbz2 )
600 + sparc? ( mirror://gentoo/ghc-bin-${PV}-r1-sparc.tbz2 )
601 + x86? ( mirror://gentoo/ghc-bin-${PV}-r1-x86.tbz2 )"
602
603 -LICENSE="as-is"
604 +LICENSE="BSD"
605 SLOT="0"
606 KEYWORDS="-* ppc sparc x86"
607 -IUSE="doc opengl"
608 +IUSE="binary doc ghcbootstrap opengl"
609 +
610 +LOC="/opt/ghc" # location for installation of binary version
611
612 PROVIDE="virtual/ghc"
613
614 RDEPEND="
615 + !dev-lang/ghc-bin
616 >=sys-devel/gcc-2.95.3
617 >=sys-devel/binutils-2.17
618 >=dev-lang/perl-5.6.1
619 >=dev-libs/gmp-4.1
620 - >=sys-libs/readline-4.2
621 + =sys-libs/readline-5*
622 opengl? ( virtual/opengl
623 virtual/glu virtual/glut )"
624
625 -# ghc cannot usually be bootstrapped using later versions ...
626 -DEPEND="${RDEPEND}
627 - <virtual/ghc-6.3
628 - !>=virtual/ghc-6.4
629 - doc? ( ~app-text/docbook-sgml-dtd-3.1
630 - >=app-text/docbook-dsssl-stylesheets-1.64
631 - >=app-text/openjade-1.3.1
632 - >=app-text/sgml-common-0.6.3
633 - >=dev-haskell/haddock-0.6-r2 )"
634 -
635 -pkg_setup() {
636 - if test $(gcc-major-version) -gt 3; then
637 - eerror "ghc-6.2.2 does not work with gcc-4.x, only 3.x or older"
638 - eerror "You can either use gcc-config to switch to gcc-3.x"
639 - eerror "or you emerge '>=dev-lang/ghc-6.4' or later."
640 - die "ghc-6.2.2 does not work with gcc-4.x, only 3.x or older"
641 - fi
642 -}
643 +DEPEND="${RDEPEND}"
644 +# In the ghcbootstrap case we rely on the developer having
645 +# >=ghc-5.04.3 on their $PATH already
646
647 append-ghc-cflags() {
648 local flag compile assemble link
649 @@ -118,113 +113,208 @@
650 gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector
651 }
652
653 -ghc_setup_wrapper() {
654 - echo '#!/bin/sh'
655 - echo "GHCBIN=\"$(ghc-libdir)/ghc-$1\";"
656 - echo "TOPDIROPT=\"-B$(ghc-libdir)\";"
657 - echo "GHC_CFLAGS=\"${GHC_CFLAGS}\";"
658 - echo '# Mini-driver for GHC'
659 - echo 'exec $GHCBIN $TOPDIROPT $GHC_CFLAGS ${1+"$@"}'
660 +pkg_setup() {
661 + if test $(gcc-major-version) -gt 3; then
662 + eerror "ghc-6.2.2 does not work with gcc-4.x, only 3.x or older"
663 + eerror "You can either use gcc-config to switch to gcc-3.x"
664 + eerror "or you emerge '>=dev-lang/ghc-6.4' or later."
665 + die "ghc-6.2.2 does not work with gcc-4.x, only 3.x or older"
666 + fi
667 +
668 + if use ghcbootstrap; then
669 + ewarn "You requested ghc bootstrapping, this is usually only used"
670 + ewarn "by Gentoo developers to make binary .tbz2 packages for"
671 + ewarn "use with the ghc ebuild's USE=\"binary\" feature."
672 + use binary && \
673 + die "USE=\"ghcbootstrap binary\" is not a valid combination."
674 + use doc && \
675 + die "USE=\"ghcbootstrap doc\" is not a valid combination"
676 + [[ -z $(type -P ghc) ]] && \
677 + die "Could not find a ghc to bootstrap with."
678 + fi
679 +
680 + if use binary; then
681 + if use opengl || use doc; then
682 + ewarn "The binary build does not include the docs or OpenGL bindings"
683 + ewarn "If you want those features, emerge with USE=\"-binary\""
684 + fi
685 + fi
686 +
687 + set_config
688 +}
689 +
690 +set_config() {
691 + # make this a separate function and call it several times as portage doesn't
692 + # remember the variables properly between the fuctions.
693 + use binary && GHC_PREFIX="/opt/ghc" || GHC_PREFIX="/usr"
694 }
695
696 src_unpack() {
697 + # Create the ${S} dir if we're using the binary version
698 + use binary && mkdir "${S}"
699 +
700 base_src_unpack
701 ghc_setup_cflags
702
703 - # Modify the ghc driver script to use GHC_CFLAGS
704 - echo "SCRIPT_SUBST_VARS += GHC_CFLAGS" >> "${S}/ghc/driver/ghc/Makefile"
705 - echo "GHC_CFLAGS = ${GHC_CFLAGS}" >> "${S}/ghc/driver/ghc/Makefile"
706 - sed -i -e 's|$TOPDIROPT|$TOPDIROPT $GHC_CFLAGS|' "${S}/ghc/driver/ghc/ghc.sh"
707 -
708 - # Patch to fix a mis-compilation in the rts due to strict aliasing,
709 - # should be fixed upstream for 6.4.3 and 6.6. Fixes bug #135651.
710 - echo 'GC_HC_OPTS += -optc-fno-strict-aliasing' >> "${S}/ghc/rts/Makefile"
711 + if use binary; then
712 +
713 + # Move unpacked files to the expected place
714 + mv "${WORKDIR}/usr" "${S}"
715 +
716 + # Relocate from /usr to /opt/ghc
717 + sed -i -e "s|/usr|${LOC}|g" \
718 + "${S}/usr/bin/ghc-${PV}" \
719 + "${S}/usr/bin/ghci-${PV}" \
720 + "${S}/usr/bin/ghc-pkg-${PV}" \
721 + "${S}/usr/bin/hsc2hs" \
722 + "${S}/usr/$(get_libdir)/${P}/package.conf" \
723 + || die "Relocating ghc from /usr to /opt/ghc failed"
724
725 - # Don't strip binaries on install. See QA warnings in bug #140369.
726 - sed -i -e 's/SRC_INSTALL_BIN_OPTS += -s//' "${S}/mk/config.mk.in"
727 + sed -i -e "s|/usr/$(get_libdir)|${LOC}/$(get_libdir)|" \
728 + "${S}/usr/bin/ghcprof"
729 +
730 + else
731 + # Modify the ghc driver script to use GHC_CFLAGS
732 + echo "SCRIPT_SUBST_VARS += GHC_CFLAGS" >> "${S}/ghc/driver/ghc/Makefile"
733 + echo "GHC_CFLAGS = ${GHC_CFLAGS}" >> "${S}/ghc/driver/ghc/Makefile"
734 + sed -i -e 's|$TOPDIROPT|$TOPDIROPT $GHC_CFLAGS|' "${S}/ghc/driver/ghc/ghc.sh"
735 +
736 + if ! use ghcbootstrap; then
737 + # Relocate from /usr to ${WORKDIR}/usr
738 + sed -i -e "s|/usr|${WORKDIR}/usr|g" \
739 + "${WORKDIR}/usr/bin/ghc-${PV}" \
740 + "${WORKDIR}/usr/bin/ghci-${PV}" \
741 + "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
742 + "${WORKDIR}/usr/bin/hsc2hs" \
743 + "${WORKDIR}/usr/$(get_libdir)/${P}/package.conf" \
744 + || die "Relocating ghc from /usr to workdir failed"
745 + fi
746 +
747 + # Patch to fix a mis-compilation in the rts due to strict aliasing,
748 + # should be fixed upstream for 6.4.3 and 6.6. Fixes bug #135651.
749 + echo 'GC_HC_OPTS += -optc-fno-strict-aliasing' >> "${S}/ghc/rts/Makefile"
750 +
751 + # Don't strip binaries on install. See QA warnings in bug #140369.
752 + sed -i -e 's/SRC_INSTALL_BIN_OPTS += -s//' "${S}/mk/config.mk.in"
753 + fi
754 }
755
756 src_compile() {
757 - # initialize build.mk
758 - echo '# Gentoo changes' > mk/build.mk
759 + if ! use binary; then
760
761 - # We also need to use the GHC_CFLAGS flags when building ghc itself
762 - echo "SRC_HC_OPTS+=${GHC_CFLAGS}" >> mk/build.mk
763 - echo "SRC_CC_OPTS+=${CFLAGS} -Wa,--noexecstack" >> mk/build.mk
764 + # initialize build.mk
765 + echo '# Gentoo changes' > mk/build.mk
766
767 - # determine what to do with documentation
768 - if use doc; then
769 - echo SGMLDocWays="html" >> mk/build.mk
770 - else
771 + # We also need to use the GHC_CFLAGS flags when building ghc itself
772 + echo "SRC_HC_OPTS+=${GHC_CFLAGS}" >> mk/build.mk
773 + echo "SRC_CC_OPTS+=${CFLAGS} -Wa,--noexecstack" >> mk/build.mk
774 +
775 + # We can't depend on haddock so we never build docs
776 + # and we rely on pre-built ones instead
777 echo SGMLDocWays="" >> mk/build.mk
778 # needed to prevent haddock from being called
779 echo NO_HADDOCK_DOCS=YES >> mk/build.mk
780 - fi
781
782 - # circumvent a very strange bug that seems related with ghc producing too much
783 - # output while being filtered through tee (e.g. due to portage logging)
784 - # reported as bug #111183
785 - echo "SRC_HC_OPTS+=-fno-warn-deprecations" >> mk/build.mk
786 -
787 - # Required for some architectures, because they don't support ghc fully ...
788 - use ppc || use sparc && echo "SplitObjs=NO" >> mk/build.mk
789 - use sparc && echo "GhcWithInterpreter=NO" >> mk/build.mk
790 -
791 - GHC_CFLAGS="" ghc_setup_wrapper $(ghc-version) > "${T}/ghc.sh"
792 - chmod +x "${T}/ghc.sh"
793 -
794 - # unset SGML_CATALOG_FILES because documentation installation
795 - # breaks otherwise ...
796 - SGML_CATALOG_FILES="" econf \
797 - --with-ghc="${T}/ghc.sh" \
798 - $(use_enable opengl hopengl) \
799 - || die "econf failed"
800 -
801 - # ghc-6.2.x build system does not support parallel make
802 - emake -j1 datadir="/usr/share/doc/${PF}" || die "make failed"
803 - # the explicit datadir is required to make the haddock entries
804 - # in the package.conf file point to the right place ...
805 + # circumvent a very strange bug that seems related with ghc producing too much
806 + # output while being filtered through tee (e.g. due to portage logging)
807 + # reported as bug #111183
808 + echo "SRC_HC_OPTS+=-fno-warn-deprecations" >> mk/build.mk
809 +
810 + # Required for some architectures, because they don't support ghc fully ...
811 + use ppc || use sparc && echo "SplitObjs=NO" >> mk/build.mk
812 + use sparc && echo "GhcWithInterpreter=NO" >> mk/build.mk
813 +
814 + # Get ghc from the unpacked binary .tbz2
815 + # except when bootstrapping we just pick ghc up off the path
816 + use ghcbootstrap || \
817 + export PATH="${WORKDIR}/usr/bin:${PATH}"
818 +
819 + # Note that --disable-hopengl actually enables it. We have to ommit
820 + # the flag to disable opengl.
821 + econf \
822 + $(use opengl && echo "--enable-hopengl") \
823 + || die "econf failed"
824 +
825 + # ghc-6.2.x build system does not support parallel make
826 + emake -j1 datadir="/usr/share/doc/${P}" || die "make failed"
827 + # the explicit datadir is required to make the haddock entries
828 + # in the package.conf file point to the right place ...
829
830 + fi # ! use binary
831 }
832
833 -src_install () {
834 - local insttarget
835 -
836 - insttarget="install"
837 - use doc && insttarget="${insttarget} install-docs"
838 -
839 - # the libdir0 setting is needed for amd64, and does not
840 - # harm for other arches
841 - emake -j1 ${insttarget} \
842 - prefix="${D}/usr" \
843 - datadir="${D}/usr/share/doc/${PF}" \
844 - infodir="${D}/usr/share/info" \
845 - mandir="${D}/usr/share/man" \
846 - libdir0="${D}/usr/$(get_libdir)" \
847 - || die "make ${insttarget} failed"
848 -
849 - #need to remove ${D} from ghcprof script
850 - # TODO: does this actually work?
851 - cd "${D}/usr/bin"
852 - mv ghcprof ghcprof-orig
853 - sed -e 's:$FPTOOLS_TOP_ABS:#$FPTOOLS_TOP_ABS:' ghcprof-orig > ghcprof
854 - chmod a+x ghcprof
855 - rm -f ghcprof-orig
856 +src_install() {
857 + if use binary; then
858 + mkdir "${D}/opt"
859 + mv "${S}/usr" "${D}/opt/ghc"
860 +
861 + cp -p "${D}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"{,.shipped} \
862 + || die "failed to copy package.conf"
863 +
864 + doenvd "${FILESDIR}/10ghc"
865 + else
866 + # the libdir0 setting is needed for amd64, and does not
867 + # harm for other arches
868 + #TODO: are any of these overrides still required? isn't econf enough?
869 + emake -j1 install \
870 + prefix="${D}/usr" \
871 + datadir="${D}/usr/share/doc/${PF}" \
872 + infodir="${D}/usr/share/info" \
873 + mandir="${D}/usr/share/man" \
874 + libdir0="${D}/usr/$(get_libdir)" \
875 + || die "make install failed"
876
877 - cd "${S}/ghc"
878 - dodoc README ANNOUNCE LICENSE VERSION
879 + cd "${S}/ghc"
880 + dodoc README ANNOUNCE LICENSE VERSION
881 +
882 + dosbin "${FILESDIR}/ghc-updater"
883 +
884 + cp -p "${D}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"{,.shipped} \
885 + || die "failed to copy package.conf"
886 + fi
887
888 - dosbin "${FILESDIR}/ghc-updater"
889 + if use doc; then
890 + docinto "html/libraries"
891 + dohtml -A haddock -r "${WORKDIR}/libraries/"* \
892 + || die "installing library docs failed"
893 + docinto "html/users_guide"
894 + dohtml -r "${WORKDIR}/users_guide/"* \
895 + || die "installing user guide failed"
896 + docinto ""
897 + fi
898 }
899
900 pkg_postinst () {
901 ghc-reregister
902 - elog "If you have dev-lang/ghc-bin installed, you might"
903 - elog "want to unmerge it. It is no longer needed."
904 - elog
905 +
906 + if use binary; then
907 + elog "The envirenment has been set to use the binary distribution of"
908 + elog "GHC. In order to activate it please run:"
909 + elog " env-update && source /etc/profile"
910 + elog "Otherwise this setting will become active the next time you login"
911 + fi
912 +
913 ewarn "IMPORTANT:"
914 ewarn "If you have upgraded from another version of ghc or"
915 - ewarn "if you have switched from ghc-bin to ghc, please run:"
916 - ewarn " /usr/sbin/ghc-updater"
917 + ewarn "if you have switched between binary and source versions"
918 + ewarn "of ghc, please run:"
919 + if use binary; then
920 + ewarn " /opt/ghc/sbin/ghc-updater"
921 + else
922 + ewarn " /usr/sbin/ghc-updater"
923 + fi
924 ewarn "to re-merge all ghc-based Haskell libraries."
925 }
926 +
927 +pkg_prerm() {
928 + # Overwrite the (potentially) modified package.conf with a copy of the
929 + # original one, so that it will be removed during uninstall.
930 +
931 + set_config # load GHC_PREFIX
932 +
933 + PKG="${ROOT}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"
934 +
935 + cp -p "${PKG}"{.shipped,}
936 +
937 + [[ -f ${PKG}.old ]] && rm "${PKG}.old"
938 +}
939
940
941
942 --
943 gentoo-commits@g.o mailing list