summaryrefslogtreecommitdiffstats
path: root/meta/classes/autotools.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/autotools.bbclass')
-rw-r--r--meta/classes/autotools.bbclass182
1 files changed, 182 insertions, 0 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
new file mode 100644
index 0000000000..927e3432b7
--- /dev/null
+++ b/meta/classes/autotools.bbclass
@@ -0,0 +1,182 @@
1inherit base
2
3def autotools_dep_prepend(d):
4 import bb;
5
6 if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1):
7 return ''
8
9 pn = bb.data.getVar('PN', d, 1)
10 deps = ''
11
12 if pn in ['autoconf-native', 'automake-native']:
13 return deps
14 deps += 'autoconf-native automake-native '
15
16 if not pn in ['libtool', 'libtool-native', 'libtool-cross']:
17 deps += 'libtool-native '
18
19 return deps + 'gnu-config-native '
20
21EXTRA_OEMAKE = ""
22DEPENDS_prepend = "${@autotools_dep_prepend(d)}"
23acpaths = "default"
24EXTRA_AUTORECONF = "--exclude=autopoint"
25
26def autotools_set_crosscompiling(d):
27 import bb
28 if not bb.data.inherits_class('native', d):
29 return " cross_compiling=yes"
30 return ""
31
32# EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
33
34oe_runconf () {
35 if [ -x ${S}/configure ] ; then
36 cfgcmd="${S}/configure \
37 --build=${BUILD_SYS} \
38 --host=${HOST_SYS} \
39 --target=${TARGET_SYS} \
40 --prefix=${prefix} \
41 --exec_prefix=${exec_prefix} \
42 --bindir=${bindir} \
43 --sbindir=${sbindir} \
44 --libexecdir=${libexecdir} \
45 --datadir=${datadir} \
46 --sysconfdir=${sysconfdir} \
47 --sharedstatedir=${sharedstatedir} \
48 --localstatedir=${localstatedir} \
49 --libdir=${libdir} \
50 --includedir=${includedir} \
51 --oldincludedir=${oldincludedir} \
52 --infodir=${infodir} \
53 --mandir=${mandir} \
54 ${EXTRA_OECONF} \
55 $@"
56 oenote "Running $cfgcmd..."
57 $cfgcmd || oefatal "oe_runconf failed"
58 else
59 oefatal "no configure script found"
60 fi
61}
62
63autotools_do_configure() {
64 case ${PN} in
65 autoconf*)
66 ;;
67 automake*)
68 ;;
69 *)
70 # WARNING: gross hack follows:
71 # An autotools built package generally needs these scripts, however only
72 # automake or libtoolize actually install the current versions of them.
73 # This is a problem in builds that do not use libtool or automake, in the case
74 # where we -need- the latest version of these scripts. e.g. running a build
75 # for a package whose autotools are old, on an x86_64 machine, which the old
76 # config.sub does not support. Work around this by installing them manually
77 # regardless.
78 ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
79 rm -f `dirname $ac`/configure
80 done )
81 if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
82 olddir=`pwd`
83 cd ${S}
84 if [ x"${acpaths}" = xdefault ]; then
85 acpaths=
86 for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
87 grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
88 acpaths="$acpaths -I $i"
89 done
90 else
91 acpaths="${acpaths}"
92 fi
93 AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
94 automake --version
95 echo "AUTOV is $AUTOV"
96 install -d ${STAGING_DIR}/${HOST_SYS}/share/aclocal
97 install -d ${STAGING_DIR}/${HOST_SYS}/share/aclocal-$AUTOV
98 acpaths="$acpaths -I ${STAGING_DIR}/${HOST_SYS}/share/aclocal-$AUTOV -I ${STAGING_DIR}/${HOST_SYS}/share/aclocal"
99 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
100 # like it was auto-generated. Work around this by blowing it away
101 # by hand, unless the package specifically asked not to run aclocal.
102 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
103 rm -f aclocal.m4
104 fi
105 if [ -e configure.in ]; then
106 CONFIGURE_AC=configure.in
107 else
108 CONFIGURE_AC=configure.ac
109 fi
110 if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
111 if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
112 : do nothing -- we still have an old unmodified configure.ac
113 else
114 oenote Executing glib-gettextize --force --copy
115 echo "no" | glib-gettextize --force --copy
116 fi
117 fi
118 if grep "^AC_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
119 oenote Executing intltoolize --copy --force --automake
120 intltoolize --copy --force --automake
121 fi
122 oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
123 mkdir -p m4
124 autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
125 cd $olddir
126 fi
127 ;;
128 esac
129 if [ -e ${S}/configure ]; then
130 oe_runconf
131 else
132 oenote "nothing to configure"
133 fi
134}
135
136autotools_do_install() {
137 oe_runmake 'DESTDIR=${D}' install
138}
139
140STAGE_TEMP="${WORKDIR}/temp-staging"
141
142autotools_stage_includes() {
143 if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ]
144 then
145 rm -rf ${STAGE_TEMP}
146 mkdir -p ${STAGE_TEMP}
147 make DESTDIR="${STAGE_TEMP}" install
148 cp -pPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR}
149 rm -rf ${STAGE_TEMP}
150 fi
151}
152
153autotools_stage_all() {
154 if [ "${INHIBIT_AUTO_STAGE}" = "1" ]
155 then
156 return
157 fi
158 rm -rf ${STAGE_TEMP}
159 mkdir -p ${STAGE_TEMP}
160 oe_runmake DESTDIR="${STAGE_TEMP}" install
161 if [ -d ${STAGE_TEMP}/${includedir} ]; then
162 cp -fpPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR}
163 fi
164 if [ -d ${STAGE_TEMP}/${libdir} ]
165 then
166 for i in ${STAGE_TEMP}/${libdir}/*.la
167 do
168 if [ ! -f "$i" ]; then
169 cp -fpPR ${STAGE_TEMP}/${libdir}/* ${STAGING_LIBDIR}
170 break
171 fi
172 oe_libinstall -so $(basename $i .la) ${STAGING_LIBDIR}
173 done
174 fi
175 if [ -d ${STAGE_TEMP}/${datadir}/aclocal ]; then
176 install -d ${STAGING_DATADIR}/aclocal
177 cp -fpPR ${STAGE_TEMP}/${datadir}/aclocal/* ${STAGING_DATADIR}/aclocal
178 fi
179 rm -rf ${STAGE_TEMP}
180}
181
182EXPORT_FUNCTIONS do_configure do_install