1 |
(Relatively) significant changes: |
2 |
* inherit eutils for < EAPI 7 for eqawarn |
3 |
* rename configure.in -> configure.ac in >= EAPI 8 (to avoid retroactive breakage) |
4 |
* convert phase test to EBUILD_PHASE_FUNC |
5 |
* use gnuconfig.eclass for finding gnuconfig logic for consistency and |
6 |
avoiding duplication |
7 |
* add explicit GNU awk BDEPEND as we use it in the eclass |
8 |
* drop support for < EAPI 5 officially |
9 |
[Needed for the EBUILD_PHASE_FUNC change. |
10 |
< EAPI 5 is no longer in ::gentoo (since December). |
11 |
|
12 |
Note that we were using ${EPREFIX} which isn't defined |
13 |
< EAPI 3 so we were wrong about which EAPIs we supported |
14 |
anyway.] |
15 |
|
16 |
eclassdoc fixes: |
17 |
* explicitly blank and mark variables as @DEFAULT_UNSET |
18 |
* add @DESCRIPTION for _at_uses_pkg |
19 |
* document AUTOTOOLS_DEPEND |
20 |
|
21 |
Cosmetic changes: |
22 |
* minor cosmetic changes to various elogs |
23 |
* fix whitespace/phrasing in comment |
24 |
* convert ewarn to eqawarn |
25 |
* consistent 'case' style |
26 |
* consistent variable references |
27 |
* consistent references to bugs in comments |
28 |
* consistent use of ${ECLASS}, not "autotools.eclass" |
29 |
* use same ${WANT_AUTOCONF} comparison test throughout |
30 |
|
31 |
Bug: https://bugs.gentoo.org/426262 |
32 |
Closes: https://bugs.gentoo.org/584254 |
33 |
Signed-off-by: Sam James <sam@g.o> |
34 |
--- |
35 |
eclass/autotools.eclass | 118 ++++++++++++++++++++++------------------ |
36 |
1 file changed, 65 insertions(+), 53 deletions(-) |
37 |
|
38 |
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass |
39 |
index 3e6906cb469..455fe38f466 100644 |
40 |
--- a/eclass/autotools.eclass |
41 |
+++ b/eclass/autotools.eclass |
42 |
@@ -4,7 +4,7 @@ |
43 |
# @ECLASS: autotools.eclass |
44 |
# @MAINTAINER: |
45 |
# base-system@g.o |
46 |
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 |
47 |
+# @SUPPORTED_EAPIS: 5 6 7 |
48 |
# @BLURB: Regenerates auto* build scripts |
49 |
# @DESCRIPTION: |
50 |
# This eclass is for safely handling autotooled software packages that need to |
51 |
@@ -19,19 +19,23 @@ if [[ ${__AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then |
52 |
# eclass at that point, but that adds overhead, and it's trivial |
53 |
# to re-order inherit in eclasses/ebuilds instead. #409611 |
54 |
if [[ ${__AUTOTOOLS_AUTO_DEPEND} != ${AUTOTOOLS_AUTO_DEPEND} ]] ; then |
55 |
- die "AUTOTOOLS_AUTO_DEPEND changed value between inherits; please inherit autotools.eclass first! ${__AUTOTOOLS_AUTO_DEPEND} -> ${AUTOTOOLS_AUTO_DEPEND}" |
56 |
+ die "AUTOTOOLS_AUTO_DEPEND changed value between inherits; please inherit ${ECLASS} first! ${__AUTOTOOLS_AUTO_DEPEND} -> ${AUTOTOOLS_AUTO_DEPEND}" |
57 |
fi |
58 |
fi |
59 |
|
60 |
-if [[ -z ${_AUTOTOOLS_ECLASS} ]]; then |
61 |
+if [[ -z ${_AUTOTOOLS_ECLASS} ]] ; then |
62 |
_AUTOTOOLS_ECLASS=1 |
63 |
|
64 |
case ${EAPI:-0} in |
65 |
- 0|1|2|3|4|5|6|7) ;; |
66 |
+ 5|6) |
67 |
+ # Needed for eqawarn |
68 |
+ inherit eutils |
69 |
+ ;; |
70 |
+ 7) ;; |
71 |
*) die "${ECLASS}: EAPI ${EAPI} not supported" ;; |
72 |
esac |
73 |
|
74 |
-inherit libtool |
75 |
+inherit gnuconfig libtool |
76 |
|
77 |
# @ECLASS-VARIABLE: WANT_AUTOCONF |
78 |
# @PRE_INHERIT |
79 |
@@ -74,21 +78,14 @@ _LATEST_AUTOMAKE=( 1.16.2-r1:1.16 ) |
80 |
|
81 |
_automake_atom="sys-devel/automake" |
82 |
_autoconf_atom="sys-devel/autoconf" |
83 |
-if [[ -n ${WANT_AUTOMAKE} ]]; then |
84 |
+if [[ -n ${WANT_AUTOMAKE} ]] ; then |
85 |
case ${WANT_AUTOMAKE} in |
86 |
# Even if the package doesn't use automake, we still need to depend |
87 |
# on it because we run aclocal to process m4 macros. This matches |
88 |
# the autoreconf tool, so this requirement is correct, bug #401605. |
89 |
none) ;; |
90 |
- latest) |
91 |
- # Use SLOT deps if we can. For EAPI=0, we get pretty close. |
92 |
- if [[ ${EAPI:-0} != 0 ]] ; then |
93 |
- _automake_atom="|| ( `printf '>=sys-devel/automake-%s:%s ' ${_LATEST_AUTOMAKE[@]/:/ }` )" |
94 |
- else |
95 |
- _automake_atom="|| ( `printf '>=sys-devel/automake-%s ' ${_LATEST_AUTOMAKE[@]/%:*}` )" |
96 |
- fi |
97 |
- ;; |
98 |
- *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;; |
99 |
+ latest) _automake_atom="|| ( `printf '>=sys-devel/automake-%s:%s ' ${_LATEST_AUTOMAKE[@]/:/ }` )" ;; |
100 |
+ *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;; |
101 |
esac |
102 |
export WANT_AUTOMAKE |
103 |
fi |
104 |
@@ -114,9 +111,16 @@ if [[ -n ${WANT_LIBTOOL} ]] ; then |
105 |
export WANT_LIBTOOL |
106 |
fi |
107 |
|
108 |
+# @ECLASS-VARIABLE: AUTOTOOLS_DEPEND |
109 |
+# @INTERNAL |
110 |
+# @DESCRIPTION: |
111 |
+# Contains the combination of requested automake/autoconf/libtool |
112 |
+# versions in *DEPEND format. |
113 |
AUTOTOOLS_DEPEND="${_automake_atom} |
114 |
${_autoconf_atom} |
115 |
- ${_libtool_atom}" |
116 |
+ ${_libtool_atom} |
117 |
+ sys-apps/gawk |
118 |
+" |
119 |
RDEPEND="" |
120 |
|
121 |
# @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND |
122 |
@@ -128,7 +132,7 @@ RDEPEND="" |
123 |
: ${AUTOTOOLS_AUTO_DEPEND:=yes} |
124 |
if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then |
125 |
case ${EAPI:-0} in |
126 |
- 0|1|2|3|4|5|6) DEPEND=${AUTOTOOLS_DEPEND} ;; |
127 |
+ 4|5|6) DEPEND=${AUTOTOOLS_DEPEND} ;; |
128 |
7) BDEPEND=${AUTOTOOLS_DEPEND} ;; |
129 |
esac |
130 |
fi |
131 |
@@ -141,12 +145,14 @@ unset _automake_atom _autoconf_atom |
132 |
# @DESCRIPTION: |
133 |
# Additional options to pass to automake during |
134 |
# eautoreconf call. |
135 |
+: ${AM_OPTS:=} |
136 |
|
137 |
# @ECLASS-VARIABLE: AT_NOEAUTOHEADER |
138 |
# @DEFAULT_UNSET |
139 |
# @DESCRIPTION: |
140 |
# Don't run eautoheader command if set to 'yes'; only used to work around |
141 |
# packages that don't want their headers being modified. |
142 |
+: ${AT_NOEAUTOHEADER:=} |
143 |
|
144 |
# @ECLASS-VARIABLE: AT_NOEAUTOMAKE |
145 |
# @DEFAULT_UNSET |
146 |
@@ -154,6 +160,7 @@ unset _automake_atom _autoconf_atom |
147 |
# Don't run eautomake command if set to 'yes'; only used to workaround |
148 |
# broken packages. Generally you should, instead, fix the package to |
149 |
# not call AM_INIT_AUTOMAKE if it doesn't actually use automake. |
150 |
+: ${AT_NOEAUTOMAKE:=} |
151 |
|
152 |
# @ECLASS-VARIABLE: AT_NOELIBTOOLIZE |
153 |
# @DEFAULT_UNSET |
154 |
@@ -161,6 +168,7 @@ unset _automake_atom _autoconf_atom |
155 |
# Don't run elibtoolize command if set to 'yes', |
156 |
# useful when elibtoolize needs to be ran with |
157 |
# particular options |
158 |
+: ${AT_NOELIBTOOLIZE:=} |
159 |
|
160 |
# @ECLASS-VARIABLE: AT_M4DIR |
161 |
# @DEFAULT_UNSET |
162 |
@@ -245,7 +253,7 @@ eautoreconf() { |
163 |
done |
164 |
${rerun_aclocal} && eaclocal |
165 |
|
166 |
- if [[ ${WANT_AUTOCONF} = 2.1 ]] ; then |
167 |
+ if [[ ${WANT_AUTOCONF} == "2.1" ]] ; then |
168 |
eautoconf |
169 |
else |
170 |
eautoconf --force |
171 |
@@ -265,6 +273,7 @@ eautoreconf() { |
172 |
# @FUNCTION: _at_uses_pkg |
173 |
# @USAGE: <macros> |
174 |
# @INTERNAL |
175 |
+# @DESCRIPTION: |
176 |
# See if the specified macros are enabled. |
177 |
_at_uses_pkg() { |
178 |
if [[ -n $(autotools_check_macro "$@") ]] ; then |
179 |
@@ -337,7 +346,7 @@ eaclocal() { |
180 |
_elibtoolize() { |
181 |
local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)} |
182 |
|
183 |
- if [[ $1 == "--auto-ltdl" ]] ; then |
184 |
+ if [[ ${1} == "--auto-ltdl" ]] ; then |
185 |
shift |
186 |
_at_uses_libltdl && set -- "$@" --ltdl |
187 |
fi |
188 |
@@ -365,23 +374,26 @@ eautoconf() { |
189 |
echo |
190 |
die "No configure.{ac,in} present!" |
191 |
fi |
192 |
+ |
193 |
if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]] ; then |
194 |
- eqawarn "This package has a configure.in file which has long been deprecated. Please" |
195 |
- eqawarn "update it to use configure.ac instead as newer versions of autotools will die" |
196 |
- eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details." |
197 |
+ case ${EAPI:-0} in |
198 |
+ 5|6|7) |
199 |
+ eqawarn "This package has a configure.in file which has long been deprecated. Please" |
200 |
+ eqawarn "update it to use configure.ac instead as newer versions of autotools will die" |
201 |
+ eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details." |
202 |
+ ;; |
203 |
+ *) |
204 |
+ # Move configure file to the new location only on newer EAPIs to ensure |
205 |
+ # checks are done rather than retroactively breaking ebuilds. |
206 |
+ einfo "Moving configure.in to configure.ac (bug #426262)" |
207 |
+ mv configure.{in,ac} || die |
208 |
+ ;; |
209 |
+ esac |
210 |
fi |
211 |
|
212 |
# Install config.guess and config.sub which are required by many macros |
213 |
# in autoconf >=2.70. |
214 |
- local _gnuconfig |
215 |
- case ${EAPI:-0} in |
216 |
- 0|1|2|3|4|5|6) |
217 |
- _gnuconfig="${EPREFIX}/usr/share/gnuconfig" |
218 |
- ;; |
219 |
- *) |
220 |
- _gnuconfig="${BROOT}/usr/share/gnuconfig" |
221 |
- ;; |
222 |
- esac |
223 |
+ local _gnuconfig=$(gnuconfig_findnewest) |
224 |
cp "${_gnuconfig}"/config.{guess,sub} . || die |
225 |
|
226 |
autotools_run_tool --at-m4flags autoconf "$@" |
227 |
@@ -409,7 +421,7 @@ eautomake() { |
228 |
if [[ -z ${makefile_name} ]] ; then |
229 |
_at_uses_automake || return 0 |
230 |
|
231 |
- elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then |
232 |
+ elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]] ; then |
233 |
local used_automake |
234 |
local installed_automake |
235 |
|
236 |
@@ -417,7 +429,7 @@ eautomake() { |
237 |
used_automake=$(head -n 1 < ${makefile_name%.am}.in | \ |
238 |
sed -e 's:.*by automake \(.*\) from .*:\1:') |
239 |
|
240 |
- if [[ ${installed_automake} != ${used_automake} ]]; then |
241 |
+ if [[ ${installed_automake} != ${used_automake} ]] ; then |
242 |
ewarn "Automake used for the package (${used_automake}) differs from" \ |
243 |
"the installed version (${installed_automake})." |
244 |
ewarn "Forcing a full rebuild of the autotools to workaround." |
245 |
@@ -432,8 +444,8 @@ eautomake() { |
246 |
# Older versions of automake do not support --force-missing. But we want |
247 |
# to use this whenever possible to update random bundled files, bug #133489. |
248 |
case $(_automake_version) in |
249 |
- 1.4|1.4[.-]*) ;; |
250 |
- *) extra_opts+=( --force-missing ) ;; |
251 |
+ 1.4|1.4[.-]*) ;; |
252 |
+ *) extra_opts+=( --force-missing ) ;; |
253 |
esac |
254 |
|
255 |
autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@" |
256 |
@@ -456,7 +468,7 @@ config_rpath_update() { |
257 |
local dst src |
258 |
|
259 |
case ${EAPI:-0} in |
260 |
- 0|1|2|3|4|5|6) |
261 |
+ 4|5|6) |
262 |
src="${EPREFIX}/usr/share/gettext/config.rpath" |
263 |
;; |
264 |
*) |
265 |
@@ -481,7 +493,7 @@ config_rpath_update() { |
266 |
autotools_env_setup() { |
267 |
# We do the "latest" → version switch here because it solves |
268 |
# possible order problems, see bug #270010 as an example. |
269 |
- if [[ ${WANT_AUTOMAKE} == "latest" ]]; then |
270 |
+ if [[ ${WANT_AUTOMAKE} == "latest" ]] ; then |
271 |
local pv |
272 |
for pv in ${_LATEST_AUTOMAKE[@]/#*:} ; do |
273 |
# Break on first hit to respect _LATEST_AUTOMAKE order. |
274 |
@@ -511,24 +523,24 @@ autotools_env_setup() { |
275 |
autotools_run_tool() { |
276 |
# Process our own internal flags first |
277 |
local autofail=true m4flags=false missing_ok=false return_output=false |
278 |
- while [[ -n $1 ]] ; do |
279 |
- case $1 in |
280 |
- --at-no-fail) autofail=false;; |
281 |
- --at-m4flags) m4flags=true;; |
282 |
- --at-missing) missing_ok=true;; |
283 |
- --at-output) return_output=true;; |
284 |
- # whatever is left goes to the actual tool |
285 |
- *) break;; |
286 |
+ while [[ -n ${1} ]] ; do |
287 |
+ case ${1} in |
288 |
+ --at-no-fail) autofail=false ;; |
289 |
+ --at-m4flags) m4flags=true ;; |
290 |
+ --at-missing) missing_ok=true ;; |
291 |
+ --at-output) return_output=true ;; |
292 |
+ # whatever is left goes to the actual tool |
293 |
+ *) break ;; |
294 |
esac |
295 |
shift |
296 |
done |
297 |
|
298 |
- if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then |
299 |
- ewarn "QA Warning: running '$1' in ${EBUILD_PHASE} phase" |
300 |
+ if [[ ${EBUILD_PHASE_FUNC} != "src_unpack" && ${EBUILD_PHASE_FUNC} != "src_prepare" ]] ; then |
301 |
+ eqawarn "Running '${1}' in ${EBUILD_PHASE_FUNC} phase" |
302 |
fi |
303 |
|
304 |
if ${missing_ok} && ! type -P ${1} >/dev/null ; then |
305 |
- einfo "Skipping '$*' because '$1' not installed" |
306 |
+ einfo "Skipping '$*' because '${1}' not installed" |
307 |
return 0 |
308 |
fi |
309 |
|
310 |
@@ -557,19 +569,19 @@ autotools_run_tool() { |
311 |
return |
312 |
fi |
313 |
|
314 |
- printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}" |
315 |
+ printf "***** ${1} *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}" |
316 |
|
317 |
- ebegin "Running $@" |
318 |
+ ebegin "Running '$@'" |
319 |
"$@" >> "${STDERR_TARGET}" 2>&1 |
320 |
if ! eend $? && ${autofail} ; then |
321 |
echo |
322 |
- eerror "Failed running '$1'!" |
323 |
+ eerror "Failed running '${1}'!" |
324 |
eerror |
325 |
eerror "Include in your bug report the contents of:" |
326 |
eerror |
327 |
eerror " ${STDERR_TARGET}" |
328 |
echo |
329 |
- die "Failed running '$1'!" |
330 |
+ die "Failed running '${1}'!" |
331 |
fi |
332 |
} |
333 |
|
334 |
@@ -642,7 +654,7 @@ _autotools_m4dir_include() { |
335 |
# We handle it below |
336 |
-${flag}) ;; |
337 |
*) |
338 |
- [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist" |
339 |
+ [[ ! -d ${x} ]] && ewarn "${ECLASS}: '${x}' does not exist" |
340 |
include_opts+=" -${flag} ${x}" |
341 |
;; |
342 |
esac |
343 |
-- |
344 |
2.31.1 |