Gentoo Archives: gentoo-commits

From: "Lennart Kolmodin (kolmodin)" <kolmodin@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/ghc: metadata.xml ChangeLog ghc-6.10.2.ebuild
Date: Sun, 19 Apr 2009 14:54:39
Message-Id: E1LvYPi-00057b-Tf@stork.gentoo.org
1 kolmodin 09/04/19 14:54:34
2
3 Modified: metadata.xml ChangeLog
4 Added: ghc-6.10.2.ebuild
5 Log:
6 Version bump dev-lang/ghc to 6.10.2, currently masked for testing.
7 (Portage version: 2.1.6.7/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.4 dev-lang/ghc/metadata.xml
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/metadata.xml?rev=1.4&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/metadata.xml?rev=1.4&content-type=text/plain
14 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/metadata.xml?r1=1.3&r2=1.4
15
16 Index: metadata.xml
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/dev-lang/ghc/metadata.xml,v
19 retrieving revision 1.3
20 retrieving revision 1.4
21 diff -u -r1.3 -r1.4
22 --- metadata.xml 23 Aug 2008 05:23:42 -0000 1.3
23 +++ metadata.xml 19 Apr 2009 14:54:34 -0000 1.4
24 @@ -8,5 +8,6 @@
25 <use>
26 <flag name='binary'>Install the binary version directly, rather than using it to build the source version.</flag>
27 <flag name='ghcbootstrap'>Internal: Bootstrap GHC from an existing GHC installation.</flag>
28 +<flag name='ghcmakebinary'>Internal: Used while bootstrapping for making binaries, license related tweaking.</flag>
29 </use>
30 </pkgmetadata>
31
32
33
34 1.160 dev-lang/ghc/ChangeLog
35
36 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ChangeLog?rev=1.160&view=markup
37 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ChangeLog?rev=1.160&content-type=text/plain
38 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ChangeLog?r1=1.159&r2=1.160
39
40 Index: ChangeLog
41 ===================================================================
42 RCS file: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v
43 retrieving revision 1.159
44 retrieving revision 1.160
45 diff -u -r1.159 -r1.160
46 --- ChangeLog 17 Apr 2009 16:27:48 -0000 1.159
47 +++ ChangeLog 19 Apr 2009 14:54:34 -0000 1.160
48 @@ -1,6 +1,11 @@
49 # ChangeLog for dev-lang/ghc
50 # Copyright 2002-2009 Gentoo Foundation; Distributed under the GPL v2
51 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.159 2009/04/17 16:27:48 kolmodin Exp $
52 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.160 2009/04/19 14:54:34 kolmodin Exp $
53 +
54 +*ghc-6.10.2 (19 Apr 2009)
55 +
56 + 19 Apr 2009; Lennart Kolmodin <kolmodin@g.o> +ghc-6.10.2.ebuild:
57 + Add ghc-6.10.2, currently masked for testing.
58
59 *ghc-6.8.2-r1 (17 Apr 2009)
60
61
62
63
64 1.1 dev-lang/ghc/ghc-6.10.2.ebuild
65
66 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ghc-6.10.2.ebuild?rev=1.1&view=markup
67 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/ghc/ghc-6.10.2.ebuild?rev=1.1&content-type=text/plain
68
69 Index: ghc-6.10.2.ebuild
70 ===================================================================
71 # Copyright 1999-2009 Gentoo Foundation
72 # Distributed under the terms of the GNU General Public License v2
73 # $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.10.2.ebuild,v 1.1 2009/04/19 14:54:34 kolmodin Exp $
74
75 # Brief explanation of the bootstrap logic:
76 #
77 # Previous ghc ebuilds have been split into two: ghc and ghc-bin,
78 # where ghc-bin was primarily used for bootstrapping purposes.
79 # From now on, these two ebuilds have been combined, with the
80 # binary USE flag used to determine whether or not the pre-built
81 # binary package should be emerged or whether ghc should be compiled
82 # from source. If the latter, then the relevant ghc-bin for the
83 # arch in question will be used in the working directory to compile
84 # ghc from source.
85 #
86 # This solution has the advantage of allowing us to retain the one
87 # ebuild for both packages, and thus phase out virtual/ghc.
88
89 # Note to users of hardened gcc-3.x:
90 #
91 # If you emerge ghc with hardened gcc it should work fine (because we
92 # turn off the hardened features that would otherwise break ghc).
93 # However, emerging ghc while using a vanilla gcc and then switching to
94 # hardened gcc (using gcc-config) will leave you with a broken ghc. To
95 # fix it you would need to either switch back to vanilla gcc or re-emerge
96 # ghc (or ghc-bin). Note that also if you are using hardened gcc-3.x and
97 # you switch to gcc-4.x that this will also break ghc and you'll need to
98 # re-emerge ghc (or ghc-bin). People using vanilla gcc can switch between
99 # gcc-3.x and 4.x with no problems.
100
101 inherit base autotools bash-completion eutils flag-o-matic toolchain-funcs ghc-package versionator
102
103 DESCRIPTION="The Glasgow Haskell Compiler"
104 HOMEPAGE="http://www.haskell.org/ghc/"
105
106 # discover if this is a snapshot release
107 IS_SNAPSHOT="$(get_version_component_range 4)" # non-empty if snapshot
108 EXTRA_SRC_URI="${PV}"
109 [[ "${IS_SNAPSHOT}" ]] && EXTRA_SRC_URI="stable/dist"
110
111 READLINE_PV="1.0.1.0"
112 READLINE_P="readline-${READLINE_PV}"
113
114 arch_binaries=""
115
116 arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~ivanm/ghc-bin-${PV}-x86.tbz2 )"
117 arch_binaries="$arch_binaries amd64? ( http://haskell.org/~kolmodin/ghc-bin-${PV}-amd64.tbz2 )"
118
119 #arch_binaries="$arch_binaries alpha? ( mirror://gentoo/ghc-bin-${PV}-alpha.tbz2 )"
120 #arch_binaries="$arch_binaries amd64? ( mirror://gentoo/ghc-bin-${PV}-amd64.tbz2 )"
121 #arch_binaries="$arch_binaries hppa? ( mirror://gentoo/ghc-bin-${PV}-hppa.tbz2 )"
122 #arch_binaries="$arch_binaries ia64? ( mirror://gentoo/ghc-bin-${PV}-ia64.tbz2 )"
123 #arch_binaries="$arch_binaries sparc? ( mirror://gentoo/ghc-bin-${PV}-sparc.tbz2 )"
124 #arch_binaries="$arch_binaries x86? ( mirror://gentoo/ghc-bin-${PV}-x86.tbz2 )"
125
126 SRC_URI="!binary? ( http://haskell.org/ghc/dist/${EXTRA_SRC_URI}/${P}-src.tar.bz2
127 http://hackage.haskell.org/packages/archive/readline/${READLINE_PV}/${READLINE_P}.tar.gz
128 )
129 !ghcbootstrap? ( $arch_binaries )"
130
131 LICENSE="BSD"
132 SLOT="0"
133 KEYWORDS="~amd64 ~x86"
134 IUSE="binary doc ghcbootstrap ghcmakebinary"
135
136 RDEPEND="
137 >=sys-devel/gcc-2.95.3
138 >=sys-devel/binutils-2.17
139 >=dev-lang/perl-5.6.1
140 >=dev-libs/gmp-4.1
141 !binary? ( >=sys-libs/readline-5 )"
142
143 DEPEND="${RDEPEND}
144 ghcbootstrap? ( doc? ( ~app-text/docbook-xml-dtd-4.2
145 app-text/docbook-xsl-stylesheets
146 >=dev-libs/libxslt-1.1.2 ) )"
147 # In the ghcbootstrap case we rely on the developer having
148 # >=ghc-5.04.3 on their $PATH already
149
150 append-ghc-cflags() {
151 local flag compile assemble link
152 for flag in $*; do
153 case ${flag} in
154 compile) compile="yes";;
155 assemble) assemble="yes";;
156 link) link="yes";;
157 *)
158 [[ ${compile} ]] && GHC_CFLAGS="${GHC_CFLAGS} -optc${flag}"
159 [[ ${assemble} ]] && GHC_CFLAGS="${GHC_CFLAGS} -opta${flag}"
160 [[ ${link} ]] && GHC_CFLAGS="${GHC_CFLAGS} -optl${flag}";;
161 esac
162 done
163 }
164
165 ghc_setup_cflags() {
166 # We need to be very careful with the CFLAGS we ask ghc to pass through to
167 # gcc. There are plenty of flags which will make gcc produce output that
168 # breaks ghc in various ways. The main ones we want to pass through are
169 # -mcpu / -march flags. These are important for arches like alpha & sparc.
170 # We also use these CFLAGS for building the C parts of ghc, ie the rts.
171 strip-flags
172 strip-unsupported-flags
173 filter-flags -fPIC
174
175 GHC_CFLAGS=""
176 for flag in ${CFLAGS}; do
177 case ${flag} in
178
179 # Ignore extra optimisation (ghc passes -O to gcc anyway)
180 # -O2 and above break on too many systems
181 -O*) ;;
182
183 # Arch and ABI flags are what we're really after
184 -m*) append-ghc-cflags compile assemble ${flag};;
185
186 # Debugging flags don't help either. You can't debug Haskell code
187 # at the C source level and the mangler discards the debug info.
188 -g*) ;;
189
190 # Ignore all other flags, including all -f* flags
191 esac
192 done
193
194 # hardened-gcc needs to be disabled, because the mangler doesn't accept
195 # its output.
196 gcc-specs-pie && append-ghc-cflags compile link -nopie
197 gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector
198
199 # We also add -Wa,--noexecstack to get ghc to generate .o files with
200 # non-exectable stack. This it a hack until ghc does it itself properly.
201 append-ghc-cflags assemble "-Wa,--noexecstack"
202 }
203
204 pkg_setup() {
205 if use ghcbootstrap; then
206 ewarn "You requested ghc bootstrapping, this is usually only used"
207 ewarn "by Gentoo developers to make binary .tbz2 packages for"
208 ewarn "use with the ghc ebuild's USE=\"binary\" feature."
209 use binary && \
210 die "USE=\"ghcbootstrap binary\" is not a valid combination."
211 [[ -z $(type -P ghc) ]] && \
212 die "Could not find a ghc to bootstrap with."
213 fi
214 }
215
216 src_unpack() {
217 # Create the ${S} dir if we're using the binary version
218 use binary && mkdir "${S}"
219
220 base_src_unpack
221 ghc_setup_cflags
222
223 if use binary; then
224
225 # Move unpacked files to the expected place
226 mv "${WORKDIR}/usr" "${S}"
227 else
228
229 # move readline into the ghc libraries dir
230 mv "${WORKDIR}/readline-${READLINE_PV}" \
231 "${S}/libraries/readline"
232
233 # use sys-libs/readline instead of dev-libs/editline
234 epatch "${FILESDIR}/${P}-readline.patch"
235
236
237
238 if ! use ghcbootstrap; then
239 # Relocate from /usr to ${WORKDIR}/usr
240 sed -i -e "s|/usr|${WORKDIR}/usr|g" \
241 "${WORKDIR}/usr/bin/ghc-${PV}" \
242 "${WORKDIR}/usr/bin/ghci-${PV}" \
243 "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
244 "${WORKDIR}/usr/bin/hsc2hs" \
245 "${WORKDIR}/usr/$(get_libdir)/${P}/package.conf" \
246 || die "Relocating ghc from /usr to workdir failed"
247 fi
248
249 # Hack to prevent haddock being installed, remove when ./configure
250 # supports something better to not build docs or haddock.
251 sed -i -e 's/DO_NOT_INSTALL =/DO_NOT_INSTALL = haddock/' \
252 "${S}/utils/Makefile"
253
254 # as we have changed the build system with the readline patch
255 eautoreconf
256 fi
257 }
258
259 src_compile() {
260 if ! use binary; then
261
262 # initialize build.mk
263 echo '# Gentoo changes' > mk/build.mk
264
265 # Put docs into the right place, ie /usr/share/doc/ghc-${PV}
266 echo "docdir = /usr/share/doc/${P}" >> mk/build.mk
267 echo "htmldir = /usr/share/doc/${P}" >> mk/build.mk
268
269 # We also need to use the GHC_CFLAGS flags when building ghc itself
270 echo "SRC_HC_OPTS+=${GHC_CFLAGS}" >> mk/build.mk
271 echo "SRC_CC_OPTS+=${CFLAGS} -Wa,--noexecstack" >> mk/build.mk
272
273 # The settings that give you the fastest complete GHC build are these:
274 if use ghcquickbuild; then
275 echo "SRC_HC_OPTS = -H64m -Onot -fasm" >> mk/build.mk
276 echo "GhcStage1HcOpts = -O -fasm" >> mk/build.mk
277 echo "GhcStage2HcOpts = -Onot -fasm" >> mk/build.mk
278 echo "GhcLibHcOpts = -Onot -fasm" >> mk/build.mk
279 echo "GhcLibWays =" >> mk/build.mk
280 echo "SplitObjs = NO" >> mk/build.mk
281 fi
282 # However, note that the libraries are built without optimisation, so
283 # this build isn't very useful. The resulting compiler will be very
284 # slow. On a 4-core x86 machine using MAKEOPTS="-j10", this build was
285 # timed at less than 8 minutes.
286
287 # We can't depend on haddock except when bootstrapping when we
288 # must build docs and include them into the binary .tbz2 package
289 if use ghcbootstrap && use doc; then
290 echo XMLDocWays="html" >> mk/build.mk
291 echo HADDOCK_DOCS=YES >> mk/build.mk
292 else
293 echo XMLDocWays="" >> mk/build.mk
294 echo HADDOCK_DOCS=NO >> mk/build.mk
295 fi
296
297 # circumvent a very strange bug that seems related with ghc producing
298 # too much output while being filtered through tee (e.g. due to
299 # portage logging) reported as bug #111183
300 echo "SRC_HC_OPTS+=-w" >> mk/build.mk
301
302 # GHC build system knows to build unregisterised on alpha and hppa,
303 # but we have to tell it to build unregisterised on some arches
304 if use alpha || use hppa || use ppc64 || use sparc; then
305 echo "GhcUnregisterised=YES" >> mk/build.mk
306 echo "GhcWithInterpreter=NO" >> mk/build.mk
307 echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
308 echo "SplitObjs=NO" >> mk/build.mk
309 echo "GhcRTSWays := debug" >> mk/build.mk
310 echo "GhcNotThreaded=YES" >> mk/build.mk
311 fi
312
313 # When making a binary to be used for bootstrapping we want as few
314 # dependencies as possible in the resulting binary. Depending on
315 # packages that might be upgraded will result in a broken bootstrapping
316 # binary, see bug #259867 comment #4.
317 # Here we disable using readline in ghci, for two reasons:
318 # 1. Building ghci with sys-libs/readline or dev-libs/libedit
319 # will make the resulting binary fragile to upgrades in the
320 # host environment.
321 # 2. We've patched ghc to use the GPL library sys-libs/readline.
322 # The licence prohibits us from distributing binaries linked to it.
323 if use ghcmakebinary; then
324 sed -i compiler/Makefile \
325 -e 's,CONFIGURE_FLAGS_STAGE2 += --flags=readline,CONFIGURE_FLAGS_STAGE2 += --flags=-readline,'
326 fi
327
328 # Get ghc from the unpacked binary .tbz2
329 # except when bootstrapping we just pick ghc up off the path
330 if ! use ghcbootstrap; then
331 export PATH="${WORKDIR}/usr/bin:${PATH}"
332 fi
333
334 econf || die "econf failed"
335
336 emake all || die "make failed"
337
338 fi # ! use binary
339 }
340
341 src_install() {
342 if use binary; then
343 mv "${S}/usr" "${D}"
344
345 # Remove the docs if not requested
346 if ! use doc; then
347 rm -rf "${D}/usr/share/doc/${P}/*/" \
348 "${D}/usr/share/doc/${P}/*.html" \
349 || die "could not remove docs (P vs PF revision mismatch?)"
350 fi
351 else
352 local insttarget="install"
353
354 # We only built docs if we were bootstrapping, otherwise
355 # we copy them out of the unpacked binary .tbz2
356 if use doc; then
357 if use ghcbootstrap; then
358 insttarget="${insttarget} install-docs"
359 else
360 mkdir -p "${D}/usr/share/doc"
361 mv "${WORKDIR}/usr/share/doc/${P}" "${D}/usr/share/doc" \
362 || die "failed to copy docs"
363 fi
364 fi
365
366 emake -j1 ${insttarget} \
367 DESTDIR="${D}" \
368 || die "make ${insttarget} failed"
369
370 dodoc "${S}/README" "${S}/ANNOUNCE" "${S}/LICENSE" "${S}/VERSION"
371
372 dosbin "${FILESDIR}/ghc-updater"
373
374 dobashcompletion "${FILESDIR}/ghc-bash-completion"
375
376 cp -p "${D}/usr/$(get_libdir)/${P}/package.conf"{,.shipped} \
377 || die "failed to copy package.conf"
378 fi
379 }
380
381 pkg_postinst() {
382 # 'ghc-pkg check' fails in ghc 6.10.2, with the error message:
383 # There are problems in package rts-1.0:
384 # include-dirs: PAPI_INCLUDE_DIR doesn't exist or isn't a directory
385 # Upstream suggests this solution to fix it:
386 export PATH="/usr/bin:${PATH}"
387 $(ghc-getghcpkg) describe rts | sed 's/PAPI_INCLUDE_DIR//' | $(ghc-getghcpkg) update -
388
389 ghc-reregister
390
391 ewarn "IMPORTANT:"
392 ewarn "If you have upgraded from another version of ghc, please run:"
393 ewarn " /usr/sbin/ghc-updater"
394 ewarn "to re-merge all ghc-based Haskell libraries."
395
396 bash-completion_pkg_postinst
397 }
398
399 pkg_prerm() {
400 # Overwrite the (potentially) modified package.conf with a copy of the
401 # original one, so that it will be removed during uninstall.
402
403 PKG="${ROOT}/usr/$(get_libdir)/${P}/package.conf"
404
405 cp -p "${PKG}"{.shipped,}
406
407 [[ -f ${PKG}.old ]] && rm "${PKG}.old"
408 }