| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2011 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.66 2007/05/30 15:45:01 cardoe Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.111 2011/12/13 21:27:38 vapier Exp $ |
| 4 | # |
4 | |
|
|
5 | # @ECLASS: autotools.eclass |
|
|
6 | # @MAINTAINER: |
| 5 | # Maintainer: base-system@gentoo.org |
7 | # base-system@gentoo.org |
| 6 | # |
8 | # @BLURB: Regenerates auto* build scripts |
|
|
9 | # @DESCRIPTION: |
| 7 | # This eclass is for handling autotooled software packages that |
10 | # This eclass is for safely handling autotooled software packages that need to |
| 8 | # needs to regenerate their build scripts. |
11 | # regenerate their build scripts. All functions will abort in case of errors. |
| 9 | # |
12 | |
| 10 | # NB: If you add anything, please comment it! |
13 | if [[ ${___ECLASS_ONCE_AUTOTOOLS} != "recur -_+^+_- spank" ]] ; then |
|
|
14 | ___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank" |
| 11 | |
15 | |
| 12 | inherit eutils libtool |
16 | inherit eutils libtool |
| 13 | |
17 | |
| 14 | [[ -z ${WANT_AUTOCONF} ]] && WANT_AUTOCONF="latest" |
18 | # @ECLASS-VARIABLE: WANT_AUTOCONF |
| 15 | [[ -z ${WANT_AUTOMAKE} ]] && WANT_AUTOMAKE="latest" |
19 | # @DESCRIPTION: |
|
|
20 | # The major version of autoconf your package needs |
|
|
21 | : ${WANT_AUTOCONF:=latest} |
|
|
22 | |
|
|
23 | # @ECLASS-VARIABLE: WANT_AUTOMAKE |
|
|
24 | # @DESCRIPTION: |
|
|
25 | # The major version of automake your package needs |
|
|
26 | : ${WANT_AUTOMAKE:=latest} |
|
|
27 | |
|
|
28 | # @ECLASS-VARIABLE: WANT_LIBTOOL |
|
|
29 | # @DESCRIPTION: |
|
|
30 | # Do you want libtool? Valid values here are "latest" and "none". |
|
|
31 | : ${WANT_LIBTOOL:=latest} |
|
|
32 | |
|
|
33 | # @ECLASS-VARIABLE: _LATEST_AUTOMAKE |
|
|
34 | # @INTERNAL |
|
|
35 | # @DESCRIPTION: |
|
|
36 | # CONSTANT! |
|
|
37 | # The latest major version/slot of automake available on each arch. |
|
|
38 | # If a newer version is stable on any arch, and is NOT reflected in this list, |
|
|
39 | # then circular dependencies may arise during emerge @system bootstraps. |
|
|
40 | # Do NOT change this variable in your ebuilds! |
|
|
41 | _LATEST_AUTOMAKE='1.11' |
| 16 | |
42 | |
| 17 | _automake_atom="sys-devel/automake" |
43 | _automake_atom="sys-devel/automake" |
| 18 | _autoconf_atom="sys-devel/autoconf" |
44 | _autoconf_atom="sys-devel/autoconf" |
| 19 | if [[ -n ${WANT_AUTOMAKE} ]]; then |
45 | if [[ -n ${WANT_AUTOMAKE} ]]; then |
| 20 | case ${WANT_AUTOMAKE} in |
46 | case ${WANT_AUTOMAKE} in |
| 21 | # workaround while we have different versions of automake in arch and ~arch |
|
|
| 22 | none) _automake_atom="" ;; # some packages don't require automake at all |
47 | none) _automake_atom="" ;; # some packages don't require automake at all |
| 23 | latest) _automake_atom="=sys-devel/automake-1.10*" ;; |
48 | # if you change the "latest" version here, change also autotools_run_tool |
|
|
49 | # this MUST reflect the latest stable major version for each arch! |
|
|
50 | latest) _automake_atom="|| ( `printf '=sys-devel/automake-%s* ' ${_LATEST_AUTOMAKE}` )" ;; |
| 24 | *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;; |
51 | *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;; |
| 25 | esac |
52 | esac |
| 26 | [[ ${WANT_AUTOMAKE} == "latest" ]] && WANT_AUTOMAKE="1.10" |
|
|
| 27 | export WANT_AUTOMAKE |
53 | export WANT_AUTOMAKE |
| 28 | fi |
54 | fi |
| 29 | |
55 | |
| 30 | if [[ -n ${WANT_AUTOCONF} ]] ; then |
56 | if [[ -n ${WANT_AUTOCONF} ]] ; then |
| 31 | case ${WANT_AUTOCONF} in |
57 | case ${WANT_AUTOCONF} in |
|
|
58 | none) _autoconf_atom="" ;; # some packages don't require autoconf at all |
| 32 | 2.1) _autoconf_atom="=sys-devel/autoconf-${WANT_AUTOCONF}*" ;; |
59 | 2.1) _autoconf_atom="=sys-devel/autoconf-${WANT_AUTOCONF}*" ;; |
|
|
60 | # if you change the “latest” version here, change also autotools_run_tool |
| 33 | latest | 2.5) _autoconf_atom=">=sys-devel/autoconf-2.59" ;; |
61 | latest|2.5) _autoconf_atom=">=sys-devel/autoconf-2.61" ;; |
|
|
62 | *) die "Invalid WANT_AUTOCONF value '${WANT_AUTOCONF}'" ;; |
| 34 | esac |
63 | esac |
| 35 | [[ ${WANT_AUTOCONF} == "latest" ]] && WANT_AUTOCONF="2.5" |
|
|
| 36 | export WANT_AUTOCONF |
64 | export WANT_AUTOCONF |
| 37 | fi |
65 | fi |
| 38 | DEPEND="${_automake_atom} |
66 | |
| 39 | ${_autoconf_atom} |
67 | _libtool_atom="sys-devel/libtool" |
| 40 | sys-devel/libtool" |
68 | if [[ -n ${WANT_LIBTOOL} ]] ; then |
|
|
69 | case ${WANT_LIBTOOL} in |
|
|
70 | none) _libtool_atom="" ;; |
|
|
71 | latest) ;; |
|
|
72 | *) die "Invalid WANT_LIBTOOL value '${WANT_LIBTOOL}'" ;; |
|
|
73 | esac |
|
|
74 | export WANT_LIBTOOL |
|
|
75 | fi |
|
|
76 | |
|
|
77 | AUTOTOOLS_DEPEND="${_automake_atom} ${_autoconf_atom} ${_libtool_atom}" |
| 41 | RDEPEND="" |
78 | RDEPEND="" |
|
|
79 | |
|
|
80 | # @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND |
|
|
81 | # @DESCRIPTION: |
|
|
82 | # Set to 'no' to disable automatically adding to DEPEND. This lets |
|
|
83 | # ebuilds former conditional depends by using ${AUTOTOOLS_DEPEND} in |
|
|
84 | # their own DEPEND string. |
|
|
85 | : ${AUTOTOOLS_AUTO_DEPEND:=yes} |
|
|
86 | if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then |
|
|
87 | DEPEND=${AUTOTOOLS_DEPEND} |
|
|
88 | fi |
|
|
89 | |
| 42 | unset _automake_atom _autoconf_atom |
90 | unset _automake_atom _autoconf_atom |
| 43 | |
91 | |
| 44 | # Variables: |
92 | # @ECLASS-VARIABLE: AM_OPTS |
| 45 | # |
93 | # @DEFAULT_UNSET |
| 46 | # AT_M4DIR - Additional director(y|ies) aclocal should search |
94 | # @DESCRIPTION: |
| 47 | # AM_OPTS - Additional options to pass to automake during |
95 | # Additional options to pass to automake during |
| 48 | # eautoreconf call. |
96 | # eautoreconf call. |
|
|
97 | |
|
|
98 | # @ECLASS-VARIABLE: AT_NOELIBTOOLIZE |
|
|
99 | # @DEFAULT_UNSET |
|
|
100 | # @DESCRIPTION: |
| 49 | # AT_NOELIBTOOLIZE - Don't run elibtoolize command if set to 'yes', |
101 | # Don't run elibtoolize command if set to 'yes', |
| 50 | # useful when elibtoolize needs to be ran with |
102 | # useful when elibtoolize needs to be ran with |
| 51 | # particular options |
103 | # particular options |
| 52 | |
|
|
| 53 | # Functions: |
|
|
| 54 | # |
|
|
| 55 | # eautoreconf() - Should do a full autoreconf - normally what most people |
|
|
| 56 | # will be interested in. Also should handle additional |
|
|
| 57 | # directories specified by AC_CONFIG_SUBDIRS. |
|
|
| 58 | # eaclocal() - Runs aclocal. Respects AT_M4DIR for additional directories |
|
|
| 59 | # to search for macro's. |
|
|
| 60 | # _elibtoolize() - Runs libtoolize. Note the '_' prefix .. to not collide |
|
|
| 61 | # with elibtoolize() from libtool.eclass |
|
|
| 62 | # eautoconf - Runs autoconf. |
|
|
| 63 | # eautoheader - Runs autoheader. |
|
|
| 64 | # eautomake - Runs automake |
|
|
| 65 | # |
|
|
| 66 | |
104 | |
| 67 | # XXX: M4DIR should be deprecated |
105 | # XXX: M4DIR should be deprecated |
|
|
106 | # @ECLASS-VARIABLE: AT_M4DIR |
|
|
107 | # @DESCRIPTION: |
|
|
108 | # Additional director(y|ies) aclocal should search |
| 68 | AT_M4DIR=${AT_M4DIR:-${M4DIR}} |
109 | : ${AT_M4DIR:=${M4DIR}} |
| 69 | AT_GNUCONF_UPDATE="no" |
|
|
| 70 | |
110 | |
| 71 | |
111 | # @FUNCTION: eautoreconf |
|
|
112 | # @DESCRIPTION: |
| 72 | # This function mimes the behavior of autoreconf, but uses the different |
113 | # This function mimes the behavior of autoreconf, but uses the different |
| 73 | # eauto* functions to run the tools. It doesn't accept parameters, but |
114 | # eauto* functions to run the tools. It doesn't accept parameters, but |
| 74 | # the directory with include files can be specified with AT_M4DIR variable. |
115 | # the directory with include files can be specified with AT_M4DIR variable. |
|
|
116 | # |
|
|
117 | # Should do a full autoreconf - normally what most people will be interested in. |
|
|
118 | # Also should handle additional directories specified by AC_CONFIG_SUBDIRS. |
| 75 | eautoreconf() { |
119 | eautoreconf() { |
| 76 | local pwd=$(pwd) x auxdir |
120 | local x auxdir g |
| 77 | |
121 | |
| 78 | if [[ -z ${AT_NO_RECURSIVE} ]]; then |
122 | if [[ -z ${AT_NO_RECURSIVE} ]]; then |
| 79 | # Take care of subdirs |
123 | # Take care of subdirs |
| 80 | for x in $(autotools_get_subdirs); do |
124 | for x in $(autotools_get_subdirs); do |
| 81 | if [[ -d ${x} ]] ; then |
125 | if [[ -d ${x} ]] ; then |
| 82 | cd "${x}" |
126 | pushd "${x}" >/dev/null |
| 83 | AT_NOELIBTOOLIZE="yes" eautoreconf |
127 | AT_NOELIBTOOLIZE="yes" eautoreconf |
| 84 | cd "${pwd}" |
128 | popd >/dev/null |
| 85 | fi |
129 | fi |
| 86 | done |
130 | done |
| 87 | fi |
131 | fi |
| 88 | |
132 | |
| 89 | auxdir=$(autotools_get_auxdir) |
133 | auxdir=$(autotools_get_auxdir) |
| 90 | |
134 | |
| 91 | einfo "Running eautoreconf in '$(pwd)' ..." |
135 | einfo "Running eautoreconf in '${PWD}' ..." |
| 92 | [[ -n ${auxdir} ]] && mkdir -p ${auxdir} |
136 | [[ -n ${auxdir} ]] && mkdir -p ${auxdir} |
| 93 | eaclocal |
137 | eaclocal |
|
|
138 | [[ ${CHOST} == *-darwin* ]] && g=g |
|
|
139 | if ${LIBTOOLIZE:-${g}libtoolize} -n --install >& /dev/null ; then |
|
|
140 | _elibtoolize --copy --force --install |
|
|
141 | else |
| 94 | _elibtoolize --copy --force |
142 | _elibtoolize --copy --force |
|
|
143 | fi |
| 95 | eautoconf |
144 | eautoconf |
| 96 | eautoheader |
145 | eautoheader |
| 97 | FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} |
146 | FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} |
| 98 | |
147 | |
| 99 | [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0 |
148 | [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0 |
| 100 | |
149 | |
| 101 | # Call it here to prevent failures due to elibtoolize called _before_ |
150 | # Call it here to prevent failures due to elibtoolize called _before_ |
| 102 | # eautoreconf. |
151 | # eautoreconf. We set $S because elibtoolize runs on that #265319 |
| 103 | elibtoolize |
152 | S=${PWD} elibtoolize --force |
| 104 | |
153 | |
| 105 | return 0 |
154 | return 0 |
| 106 | } |
155 | } |
| 107 | |
156 | |
|
|
157 | # @FUNCTION: eaclocal_amflags |
|
|
158 | # @DESCRIPTION: |
|
|
159 | # Extract the ACLOCAL_AMFLAGS value from the Makefile.am and try to handle |
|
|
160 | # (most) of the crazy crap that people throw at us. |
|
|
161 | eaclocal_amflags() { |
|
|
162 | local aclocal_opts amflags_file |
|
|
163 | |
|
|
164 | for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in ; do |
|
|
165 | [[ -e ${amflags_file} ]] || continue |
|
|
166 | # setup the env in case the pkg does something crazy |
|
|
167 | # in their ACLOCAL_AMFLAGS. like run a shell script |
|
|
168 | # which turns around and runs autotools. #365401 |
|
|
169 | # or split across multiple lines. #383525 |
|
|
170 | autotools_env_setup |
|
|
171 | aclocal_opts=$(sed -n \ |
|
|
172 | "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ \ |
|
|
173 | # match the first line |
|
|
174 | s:[^=]*=::p; \ |
|
|
175 | # then gobble up all escaped lines |
|
|
176 | : nextline /\\\\$/{ n; p; b nextline; } \ |
|
|
177 | }" ${amflags_file}) |
|
|
178 | eval aclocal_opts=\""${aclocal_opts}"\" |
|
|
179 | break |
|
|
180 | done |
|
|
181 | |
|
|
182 | echo ${aclocal_opts} |
|
|
183 | } |
|
|
184 | |
|
|
185 | # @FUNCTION: eaclocal |
|
|
186 | # @DESCRIPTION: |
| 108 | # These functions runs the autotools using autotools_run_tool with the |
187 | # These functions runs the autotools using autotools_run_tool with the |
| 109 | # specified parametes. The name of the tool run is the same of the function |
188 | # specified parametes. The name of the tool run is the same of the function |
| 110 | # without e prefix. |
189 | # without e prefix. |
| 111 | # They also force installing the support files for safety. |
190 | # They also force installing the support files for safety. |
|
|
191 | # Respects AT_M4DIR for additional directories to search for macro's. |
| 112 | eaclocal() { |
192 | eaclocal() { |
| 113 | local aclocal_opts |
|
|
| 114 | |
|
|
| 115 | if [[ -n ${AT_M4DIR} ]] ; then |
|
|
| 116 | for x in ${AT_M4DIR} ; do |
|
|
| 117 | case "${x}" in |
|
|
| 118 | "-I") |
|
|
| 119 | # We handle it below |
|
|
| 120 | ;; |
|
|
| 121 | *) |
|
|
| 122 | [[ ! -d ${x} ]] && ewarn "eaclocal: '${x}' does not exist" |
|
|
| 123 | aclocal_opts="${aclocal_opts} -I ${x}" |
|
|
| 124 | ;; |
|
|
| 125 | esac |
|
|
| 126 | done |
|
|
| 127 | fi |
|
|
| 128 | |
|
|
| 129 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
193 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
| 130 | autotools_run_tool aclocal "$@" ${aclocal_opts} |
194 | autotools_run_tool aclocal $(autotools_m4dir_include) "$@" $(eaclocal_amflags) |
| 131 | } |
195 | } |
| 132 | |
196 | |
|
|
197 | # @FUNCTION: _elibtoolize |
|
|
198 | # @DESCRIPTION: |
|
|
199 | # Runs libtoolize. Note the '_' prefix .. to not collide with elibtoolize() from |
|
|
200 | # libtool.eclass. |
| 133 | _elibtoolize() { |
201 | _elibtoolize() { |
| 134 | local opts |
202 | local opts g= |
| 135 | local lttest |
|
|
| 136 | |
203 | |
| 137 | # Check if we should run libtoolize (AM_PROG_LIBTOOL is an older macro, |
204 | # Check if we should run libtoolize (AM_PROG_LIBTOOL is an older macro, |
| 138 | # check for both it and the current AC_PROG_LIBTOOL) |
205 | # check for both it and the current AC_PROG_LIBTOOL) |
| 139 | lttest="$(autotools_check_macro "AC_PROG_LIBTOOL")$(autotools_check_macro "AM_PROG_LIBTOOL")" |
206 | [[ -n $(autotools_check_macro AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT) ]] || return 0 |
| 140 | [[ -n $lttest ]] || return 0 |
|
|
| 141 | |
207 | |
| 142 | [[ -f Makefile.am ]] && opts="--automake" |
208 | [[ -f GNUmakefile.am || -f Makefile.am ]] && opts="--automake" |
| 143 | |
209 | |
| 144 | [[ "${USERLAND}" == "Darwin" ]] && LIBTOOLIZE="glibtoolize" |
210 | [[ ${CHOST} == *-darwin* ]] && g=g |
| 145 | autotools_run_tool ${LIBTOOLIZE:-libtoolize} "$@" ${opts} |
211 | autotools_run_tool ${LIBTOOLIZE:-${g}libtoolize} "$@" ${opts} |
| 146 | |
212 | |
| 147 | # Need to rerun aclocal |
213 | # Need to rerun aclocal |
| 148 | eaclocal |
214 | eaclocal |
| 149 | } |
215 | } |
| 150 | |
216 | |
|
|
217 | # @FUNCTION: eautoheader |
|
|
218 | # @DESCRIPTION: |
|
|
219 | # Runs autoheader. |
| 151 | eautoheader() { |
220 | eautoheader() { |
| 152 | # Check if we should run autoheader |
221 | # Check if we should run autoheader |
| 153 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
222 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
| 154 | NO_FAIL=1 autotools_run_tool autoheader "$@" |
223 | NO_FAIL=1 autotools_run_tool autoheader $(autotools_m4dir_include) "$@" |
| 155 | } |
224 | } |
| 156 | |
225 | |
|
|
226 | # @FUNCTION: eautoconf |
|
|
227 | # @DESCRIPTION: |
|
|
228 | # Runs autoconf. |
| 157 | eautoconf() { |
229 | eautoconf() { |
| 158 | if [[ ! -f configure.ac && ! -f configure.in ]] ; then |
230 | if [[ ! -f configure.ac && ! -f configure.in ]] ; then |
| 159 | echo |
231 | echo |
| 160 | eerror "No configure.{ac,in} present in '$(pwd | sed -e 's:.*/::')'!" |
232 | eerror "No configure.{ac,in} present in '${PWD}'!" |
| 161 | echo |
233 | echo |
| 162 | die "No configure.{ac,in} present!" |
234 | die "No configure.{ac,in} present!" |
| 163 | fi |
235 | fi |
| 164 | |
236 | |
| 165 | autotools_run_tool autoconf "$@" |
237 | autotools_run_tool autoconf $(autotools_m4dir_include) "$@" |
| 166 | } |
238 | } |
| 167 | |
239 | |
|
|
240 | # @FUNCTION: eautomake |
|
|
241 | # @DESCRIPTION: |
|
|
242 | # Runs automake. |
| 168 | eautomake() { |
243 | eautomake() { |
| 169 | local extra_opts |
244 | local extra_opts |
|
|
245 | local makefile_name |
| 170 | |
246 | |
|
|
247 | # Run automake if: |
|
|
248 | # - a Makefile.am type file exists |
|
|
249 | # - a Makefile.in type file exists and the configure |
|
|
250 | # script is using the AM_INIT_AUTOMAKE directive |
|
|
251 | for makefile_name in {GNUmakefile,{M,m}akefile}.{am,in} "" ; do |
|
|
252 | [[ -f ${makefile_name} ]] && break |
|
|
253 | done |
| 171 | [[ -f Makefile.am ]] || return 0 |
254 | [[ -z ${makefile_name} ]] && return 0 |
| 172 | |
255 | |
|
|
256 | if [[ ${makefile_name} == *.in ]] ; then |
|
|
257 | if ! grep -qs AM_INIT_AUTOMAKE configure.?? ; then |
|
|
258 | return 0 |
|
|
259 | fi |
|
|
260 | |
| 173 | if [[ -z ${FROM_EAUTORECONF} && -f Makefile.in ]]; then |
261 | elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then |
| 174 | local used_automake |
262 | local used_automake |
| 175 | local installed_automake |
263 | local installed_automake |
| 176 | |
264 | |
| 177 | installed_automake=$(automake --version | head -n 1 | \ |
265 | installed_automake=$(WANT_AUTOMAKE= automake --version | head -n 1 | \ |
| 178 | sed -e 's:.*(GNU automake) ::') |
266 | sed -e 's:.*(GNU automake) ::') |
| 179 | used_automake=$(head -n 1 < Makefile.in | \ |
267 | used_automake=$(head -n 1 < ${makefile_name%.am}.in | \ |
| 180 | sed -e 's:.*by automake \(.*\) from .*:\1:') |
268 | sed -e 's:.*by automake \(.*\) from .*:\1:') |
| 181 | |
269 | |
| 182 | if [[ ${installed_automake} != ${used_automake} ]]; then |
270 | if [[ ${installed_automake} != ${used_automake} ]]; then |
| 183 | einfo "Automake used for the package (${used_automake}) differs from" |
271 | einfo "Automake used for the package (${used_automake}) differs from" |
| 184 | einfo "the installed version (${installed_automake})." |
272 | einfo "the installed version (${installed_automake})." |
| 185 | eautoreconf |
273 | eautoreconf |
| 186 | return 0 |
274 | return 0 |
| 187 | fi |
275 | fi |
| 188 | fi |
276 | fi |
| 189 | |
277 | |
| 190 | [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS ]] \ |
278 | [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] \ |
| 191 | || extra_opts="${extra_opts} --foreign" |
279 | || extra_opts="${extra_opts} --foreign" |
| 192 | |
280 | |
| 193 | # --force-missing seems not to be recognized by some flavours of automake |
281 | # --force-missing seems not to be recognized by some flavours of automake |
| 194 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
282 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
| 195 | } |
283 | } |
| 196 | |
284 | |
|
|
285 | # @FUNCTION: eautopoint |
|
|
286 | # @DESCRIPTION: |
|
|
287 | # Runs autopoint (from the gettext package). |
|
|
288 | eautopoint() { |
|
|
289 | autotools_run_tool autopoint "$@" |
|
|
290 | } |
|
|
291 | |
| 197 | # Internal function to run an autotools' tool |
292 | # Internal function to run an autotools' tool |
|
|
293 | autotools_env_setup() { |
|
|
294 | # We do the “latest” → version switch here because it solves |
|
|
295 | # possible order problems, see bug #270010 as an example. |
|
|
296 | if [[ ${WANT_AUTOMAKE} == "latest" ]]; then |
|
|
297 | local pv |
|
|
298 | for pv in ${_LATEST_AUTOMAKE} ; do |
|
|
299 | # has_version respects ROOT, but in this case, we don't want it to, |
|
|
300 | # thus "ROOT=/" prefix: |
|
|
301 | ROOT=/ has_version "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="$pv" |
|
|
302 | done |
|
|
303 | [[ ${WANT_AUTOMAKE} == "latest" ]] && \ |
|
|
304 | die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE}" |
|
|
305 | fi |
|
|
306 | [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5 |
|
|
307 | } |
| 198 | autotools_run_tool() { |
308 | autotools_run_tool() { |
|
|
309 | if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then |
|
|
310 | ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase" |
|
|
311 | fi |
|
|
312 | |
|
|
313 | autotools_env_setup |
|
|
314 | |
| 199 | local STDERR_TARGET="${T}/$$.out" |
315 | local STDERR_TARGET="${T}/$1.out" |
|
|
316 | # most of the time, there will only be one run, but if there are |
|
|
317 | # more, make sure we get unique log filenames |
|
|
318 | if [[ -e ${STDERR_TARGET} ]] ; then |
| 200 | local ris |
319 | local i=1 |
|
|
320 | while :; do |
|
|
321 | STDERR_TARGET="${T}/$1-${i}.out" |
|
|
322 | [[ -e ${STDERR_TARGET} ]] || break |
|
|
323 | : $(( i++ )) |
|
|
324 | done |
|
|
325 | fi |
| 201 | |
326 | |
| 202 | echo "***** $1 *****" > ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/} |
327 | printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}" |
| 203 | echo >> ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/} |
|
|
| 204 | |
328 | |
| 205 | ebegin "Running $@" |
329 | ebegin "Running $@" |
| 206 | $@ >> ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/} 2>&1 |
330 | "$@" >> "${STDERR_TARGET}" 2>&1 |
| 207 | ris=$? |
331 | eend $? |
| 208 | eend ${ris} |
|
|
| 209 | |
332 | |
| 210 | if [[ ${ris} != 0 && ${NO_FAIL} != 1 ]]; then |
333 | if [[ $? != 0 && ${NO_FAIL} != 1 ]] ; then |
| 211 | echo |
334 | echo |
| 212 | eerror "Failed Running $1 !" |
335 | eerror "Failed Running $1 !" |
| 213 | eerror |
336 | eerror |
| 214 | eerror "Include in your bugreport the contents of:" |
337 | eerror "Include in your bugreport the contents of:" |
| 215 | eerror |
338 | eerror |
| 216 | eerror " ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/}" |
339 | eerror " ${STDERR_TARGET}" |
| 217 | echo |
340 | echo |
| 218 | die "Failed Running $1 !" |
341 | die "Failed Running $1 !" |
| 219 | fi |
342 | fi |
| 220 | } |
343 | } |
| 221 | |
344 | |
| 222 | # Internal function to check for support |
345 | # Internal function to check for support |
| 223 | autotools_check_macro() { |
346 | autotools_check_macro() { |
| 224 | [[ -f configure.ac || -f configure.in ]] && \ |
347 | [[ -f configure.ac || -f configure.in ]] || return 0 |
| 225 | WANT_AUTOCONF="2.5" autoconf --trace=$1 2>/dev/null |
348 | local macro |
|
|
349 | for macro ; do |
|
|
350 | WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) --trace="${macro}" 2>/dev/null |
|
|
351 | done |
| 226 | return 0 |
352 | return 0 |
| 227 | } |
353 | } |
| 228 | |
354 | |
| 229 | # Internal function to get additional subdirs to configure |
355 | # Internal function to get additional subdirs to configure |
| 230 | autotools_get_subdirs() { |
356 | autotools_get_subdirs() { |
| … | |
… | |
| 254 | print res[1] |
380 | print res[1] |
| 255 | }' | uniq |
381 | }' | uniq |
| 256 | |
382 | |
| 257 | return 0 |
383 | return 0 |
| 258 | } |
384 | } |
|
|
385 | |
|
|
386 | autotools_m4dir_include() { |
|
|
387 | [[ -n ${AT_M4DIR} ]] || return |
|
|
388 | |
|
|
389 | local include_opts= |
|
|
390 | |
|
|
391 | for x in ${AT_M4DIR} ; do |
|
|
392 | case "${x}" in |
|
|
393 | "-I") |
|
|
394 | # We handle it below |
|
|
395 | ;; |
|
|
396 | *) |
|
|
397 | [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist" |
|
|
398 | include_opts="${include_opts} -I ${x}" |
|
|
399 | ;; |
|
|
400 | esac |
|
|
401 | done |
|
|
402 | |
|
|
403 | echo $include_opts |
|
|
404 | } |
|
|
405 | |
|
|
406 | fi |