1 |
slyfox 13/06/01 14:16:25 |
2 |
|
3 |
Modified: ChangeLog |
4 |
Added: ghc-7.6.3.ebuild |
5 |
Log: |
6 |
Version bump. With x86 and amd64 binaries for now. |
7 |
|
8 |
(Portage version: 2.2.0_alpha177_p3/cvs/Linux x86_64, signed Manifest commit with key 611FF3AA) |
9 |
|
10 |
Revision Changes Path |
11 |
1.243 dev-lang/ghc/ChangeLog |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ChangeLog?rev=1.243&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ChangeLog?rev=1.243&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ChangeLog?r1=1.242&r2=1.243 |
16 |
|
17 |
Index: ChangeLog |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v |
20 |
retrieving revision 1.242 |
21 |
retrieving revision 1.243 |
22 |
diff -u -r1.242 -r1.243 |
23 |
--- ChangeLog 25 Apr 2013 18:47:56 -0000 1.242 |
24 |
+++ ChangeLog 1 Jun 2013 14:16:25 -0000 1.243 |
25 |
@@ -1,6 +1,11 @@ |
26 |
# ChangeLog for dev-lang/ghc |
27 |
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 |
28 |
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.242 2013/04/25 18:47:56 ago Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.243 2013/06/01 14:16:25 slyfox Exp $ |
30 |
+ |
31 |
+*ghc-7.6.3 (01 Jun 2013) |
32 |
+ |
33 |
+ 01 Jun 2013; Sergei Trofimovich <slyfox@g.o> +ghc-7.6.3.ebuild: |
34 |
+ Version bump. With x86 and amd64 binaries for now. |
35 |
|
36 |
25 Apr 2013; Agostino Sarubbo <ago@g.o> ghc-7.4.2.ebuild: |
37 |
Stable for sparc, wrt bug #457780 |
38 |
|
39 |
|
40 |
|
41 |
1.1 dev-lang/ghc/ghc-7.6.3.ebuild |
42 |
|
43 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ghc-7.6.3.ebuild?rev=1.1&view=markup |
44 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/ghc/ghc-7.6.3.ebuild?rev=1.1&content-type=text/plain |
45 |
|
46 |
Index: ghc-7.6.3.ebuild |
47 |
=================================================================== |
48 |
# Copyright 1999-2013 Gentoo Foundation |
49 |
# Distributed under the terms of the GNU General Public License v2 |
50 |
# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-7.6.3.ebuild,v 1.1 2013/06/01 14:16:25 slyfox Exp $ |
51 |
|
52 |
# Brief explanation of the bootstrap logic: |
53 |
# |
54 |
# Previous ghc ebuilds have been split into two: ghc and ghc-bin, |
55 |
# where ghc-bin was primarily used for bootstrapping purposes. |
56 |
# From now on, these two ebuilds have been combined, with the |
57 |
# binary USE flag used to determine whether or not the pre-built |
58 |
# binary package should be emerged or whether ghc should be compiled |
59 |
# from source. If the latter, then the relevant ghc-bin for the |
60 |
# arch in question will be used in the working directory to compile |
61 |
# ghc from source. |
62 |
# |
63 |
# This solution has the advantage of allowing us to retain the one |
64 |
# ebuild for both packages, and thus phase out virtual/ghc. |
65 |
|
66 |
# Note to users of hardened gcc-3.x: |
67 |
# |
68 |
# If you emerge ghc with hardened gcc it should work fine (because we |
69 |
# turn off the hardened features that would otherwise break ghc). |
70 |
# However, emerging ghc while using a vanilla gcc and then switching to |
71 |
# hardened gcc (using gcc-config) will leave you with a broken ghc. To |
72 |
# fix it you would need to either switch back to vanilla gcc or re-emerge |
73 |
# ghc (or ghc-bin). Note that also if you are using hardened gcc-3.x and |
74 |
# you switch to gcc-4.x that this will also break ghc and you'll need to |
75 |
# re-emerge ghc (or ghc-bin). People using vanilla gcc can switch between |
76 |
# gcc-3.x and 4.x with no problems. |
77 |
|
78 |
EAPI="5" |
79 |
|
80 |
# to make make a crosscompiler use crossdev and symlink ghc tree into |
81 |
# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc' |
82 |
# |
83 |
# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass' |
84 |
export CTARGET=${CTARGET:-${CHOST}} |
85 |
if [[ ${CTARGET} = ${CHOST} ]] ; then |
86 |
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then |
87 |
export CTARGET=${CATEGORY/cross-} |
88 |
fi |
89 |
fi |
90 |
|
91 |
inherit base autotools bash-completion-r1 eutils flag-o-matic multilib toolchain-funcs ghc-package versionator pax-utils |
92 |
|
93 |
DESCRIPTION="The Glasgow Haskell Compiler" |
94 |
HOMEPAGE="http://www.haskell.org/ghc/" |
95 |
|
96 |
# we don't have any binaries yet |
97 |
arch_binaries="" |
98 |
|
99 |
# sorted! |
100 |
#arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )" |
101 |
#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )" |
102 |
arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PV}-amd64.tbz2 )" |
103 |
#arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64.tbz2 )" |
104 |
#arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )" |
105 |
#arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )" |
106 |
#arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )" |
107 |
arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PV}-x86.tbz2 )" |
108 |
|
109 |
# various ports: |
110 |
#arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )" |
111 |
|
112 |
# 0 - yet |
113 |
yet_binary() { |
114 |
case "${ARCH}" in |
115 |
#alpha) return 0 ;; |
116 |
#arm) |
117 |
# ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution." |
118 |
# return 0 |
119 |
#;; |
120 |
amd64) return 0 ;; |
121 |
#ia64) return 0 ;; |
122 |
#ppc) return 0 ;; |
123 |
#ppc64) return 0 ;; |
124 |
#sparc) return 0 ;; |
125 |
x86) return 0 ;; |
126 |
*) return 1 ;; |
127 |
esac |
128 |
} |
129 |
|
130 |
SRC_URI="!binary? ( http://www.haskell.org/ghc/dist/${PV}/${P}-src.tar.bz2 )" |
131 |
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )" |
132 |
LICENSE="BSD" |
133 |
SLOT="0/${PV}" |
134 |
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris" |
135 |
IUSE="doc ghcbootstrap ghcmakebinary +gmp llvm" |
136 |
IUSE+=" binary" # don't forget about me later! |
137 |
IUSE+=" elibc_glibc" # system stuff |
138 |
|
139 |
RDEPEND=" |
140 |
!kernel_Darwin? ( >=sys-devel/gcc-2.95.3 ) |
141 |
kernel_linux? ( >=sys-devel/binutils-2.17 ) |
142 |
kernel_SunOS? ( >=sys-devel/binutils-2.17 ) |
143 |
>=dev-lang/perl-5.6.1 |
144 |
>=dev-libs/gmp-5 |
145 |
virtual/libffi |
146 |
!<dev-haskell/haddock-2.4.2 |
147 |
sys-libs/ncurses[unicode]" |
148 |
# earlier versions than 2.4.2 of haddock only works with older ghc releases |
149 |
|
150 |
# force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to |
151 |
# that we want the binaries to use the latest versioun available, and not to be |
152 |
# built against gmp-4 |
153 |
|
154 |
# similar for glibc. we have bootstrapped binaries against glibc-2.14 |
155 |
DEPEND="${RDEPEND} |
156 |
ghcbootstrap? ( >=dev-haskell/alex-2.3 |
157 |
>=dev-haskell/happy-1.18 |
158 |
doc? ( app-text/docbook-xml-dtd:4.2 |
159 |
app-text/docbook-xml-dtd:4.5 |
160 |
app-text/docbook-xsl-stylesheets |
161 |
>=dev-libs/libxslt-1.1.2 ) ) |
162 |
!ghcbootstrap? ( !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.15 ) ) )" |
163 |
|
164 |
PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )" |
165 |
PDEPEND=" |
166 |
${PDEPEND} |
167 |
llvm? ( sys-devel/llvm )" |
168 |
|
169 |
# ia64 fails to return from STG GMP primitives (stage2 always SIGSEGVs) |
170 |
REQUIRED_USE="ia64? ( !gmp )" |
171 |
|
172 |
is_crosscompile() { |
173 |
[[ ${CHOST} != ${CTARGET} ]] |
174 |
} |
175 |
|
176 |
append-ghc-cflags() { |
177 |
local flag compile assemble link |
178 |
for flag in $*; do |
179 |
case ${flag} in |
180 |
compile) compile="yes";; |
181 |
assemble) assemble="yes";; |
182 |
link) link="yes";; |
183 |
*) |
184 |
[[ ${compile} ]] && GHC_FLAGS="${GHC_FLAGS} -optc${flag}" CFLAGS="${CFLAGS} ${flag}" |
185 |
[[ ${assemble} ]] && GHC_FLAGS="${GHC_FLAGS} -opta${flag}" CFLAGS="${CFLAGS} ${flag}" |
186 |
[[ ${link} ]] && GHC_FLAGS="${GHC_FLAGS} -optl${flag}" FILTERED_LDFLAGS="${FILTERED_LDFLAGS} ${flag}";; |
187 |
esac |
188 |
done |
189 |
} |
190 |
|
191 |
ghc_setup_cflags() { |
192 |
if is_crosscompile; then |
193 |
export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"} |
194 |
export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"} |
195 |
einfo "Crosscompiling mode:" |
196 |
einfo " CHOST: ${CHOST}" |
197 |
einfo " CTARGET: ${CTARGET}" |
198 |
einfo " CFLAGS: ${CFLAGS}" |
199 |
einfo " LDFLAGS: ${LDFLAGS}" |
200 |
return |
201 |
fi |
202 |
# We need to be very careful with the CFLAGS we ask ghc to pass through to |
203 |
# gcc. There are plenty of flags which will make gcc produce output that |
204 |
# breaks ghc in various ways. The main ones we want to pass through are |
205 |
# -mcpu / -march flags. These are important for arches like alpha & sparc. |
206 |
# We also use these CFLAGS for building the C parts of ghc, ie the rts. |
207 |
strip-flags |
208 |
strip-unsupported-flags |
209 |
|
210 |
GHC_FLAGS="" |
211 |
for flag in ${CFLAGS}; do |
212 |
case ${flag} in |
213 |
|
214 |
# Ignore extra optimisation (ghc passes -O to gcc anyway) |
215 |
# -O2 and above break on too many systems |
216 |
-O*) ;; |
217 |
|
218 |
# Arch and ABI flags are what we're really after |
219 |
-m*) append-ghc-cflags compile assemble ${flag};; |
220 |
|
221 |
# Sometimes it's handy to see backtrace of RTS |
222 |
# to get an idea what happens there |
223 |
-g*) append-ghc-cflags compile ${flag};; |
224 |
|
225 |
# Ignore all other flags, including all -f* flags |
226 |
esac |
227 |
done |
228 |
|
229 |
FILTERED_LDFLAGS="" |
230 |
for flag in ${LDFLAGS}; do |
231 |
case ${flag} in |
232 |
# Pass the canary. we don't quite respect LDFLAGS, but we have an excuse! |
233 |
"-Wl,--hash-style="*) append-ghc-cflags link ${flag};; |
234 |
|
235 |
# Ignore all other flags |
236 |
esac |
237 |
done |
238 |
|
239 |
# hardened-gcc needs to be disabled, because the mangler doesn't accept |
240 |
# its output. |
241 |
gcc-specs-pie && append-ghc-cflags compile link -nopie |
242 |
gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector |
243 |
|
244 |
# prevent from failind building unregisterised ghc: |
245 |
# http://www.mail-archive.com/debian-bugs-dist@××××××××××××.org/msg171602.html |
246 |
use ppc64 && append-ghc-cflags compile -mminimal-toc |
247 |
# fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data |
248 |
# currently ghc fails to build haddock |
249 |
# http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html |
250 |
use ia64 && append-ghc-cflags compile -G0 -Os |
251 |
|
252 |
# Unfortunately driver/split/ghc-split.lprl is dumb |
253 |
# enough to preserve stack marking for each split object |
254 |
# and it flags stack marking violation: |
255 |
# * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__1.o |
256 |
# * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__2.o |
257 |
# * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__3.o |
258 |
case $($(tc-getAS) -v 2>&1 </dev/null) in |
259 |
*"GNU Binutils"*) # GNU ld |
260 |
append-ghc-cflags compile assemble -Wa,--noexecstack |
261 |
;; |
262 |
esac |
263 |
} |
264 |
|
265 |
# substitutes string $1 to $2 in files $3 $4 ... |
266 |
relocate_path() { |
267 |
local from=$1 |
268 |
local to=$2 |
269 |
shift 2 |
270 |
local file= |
271 |
for file in "$@" |
272 |
do |
273 |
sed -i -e "s|$from|$to|g" \ |
274 |
"$file" || die "path relocation failed for '$file'" |
275 |
done |
276 |
} |
277 |
|
278 |
# changes hardcoded ghc paths and updates package index |
279 |
# $1 - new absolute root path |
280 |
relocate_ghc() { |
281 |
local to=$1 |
282 |
|
283 |
# backup original script to use it later after relocation |
284 |
local gp_back="${T}/ghc-pkg-${PV}-orig" |
285 |
cp "${WORKDIR}/usr/bin/ghc-pkg-${PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper" |
286 |
|
287 |
# Relocate from /usr to ${EPREFIX}/usr |
288 |
relocate_path "/usr" "${to}/usr" \ |
289 |
"${WORKDIR}/usr/bin/ghc-${PV}" \ |
290 |
"${WORKDIR}/usr/bin/ghci-${PV}" \ |
291 |
"${WORKDIR}/usr/bin/ghc-pkg-${PV}" \ |
292 |
"${WORKDIR}/usr/bin/hsc2hs" \ |
293 |
"${WORKDIR}/usr/$(get_libdir)/${P}/package.conf.d/"* |
294 |
|
295 |
# this one we will use to regenerate cache |
296 |
# so it shoult point to current tree location |
297 |
relocate_path "/usr" "${WORKDIR}/usr" "$gp_back" |
298 |
|
299 |
if use prefix; then |
300 |
# and insert LD_LIBRARY_PATH entry to EPREFIX dir tree |
301 |
# TODO: add the same for darwin's CHOST and it's DYLD_ |
302 |
local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH' |
303 |
sed -i -e '2i'"$new_ldpath" \ |
304 |
"${WORKDIR}/usr/bin/ghc-${PV}" \ |
305 |
"${WORKDIR}/usr/bin/ghci-${PV}" \ |
306 |
"${WORKDIR}/usr/bin/ghc-pkg-${PV}" \ |
307 |
"$gp_back" \ |
308 |
"${WORKDIR}/usr/bin/hsc2hs" \ |
309 |
|| die "Adding LD_LIBRARY_PATH for wrappers failed" |
310 |
fi |
311 |
|
312 |
# regenerate the binary package cache |
313 |
"$gp_back" recache || die "failed to update cache after relocation" |
314 |
rm "$gp_back" |
315 |
} |
316 |
|
317 |
pkg_setup() { |
318 |
if use ghcbootstrap; then |
319 |
ewarn "You requested ghc bootstrapping, this is usually only used" |
320 |
ewarn "by Gentoo developers to make binary .tbz2 packages for" |
321 |
ewarn "use with the ghc ebuild's USE=\"binary\" feature." |
322 |
use binary && \ |
323 |
die "USE=\"ghcbootstrap binary\" is not a valid combination." |
324 |
[[ -z $(type -P ghc) ]] && \ |
325 |
die "Could not find a ghc to bootstrap with." |
326 |
else |
327 |
if ! yet_binary; then |
328 |
eerror "Please try emerging with USE=ghcbootstrap and report build" |
329 |
eerror "sucess or failure to the haskell team (haskell@g.o)" |
330 |
die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap" |
331 |
fi |
332 |
fi |
333 |
} |
334 |
|
335 |
src_unpack() { |
336 |
# Create the ${S} dir if we're using the binary version |
337 |
use binary && mkdir "${S}" |
338 |
|
339 |
# the Solaris and Darwin binaries from ghc (maeder) need to be |
340 |
# unpacked separately, so prevent them from being unpacked |
341 |
local ONLYA=${A} |
342 |
case ${CHOST} in |
343 |
*-darwin* | *-solaris*) ONLYA=${P}-src.tar.bz2 ;; |
344 |
esac |
345 |
unpack ${ONLYA} |
346 |
} |
347 |
|
348 |
src_prepare() { |
349 |
ghc_setup_cflags |
350 |
|
351 |
if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then |
352 |
# Modify the wrapper script from the binary tarball to use GHC_FLAGS. |
353 |
# See bug #313635. |
354 |
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_FLAGS}|" \ |
355 |
"${WORKDIR}/usr/bin/ghc-${PV}" |
356 |
|
357 |
# allow hardened users use vanilla binary to bootstrap ghc |
358 |
# ghci uses mmap with rwx protection at it implements dynamic |
359 |
# linking on it's own (bug #299709) |
360 |
pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${P}/ghc" |
361 |
fi |
362 |
|
363 |
if use binary; then |
364 |
if use prefix; then |
365 |
relocate_ghc "${EPREFIX}" |
366 |
fi |
367 |
|
368 |
# Move unpacked files to the expected place |
369 |
mv "${WORKDIR}/usr" "${S}" |
370 |
else |
371 |
if ! use ghcbootstrap; then |
372 |
case ${CHOST} in |
373 |
*-darwin* | *-solaris*) |
374 |
# UPDATE ME for ghc-7 |
375 |
mkdir "${WORKDIR}"/ghc-bin-installer || die |
376 |
pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die |
377 |
use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2 |
378 |
use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2 |
379 |
use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2 |
380 |
use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2 |
381 |
popd > /dev/null |
382 |
|
383 |
pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die |
384 |
# fix the binaries so they run, on Solaris we need an |
385 |
# LD_LIBRARY_PATH which has our prefix libdirs, on |
386 |
# Darwin we need to replace the frameworks with our libs |
387 |
# from the prefix fix before installation, because some |
388 |
# of the tools are actually used during configure/make |
389 |
if [[ ${CHOST} == *-solaris* ]] ; then |
390 |
export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}" |
391 |
elif [[ ${CHOST} == *-darwin* ]] ; then |
392 |
local readline_framework=GNUreadline.framework/GNUreadline |
393 |
local gmp_framework=/opt/local/lib/libgmp.10.dylib |
394 |
local ncurses_file=/opt/local/lib/libncurses.5.dylib |
395 |
for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do |
396 |
install_name_tool -change \ |
397 |
${readline_framework} \ |
398 |
"${EPREFIX}"/lib/libreadline.dylib \ |
399 |
${binary} || die |
400 |
install_name_tool -change \ |
401 |
${gmp_framework} \ |
402 |
"${EPREFIX}"/usr/lib/libgmp.dylib \ |
403 |
${binary} || die |
404 |
install_name_tool -change \ |
405 |
${ncurses_file} \ |
406 |
"${EPREFIX}"/usr/lib/libncurses.dylib \ |
407 |
${binary} || die |
408 |
done |
409 |
# we don't do frameworks! |
410 |
sed -i \ |
411 |
-e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \ |
412 |
-e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \ |
413 |
rts/package.conf.in || die |
414 |
fi |
415 |
|
416 |
# it is autoconf, but we really don't want to give it too |
417 |
# much arguments, in fact we do the make in-place anyway |
418 |
./configure --prefix="${WORKDIR}"/usr || die |
419 |
make install || die |
420 |
popd > /dev/null |
421 |
;; |
422 |
*) |
423 |
relocate_ghc "${WORKDIR}" |
424 |
;; |
425 |
esac |
426 |
fi |
427 |
|
428 |
sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_FLAGS}|" \ |
429 |
"${S}/ghc/ghc.wrapper" |
430 |
|
431 |
cd "${S}" # otherwise epatch will break |
432 |
|
433 |
epatch "${FILESDIR}/ghc-7.0.4-CHOST-prefix.patch" |
434 |
|
435 |
# epatch "${FILESDIR}"/${PN}-7.0.4-darwin8.patch |
436 |
# failed to apply. FIXME |
437 |
#epatch "${FILESDIR}"/${PN}-6.12.3-mach-o-relocation-limit.patch |
438 |
|
439 |
# epatch "${FILESDIR}"/${PN}-7.4-rc2-macos-prefix-respect-gcc.patch |
440 |
# epatch "${FILESDIR}"/${PN}-7.2.1-freebsd-CHOST.patch |
441 |
|
442 |
we_want_libffi_workaround() { |
443 |
use ghcmakebinary && return 1 |
444 |
|
445 |
# pick only registerised arches |
446 |
# http://bugs.gentoo.org/463814 |
447 |
use amd64 && return 0 |
448 |
use x86 && return 0 |
449 |
return 1 |
450 |
} |
451 |
# one mode external depend with unstable ABI be careful to stash it |
452 |
# avoid external libffi runtime when we build binaries |
453 |
we_want_libffi_workaround && epatch "${FILESDIR}"/${PN}-7.5.20120505-system-libffi.patch |
454 |
|
455 |
epatch "${FILESDIR}"/${PN}-7.4.1-ticket-7339-fix-unaligned-unreg.patch |
456 |
epatch "${FILESDIR}"/${PN}-7.6.2-integer-simple-div-mod.patch |
457 |
|
458 |
if use prefix; then |
459 |
# Make configure find docbook-xsl-stylesheets from Prefix |
460 |
sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \ |
461 |
-i utils/haddock/doc/configure.ac || die |
462 |
fi |
463 |
|
464 |
# as we have changed the build system |
465 |
eautoreconf |
466 |
fi |
467 |
} |
468 |
|
469 |
src_configure() { |
470 |
GHC_PV=${PV} # overrided in live ebuilds |
471 |
|
472 |
if ! use binary; then |
473 |
# initialize build.mk |
474 |
echo '# Gentoo changes' > mk/build.mk |
475 |
|
476 |
# Put docs into the right place, ie /usr/share/doc/ghc-${PV} |
477 |
echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk |
478 |
echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk |
479 |
|
480 |
# We also need to use the GHC_FLAGS flags when building ghc itself |
481 |
echo "SRC_HC_OPTS+=${GHC_FLAGS}" >> mk/build.mk |
482 |
echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk |
483 |
echo "SRC_LD_OPTS+=${FILTERED_LDFLAGS}" >> mk/build.mk |
484 |
|
485 |
# We can't depend on haddock except when bootstrapping when we |
486 |
# must build docs and include them into the binary .tbz2 package |
487 |
# app-text/dblatex is not in portage, can not build PDF or PS |
488 |
if use ghcbootstrap && use doc; then |
489 |
echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk |
490 |
echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk |
491 |
echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk |
492 |
if is_crosscompile; then |
493 |
# TODO this is a workaround for this build error with the live ebuild with haddock: |
494 |
# make[1]: *** No rule to make target `compiler/stage2/build/Module.hi', |
495 |
# needed by `utils/haddock/dist/build/Main.o'. Stop. |
496 |
echo "HADDOCK_DOCS = NO" >> mk/build.mk |
497 |
else |
498 |
echo "HADDOCK_DOCS = YES" >> mk/build.mk |
499 |
fi |
500 |
else |
501 |
echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk |
502 |
echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk |
503 |
echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk |
504 |
echo "HADDOCK_DOCS = NO" >> mk/build.mk |
505 |
fi |
506 |
|
507 |
# circumvent a very strange bug that seems related with ghc producing |
508 |
# too much output while being filtered through tee (e.g. due to |
509 |
# portage logging) reported as bug #111183 |
510 |
echo "SRC_HC_OPTS+=-w" >> mk/build.mk |
511 |
|
512 |
# some arches do not support ELF parsing for ghci module loading |
513 |
# PPC64: never worked (should be easy to implement) |
514 |
# alpha: never worked |
515 |
# arm: http://hackage.haskell.org/trac/ghc/changeset/27302c9094909e04eb73f200d52d5e9370c34a8a |
516 |
if use alpha || use ppc64; then |
517 |
echo "GhcWithInterpreter=NO" >> mk/build.mk |
518 |
fi |
519 |
|
520 |
# we have to tell it to build unregisterised on some arches |
521 |
# ppc64: EvilMangler currently does not understand some TOCs |
522 |
# ia64: EvilMangler bitrot |
523 |
# set GHC_IS_UNREG if you like to build slow unregisterised |
524 |
# host compiler. Handy if you plan to user resulting |
525 |
# host compiler as a booting compiler for crosscompiler |
526 |
# which can work only in unregisterised mode. |
527 |
if use alpha || use ia64 || use ppc64 || [[ -n ${GHC_IS_UNREG} ]]; then |
528 |
echo "GhcUnregisterised=YES" >> mk/build.mk |
529 |
echo "GhcWithNativeCodeGen=NO" >> mk/build.mk |
530 |
echo "SplitObjs=NO" >> mk/build.mk |
531 |
echo "GhcRTSWays := debug" >> mk/build.mk |
532 |
echo "GhcNotThreaded=YES" >> mk/build.mk |
533 |
fi |
534 |
|
535 |
# arm: no EvilMangler support, no NCG support |
536 |
if use arm; then |
537 |
echo "GhcUnregisterised=YES" >> mk/build.mk |
538 |
echo "GhcWithNativeCodeGen=NO" >> mk/build.mk |
539 |
fi |
540 |
|
541 |
# Have "ld -r --relax" problem with split-objs on sparc: |
542 |
if use sparc; then |
543 |
echo "SplitObjs=NO" >> mk/build.mk |
544 |
fi |
545 |
|
546 |
if ! use llvm; then |
547 |
echo "GhcWithLlvmCodeGen=NO" >> mk/build.mk |
548 |
fi |
549 |
|
550 |
# allows overriding build flavours for libraries: |
551 |
# v - vanilla (static libs) |
552 |
# p - profiled |
553 |
# dyn - shared libraries |
554 |
# example: GHC_LIBRARY_WAYS="v dyn" |
555 |
if [[ -n ${GHC_LIBRARY_WAYS} ]]; then |
556 |
echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk |
557 |
fi |
558 |
|
559 |
# Get ghc from the unpacked binary .tbz2 |
560 |
# except when bootstrapping we just pick ghc up off the path |
561 |
if ! use ghcbootstrap; then |
562 |
export PATH="${WORKDIR}/usr/bin:${PATH}" |
563 |
fi |
564 |
|
565 |
if use gmp; then |
566 |
echo "INTEGER_LIBRARY=integer-gmp" >> mk/build.mk |
567 |
else |
568 |
echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk |
569 |
fi |
570 |
|
571 |
# Since GHC 6.12.2 the GHC wrappers store which GCC version GHC was |
572 |
# compiled with, by saving the path to it. The purpose is to make sure |
573 |
# that GHC will use the very same gcc version when it compiles haskell |
574 |
# sources, as the extra-gcc-opts files contains extra gcc options which |
575 |
# match only this GCC version. |
576 |
# However, this is not required in Gentoo, as only modern GCCs are used |
577 |
# (>4). |
578 |
# Instead, this causes trouble when for example ccache is used during |
579 |
# compilation, but we don't want the wrappers to point to ccache. |
580 |
# Due to the above, we simply set GCC to be "gcc". When compiling ghc it |
581 |
# might point to ccache, once installed it will point to the users |
582 |
# regular gcc. |
583 |
|
584 |
local econf_args=() |
585 |
|
586 |
is_crosscompile || econf_args+=--with-gcc=${CHOST}-gcc |
587 |
|
588 |
econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot \ |
589 |
|| die "econf failed" |
590 |
|
591 |
[[ ${PV} == *9999* ]] && GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')" |
592 |
GHC_TPF="$(grep 'S\[\"TargetPlatformFull\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')" |
593 |
fi # ! use binary |
594 |
} |
595 |
|
596 |
src_compile() { |
597 |
if ! use binary; then |
598 |
#limit_jobs() { |
599 |
# if [[ -n ${I_DEMAND_MY_CORES_LOADED} ]]; then |
600 |
# ewarn "You have requested parallel build which is known to break." |
601 |
# ewarn "Please report all breakages upstream." |
602 |
# return |
603 |
# fi |
604 |
# echo $@ |
605 |
#} |
606 |
# ghc massively parallel make: #409631, #409873 |
607 |
# but let users screw it by setting 'I_DEMAND_MY_CORES_LOADED' |
608 |
#emake $(limit_jobs -j1) all |
609 |
# ^ above seems to be fixed. |
610 |
emake all V=1 |
611 |
|
612 |
if is_crosscompile; then |
613 |
# runghc does not work for a stage1 compiler, we can build it anyway |
614 |
# so it will print the error message: not built for interactive use |
615 |
pushd "${S}/utils/runghc" || die "Could not cd to utils/runghc" |
616 |
if [ ! -f Setup.hs ]; then |
617 |
echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \ |
618 |
> Setup.hs || die "failed to create default Setup.hs" |
619 |
fi |
620 |
ghc -o setup --make Setup.hs || die "setup build failed" |
621 |
./setup configure || die "runghc configure failed" |
622 |
sed -e "s@VERSION@\"${GHC_PV}\"@" -i runghc.hs |
623 |
./setup build || die "runghc build failed" |
624 |
popd |
625 |
fi |
626 |
fi # ! use binary |
627 |
} |
628 |
|
629 |
src_install() { |
630 |
if use binary; then |
631 |
use prefix && mkdir -p "${ED}" |
632 |
mv "${S}/usr" "${ED}" |
633 |
|
634 |
# Remove the docs if not requested |
635 |
if ! use doc; then |
636 |
rm -rf "${ED}/usr/share/doc/${P}/*/" \ |
637 |
"${ED}/usr/share/doc/${P}/*.html" \ |
638 |
|| die "could not remove docs (P vs PF revision mismatch?)" |
639 |
fi |
640 |
else |
641 |
local insttarget="install" |
642 |
|
643 |
# We only built docs if we were bootstrapping, otherwise |
644 |
# we copy them out of the unpacked binary .tbz2 |
645 |
if use doc && ! use ghcbootstrap; then |
646 |
mkdir -p "${ED}/usr/share/doc" |
647 |
mv "${WORKDIR}/usr/share/doc/${P}" "${ED}/usr/share/doc" \ |
648 |
|| die "failed to copy docs" |
649 |
else |
650 |
dodoc "${S}/README" "${S}/ANNOUNCE" "${S}/LICENSE" "${S}/VERSION" |
651 |
fi |
652 |
|
653 |
emake -j1 ${insttarget} \ |
654 |
DESTDIR="${D}" \ |
655 |
|| die "make ${insttarget} failed" |
656 |
|
657 |
# remove wrapper and linker |
658 |
rm -f "${ED}"/usr/bin/haddock* |
659 |
|
660 |
# ghci uses mmap with rwx protection at it implements dynamic |
661 |
# linking on it's own (bug #299709) |
662 |
# so mark resulting binary |
663 |
pax-mark -m "${ED}/usr/$(get_libdir)/${P}/ghc" |
664 |
|
665 |
if [[ ! -f "${S}/VERSION" ]]; then |
666 |
echo "${GHC_PV}" > "${S}/VERSION" \ |
667 |
|| die "Could not create file ${S}/VERSION" |
668 |
fi |
669 |
dobashcomp "${FILESDIR}/ghc-bash-completion" |
670 |
|
671 |
fi |
672 |
|
673 |
# path to the package.cache |
674 |
local package_confdir="${ED}/usr/$(get_libdir)/${PN}-${GHC_PV}/package.conf.d" |
675 |
PKGCACHE="${package_confdir}"/package.cache |
676 |
# copy the package.conf.d, including timestamp, save it so we can help |
677 |
# users that have a broken package.conf.d |
678 |
cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d" |
679 |
|
680 |
# copy the package.conf, including timestamp, save it so we later can put it |
681 |
# back before uninstalling, or when upgrading. |
682 |
cp -p "${PKGCACHE}"{,.shipped} \ |
683 |
|| die "failed to copy package.conf.d/package.cache" |
684 |
} |
685 |
|
686 |
pkg_preinst() { |
687 |
# have we got an earlier version of ghc installed? |
688 |
if has_version "<${CATEGORY}/${PF}"; then |
689 |
haskell_updater_warn="1" |
690 |
fi |
691 |
} |
692 |
|
693 |
pkg_postinst() { |
694 |
ghc-reregister |
695 |
|
696 |
# path to the package.cache |
697 |
PKGCACHE="${EROOT}/usr/$(get_libdir)/${P}/package.conf.d/package.cache" |
698 |
|
699 |
# give the cache a new timestamp, it must be as recent as |
700 |
# the package.conf.d directory. |
701 |
touch "${PKGCACHE}" |
702 |
|
703 |
if [[ "${haskell_updater_warn}" == "1" ]]; then |
704 |
ewarn |
705 |
ewarn "\e[1;31m************************************************************************\e[0m" |
706 |
ewarn |
707 |
ewarn "You have just upgraded from an older version of GHC." |
708 |
ewarn "You may have to run" |
709 |
ewarn " 'haskell-updater --upgrade'" |
710 |
ewarn "to rebuild all ghc-based Haskell libraries." |
711 |
ewarn |
712 |
ewarn "\e[1;31m************************************************************************\e[0m" |
713 |
ewarn |
714 |
fi |
715 |
if is_crosscompile; then |
716 |
ewarn |
717 |
ewarn "\e[1;31m************************************************************************\e[0m" |
718 |
ewarn |
719 |
ewarn "GHC built as a cross compiler. The interpreter, ghci and runghc, do" |
720 |
ewarn "not work for a cross compiler." |
721 |
ewarn "For the ghci error: \"<command line>: not built for interactive use\" see:" |
722 |
ewarn "http://www.haskell.org/haskellwiki/GHC:FAQ#When_I_try_to_start_ghci_.28probably_one_I_compiled_myself.29_it_says_ghc-5.02:_not_built_for_interactive_use" |
723 |
ewarn |
724 |
ewarn "\e[1;31m************************************************************************\e[0m" |
725 |
ewarn |
726 |
fi |
727 |
} |
728 |
|
729 |
pkg_prerm() { |
730 |
# Be very careful here... Call order when upgrading is (according to PMS): |
731 |
# * src_install for new package |
732 |
# * pkg_preinst for new package |
733 |
# * pkg_postinst for new package |
734 |
# * pkg_prerm for the package being replaced |
735 |
# * pkg_postrm for the package being replaced |
736 |
# so you'll actually be touching the new packages files, not the one you |
737 |
# uninstall, due to that or installation directory ${P} will be the same for |
738 |
# both packages. |
739 |
|
740 |
# Call order for reinstalling is (according to PMS): |
741 |
# * src_install |
742 |
# * pkg_preinst |
743 |
# * pkg_prerm for the package being replaced |
744 |
# * pkg_postrm for the package being replaced |
745 |
# * pkg_postinst |
746 |
|
747 |
# Overwrite the modified package.cache with a copy of the |
748 |
# original one, so that it will be removed during uninstall. |
749 |
|
750 |
PKGCACHE="${EROOT}/usr/$(get_libdir)/${P}/package.conf.d/package.cache" |
751 |
rm -rf "${PKGCACHE}" |
752 |
|
753 |
cp -p "${PKGCACHE}"{.shipped,} |
754 |
} |