1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2007 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.62 2007/01/08 23:04:49 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.64 2007/01/19 23:39:29 vapier Exp $ |
4 | # |
4 | # |
5 | # Author: Diego Pettenò <flameeyes@gentoo.org> |
5 | # Author: Diego Pettenò <flameeyes@gentoo.org> |
6 | # Enhancements: Martin Schlemmer <azarah@gentoo.org> |
6 | # Enhancements: Martin Schlemmer <azarah@gentoo.org> |
7 | # |
7 | # |
8 | # This eclass is for handling autotooled software packages that |
8 | # This eclass is for handling autotooled software packages that |
9 | # needs to regenerate their build scripts. |
9 | # needs to regenerate their build scripts. |
10 | # |
10 | # |
11 | # NB: If you add anything, please comment it! |
11 | # NB: If you add anything, please comment it! |
12 | |
12 | |
13 | inherit eutils libtool |
13 | inherit eutils libtool |
|
|
14 | |
|
|
15 | [[ -z ${WANT_AUTOCONF} ]] && WANT_AUTOCONF="latest" |
|
|
16 | [[ -z ${WANT_AUTOMAKE} ]] && WANT_AUTOMAKE="latest" |
14 | |
17 | |
15 | _automake_atom="sys-devel/automake" |
18 | _automake_atom="sys-devel/automake" |
16 | _autoconf_atom="sys-devel/autoconf" |
19 | _autoconf_atom="sys-devel/autoconf" |
17 | if [[ -n ${WANT_AUTOMAKE} ]]; then |
20 | if [[ -n ${WANT_AUTOMAKE} ]]; then |
18 | case ${WANT_AUTOMAKE} in |
21 | case ${WANT_AUTOMAKE} in |
19 | # workaround while we have different versions of automake in arch and ~arch |
22 | # workaround while we have different versions of automake in arch and ~arch |
20 | none) _automake_atom="" ;; # some packages don't require automake at all |
23 | none) _automake_atom="" ;; # some packages don't require automake at all |
21 | latest) _automake_atom="|| ( =sys-devel/automake-1.10* =sys-devel/automake-1.9* )" ;; |
24 | latest) _automake_atom="=sys-devel/automake-1.10*" ;; |
22 | *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;; |
25 | *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;; |
23 | esac |
26 | esac |
|
|
27 | [[ ${WANT_AUTOMAKE} == "latest" ]] && WANT_AUTOMAKE="1.10" |
|
|
28 | export WANT_AUTOMAKE |
24 | fi |
29 | fi |
25 | |
30 | |
26 | if [[ -n ${WANT_AUTOCONF} ]] ; then |
31 | if [[ -n ${WANT_AUTOCONF} ]] ; then |
27 | case ${WANT_AUTOCONF} in |
32 | case ${WANT_AUTOCONF} in |
28 | 2.1) _autoconf_atom="=sys-devel/autoconf-${WANT_AUTOCONF}*" ;; |
33 | 2.1) _autoconf_atom="=sys-devel/autoconf-${WANT_AUTOCONF}*" ;; |
29 | latest | 2.5) _autoconf_atom=">=sys-devel/autoconf-2.59" ;; |
34 | latest | 2.5) _autoconf_atom=">=sys-devel/autoconf-2.59" ;; |
30 | esac |
35 | esac |
|
|
36 | [[ ${WANT_AUTOCONF} == "latest" ]] && WANT_AUTOCONF="2.5" |
|
|
37 | export WANT_AUTOCONF |
31 | fi |
38 | fi |
32 | DEPEND="${_automake_atom} |
39 | DEPEND="${_automake_atom} |
33 | ${_autoconf_atom} |
40 | ${_autoconf_atom} |
34 | sys-devel/libtool" |
41 | sys-devel/libtool" |
35 | RDEPEND="" |
42 | RDEPEND="" |
… | |
… | |
118 | ;; |
125 | ;; |
119 | esac |
126 | esac |
120 | done |
127 | done |
121 | fi |
128 | fi |
122 | |
129 | |
123 | autotools_set_versions |
|
|
124 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
130 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
125 | autotools_run_tool aclocal "$@" ${aclocal_opts} |
131 | autotools_run_tool aclocal "$@" ${aclocal_opts} |
126 | } |
132 | } |
127 | |
133 | |
128 | _elibtoolize() { |
134 | _elibtoolize() { |
… | |
… | |
144 | } |
150 | } |
145 | |
151 | |
146 | eautoheader() { |
152 | eautoheader() { |
147 | # Check if we should run autoheader |
153 | # Check if we should run autoheader |
148 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
154 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
149 | autotools_set_versions |
|
|
150 | NO_FAIL=1 autotools_run_tool autoheader "$@" |
155 | NO_FAIL=1 autotools_run_tool autoheader "$@" |
151 | } |
156 | } |
152 | |
157 | |
153 | eautoconf() { |
158 | eautoconf() { |
154 | if [[ ! -f configure.ac && ! -f configure.in ]] ; then |
159 | if [[ ! -f configure.ac && ! -f configure.in ]] ; then |
… | |
… | |
156 | eerror "No configure.{ac,in} present in '$(pwd | sed -e 's:.*/::')'!" |
161 | eerror "No configure.{ac,in} present in '$(pwd | sed -e 's:.*/::')'!" |
157 | echo |
162 | echo |
158 | die "No configure.{ac,in} present!" |
163 | die "No configure.{ac,in} present!" |
159 | fi |
164 | fi |
160 | |
165 | |
161 | autotools_set_versions |
|
|
162 | autotools_run_tool autoconf "$@" |
166 | autotools_run_tool autoconf "$@" |
163 | } |
167 | } |
164 | |
168 | |
165 | eautomake() { |
169 | eautomake() { |
166 | local extra_opts |
170 | local extra_opts |
167 | |
171 | |
168 | [[ -f Makefile.am ]] || return 0 |
172 | [[ -f Makefile.am ]] || return 0 |
169 | |
173 | |
170 | autotools_set_versions |
|
|
171 | if [[ -z ${FROM_EAUTORECONF} && -f Makefile.in ]]; then |
174 | if [[ -z ${FROM_EAUTORECONF} && -f Makefile.in ]]; then |
172 | local used_automake |
175 | local used_automake |
173 | local installed_automake |
176 | local installed_automake |
174 | |
177 | |
175 | installed_automake=$(automake --version | head -n 1 | \ |
178 | installed_automake=$(automake --version | head -n 1 | \ |
… | |
… | |
190 | |
193 | |
191 | # --force-missing seems not to be recognized by some flavours of automake |
194 | # --force-missing seems not to be recognized by some flavours of automake |
192 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
195 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
193 | } |
196 | } |
194 | |
197 | |
195 | autotools_set_versions() { |
|
|
196 | [[ -n ${autotools_version_sets} ]] && return 0 |
|
|
197 | |
|
|
198 | if [[ -n ${WANT_AUTOCONF} ]]; then |
|
|
199 | [[ ${WANT_AUTOCONF} == "latest" ]] && WANT_AUTOCONF="2.5" |
|
|
200 | export WANT_AUTOCONF |
|
|
201 | einfo "Requested autoconf ${WANT_AUTOCONF}" |
|
|
202 | einfo "Using $(autoconf --version 2>/dev/null | head -n 1)" |
|
|
203 | einfo "Using $(autoheader --version 2>/dev/null | head -n 1)" |
|
|
204 | else |
|
|
205 | ewarn "QA Notice: \${WANT_AUTOCONF} variable unset. Please report on http://bugs.gentoo.org/" |
|
|
206 | fi |
|
|
207 | |
|
|
208 | if [[ -n ${WANT_AUTOMAKE} ]]; then |
|
|
209 | local latest_automake |
|
|
210 | if [[ ${WANT_AUTOMAKE} == "latest" ]]; then |
|
|
211 | latest_automake="latest: " |
|
|
212 | for amver in 1.10 1.9 1.8 1.7 1.6; do |
|
|
213 | WANT_AUTOMAKE="${amver}" |
|
|
214 | ROOT=/ has_version =sys-devel/automake-${amver}* && break |
|
|
215 | done |
|
|
216 | fi |
|
|
217 | |
|
|
218 | # Don't do stuff if no autoamke is requested/required |
|
|
219 | if [[ ${WANT_AUTOMAKE} != "none" ]]; then |
|
|
220 | export WANT_AUTOMAKE |
|
|
221 | einfo "Requested automake ${latest_automake}${WANT_AUTOMAKE}" |
|
|
222 | einfo "Using $(automake --version 2>/dev/null | head -n 1)" |
|
|
223 | einfo "Using $(aclocal --version 2>/dev/null | head -n 1)" |
|
|
224 | fi |
|
|
225 | else |
|
|
226 | ewarn "QA Notice: \${WANT_AUTOMAKE} variable unset. Please report on http://bugs.gentoo.org/" |
|
|
227 | fi |
|
|
228 | |
|
|
229 | autotools_version_sets="yes" |
|
|
230 | } |
|
|
231 | |
|
|
232 | # Internal function to run an autotools' tool |
198 | # Internal function to run an autotools' tool |
233 | autotools_run_tool() { |
199 | autotools_run_tool() { |
234 | local STDERR_TARGET="${T}/$$.out" |
200 | local STDERR_TARGET="${T}/$$.out" |
235 | local ris |
201 | local ris |
236 | |
202 | |