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