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 pn not in ['libtool', 'libtool-native', 'libtool-cross']:
16 deps += 'libtool-native '
17 if (not oe.utils.inherits(d, 'native', 'nativesdk', 'cross',
19 not d.getVar('INHIBIT_DEFAULT_DEPS', True)):
20 deps += 'libtool-cross '
22 return deps + 'gnu-config-native '
26 DEPENDS_prepend = "${@autotools_deps(d)}"
27 DEPENDS_virtclass-native_prepend = "${@autotools_deps(d)}"
28 DEPENDS_virtclass-nativesdk_prepend = "${@autotools_deps(d)}"
32 def _autotools_get_sitefiles(d):
33 if oe.utils.inherits(d, 'native', 'nativesdk'):
36 sitedata = siteinfo_data(d)
37 for path in d.getVar("BBPATH", True).split(":"):
38 for element in sitedata:
39 filename = os.path.join(path, "site", element)
40 if os.path.exists(filename):
43 # Space separated list of shell scripts with variables defined to supply test
44 # results for autoconf tests we cannot run at build time.
45 export CONFIG_SITE = "${@' '.join(_autotools_get_sitefiles(d))}"
48 EXTRA_AUTORECONF = "--exclude=autopoint"
50 def autotools_set_crosscompiling(d):
51 if not bb.data.inherits_class('native', d):
52 return " cross_compiling=yes"
55 def append_libtool_sysroot(d):
56 if bb.data.getVar('LIBTOOL_HAS_SYSROOT', d, 1) == "yes":
57 if bb.data.getVar('BUILD_SYS', d, 1) == bb.data.getVar('HOST_SYS', d, 1):
58 return '--with-libtool-sysroot'
60 return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
63 def distro_imposed_configure_flags(d):
64 distro_features = bb.data.getVar('DISTRO_FEATURES', d, True) or ""
65 distro_features = distro_features.split()
67 features = (('largefile', 'largefile'),
71 for knob, cfgargs in features:
72 if isinstance(cfgargs, basestring):
74 en_or_dis = knob in distro_features and "enable" or "disable"
76 flags.add("--%s-%s" % (en_or_dis, flg))
77 return " ".join(flags)
79 # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
81 CONFIGUREOPTS = " --build=${BUILD_SYS} \
83 --target=${TARGET_SYS} \
85 --exec_prefix=${exec_prefix} \
87 --sbindir=${sbindir} \
88 --libexecdir=${libexecdir} \
89 --datadir=${datadir} \
90 --sysconfdir=${sysconfdir} \
91 --sharedstatedir=${sharedstatedir} \
92 --localstatedir=${localstatedir} \
94 --includedir=${includedir} \
95 --oldincludedir=${oldincludedir} \
96 --infodir=${infodir} \
98 ${@append_libtool_sysroot(d)} \
99 ${@distro_imposed_configure_flags(d)} \
103 if [ -x ${S}/configure ] ; then
105 ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"
107 oefatal "no configure script found"
112 if [ x"${acpaths}" = xdefault ]; then
114 for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
115 grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
116 acpaths="$acpaths -I $i"
121 AUTOV=`automake --version | head -n 1 | sed "s/.* //;s/\.[0-9]\+$//"`
122 install -d ${STAGING_DATADIR}/aclocal
123 install -d ${STAGING_DATADIR}/aclocal-$AUTOV
124 acpaths="$acpaths -I${STAGING_DATADIR}/aclocal-$AUTOV -I ${STAGING_DATADIR}/aclocal"
125 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
126 # like it was auto-generated. Work around this by blowing it away
127 # by hand, unless the package specifically asked not to run aclocal.
128 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
131 if [ -e configure.in ]; then
132 CONFIGURE_AC=configure.in
134 CONFIGURE_AC=configure.ac
136 if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
137 if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
138 : do nothing -- we still have an old unmodified configure.ac
140 echo "no" | glib-gettextize --force --copy
142 else if grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
143 if [ -e ${STAGING_DATADIR}/gettext/config.rpath ]; then
144 cp ${STAGING_DATADIR}/gettext/config.rpath ${S}/
146 oenote ${STAGING_DATADIR}/gettext/config.rpath not found. gettext is not installed.
151 for aux in m4 `sed -n -e '/^[[:space:]]*AC_CONFIG_MACRO_DIR/s|[^(]*([[]*\([^])]*\)[]]*)|\1|p' $CONFIGURE_AC`; do
154 autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
155 if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
156 intltoolize --copy --force --automake
160 autotools_do_configure() {
165 find ${S} -name configure.in -o -name configure.ac | \
167 rm -f `dirname $fn`/configure
169 if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
177 if [ -e ${S}/configure ]; then
180 oenote "nothing to configure"
184 autotools_do_install() {
185 oe_runmake 'DESTDIR=${D}' install
188 PACKAGE_PREPROCESS_FUNCS += "${@['autotools_prepackage_lamangler',''][bb.data.getVar('LIBTOOL_HAS_SYSROOT', d, 1) == "yes"]}"
189 autotools_prepackage_lamangler () {
190 for i in `find ${PKGD} -name "*.la"` ; do \
191 sed -i -e 's:${STAGING_LIBDIR}:${libdir}:g;' \
193 -e 's:-I${WORKDIR}\S*: :g;' \
194 -e 's:-L${WORKDIR}\S*: :g;' \
199 # STAGE_TEMP_PREFIX is used for a speedup by packaged-staging
200 STAGE_TEMP="${WORKDIR}/temp-staging"
201 STAGE_TEMP_PREFIX = ""
203 autotools_stage_includes() {
204 if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ]
207 mkdir -p ${STAGE_TEMP}
208 make DESTDIR="${STAGE_TEMP}" install
209 cp -pPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR}
214 autotools_stage_dir() {
215 sysroot_stage_dir $1 ${STAGE_TEMP_PREFIX}$2
218 autotools_stage_libdir() {
219 sysroot_stage_libdir $1 ${STAGE_TEMP_PREFIX}$2
222 autotools_stage_all() {
223 if [ "${INHIBIT_AUTO_STAGE}" = "1" ]
228 mkdir -p ${STAGE_TEMP}
229 oe_runmake DESTDIR="${STAGE_TEMP}" install
230 rm -rf ${STAGE_TEMP}/${mandir} || true
231 rm -rf ${STAGE_TEMP}/${infodir} || true
232 sysroot_stage_dirs ${STAGE_TEMP} ${STAGE_TEMP_PREFIX}
236 EXPORT_FUNCTIONS do_configure do_install