1 # use autotools_stage_all for native packages
2 AUTOTOOLS_NATIVE_STAGE_INSTALL = "1"
5 if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1):
8 pn = bb.data.getVar('PN', d, 1)
11 if pn in ['autoconf-native', 'automake-native', 'help2man-native']:
13 deps += 'autoconf-native automake-native help2man-native '
15 if not pn in ['libtool', 'libtool-native', 'libtool-cross']:
16 deps += 'libtool-native '
17 if not bb.data.inherits_class('native', d) \
18 and not bb.data.inherits_class('cross', d) \
19 and not bb.data.inherits_class('sdk', d) \
20 and not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1):
21 deps += 'libtool-cross '
23 return deps + 'gnu-config-native '
27 DEPENDS_prepend = "${@autotools_deps(d)}"
28 DEPENDS_virtclass-native_prepend = "${@autotools_deps(d)}"
29 DEPENDS_virtclass-nativesdk_prepend = "${@autotools_deps(d)}"
33 def _autotools_get_sitefiles(d):
34 def inherits(d, *classes):
35 if any(bb.data.inherits_class(cls, d) for cls in classes):
38 if inherits(d, "native", "nativesdk"):
41 sitedata = siteinfo_data(d)
42 for path in d.getVar("BBPATH", True).split(":"):
43 for element in sitedata:
44 filename = os.path.join(path, "site", element)
45 if os.path.exists(filename):
48 # Space separated list of shell scripts with variables defined to supply test
49 # results for autoconf tests we cannot run at build time.
50 export CONFIG_SITE = "${@' '.join(_autotools_get_sitefiles(d))}"
53 EXTRA_AUTORECONF = "--exclude=autopoint"
55 def autotools_set_crosscompiling(d):
56 if not bb.data.inherits_class('native', d):
57 return " cross_compiling=yes"
60 def append_libtool_sysroot(d):
61 if bb.data.getVar('LIBTOOL_HAS_SYSROOT', d, 1) == "yes":
62 if bb.data.getVar('BUILD_SYS', d, 1) == bb.data.getVar('HOST_SYS', d, 1):
63 return '--with-libtool-sysroot'
65 return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
68 def distro_imposed_configure_flags(d):
69 distro_features = bb.data.getVar('DISTRO_FEATURES', d, True) or ""
70 distro_features = distro_features.split()
72 features = (('largefile', 'largefile'),
76 for knob, cfgargs in features:
77 if isinstance(cfgargs, basestring):
79 en_or_dis = knob in distro_features and "enable" or "disable"
81 flags.add("--%s-%s" % (en_or_dis, flg))
82 return " ".join(flags)
84 # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
86 CONFIGUREOPTS = " --build=${BUILD_SYS} \
88 --target=${TARGET_SYS} \
90 --exec_prefix=${exec_prefix} \
92 --sbindir=${sbindir} \
93 --libexecdir=${libexecdir} \
94 --datadir=${datadir} \
95 --sysconfdir=${sysconfdir} \
96 --sharedstatedir=${sharedstatedir} \
97 --localstatedir=${localstatedir} \
99 --includedir=${includedir} \
100 --oldincludedir=${oldincludedir} \
101 --infodir=${infodir} \
103 ${@append_libtool_sysroot(d)} \
104 ${@distro_imposed_configure_flags(d)} \
108 if [ -x ${S}/configure ] ; then
110 ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"
112 oefatal "no configure script found"
116 autotools_do_configure() {
123 # WARNING: gross hack follows:
124 # An autotools built package generally needs these scripts, however only
125 # automake or libtoolize actually install the current versions of them.
126 # This is a problem in builds that do not use libtool or automake, in the case
127 # where we -need- the latest version of these scripts. e.g. running a build
128 # for a package whose autotools are old, on an x86_64 machine, which the old
129 # config.sub does not support. Work around this by installing them manually
131 ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
132 rm -f `dirname $ac`/configure
134 if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
137 if [ x"${acpaths}" = xdefault ]; then
139 for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
140 grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
141 acpaths="$acpaths -I $i"
146 AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
148 echo "AUTOV is $AUTOV"
149 install -d ${STAGING_DATADIR}/aclocal
150 install -d ${STAGING_DATADIR}/aclocal-$AUTOV
151 acpaths="$acpaths -I${STAGING_DATADIR}/aclocal-$AUTOV -I ${STAGING_DATADIR}/aclocal"
152 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
153 # like it was auto-generated. Work around this by blowing it away
154 # by hand, unless the package specifically asked not to run aclocal.
155 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
158 if [ -e configure.in ]; then
159 CONFIGURE_AC=configure.in
161 CONFIGURE_AC=configure.ac
163 if grep -q "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC; then
164 if grep -q "sed.*POTFILES" $CONFIGURE_AC; then
165 : do nothing -- we still have an old unmodified configure.ac
167 oenote Executing glib-gettextize --force --copy
168 echo "no" | glib-gettextize --force --copy
170 else if grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then
171 if [ -e ${STAGING_DATADIR}/gettext/config.rpath ]; then
172 cp ${STAGING_DATADIR}/gettext/config.rpath ${S}/
174 oenote ${STAGING_DATADIR}/gettext/config.rpath not found. gettext is not installed.
179 for aux in m4 `sed -n -e '/^[[:space:]]*AC_CONFIG_MACRO_DIR/s|[^(]*([[]*\([^])]*\)[]]*)|\1|p' $CONFIGURE_AC`; do
182 oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
183 autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
184 if grep -q "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC; then
185 oenote Executing intltoolize --copy --force --automake
186 intltoolize --copy --force --automake
192 if [ -e ${S}/configure ]; then
195 oenote "nothing to configure"
199 autotools_do_install() {
200 oe_runmake 'DESTDIR=${D}' install
203 PACKAGE_PREPROCESS_FUNCS += "${@['autotools_prepackage_lamangler',''][bb.data.getVar('LIBTOOL_HAS_SYSROOT', d, 1) == "yes"]}"
204 autotools_prepackage_lamangler () {
205 for i in `find ${PKGD} -name "*.la"` ; do \
206 sed -i -e 's:${STAGING_LIBDIR}:${libdir}:g;' \
208 -e 's:-I${WORKDIR}\S*: :g;' \
209 -e 's:-L${WORKDIR}\S*: :g;' \
214 # STAGE_TEMP_PREFIX is used for a speedup by packaged-staging
215 STAGE_TEMP="${WORKDIR}/temp-staging"
216 STAGE_TEMP_PREFIX = ""
218 autotools_stage_includes() {
219 if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ]
222 mkdir -p ${STAGE_TEMP}
223 make DESTDIR="${STAGE_TEMP}" install
224 cp -pPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR}
229 autotools_stage_dir() {
230 sysroot_stage_dir $1 ${STAGE_TEMP_PREFIX}$2
233 autotools_stage_libdir() {
234 sysroot_stage_libdir $1 ${STAGE_TEMP_PREFIX}$2
237 autotools_stage_all() {
238 if [ "${INHIBIT_AUTO_STAGE}" = "1" ]
243 mkdir -p ${STAGE_TEMP}
244 oe_runmake DESTDIR="${STAGE_TEMP}" install
245 rm -rf ${STAGE_TEMP}/${mandir} || true
246 rm -rf ${STAGE_TEMP}/${infodir} || true
247 sysroot_stage_dirs ${STAGE_TEMP} ${STAGE_TEMP_PREFIX}
251 EXPORT_FUNCTIONS do_configure do_install