1 |
slyfox 14/02/11 19:00:07 |
2 |
|
3 |
Modified: ChangeLog ghc-package.eclass haskell-cabal.eclass |
4 |
Log: |
5 |
Add support for parallel building (ghc-7.8+). Disable dynamic library stripping and respect --sysconfdir (Cabal-1.18+). |
6 |
|
7 |
Revision Changes Path |
8 |
1.1141 eclass/ChangeLog |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1141&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1141&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1140&r2=1.1141 |
13 |
|
14 |
Index: ChangeLog |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
17 |
retrieving revision 1.1140 |
18 |
retrieving revision 1.1141 |
19 |
diff -u -r1.1140 -r1.1141 |
20 |
--- ChangeLog 9 Feb 2014 08:30:23 -0000 1.1140 |
21 |
+++ ChangeLog 11 Feb 2014 19:00:06 -0000 1.1141 |
22 |
@@ -1,6 +1,11 @@ |
23 |
# ChangeLog for eclass directory |
24 |
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1140 2014/02/09 08:30:23 pacho Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1141 2014/02/11 19:00:06 slyfox Exp $ |
27 |
+ |
28 |
+ 11 Feb 2014; Sergei Trofimovich <slyfox@g.o> ghc-package.eclass, |
29 |
+ haskell-cabal.eclass: |
30 |
+ Add support for parallel building (ghc-7.8+). Disable dynamic library |
31 |
+ stripping and respect --sysconfdir (Cabal-1.18+). |
32 |
|
33 |
09 Feb 2014; Pacho Ramos <pacho@g.o> gnome2-utils.eclass: |
34 |
Drop also values of DGSEAL_ENABLE (#500730) |
35 |
|
36 |
|
37 |
|
38 |
1.39 eclass/ghc-package.eclass |
39 |
|
40 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?rev=1.39&view=markup |
41 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?rev=1.39&content-type=text/plain |
42 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?r1=1.38&r2=1.39 |
43 |
|
44 |
Index: ghc-package.eclass |
45 |
=================================================================== |
46 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v |
47 |
retrieving revision 1.38 |
48 |
retrieving revision 1.39 |
49 |
diff -u -r1.38 -r1.39 |
50 |
--- ghc-package.eclass 19 Jan 2014 08:23:36 -0000 1.38 |
51 |
+++ ghc-package.eclass 11 Feb 2014 19:00:06 -0000 1.39 |
52 |
@@ -1,6 +1,6 @@ |
53 |
# Copyright 1999-2014 Gentoo Foundation |
54 |
# Distributed under the terms of the GNU General Public License v2 |
55 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.38 2014/01/19 08:23:36 slyfox Exp $ |
56 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.39 2014/02/11 19:00:06 slyfox Exp $ |
57 |
|
58 |
# @ECLASS: ghc-package.eclass |
59 |
# @MAINTAINER: |
60 |
@@ -124,6 +124,14 @@ |
61 |
$(ghc-getghc) --info | grep "Have interpreter" | grep -q "YES" |
62 |
} |
63 |
|
64 |
+# @FUNCTION: ghc-supports-parallel-make |
65 |
+# @DESCRIPTION: |
66 |
+# checks if ghc has support for '--make -j' mode |
67 |
+# The option was introduced in ghc-7.8-rc1. |
68 |
+ghc-supports-parallel-make() { |
69 |
+ $(ghc-getghc) --info | grep "Support parallel --make" | grep -q "YES" |
70 |
+} |
71 |
+ |
72 |
# @FUNCTION: ghc-extractportageversion |
73 |
# @DESCRIPTION: |
74 |
# extract the version of a portage-installed package |
75 |
|
76 |
|
77 |
|
78 |
1.43 eclass/haskell-cabal.eclass |
79 |
|
80 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.43&view=markup |
81 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.43&content-type=text/plain |
82 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.42&r2=1.43 |
83 |
|
84 |
Index: haskell-cabal.eclass |
85 |
=================================================================== |
86 |
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v |
87 |
retrieving revision 1.42 |
88 |
retrieving revision 1.43 |
89 |
diff -u -r1.42 -r1.43 |
90 |
--- haskell-cabal.eclass 20 Nov 2013 09:19:19 -0000 1.42 |
91 |
+++ haskell-cabal.eclass 11 Feb 2014 19:00:06 -0000 1.43 |
92 |
@@ -1,6 +1,6 @@ |
93 |
-# Copyright 1999-2013 Gentoo Foundation |
94 |
+# Copyright 1999-2014 Gentoo Foundation |
95 |
# Distributed under the terms of the GNU General Public License v2 |
96 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.42 2013/11/20 09:19:19 slyfox Exp $ |
97 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.43 2014/02/11 19:00:06 slyfox Exp $ |
98 |
|
99 |
# @ECLASS: haskell-cabal.eclass |
100 |
# @MAINTAINER: |
101 |
@@ -33,7 +33,7 @@ |
102 |
# on cabal, but still use this eclass (e.g. haskell-updater). |
103 |
# test-suite -- add support for cabal test-suites (introduced in Cabal-1.8) |
104 |
|
105 |
-inherit eutils ghc-package multilib |
106 |
+inherit eutils ghc-package multilib multiprocessing |
107 |
|
108 |
# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS |
109 |
# @DESCRIPTION: |
110 |
@@ -274,47 +274,58 @@ |
111 |
} |
112 |
|
113 |
cabal-configure() { |
114 |
+ local cabalconf=() |
115 |
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
116 |
|
117 |
if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then |
118 |
- cabalconf="${cabalconf} --with-haddock=${EPREFIX}/usr/bin/haddock" |
119 |
+ cabalconf+=(--with-haddock=${EPREFIX}/usr/bin/haddock) |
120 |
fi |
121 |
if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then |
122 |
- cabalconf="${cabalconf} --enable-library-profiling" |
123 |
+ cabalconf+=(--enable-library-profiling) |
124 |
fi |
125 |
if [[ -n "${CABAL_USE_ALEX}" ]]; then |
126 |
- cabalconf="${cabalconf} --with-alex=${EPREFIX}/usr/bin/alex" |
127 |
+ cabalconf+=(--with-alex=${EPREFIX}/usr/bin/alex) |
128 |
fi |
129 |
|
130 |
if [[ -n "${CABAL_USE_HAPPY}" ]]; then |
131 |
- cabalconf="${cabalconf} --with-happy=${EPREFIX}/usr/bin/happy" |
132 |
+ cabalconf+=(--with-happy=${EPREFIX}/usr/bin/happy) |
133 |
fi |
134 |
|
135 |
if [[ -n "${CABAL_USE_C2HS}" ]]; then |
136 |
- cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs" |
137 |
+ cabalconf+=(--with-c2hs=${EPREFIX}/usr/bin/c2hs) |
138 |
fi |
139 |
if [[ -n "${CABAL_USE_CPPHS}" ]]; then |
140 |
- cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs" |
141 |
+ cabalconf+=(--with-cpphs=${EPREFIX}/usr/bin/cpphs) |
142 |
fi |
143 |
if [[ -n "${CABAL_TEST_SUITE}" ]]; then |
144 |
- cabalconf="${cabalconf} $(use_enable test tests)" |
145 |
+ cabalconf+=($(use_enable test tests)) |
146 |
fi |
147 |
|
148 |
local option |
149 |
for option in ${HCFLAGS} |
150 |
do |
151 |
- cabalconf+=" --ghc-option=$option" |
152 |
+ cabalconf+=(--ghc-option="$option") |
153 |
done |
154 |
|
155 |
+ # parallel on all available cores |
156 |
+ if ghc-supports-parallel-make; then |
157 |
+ local max_jobs=$(makeopts_jobs) |
158 |
+ |
159 |
+ # limit to sort-of-sane value (same as Cabal) |
160 |
+ [[ ${max_jobs} -gt 64 ]] && max_jobs=64 |
161 |
+ |
162 |
+ cabalconf+=(--ghc-option=-j"$max_jobs") |
163 |
+ fi |
164 |
+ |
165 |
# Building GHCi libs on ppc64 causes "TOC overflow". |
166 |
if use ppc64; then |
167 |
- cabalconf="${cabalconf} --disable-library-for-ghci" |
168 |
+ cabalconf+=(--disable-library-for-ghci) |
169 |
fi |
170 |
|
171 |
# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217) |
172 |
# so translate LDFLAGS to ghc parameters (without filtering) |
173 |
local flag |
174 |
- for flag in $LDFLAGS; do cabalconf="${cabalconf} --ghc-option=-optl$flag"; done |
175 |
+ for flag in $LDFLAGS; do cabalconf+=(--ghc-option="-optl$flag"); done |
176 |
|
177 |
# disable executable stripping for the executables, as portage will |
178 |
# strip by itself, and pre-stripping gives a QA warning. |
179 |
@@ -322,26 +333,36 @@ |
180 |
# not accept the flag. |
181 |
# this fixes numerous bugs, amongst them; |
182 |
# bug #251881, bug #251882, bug #251884, bug #251886, bug #299494 |
183 |
- cabalconf="${cabalconf} --disable-executable-stripping" |
184 |
+ cabalconf+=(--disable-executable-stripping) |
185 |
|
186 |
- cabalconf="${cabalconf} --docdir=${EPREFIX}/usr/share/doc/${PF}" |
187 |
+ cabalconf+=(--docdir="${EPREFIX}"/usr/share/doc/${PF}) |
188 |
# As of Cabal 1.2, configure is quite quiet. For diagnostic purposes |
189 |
# it's better if the configure chatter is in the build logs: |
190 |
- cabalconf="${cabalconf} --verbose" |
191 |
+ cabalconf+=(--verbose) |
192 |
|
193 |
# We build shared version of our Cabal where ghc ships it's shared |
194 |
# version of it. We will link ./setup as dynamic binary againt Cabal later. |
195 |
[[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \ |
196 |
$(ghc-supports-shared-libraries) && \ |
197 |
- cabalconf="${cabalconf} --enable-shared" |
198 |
+ cabalconf+=(--enable-shared) |
199 |
|
200 |
if $(ghc-supports-shared-libraries); then |
201 |
# maybe a bit lower |
202 |
if $(ghc-supports-dynamic-by-default); then |
203 |
- cabalconf="${cabalconf} --enable-shared" |
204 |
+ cabalconf+=(--enable-shared) |
205 |
fi |
206 |
fi |
207 |
|
208 |
+ # --sysconfdir appeared in Cabal-1.18+ |
209 |
+ if ./setup configure --help | grep -q -- --sysconfdir; then |
210 |
+ cabalconf+=(--sysconfdir="${EPREFIX}"/etc) |
211 |
+ fi |
212 |
+ |
213 |
+ # appeared in Cabal-1.18+ (see '--disable-executable-stripping') |
214 |
+ if ./setup configure --help | grep -q -- --disable-library-stripping; then |
215 |
+ cabalconf+=(--disable-library-stripping) |
216 |
+ fi |
217 |
+ |
218 |
set -- configure \ |
219 |
--ghc --prefix="${EPREFIX}"/usr \ |
220 |
--with-compiler="$(ghc-getghc)" \ |
221 |
@@ -351,7 +372,7 @@ |
222 |
--libsubdir=${P}/ghc-$(ghc-version) \ |
223 |
--datadir="${EPREFIX}"/usr/share/ \ |
224 |
--datasubdir=${P}/ghc-$(ghc-version) \ |
225 |
- ${cabalconf} \ |
226 |
+ "${cabalconf[@]}" \ |
227 |
${CABAL_CONFIGURE_FLAGS} \ |
228 |
${CABAL_EXTRA_CONFIGURE_FLAGS} \ |
229 |
"$@" |