1 |
commit: 831487b972c24579bc038521111cef314822c08b |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 29 14:37:27 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jun 29 14:37:27 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=831487b9 |
7 |
|
8 |
autotools.eclass: drop, now in ::gentoo |
9 |
|
10 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
11 |
|
12 |
eclass/autotools.eclass | 694 ------------------------------------------------ |
13 |
1 file changed, 694 deletions(-) |
14 |
|
15 |
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass |
16 |
deleted file mode 100644 |
17 |
index fbe7d837f0..0000000000 |
18 |
--- a/eclass/autotools.eclass |
19 |
+++ /dev/null |
20 |
@@ -1,694 +0,0 @@ |
21 |
-# Copyright 1999-2022 Gentoo Authors |
22 |
-# Distributed under the terms of the GNU General Public License v2 |
23 |
- |
24 |
-# @ECLASS: autotools.eclass |
25 |
-# @MAINTAINER: |
26 |
-# base-system@g.o |
27 |
-# @SUPPORTED_EAPIS: 5 6 7 8 |
28 |
-# @BLURB: Regenerates auto* build scripts |
29 |
-# @DESCRIPTION: |
30 |
-# This eclass is for safely handling autotooled software packages that need to |
31 |
-# regenerate their build scripts. All functions will abort in case of errors. |
32 |
- |
33 |
-# Note: We require GNU m4, as does autoconf. So feel free to use any features |
34 |
-# from the GNU version of m4 without worrying about other variants (i.e. BSD). |
35 |
- |
36 |
-if [[ ${_AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then |
37 |
- # See if we were included already, but someone changed the value |
38 |
- # of AUTOTOOLS_AUTO_DEPEND on us. We could reload the entire |
39 |
- # eclass at that point, but that adds overhead, and it's trivial |
40 |
- # to re-order inherit in eclasses/ebuilds instead. #409611 |
41 |
- if [[ ${_AUTOTOOLS_AUTO_DEPEND} != ${AUTOTOOLS_AUTO_DEPEND} ]] ; then |
42 |
- die "AUTOTOOLS_AUTO_DEPEND changed value between inherits; please inherit ${ECLASS} first! ${_AUTOTOOLS_AUTO_DEPEND} -> ${AUTOTOOLS_AUTO_DEPEND}" |
43 |
- fi |
44 |
-fi |
45 |
- |
46 |
-if [[ -z ${_AUTOTOOLS_ECLASS} ]] ; then |
47 |
-_AUTOTOOLS_ECLASS=1 |
48 |
- |
49 |
-case ${EAPI} in |
50 |
- 5|6) |
51 |
- # Needed for eqawarn |
52 |
- inherit eutils |
53 |
- ;; |
54 |
- 7|8) ;; |
55 |
- *) die "${ECLASS}: EAPI ${EAPI} not supported" ;; |
56 |
-esac |
57 |
- |
58 |
-inherit gnuconfig libtool |
59 |
- |
60 |
-# @ECLASS_VARIABLE: WANT_AUTOCONF |
61 |
-# @PRE_INHERIT |
62 |
-# @DESCRIPTION: |
63 |
-# The major version of autoconf your package needs |
64 |
-: ${WANT_AUTOCONF:=latest} |
65 |
- |
66 |
-# @ECLASS_VARIABLE: WANT_AUTOMAKE |
67 |
-# @PRE_INHERIT |
68 |
-# @DESCRIPTION: |
69 |
-# The major version of automake your package needs |
70 |
-: ${WANT_AUTOMAKE:=latest} |
71 |
- |
72 |
-# @ECLASS_VARIABLE: WANT_LIBTOOL |
73 |
-# @PRE_INHERIT |
74 |
-# @DESCRIPTION: |
75 |
-# Do you want libtool? Valid values here are "latest" and "none". |
76 |
-: ${WANT_LIBTOOL:=latest} |
77 |
- |
78 |
-# @ECLASS_VARIABLE: _LATEST_AUTOMAKE |
79 |
-# @INTERNAL |
80 |
-# @DESCRIPTION: |
81 |
-# CONSTANT! |
82 |
-# The latest major unstable and stable version/slot of automake available |
83 |
-# on each arch. |
84 |
-# Only add unstable version if it is in a different slot than latest stable |
85 |
-# version. |
86 |
-# List latest unstable version first to boost testing adoption rate because |
87 |
-# most package manager dependency resolver will pick the first suitable |
88 |
-# version. |
89 |
-# If a newer slot is stable on any arch, and is NOT reflected in this list, |
90 |
-# then circular dependencies may arise during emerge @system bootstraps. |
91 |
-# |
92 |
-# See bug #312315 and bug #465732 for further information and context. |
93 |
-# |
94 |
-# Do NOT change this variable in your ebuilds! |
95 |
-# If you want to force a newer minor version, you can specify the correct |
96 |
-# WANT value by using a colon: <PV>:<WANT_AUTOMAKE> |
97 |
-_LATEST_AUTOMAKE=( 1.16.5:1.16 ) |
98 |
- |
99 |
-_automake_atom="sys-devel/automake" |
100 |
-_autoconf_atom="sys-devel/autoconf" |
101 |
-if [[ -n ${WANT_AUTOMAKE} ]] ; then |
102 |
- case ${WANT_AUTOMAKE} in |
103 |
- # Even if the package doesn't use automake, we still need to depend |
104 |
- # on it because we run aclocal to process m4 macros. This matches |
105 |
- # the autoreconf tool, so this requirement is correct, bug #401605. |
106 |
- none) ;; |
107 |
- latest) _automake_atom="|| ( `printf '>=sys-devel/automake-%s:%s ' ${_LATEST_AUTOMAKE[@]/:/ }` )" ;; |
108 |
- *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*";; |
109 |
- esac |
110 |
- export WANT_AUTOMAKE |
111 |
-fi |
112 |
- |
113 |
-if [[ -n ${WANT_AUTOCONF} ]] ; then |
114 |
- case ${WANT_AUTOCONF} in |
115 |
- none) _autoconf_atom="" ;; # some packages don't require autoconf at all |
116 |
- 2.1) _autoconf_atom="~sys-devel/autoconf-2.13" ;; |
117 |
- # if you change the "latest" version here, change also autotools_env_setup |
118 |
- latest|2.5) _autoconf_atom=">=sys-devel/autoconf-2.71" ;; |
119 |
- *) die "Invalid WANT_AUTOCONF value '${WANT_AUTOCONF}'" ;; |
120 |
- esac |
121 |
- export WANT_AUTOCONF |
122 |
-fi |
123 |
- |
124 |
-_libtool_atom=">=sys-devel/libtool-2.4" |
125 |
-if [[ -n ${WANT_LIBTOOL} ]] ; then |
126 |
- case ${WANT_LIBTOOL} in |
127 |
- none) _libtool_atom="" ;; |
128 |
- latest) ;; |
129 |
- *) die "Invalid WANT_LIBTOOL value '${WANT_LIBTOOL}'" ;; |
130 |
- esac |
131 |
- export WANT_LIBTOOL |
132 |
-fi |
133 |
- |
134 |
-# @ECLASS_VARIABLE: AUTOTOOLS_DEPEND |
135 |
-# @OUTPUT_VARIABLE |
136 |
-# @DESCRIPTION: |
137 |
-# Contains the combination of requested automake/autoconf/libtool |
138 |
-# versions in *DEPEND format. |
139 |
-AUTOTOOLS_DEPEND="${_automake_atom} |
140 |
- ${_autoconf_atom} |
141 |
- ${_libtool_atom}" |
142 |
-RDEPEND="" |
143 |
- |
144 |
-# @ECLASS_VARIABLE: AUTOTOOLS_AUTO_DEPEND |
145 |
-# @PRE_INHERIT |
146 |
-# @DESCRIPTION: |
147 |
-# Set to 'no' to disable automatically adding to DEPEND. This lets |
148 |
-# ebuilds form conditional depends by using ${AUTOTOOLS_DEPEND} in |
149 |
-# their own DEPEND string. |
150 |
-: ${AUTOTOOLS_AUTO_DEPEND:=yes} |
151 |
-if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then |
152 |
- case ${EAPI} in |
153 |
- 5|6) DEPEND=${AUTOTOOLS_DEPEND} ;; |
154 |
- *) BDEPEND=${AUTOTOOLS_DEPEND} ;; |
155 |
- esac |
156 |
-fi |
157 |
-_AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass |
158 |
- |
159 |
-unset _automake_atom _autoconf_atom |
160 |
- |
161 |
-# @ECLASS_VARIABLE: AM_OPTS |
162 |
-# @DEFAULT_UNSET |
163 |
-# @DESCRIPTION: |
164 |
-# Additional options to pass to automake during |
165 |
-# eautoreconf call. |
166 |
-: ${AM_OPTS:=} |
167 |
- |
168 |
-# @ECLASS_VARIABLE: AT_NOEAUTOHEADER |
169 |
-# @DEFAULT_UNSET |
170 |
-# @DESCRIPTION: |
171 |
-# Don't run eautoheader command if set to 'yes'; only used to work around |
172 |
-# packages that don't want their headers being modified. |
173 |
-: ${AT_NOEAUTOHEADER:=} |
174 |
- |
175 |
-# @ECLASS_VARIABLE: AT_NOEAUTOMAKE |
176 |
-# @DEFAULT_UNSET |
177 |
-# @DESCRIPTION: |
178 |
-# Don't run eautomake command if set to 'yes'; only used to workaround |
179 |
-# broken packages. Generally you should, instead, fix the package to |
180 |
-# not call AM_INIT_AUTOMAKE if it doesn't actually use automake. |
181 |
-: ${AT_NOEAUTOMAKE:=} |
182 |
- |
183 |
-# @ECLASS_VARIABLE: AT_NOELIBTOOLIZE |
184 |
-# @DEFAULT_UNSET |
185 |
-# @DESCRIPTION: |
186 |
-# Don't run elibtoolize command if set to 'yes', |
187 |
-# useful when elibtoolize needs to be ran with |
188 |
-# particular options |
189 |
-: ${AT_NOELIBTOOLIZE:=} |
190 |
- |
191 |
-# @ECLASS_VARIABLE: AT_M4DIR |
192 |
-# @DEFAULT_UNSET |
193 |
-# @DESCRIPTION: |
194 |
-# Additional director(y|ies) aclocal should search |
195 |
-: ${AT_M4DIR:=} |
196 |
- |
197 |
-# @ECLASS_VARIABLE: AT_SYS_M4DIR |
198 |
-# @DEFAULT_UNSET |
199 |
-# @INTERNAL |
200 |
-# @DESCRIPTION: |
201 |
-# For system integrators, a list of additional aclocal search paths. |
202 |
-# This variable gets eval-ed, so you can use variables in the definition |
203 |
-# that may not be valid until eautoreconf & friends are run. |
204 |
-: ${AT_SYS_M4DIR:=} |
205 |
- |
206 |
-# @FUNCTION: eautoreconf |
207 |
-# @DESCRIPTION: |
208 |
-# This function mimes the behavior of autoreconf, but uses the different |
209 |
-# eauto* functions to run the tools. It doesn't accept parameters, but |
210 |
-# the directory with include files can be specified with AT_M4DIR variable. |
211 |
-# |
212 |
-# Should do a full autoreconf - normally what most people will be interested in. |
213 |
-# Also should handle additional directories specified by AC_CONFIG_SUBDIRS. |
214 |
-eautoreconf() { |
215 |
- local x g |
216 |
- |
217 |
- # Subdirs often share a common build dir, bug #529404. If so, we can't safely |
218 |
- # run in parallel because many tools clobber the content in there. Libtool |
219 |
- # and automake both `rm && cp` while aclocal reads the output. We might be |
220 |
- # able to handle this if we split the steps and grab locks on the dirs the |
221 |
- # tools actually write to. Then we'd run all the common tools that use |
222 |
- # those inputs. Doing this in bash does not scale easily. |
223 |
- # If we do re-enable parallel support, make sure bug #426512 is handled. |
224 |
- if [[ -z ${AT_NO_RECURSIVE} ]] ; then |
225 |
- # Take care of subdirs |
226 |
- for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS) ; do |
227 |
- if [[ -d ${x} ]] ; then |
228 |
- pushd "${x}" >/dev/null |
229 |
- # Avoid unsafe nested multijob_finish_one for bug #426512. |
230 |
- AT_NOELIBTOOLIZE="yes" eautoreconf || die |
231 |
- popd >/dev/null |
232 |
- fi |
233 |
- done |
234 |
- fi |
235 |
- |
236 |
- einfo "Running eautoreconf in '${PWD}' ..." |
237 |
- |
238 |
- local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR) |
239 |
- [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs} |
240 |
- |
241 |
- # Run all the tools before aclocal so we can gather the .m4 files. |
242 |
- local i tools=( |
243 |
- # <tool> <was run> <command> |
244 |
- glibgettext false "autotools_run_tool glib-gettextize --copy --force" |
245 |
- gettext false "autotools_run_tool --at-missing autopoint --force" |
246 |
- # intltool must come after autopoint. |
247 |
- intltool false "autotools_run_tool intltoolize --automake --copy --force" |
248 |
- gtkdoc false "autotools_run_tool --at-missing gtkdocize --copy" |
249 |
- gnomedoc false "autotools_run_tool --at-missing gnome-doc-prepare --copy --force" |
250 |
- libtool false "_elibtoolize --auto-ltdl --install --copy --force" |
251 |
- ) |
252 |
- for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do |
253 |
- if _at_uses_${tools[i]} ; then |
254 |
- tools[i+1]=true |
255 |
- ${tools[i+2]} |
256 |
- fi |
257 |
- done |
258 |
- |
259 |
- # Generate aclocal.m4 with our up-to-date m4 files. |
260 |
- local rerun_aclocal=false |
261 |
- eaclocal |
262 |
- |
263 |
- # Check to see if we had macros expanded by other macros or in other |
264 |
- # m4 files that we couldn't detect early. This is uncommon, but some |
265 |
- # packages do this, so we have to handle it correctly. |
266 |
- for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do |
267 |
- if ! ${tools[i+1]} && _at_uses_${tools[i]} ; then |
268 |
- ${tools[i+2]} |
269 |
- rerun_aclocal=true |
270 |
- fi |
271 |
- done |
272 |
- ${rerun_aclocal} && eaclocal |
273 |
- |
274 |
- if [[ ${WANT_AUTOCONF} == "2.1" ]] ; then |
275 |
- eautoconf |
276 |
- else |
277 |
- eautoconf --force |
278 |
- fi |
279 |
- [[ ${AT_NOEAUTOHEADER} != "yes" ]] && eautoheader |
280 |
- [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} |
281 |
- |
282 |
- if [[ ${AT_NOELIBTOOLIZE} != "yes" ]] ; then |
283 |
- # Call it here to prevent failures due to elibtoolize called _before_ |
284 |
- # eautoreconf. |
285 |
- elibtoolize --force "${PWD}" |
286 |
- fi |
287 |
- |
288 |
- return 0 |
289 |
-} |
290 |
- |
291 |
-# @FUNCTION: _at_uses_pkg |
292 |
-# @USAGE: <macros> |
293 |
-# @INTERNAL |
294 |
-# @DESCRIPTION: |
295 |
-# See if the specified macros are enabled. |
296 |
-_at_uses_pkg() { |
297 |
- if [[ -n $(autotools_check_macro "$@") ]] ; then |
298 |
- return 0 |
299 |
- else |
300 |
- # If the trace didn't find it (perhaps because aclocal.m4 hasn't |
301 |
- # been generated yet), cheat, but be conservative. |
302 |
- local macro args=() |
303 |
- for macro ; do |
304 |
- args+=( -e "^[[:space:]]*${macro}\>" ) |
305 |
- done |
306 |
- grep -E -q "${args[@]}" configure.?? |
307 |
- fi |
308 |
-} |
309 |
-_at_uses_autoheader() { _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}; } |
310 |
-_at_uses_automake() { _at_uses_pkg AM_INIT_AUTOMAKE; } |
311 |
-_at_uses_gettext() { _at_uses_pkg AM_GNU_GETTEXT_{,REQUIRE_}VERSION; } |
312 |
-_at_uses_glibgettext() { _at_uses_pkg AM_GLIB_GNU_GETTEXT; } |
313 |
-_at_uses_intltool() { _at_uses_pkg {AC,IT}_PROG_INTLTOOL; } |
314 |
-_at_uses_gtkdoc() { _at_uses_pkg GTK_DOC_CHECK; } |
315 |
-_at_uses_gnomedoc() { _at_uses_pkg GNOME_DOC_INIT; } |
316 |
-_at_uses_libtool() { _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT; } |
317 |
-_at_uses_libltdl() { _at_uses_pkg LT_CONFIG_LTDL_DIR; } |
318 |
- |
319 |
-# @FUNCTION: eaclocal_amflags |
320 |
-# @DESCRIPTION: |
321 |
-# Extract the ACLOCAL_AMFLAGS value from the Makefile.am and try to handle |
322 |
-# (most) of the crazy crap that people throw at us. |
323 |
-eaclocal_amflags() { |
324 |
- local aclocal_opts amflags_file |
325 |
- |
326 |
- for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in ; do |
327 |
- [[ -e ${amflags_file} ]] || continue |
328 |
- # setup the env in case the pkg does something crazy |
329 |
- # in their ACLOCAL_AMFLAGS. like run a shell script |
330 |
- # which turns around and runs autotools (bug #365401) |
331 |
- # or split across multiple lines (bug #383525) |
332 |
- autotools_env_setup |
333 |
- aclocal_opts=$(sed -n \ |
334 |
- "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ \ |
335 |
- # match the first line |
336 |
- s:[^=]*=::p; \ |
337 |
- # then gobble up all escaped lines |
338 |
- : nextline /\\\\$/{ n; p; b nextline; } \ |
339 |
- }" ${amflags_file}) |
340 |
- eval aclocal_opts=\""${aclocal_opts}"\" |
341 |
- break |
342 |
- done |
343 |
- |
344 |
- echo ${aclocal_opts} |
345 |
-} |
346 |
- |
347 |
-# @FUNCTION: eaclocal |
348 |
-# @DESCRIPTION: |
349 |
-# These functions runs the autotools using autotools_run_tool with the |
350 |
-# specified parametes. The name of the tool run is the same of the function |
351 |
-# without e prefix. |
352 |
-# They also force installing the support files for safety. |
353 |
-# Respects AT_M4DIR for additional directories to search for macros. |
354 |
-eaclocal() { |
355 |
- # Feed in a list of paths: |
356 |
- # - ${BROOT}/usr/share/aclocal |
357 |
- # - ${ESYSROOT}/usr/share/aclocal |
358 |
- # See bug #677002 |
359 |
- if [[ ${EAPI} != [56] ]] ; then |
360 |
- if [[ ! -f "${T}"/aclocal/dirlist ]] ; then |
361 |
- mkdir "${T}"/aclocal || die |
362 |
- cat <<- EOF > "${T}"/aclocal/dirlist || die |
363 |
- ${BROOT}/usr/share/aclocal |
364 |
- ${ESYSROOT}/usr/share/aclocal |
365 |
- EOF |
366 |
- fi |
367 |
- |
368 |
- local system_acdir=" --system-acdir=${T}/aclocal" |
369 |
- else |
370 |
- local system_acdir="" |
371 |
- fi |
372 |
- |
373 |
- [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
374 |
- autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags) ${system_acdir} |
375 |
-} |
376 |
- |
377 |
-# @FUNCTION: _elibtoolize |
378 |
-# @DESCRIPTION: |
379 |
-# Runs libtoolize. |
380 |
-# |
381 |
-# Note the '_' prefix: avoid collision with elibtoolize() from libtool.eclass. |
382 |
-_elibtoolize() { |
383 |
- local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)} |
384 |
- |
385 |
- if [[ ${1} == "--auto-ltdl" ]] ; then |
386 |
- shift |
387 |
- _at_uses_libltdl && set -- "$@" --ltdl |
388 |
- fi |
389 |
- |
390 |
- [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake |
391 |
- |
392 |
- autotools_run_tool ${LIBTOOLIZE} "$@" |
393 |
-} |
394 |
- |
395 |
-# @FUNCTION: eautoheader |
396 |
-# @DESCRIPTION: |
397 |
-# Runs autoheader. |
398 |
-eautoheader() { |
399 |
- _at_uses_autoheader || return 0 |
400 |
- autotools_run_tool --at-no-fail --at-m4flags autoheader "$@" |
401 |
-} |
402 |
- |
403 |
-# @FUNCTION: eautoconf |
404 |
-# @DESCRIPTION: |
405 |
-# Runs autoconf. |
406 |
-eautoconf() { |
407 |
- if [[ ! -f configure.ac && ! -f configure.in ]] ; then |
408 |
- echo |
409 |
- eerror "No configure.{ac,in} present in '${PWD}'!" |
410 |
- echo |
411 |
- die "No configure.{ac,in} present!" |
412 |
- fi |
413 |
- |
414 |
- |
415 |
- if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]] ; then |
416 |
- case ${EAPI} in |
417 |
- 5|6|7) |
418 |
- eqawarn "This package has a configure.in file which has long been deprecated. Please" |
419 |
- eqawarn "update it to use configure.ac instead as newer versions of autotools will die" |
420 |
- eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details." |
421 |
- ;; |
422 |
- *) |
423 |
- # Move configure file to the new location only on newer EAPIs to ensure |
424 |
- # checks are done rather than retroactively breaking ebuilds. |
425 |
- eqawarn "Moving configure.in to configure.ac (bug #426262)" |
426 |
- mv configure.{in,ac} || die |
427 |
- ;; |
428 |
- esac |
429 |
- fi |
430 |
- |
431 |
- # Install config.guess and config.sub which are required by many macros |
432 |
- # in autoconf >=2.70. |
433 |
- local _gnuconfig=$(gnuconfig_findnewest) |
434 |
- cp "${_gnuconfig}"/config.{guess,sub} . || die |
435 |
- |
436 |
- autotools_run_tool --at-m4flags autoconf "$@" |
437 |
-} |
438 |
- |
439 |
-# @FUNCTION: eautomake |
440 |
-# @DESCRIPTION: |
441 |
-# Runs automake. |
442 |
-eautomake() { |
443 |
- local extra_opts=() |
444 |
- local makefile_name |
445 |
- |
446 |
- # Run automake if: |
447 |
- # - a Makefile.am type file exists |
448 |
- # - the configure script is using the AM_INIT_AUTOMAKE directive |
449 |
- for makefile_name in {GNUmakefile,{M,m}akefile}.am "" ; do |
450 |
- [[ -f ${makefile_name} ]] && break |
451 |
- done |
452 |
- |
453 |
- _automake_version() { |
454 |
- autotools_run_tool --at-output automake --version 2>/dev/null | |
455 |
- sed -n -e '1{s:.*(GNU automake) ::p;q}' |
456 |
- } |
457 |
- |
458 |
- if [[ -z ${makefile_name} ]] ; then |
459 |
- _at_uses_automake || return 0 |
460 |
- |
461 |
- elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]] ; then |
462 |
- local used_automake |
463 |
- local installed_automake |
464 |
- |
465 |
- installed_automake=$(WANT_AUTOMAKE= _automake_version) |
466 |
- used_automake=$(head -n 1 < ${makefile_name%.am}.in | \ |
467 |
- sed -e 's:.*by automake \(.*\) from .*:\1:') |
468 |
- |
469 |
- if [[ ${installed_automake} != ${used_automake} ]] ; then |
470 |
- ewarn "Automake used for the package (${used_automake}) differs from" \ |
471 |
- "the installed version (${installed_automake})." |
472 |
- ewarn "Forcing a full rebuild of the autotools to workaround." |
473 |
- eautoreconf |
474 |
- return 0 |
475 |
- fi |
476 |
- fi |
477 |
- |
478 |
- [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] \ |
479 |
- || extra_opts+=( --foreign ) |
480 |
- |
481 |
- # Older versions of automake do not support --force-missing. But we want |
482 |
- # to use this whenever possible to update random bundled files, bug #133489. |
483 |
- case $(_automake_version) in |
484 |
- 1.4|1.4[.-]*) ;; |
485 |
- *) extra_opts+=( --force-missing ) ;; |
486 |
- esac |
487 |
- |
488 |
- autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@" |
489 |
-} |
490 |
- |
491 |
-# @FUNCTION: eautopoint |
492 |
-# @DESCRIPTION: |
493 |
-# Runs autopoint (from the gettext package). |
494 |
-eautopoint() { |
495 |
- autotools_run_tool autopoint "$@" |
496 |
-} |
497 |
- |
498 |
-# @FUNCTION: config_rpath_update |
499 |
-# @USAGE: [destination] |
500 |
-# @DESCRIPTION: |
501 |
-# Some packages utilize the config.rpath helper script, but don't |
502 |
-# use gettext directly. So we have to copy it in manually since |
503 |
-# we can't let `autopoint` do it for us. |
504 |
-config_rpath_update() { |
505 |
- local dst src |
506 |
- |
507 |
- case ${EAPI} in |
508 |
- 5|6) |
509 |
- src="${EPREFIX}/usr/share/gettext/config.rpath" |
510 |
- ;; |
511 |
- *) |
512 |
- src="${BROOT}/usr/share/gettext/config.rpath" |
513 |
- ;; |
514 |
- esac |
515 |
- |
516 |
- [[ $# -eq 0 ]] && set -- $(find -name config.rpath) |
517 |
- [[ $# -eq 0 ]] && return 0 |
518 |
- |
519 |
- einfo "Updating all config.rpath files" |
520 |
- for dst in "$@" ; do |
521 |
- einfo " ${dst}" |
522 |
- cp "${src}" "${dst}" || die |
523 |
- done |
524 |
-} |
525 |
- |
526 |
-# @FUNCTION: autotools_env_setup |
527 |
-# @INTERNAL |
528 |
-# @DESCRIPTION: |
529 |
-# Process the WANT_AUTO{CONF,MAKE} flags. |
530 |
-autotools_env_setup() { |
531 |
- # We do the "latest" → version switch here because it solves |
532 |
- # possible order problems, see bug #270010 as an example. |
533 |
- # During bootstrap in prefix there might be no automake merged yet |
534 |
- # due to --nodeps, but still available somewhere in PATH. |
535 |
- # For example, ncurses needs local libtool on aix and hpux. |
536 |
- if [[ ${WANT_AUTOMAKE} == "latest" ]] && |
537 |
- ROOT=/ has_version "sys-devel/automake"; then |
538 |
- local pv |
539 |
- for pv in ${_LATEST_AUTOMAKE[@]/#*:} ; do |
540 |
- # Break on first hit to respect _LATEST_AUTOMAKE order. |
541 |
- local hv_args="" |
542 |
- case ${EAPI} in |
543 |
- 5|6) |
544 |
- hv_args="--host-root" |
545 |
- ;; |
546 |
- *) |
547 |
- hv_args="-b" |
548 |
- ;; |
549 |
- esac |
550 |
- has_version ${hv_args} "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}" && break |
551 |
- done |
552 |
- [[ ${WANT_AUTOMAKE} == "latest" ]] && \ |
553 |
- die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}" |
554 |
- fi |
555 |
- [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.71 |
556 |
-} |
557 |
- |
558 |
-# @FUNCTION: autotools_run_tool |
559 |
-# @USAGE: [--at-no-fail] [--at-m4flags] [--at-missing] [--at-output] <autotool> [tool-specific flags] |
560 |
-# @INTERNAL |
561 |
-# @DESCRIPTION: |
562 |
-# Run the specified autotool helper, but do logging and error checking |
563 |
-# around it in the process. |
564 |
-autotools_run_tool() { |
565 |
- # Process our own internal flags first |
566 |
- local autofail=true m4flags=false missing_ok=false return_output=false |
567 |
- while [[ -n ${1} ]] ; do |
568 |
- case ${1} in |
569 |
- --at-no-fail) autofail=false ;; |
570 |
- --at-m4flags) m4flags=true ;; |
571 |
- --at-missing) missing_ok=true ;; |
572 |
- --at-output) return_output=true ;; |
573 |
- # whatever is left goes to the actual tool |
574 |
- *) break ;; |
575 |
- esac |
576 |
- shift |
577 |
- done |
578 |
- |
579 |
- if [[ ${EBUILD_PHASE_FUNC} != "src_unpack" && ${EBUILD_PHASE_FUNC} != "src_prepare" ]] ; then |
580 |
- eqawarn "Running '${1}' in ${EBUILD_PHASE_FUNC} phase" |
581 |
- fi |
582 |
- |
583 |
- if ${missing_ok} && ! type -P ${1} >/dev/null ; then |
584 |
- einfo "Skipping '$*' because '${1}' not installed" |
585 |
- return 0 |
586 |
- fi |
587 |
- |
588 |
- autotools_env_setup |
589 |
- |
590 |
- # Allow people to pass in full paths, bug #549268 |
591 |
- local STDERR_TARGET="${T}/${1##*/}.out" |
592 |
- # most of the time, there will only be one run, but if there are |
593 |
- # more, make sure we get unique log filenames |
594 |
- if [[ -e ${STDERR_TARGET} ]] ; then |
595 |
- local i=1 |
596 |
- while :; do |
597 |
- STDERR_TARGET="${T}/${1##*/}-${i}.out" |
598 |
- [[ -e ${STDERR_TARGET} ]] || break |
599 |
- : $(( i++ )) |
600 |
- done |
601 |
- fi |
602 |
- |
603 |
- if ${m4flags} ; then |
604 |
- set -- "${1}" $(autotools_m4dir_include) $(autotools_m4sysdir_include) "${@:2}" |
605 |
- fi |
606 |
- |
607 |
- # If the caller wants to probe something, then let them do it directly. |
608 |
- if ${return_output} ; then |
609 |
- "$@" |
610 |
- return |
611 |
- fi |
612 |
- |
613 |
- printf "***** ${1} *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}" |
614 |
- |
615 |
- ebegin "Running '$@'" |
616 |
- "$@" >> "${STDERR_TARGET}" 2>&1 |
617 |
- if ! eend $? && ${autofail} ; then |
618 |
- echo |
619 |
- eerror "Failed running '${1}'!" |
620 |
- eerror |
621 |
- eerror "Include in your bug report the contents of:" |
622 |
- eerror |
623 |
- eerror " ${STDERR_TARGET}" |
624 |
- echo |
625 |
- die "Failed running '${1}'!" |
626 |
- fi |
627 |
-} |
628 |
- |
629 |
-# Internal function to check for support |
630 |
- |
631 |
-# Keep a list of all the macros we might use so that we only |
632 |
-# have to run the trace code once. Order doesn't matter. |
633 |
-ALL_AUTOTOOLS_MACROS=( |
634 |
- A{C,M}_PROG_LIBTOOL LT_INIT LT_CONFIG_LTDL_DIR |
635 |
- A{C,M}_CONFIG_HEADER{S,} |
636 |
- AC_CONFIG_SUBDIRS |
637 |
- AC_CONFIG_AUX_DIR AC_CONFIG_MACRO_DIR |
638 |
- AM_INIT_AUTOMAKE |
639 |
- AM_GLIB_GNU_GETTEXT |
640 |
- AM_GNU_GETTEXT_{,REQUIRE_}VERSION |
641 |
- {AC,IT}_PROG_INTLTOOL |
642 |
- GTK_DOC_CHECK |
643 |
- GNOME_DOC_INIT |
644 |
-) |
645 |
-autotools_check_macro() { |
646 |
- [[ -f configure.ac || -f configure.in ]] || return 0 |
647 |
- |
648 |
- # We can run in multiple dirs, so we have to cache the trace |
649 |
- # data in $PWD rather than an env var. |
650 |
- local trace_file=".__autoconf_trace_data" |
651 |
- if [[ ! -e ${trace_file} ]] || [[ ! aclocal.m4 -ot ${trace_file} ]] ; then |
652 |
- WANT_AUTOCONF="2.5" autoconf \ |
653 |
- $(autotools_m4dir_include) \ |
654 |
- ${ALL_AUTOTOOLS_MACROS[@]/#/--trace=} > ${trace_file} 2>/dev/null |
655 |
- fi |
656 |
- |
657 |
- local macro args=() |
658 |
- for macro ; do |
659 |
- has ${macro} ${ALL_AUTOTOOLS_MACROS[@]} || die "internal error: add ${macro} to ALL_AUTOTOOLS_MACROS" |
660 |
- args+=( -e ":${macro}:" ) |
661 |
- done |
662 |
- grep "${args[@]}" ${trace_file} |
663 |
-} |
664 |
- |
665 |
-# @FUNCTION: autotools_check_macro_val |
666 |
-# @USAGE: <macro> [macros] |
667 |
-# @INTERNAL |
668 |
-# @DESCRIPTION: |
669 |
-# Look for a macro and extract its value. |
670 |
-autotools_check_macro_val() { |
671 |
- local macro scan_out |
672 |
- |
673 |
- for macro ; do |
674 |
- autotools_check_macro "${macro}" | \ |
675 |
- gawk -v macro="${macro}" \ |
676 |
- '($0 !~ /^[[:space:]]*(#|dnl)/) { |
677 |
- if (match($0, macro ":(.*)$", res)) |
678 |
- print res[1] |
679 |
- }' | uniq |
680 |
- done |
681 |
- |
682 |
- return 0 |
683 |
-} |
684 |
- |
685 |
-_autotools_m4dir_include() { |
686 |
- local x include_opts flag |
687 |
- |
688 |
- # Use the right flag to autoconf based on the version #448986 |
689 |
- [[ ${WANT_AUTOCONF} == "2.1" ]] \ |
690 |
- && flag="l" \ |
691 |
- || flag="I" |
692 |
- |
693 |
- for x in "$@" ; do |
694 |
- case ${x} in |
695 |
- # We handle it below |
696 |
- -${flag}) ;; |
697 |
- *) |
698 |
- [[ ! -d ${x} ]] && ewarn "${ECLASS}: '${x}' does not exist" |
699 |
- include_opts+=" -${flag} ${x}" |
700 |
- ;; |
701 |
- esac |
702 |
- done |
703 |
- |
704 |
- echo ${include_opts} |
705 |
-} |
706 |
-autotools_m4dir_include() { _autotools_m4dir_include ${AT_M4DIR} ; } |
707 |
-autotools_m4sysdir_include() { |
708 |
- # First try to use the paths the system integrator has set up. |
709 |
- local paths=( $(eval echo ${AT_SYS_M4DIR}) ) |
710 |
- |
711 |
- _autotools_m4dir_include "${paths[@]}" |
712 |
-} |
713 |
- |
714 |
-fi |