1 |
Please note that this is an early sketch. It surely can be improved, |
2 |
especially with some help on autotools.eclass side which is currently |
3 |
really hard to co-operate with. |
4 |
|
5 |
It works very similarly to gnome-autogen.sh. This means that it |
6 |
automatically determines all the tools needed to run, including gettext, |
7 |
gtk-doc etc. |
8 |
--- |
9 |
eclass/autotools-utils.eclass | 102 +++++++++++++++++++++++++++++++++++++++-- |
10 |
1 files changed, 98 insertions(+), 4 deletions(-) |
11 |
|
12 |
diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass |
13 |
index 354fdad..54b7d6e 100644 |
14 |
--- a/eclass/autotools-utils.eclass |
15 |
+++ b/eclass/autotools-utils.eclass |
16 |
@@ -1,6 +1,6 @@ |
17 |
# Copyright 1999-2011 Gentoo Foundation |
18 |
# Distributed under the terms of the GNU General Public License v2 |
19 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.31 2011/12/22 18:01:12 mgorny Exp $ |
20 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.29 2011/11/27 09:57:20 mgorny Exp $ |
21 |
|
22 |
# @ECLASS: autotools-utils.eclass |
23 |
# @MAINTAINER: |
24 |
@@ -93,10 +93,28 @@ case ${EAPI:-0} in |
25 |
*) die "EAPI=${EAPI} is not supported" ;; |
26 |
esac |
27 |
|
28 |
+# @ECLASS-VARIABLE: AUTOTOOLS_AUTORECONF |
29 |
+# @DEFAULT-UNSET |
30 |
+# @DESCRIPTION: |
31 |
+# Set to enable running autoreconf in src_prepare() and adding autotools |
32 |
+# dependencies. |
33 |
+# |
34 |
+# The eclass will try to determine the correct autotools to run including a few |
35 |
+# external tools: gettext, glib-gettext, intltool, gtk-doc, gnome-doc-prepare. |
36 |
+# If your tool is not supported, please open a bug and we'll add support for it. |
37 |
+# |
38 |
+# Note that dependencies are added for autoconf, automake and libtool only. |
39 |
+# If your package needs one of the external tools listed above, you need to add |
40 |
+# appropriate packages to DEPEND yourself. |
41 |
+[[ ${AUTOTOOLS_AUTORECONF} ]] || _autotools_auto_dep=no |
42 |
+ |
43 |
+AUTOTOOLS_AUTO_DEPEND=${_autotools_auto_dep} \ |
44 |
inherit autotools eutils libtool |
45 |
|
46 |
EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test |
47 |
|
48 |
+unset _autotools_auto_dep |
49 |
+ |
50 |
# @ECLASS-VARIABLE: AUTOTOOLS_BUILD_DIR |
51 |
# @DEFAULT_UNSET |
52 |
# @DESCRIPTION: |
53 |
@@ -250,20 +268,96 @@ remove_libtool_files() { |
54 |
fi |
55 |
} |
56 |
|
57 |
+# @FUNCTION: autotools-utils_autoreconf |
58 |
+# @DESCRIPTION: |
59 |
+# Reconfigure the sources (like gnome-doc-autogen.sh or eautoreconf). |
60 |
+autotools-utils_autoreconf() { |
61 |
+ debug-print-function ${FUNCNAME} "$@" |
62 |
+ |
63 |
+ # Override this func to not require unnecessary eaclocal calls. |
64 |
+ autotools_check_macro() { |
65 |
+ local x |
66 |
+ |
67 |
+ # Add a few additional variants as we don't get expansions. |
68 |
+ [[ ${1} = AC_CONFIG_HEADERS ]] && set -- "${@}" AC_CONFIG_HEADER |
69 |
+ |
70 |
+ for x; do |
71 |
+ grep -h "^${x}" configure.{ac,in} 2>/dev/null |
72 |
+ done |
73 |
+ } |
74 |
+ |
75 |
+ einfo "Autoreconfiguring '${PWD}' ..." |
76 |
+ |
77 |
+ local auxdir=$(sed -n -e 's/^AC_CONFIG_AUX_DIR(\(.*\))$/\1/p' \ |
78 |
+ configure.{ac,in} 2>/dev/null) |
79 |
+ if [[ ${auxdir} ]]; then |
80 |
+ auxdir=${auxdir%%]} |
81 |
+ mkdir -p ${auxdir##[} |
82 |
+ fi |
83 |
+ |
84 |
+ # Support running additional tools like gnome-autogen.sh. |
85 |
+ # Note: you need to add additional depends to the ebuild. |
86 |
+ |
87 |
+ # gettext |
88 |
+ if [[ $(autotools_check_macro AM_GLIB_GNU_GETTEXT) ]]; then |
89 |
+ echo 'no' | autotools_run_tool glib-gettextize --copy |
90 |
+ elif [[ $(autotools_check_macro AM_GNU_GETTEXT) ]]; then |
91 |
+ eautopoint |
92 |
+ fi |
93 |
+ |
94 |
+ # intltool |
95 |
+ if [[ $(autotools_check_macro AC_PROG_INTLTOOL IT_PROG_INTLTOOL) ]] |
96 |
+ then |
97 |
+ autotools_run_tool intltoolize --copy --automake |
98 |
+ fi |
99 |
+ |
100 |
+ # gtk-doc |
101 |
+ if [[ $(autotools_check_macro GTK_DOC_CHECK) ]]; then |
102 |
+ autotools_run_tool gtkdocize --copy |
103 |
+ fi |
104 |
+ |
105 |
+ # gnome-doc |
106 |
+ if [[ $(autotools_check_macro GNOME_DOC_INIT) ]]; then |
107 |
+ autotools_run_tool gnome-doc-prepare --copy |
108 |
+ fi |
109 |
+ |
110 |
+ # We need to perform the check twice to know whether to run eaclocal. |
111 |
+ # (_elibtoolize does that itself) |
112 |
+ if [[ $(autotools_check_macro AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT) ]] |
113 |
+ then |
114 |
+ _elibtoolize --copy --force --install |
115 |
+ else |
116 |
+ eaclocal |
117 |
+ fi |
118 |
+ |
119 |
+ eautoconf |
120 |
+ eautoheader |
121 |
+ eautomake |
122 |
+ |
123 |
+ local x |
124 |
+ for x in $(autotools_get_subdirs); do |
125 |
+ if [[ -d ${x} ]] ; then |
126 |
+ pushd "${x}" >/dev/null |
127 |
+ autotools-utils_eautoreconf |
128 |
+ popd >/dev/null |
129 |
+ fi |
130 |
+ done |
131 |
+} |
132 |
+ |
133 |
# @FUNCTION: autotools-utils_src_prepare |
134 |
# @DESCRIPTION: |
135 |
# The src_prepare function. |
136 |
# |
137 |
# Supporting PATCHES array and user patches. See base.eclass(5) for reference. |
138 |
-# |
139 |
-# This function calls elibtoolize implicitly. If you need to call eautoreconf |
140 |
-# afterwards, please use AT_NOELIBTOOLIZE=yes to avoid it being called twice. |
141 |
autotools-utils_src_prepare() { |
142 |
debug-print-function ${FUNCNAME} "$@" |
143 |
|
144 |
+ local want_autoreconf=${AUTOTOOLS_AUTORECONF} |
145 |
+ |
146 |
[[ ${PATCHES} ]] && epatch "${PATCHES[@]}" |
147 |
epatch_user |
148 |
|
149 |
+ [[ ${want_autoreconf} ]] && autotools-utils_autoreconf |
150 |
elibtoolize --patch-only |
151 |
} |
152 |
|
153 |
-- |
154 |
1.7.8.1.385.gec330.dirty |