1 |
More details in the mail preceding the patch. |
2 |
--- |
3 |
gx86/eclass/autotools-multilib.eclass | 47 ++++++++-- |
4 |
gx86/eclass/autotools-utils.eclass | 157 +++++++++++++++++++++++++--------- |
5 |
2 files changed, 158 insertions(+), 46 deletions(-) |
6 |
|
7 |
diff --git a/gx86/eclass/autotools-multilib.eclass b/gx86/eclass/autotools-multilib.eclass |
8 |
index 5ca8112..6156610 100644 |
9 |
--- a/gx86/eclass/autotools-multilib.eclass |
10 |
+++ b/gx86/eclass/autotools-multilib.eclass |
11 |
@@ -38,27 +38,62 @@ autotools-multilib_src_prepare() { |
12 |
} |
13 |
|
14 |
autotools-multilib_src_configure() { |
15 |
- multilib_parallel_foreach_abi autotools-utils_src_configure "${@}" |
16 |
+ if declare -f autotools_configure >/dev/null; then |
17 |
+ multilib_parallel_foreach_abi \ |
18 |
+ _autotools-utils_run_phase autotools_configure "${@}" |
19 |
+ else |
20 |
+ multilib_parallel_foreach_abi \ |
21 |
+ _autotools-utils_run_phase \ |
22 |
+ autotools-utils_autotools_configure "${@}" |
23 |
+ fi |
24 |
} |
25 |
|
26 |
autotools-multilib_src_compile() { |
27 |
- multilib_foreach_abi autotools-utils_src_compile "${@}" |
28 |
+ if declare -f autotools_compile >/dev/null; then |
29 |
+ multilib_foreach_abi \ |
30 |
+ _autotools-utils_run_phase autotools_compile "${@}" |
31 |
+ else |
32 |
+ multilib_foreach_abi \ |
33 |
+ _autotools-utils_run_phase \ |
34 |
+ autotools-utils_autotools_compile "${@}" |
35 |
+ fi |
36 |
} |
37 |
|
38 |
autotools-multilib_src_test() { |
39 |
- multilib_foreach_abi autotools-utils_src_test "${@}" |
40 |
+ if declare -f autotools_test >/dev/null; then |
41 |
+ multilib_foreach_abi \ |
42 |
+ _autotools-utils_run_phase autotools_test "${@}" |
43 |
+ else |
44 |
+ multilib_foreach_abi \ |
45 |
+ _autotools-utils_run_phase \ |
46 |
+ autotools-utils_autotools_test "${@}" |
47 |
+ fi |
48 |
} |
49 |
|
50 |
autotools-multilib_src_install() { |
51 |
- autotools-multilib_secure_install() { |
52 |
- autotools-utils_src_install "${@}" |
53 |
+ _autotools-multilib_wrap_install() { |
54 |
+ "${@}" |
55 |
|
56 |
multilib_prepare_wrappers |
57 |
# Make sure all headers are the same for each ABI. |
58 |
multilib_check_headers |
59 |
} |
60 |
|
61 |
- multilib_foreach_abi autotools-multilib_secure_install "${@}" |
62 |
+ if declare -f autotools_install >/dev/null; then |
63 |
+ multilib_foreach_abi _autotools-multilib_wrap_install \ |
64 |
+ _autotools-utils_run_phase autotools_install "${@}" |
65 |
+ else |
66 |
+ multilib_foreach_abi _autotools-multilib_wrap_install \ |
67 |
+ _autotools-utils_run_phase \ |
68 |
+ autotools-utils_autotools_install "${@}" |
69 |
+ fi |
70 |
+ |
71 |
+ if declare -f autotools_install_all >/dev/null; then |
72 |
+ _autotools-utils_run_phase autotools_install_all "${@}" |
73 |
+ else |
74 |
+ _autotools-utils_run_phase \ |
75 |
+ autotools-utils_autotools_install_all "${@}" |
76 |
+ fi |
77 |
|
78 |
# merge the wrappers |
79 |
multilib_install_wrappers |
80 |
diff --git a/gx86/eclass/autotools-utils.eclass b/gx86/eclass/autotools-utils.eclass |
81 |
index e6bf526..b0a299c 100644 |
82 |
--- a/gx86/eclass/autotools-utils.eclass |
83 |
+++ b/gx86/eclass/autotools-utils.eclass |
84 |
@@ -14,8 +14,15 @@ |
85 |
# handling, libtool files removal. |
86 |
# |
87 |
# Please note that autotools-utils does not support mixing of its phase |
88 |
-# functions with regular econf/emake calls. If necessary, please call |
89 |
-# autotools-utils_src_compile instead of the latter. |
90 |
+# functions with regular econf/emake calls in src_*. If necessary, please |
91 |
+# declare autotools_* sub-phases instead which will be run in ${BUILD_DIR}. |
92 |
+# |
93 |
+# autotools-utils uses the following sub-phases: |
94 |
+# |
95 |
+# - autotools_prepare_all, autotools_install_all -- run in ${S}, once. |
96 |
+# |
97 |
+# - autotools_configure, autotools_compile, autotools_test, |
98 |
+# autotools_install -- run in ${BUILD_DIR}, may be run multiple times. |
99 |
# |
100 |
# @EXAMPLE: |
101 |
# Typical ebuild using autotools-utils.eclass: |
102 |
@@ -60,26 +67,26 @@ |
103 |
# "${FILESDIR}/${P}-unbundle_libpng.patch" |
104 |
# ) |
105 |
# |
106 |
-# src_configure() { |
107 |
+# autotools_configure() { |
108 |
# local myeconfargs=( |
109 |
# $(use_enable debug) |
110 |
# $(use_with qt4) |
111 |
# $(use_enable threads multithreading) |
112 |
# $(use_with tiff) |
113 |
# ) |
114 |
-# autotools-utils_src_configure |
115 |
+# edefault |
116 |
# } |
117 |
# |
118 |
-# src_compile() { |
119 |
-# autotools-utils_src_compile |
120 |
-# use doc && autotools-utils_src_compile docs |
121 |
+# autotools_compile() { |
122 |
+# edefault |
123 |
+# use doc && emake docs |
124 |
# } |
125 |
# |
126 |
-# src_install() { |
127 |
-# use doc && HTML_DOCS=("${BUILD_DIR}/apidocs/html/") |
128 |
-# autotools-utils_src_install |
129 |
+# autotools_install_all() { |
130 |
+# use doc && HTML_DOCS=( apidocs/html/. ) |
131 |
+# edefault |
132 |
# if use examples; then |
133 |
-# dobin "${BUILD_DIR}"/foo_example{1,2,3} \\ |
134 |
+# dobin foo_example{1,2,3} \\ |
135 |
# || die 'dobin examples failed' |
136 |
# fi |
137 |
# } |
138 |
@@ -228,6 +235,8 @@ _check_build_dir() { |
139 |
# Backwards compatibility for getting the value. |
140 |
AUTOTOOLS_BUILD_DIR=${BUILD_DIR} |
141 |
echo ">>> Working in BUILD_DIR: \"${BUILD_DIR}\"" |
142 |
+ |
143 |
+ mkdir -p "${BUILD_DIR}" || die |
144 |
} |
145 |
|
146 |
# @FUNCTION: remove_libtool_files |
147 |
@@ -383,12 +392,12 @@ autotools-utils_autoreconf() { |
148 |
done |
149 |
} |
150 |
|
151 |
-# @FUNCTION: autotools-utils_src_prepare |
152 |
+# @FUNCTION: autotools-utils_autotools_prepare_all |
153 |
# @DESCRIPTION: |
154 |
# The src_prepare function. |
155 |
# |
156 |
# Supporting PATCHES array and user patches. See base.eclass(5) for reference. |
157 |
-autotools-utils_src_prepare() { |
158 |
+autotools-utils_autotools_prepare_all() { |
159 |
debug-print-function ${FUNCNAME} "$@" |
160 |
|
161 |
local want_autoreconf=${AUTOTOOLS_AUTORECONF} |
162 |
@@ -415,7 +424,7 @@ autotools-utils_src_prepare() { |
163 |
elibtoolize --patch-only |
164 |
} |
165 |
|
166 |
-# @FUNCTION: autotools-utils_src_configure |
167 |
+# @FUNCTION: autotools-utils_autotools_configure |
168 |
# @DESCRIPTION: |
169 |
# The src_configure function. For out of source build it creates build |
170 |
# directory and runs econf there. Configuration parameters defined |
171 |
@@ -424,7 +433,7 @@ autotools-utils_src_prepare() { |
172 |
# |
173 |
# IUSE="static-libs" passes --enable-shared and either --disable-static/--enable-static |
174 |
# to econf respectively. |
175 |
-autotools-utils_src_configure() { |
176 |
+autotools-utils_autotools_configure() { |
177 |
debug-print-function ${FUNCNAME} "$@" |
178 |
|
179 |
[[ -z ${myeconfargs+1} || $(declare -p myeconfargs) == 'declare -a'* ]] \ |
180 |
@@ -435,7 +444,6 @@ autotools-utils_src_configure() { |
181 |
# Common args |
182 |
local econfargs=() |
183 |
|
184 |
- _check_build_dir |
185 |
if "${ECONF_SOURCE}"/configure --help 2>&1 | grep -q '^ *--docdir='; then |
186 |
econfargs+=( |
187 |
--docdir="${EPREFIX}"/usr/share/doc/${PF} |
188 |
@@ -453,40 +461,38 @@ autotools-utils_src_configure() { |
189 |
# Append user args |
190 |
econfargs+=("${myeconfargs[@]}") |
191 |
|
192 |
- mkdir -p "${BUILD_DIR}" || die |
193 |
- pushd "${BUILD_DIR}" > /dev/null || die |
194 |
econf "${econfargs[@]}" "$@" |
195 |
- popd > /dev/null || die |
196 |
} |
197 |
|
198 |
-# @FUNCTION: autotools-utils_src_compile |
199 |
+# @FUNCTION: autotools-utils_autotools_compile |
200 |
# @DESCRIPTION: |
201 |
# The autotools src_compile function, invokes emake in specified BUILD_DIR. |
202 |
-autotools-utils_src_compile() { |
203 |
+autotools-utils_autotools_compile() { |
204 |
debug-print-function ${FUNCNAME} "$@" |
205 |
|
206 |
- _check_build_dir |
207 |
- pushd "${BUILD_DIR}" > /dev/null || die |
208 |
emake "$@" || die 'emake failed' |
209 |
- popd > /dev/null || die |
210 |
} |
211 |
|
212 |
-# @FUNCTION: autotools-utils_src_install |
213 |
+# @FUNCTION: autotools-utils_autotools_install |
214 |
+# @DESCRIPTION: |
215 |
+# The build-dir part of src_install function. Runs emake install. |
216 |
+autotools-utils_autotools_install() { |
217 |
+ debug-print-function ${FUNCNAME} "$@" |
218 |
+ |
219 |
+ emake DESTDIR="${D}" "$@" install || die "emake install failed" |
220 |
+} |
221 |
+ |
222 |
+# @FUNCTION: autotools-utils_autotools_install_all |
223 |
# @DESCRIPTION: |
224 |
-# The autotools src_install function. Runs emake install, unconditionally |
225 |
-# removes unnecessary static libs (based on shouldnotlink libtool property) |
226 |
-# and removes unnecessary libtool files when static-libs USE flag is defined |
227 |
+# The common part of autotools src_install function. Removes unnecessary |
228 |
+# static libs (based on shouldnotlink libtool property) and removes |
229 |
+# unnecessary libtool files when static-libs USE flag is defined |
230 |
# and unset. |
231 |
# |
232 |
# DOCS and HTML_DOCS arrays are supported. See base.eclass(5) for reference. |
233 |
-autotools-utils_src_install() { |
234 |
+autotools-utils_autotools_install_all() { |
235 |
debug-print-function ${FUNCNAME} "$@" |
236 |
|
237 |
- _check_build_dir |
238 |
- pushd "${BUILD_DIR}" > /dev/null || die |
239 |
- emake DESTDIR="${D}" "$@" install || die "emake install failed" |
240 |
- popd > /dev/null || die |
241 |
- |
242 |
# Move docs installed by autotools (in EAPI < 4). |
243 |
if [[ ${EAPI} == [23] ]] \ |
244 |
&& path_exists "${D}${EPREFIX}"/usr/share/doc/${PF}/*; then |
245 |
@@ -532,17 +538,88 @@ autotools-utils_src_install() { |
246 |
prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}} |
247 |
} |
248 |
|
249 |
-# @FUNCTION: autotools-utils_src_test |
250 |
+# @FUNCTION: autotools-utils_autotools_test |
251 |
# @DESCRIPTION: |
252 |
# The autotools src_test function. Runs emake check in build directory. |
253 |
-autotools-utils_src_test() { |
254 |
+autotools-utils_autotools_test() { |
255 |
debug-print-function ${FUNCNAME} "$@" |
256 |
|
257 |
- _check_build_dir |
258 |
- pushd "${BUILD_DIR}" > /dev/null || die |
259 |
- |
260 |
# XXX: do we need to support other targets in autotools? |
261 |
emake check "${@}" || die 'emake check failed.' |
262 |
+} |
263 |
+ |
264 |
+# @FUNCTION: _autotools-utils_run_phase |
265 |
+# @USAGE: <sub-phase> [<args>...] |
266 |
+# @INTERNAL |
267 |
+# @DESCRIPTION: |
268 |
+# Run the given ebuild sub-phase or the default implementation. |
269 |
+_autotools-utils_run_phase() { |
270 |
+ local phase=${1} |
271 |
+ |
272 |
+ # it's ok to have wrong value in default impls |
273 |
+ # since they can't use it anyway. |
274 |
+ eval "edefault() { autotools-utils_${phase} \"\${@}\"; }" |
275 |
+ if [[ ${phase} != *_all ]]; then |
276 |
+ _check_build_dir |
277 |
+ pushd "${BUILD_DIR}" > /dev/null || die |
278 |
+ fi |
279 |
+ |
280 |
+ "${@}" |
281 |
+ |
282 |
+ if [[ ${phase} != *_all ]]; then |
283 |
+ popd > /dev/null || die |
284 |
+ fi |
285 |
+ unset -f edefault |
286 |
+} |
287 |
+ |
288 |
+autotools-utils_src_prepare() { |
289 |
+ if declare -f autotools_prepare_all >/dev/null; then |
290 |
+ _autotools-utils_run_phase autotools_prepare_all "${@}" |
291 |
+ else |
292 |
+ _autotools-utils_run_phase \ |
293 |
+ autotools-utils_autotools_prepare_all "${@}" |
294 |
+ fi |
295 |
+} |
296 |
+ |
297 |
+autotools-utils_src_configure() { |
298 |
+ if declare -f autotools_configure >/dev/null; then |
299 |
+ _autotools-utils_run_phase autotools_configure "${@}" |
300 |
+ else |
301 |
+ _autotools-utils_run_phase \ |
302 |
+ autotools-utils_autotools_configure "${@}" |
303 |
+ fi |
304 |
+} |
305 |
+ |
306 |
+autotools-utils_src_compile() { |
307 |
+ if declare -f autotools_compile >/dev/null; then |
308 |
+ _autotools-utils_run_phase autotools_compile "${@}" |
309 |
+ else |
310 |
+ _autotools-utils_run_phase \ |
311 |
+ autotools-utils_autotools_compile "${@}" |
312 |
+ fi |
313 |
+} |
314 |
+ |
315 |
+autotools-utils_src_test() { |
316 |
+ if declare -f autotools_test >/dev/null; then |
317 |
+ _autotools-utils_run_phase autotools_test "${@}" |
318 |
+ else |
319 |
+ _autotools-utils_run_phase \ |
320 |
+ autotools-utils_autotools_test "${@}" |
321 |
+ fi |
322 |
+} |
323 |
|
324 |
- popd > /dev/null || die |
325 |
+autotools-utils_src_install() { |
326 |
+ if declare -f autotools_install >/dev/null; then |
327 |
+ _autotools-utils_run_phase autotools_install "${@}" |
328 |
+ else |
329 |
+ _autotools-utils_run_phase \ |
330 |
+ autotools-utils_autotools_install "${@}" |
331 |
+ fi |
332 |
+ |
333 |
+ if declare -f autotools_install_all >/dev/null; then |
334 |
+ _autotools-utils_run_phase autotools_install_all "${@}" |
335 |
+ else |
336 |
+ _autotools-utils_run_phase \ |
337 |
+ autotools-utils_autotools_install_all "${@}" |
338 |
+ fi |
339 |
} |
340 |
-- |
341 |
1.8.2.1 |