summaryrefslogtreecommitdiff
path: root/meta/classes/autotools.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/autotools.bbclass')
-rw-r--r--meta/classes/autotools.bbclass223
1 files changed, 92 insertions, 131 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index 365258f65..941c06d03 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -1,72 +1,87 @@
-inherit base
-
-# use autotools_stage_all for native packages
-AUTOTOOLS_NATIVE_STAGE_INSTALL = "1"
-
def autotools_dep_prepend(d):
- import bb;
-
- if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1):
+ if d.getVar('INHIBIT_AUTOTOOLS_DEPS', True):
return ''
- pn = bb.data.getVar('PN', d, 1)
+ pn = d.getVar('PN', True)
deps = ''
- if pn in ['autoconf-native', 'automake-native']:
+ if pn in ['autoconf-native', 'automake-native', 'help2man-native']:
return deps
deps += 'autoconf-native automake-native '
- if not pn in ['libtool', 'libtool-native', 'libtool-cross']:
+ if not pn in ['libtool', 'libtool-native'] and not pn.endswith("libtool-cross"):
deps += 'libtool-native '
if not bb.data.inherits_class('native', d) \
+ and not bb.data.inherits_class('nativesdk', d) \
and not bb.data.inherits_class('cross', d) \
- and not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1):
+ and not d.getVar('INHIBIT_DEFAULT_DEPS', True):
deps += 'libtool-cross '
return deps + 'gnu-config-native '
EXTRA_OEMAKE = ""
+
DEPENDS_prepend = "${@autotools_dep_prepend(d)}"
+
+inherit siteinfo
+
+# Space separated list of shell scripts with variables defined to supply test
+# results for autoconf tests we cannot run at build time.
+export CONFIG_SITE = "${@siteinfo_get_files(d)}"
+
acpaths = "default"
EXTRA_AUTORECONF = "--exclude=autopoint"
+export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
+
def autotools_set_crosscompiling(d):
- import bb
if not bb.data.inherits_class('native', d):
return " cross_compiling=yes"
return ""
+def append_libtool_sysroot(d):
+ # Only supply libtool sysroot option for non-native packages
+ if not bb.data.inherits_class('native', d):
+ return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
+ return ""
+
# EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
+CONFIGUREOPTS = " --build=${BUILD_SYS} \
+ --host=${HOST_SYS} \
+ --target=${TARGET_SYS} \
+ --prefix=${prefix} \
+ --exec_prefix=${exec_prefix} \
+ --bindir=${bindir} \
+ --sbindir=${sbindir} \
+ --libexecdir=${libexecdir} \
+ --datadir=${datadir} \
+ --sysconfdir=${sysconfdir} \
+ --sharedstatedir=${sharedstatedir} \
+ --localstatedir=${localstatedir} \
+ --libdir=${libdir} \
+ --includedir=${includedir} \
+ --oldincludedir=${oldincludedir} \
+ --infodir=${infodir} \
+ --mandir=${mandir} \
+ --disable-silent-rules \
+ ${CONFIGUREOPT_DEPTRACK} \
+ ${@append_libtool_sysroot(d)}"
+CONFIGUREOPT_DEPTRACK = "--disable-dependency-tracking"
+
+
oe_runconf () {
- if [ -x ${S}/configure ] ; then
- cfgcmd="${S}/configure \
- --build=${BUILD_SYS} \
- --host=${HOST_SYS} \
- --target=${TARGET_SYS} \
- --prefix=${prefix} \
- --exec_prefix=${exec_prefix} \
- --bindir=${bindir} \
- --sbindir=${sbindir} \
- --libexecdir=${libexecdir} \
- --datadir=${datadir} \
- --sysconfdir=${sysconfdir} \
- --sharedstatedir=${sharedstatedir} \
- --localstatedir=${localstatedir} \
- --libdir=${libdir} \
- --includedir=${includedir} \
- --oldincludedir=${oldincludedir} \
- --infodir=${infodir} \
- --mandir=${mandir} \
- ${EXTRA_OECONF} \
- $@"
- oenote "Running $cfgcmd..."
- $cfgcmd || oefatal "oe_runconf failed"
+ cfgscript="${S}/configure"
+ if [ -x "$cfgscript" ] ; then
+ bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
+ ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@" || bbfatal "oe_runconf failed"
else
- oefatal "no configure script found"
+ bbfatal "no configure script found at $cfgscript"
fi
}
+AUTOTOOLS_AUXDIR ?= "${S}"
+
autotools_do_configure() {
case ${PN} in
autoconf*)
@@ -88,6 +103,8 @@ autotools_do_configure() {
if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
olddir=`pwd`
cd ${S}
+ # Remove any previous copy of the m4 macros
+ rm -rf ${B}/aclocal-copy/
if [ x"${acpaths}" = xdefault ]; then
acpaths=
for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
@@ -100,9 +117,19 @@ autotools_do_configure() {
AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
automake --version
echo "AUTOV is $AUTOV"
- install -d ${STAGING_DATADIR}/aclocal
- install -d ${STAGING_DATADIR}/aclocal-$AUTOV
- acpaths="$acpaths -I${STAGING_DATADIR}/aclocal-$AUTOV -I ${STAGING_DATADIR}/aclocal"
+ if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then
+ acpaths="$acpaths -I${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV"
+ fi
+ # The aclocal directory could get modified by other processes
+ # uninstalling data from the sysroot. See Yocto #861 for details.
+ # We avoid this by taking a copy here and then files cannot disappear.
+ if [ -d ${STAGING_DATADIR}/aclocal ]; then
+ mkdir -p ${B}/aclocal-copy/
+ # for scratch build this directory can be empty
+ # so avoid cp's no files to copy error
+ cp -r ${STAGING_DATADIR}/aclocal/. ${B}/aclocal-copy/
+ acpaths="$acpaths -I ${B}/aclocal-copy/"
+ fi
# autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
# like it was auto-generated. Work around this by blowing it away
# by hand, unless the package specifically asked not to run aclocal.
@@ -114,21 +141,30 @@ autotools_do_configure() {
else
CONFIGURE_AC=configure.ac
fi
- if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
- if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
- : do nothing -- we still have an old unmodified configure.ac
- else
- oenote Executing glib-gettextize --force --copy
- echo "no" | glib-gettextize --force --copy
+ if ! echo ${EXTRA_OECONF} | grep -q "\-\-disable-nls"; then
+ if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
+ if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
+ : do nothing -- we still have an old unmodified configure.ac
+ else
+ bbnote Executing glib-gettextize --force --copy
+ echo "no" | glib-gettextize --force --copy
+ fi
+ else if grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
+ # We'd call gettextize here if it wasn't so broken...
+ cp ${STAGING_DATADIR}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
+ if [ -d ${S}/po/ -a ! -e ${S}/po/Makefile.in.in ]; then
+ cp ${STAGING_DATADIR}/gettext/po/Makefile.in.in ${S}/po/
+ fi
fi
fi
- if grep "^[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
- oenote Executing intltoolize --copy --force --automake
- intltoolize --copy --force --automake
fi
- oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
mkdir -p m4
- autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
+ if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
+ bbnote Executing intltoolize --copy --force --automake
+ intltoolize --copy --force --automake
+ fi
+ bbnote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
+ autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || bbfatal "autoreconf execution failed."
cd $olddir
fi
;;
@@ -136,93 +172,18 @@ autotools_do_configure() {
if [ -e ${S}/configure ]; then
oe_runconf
else
- oenote "nothing to configure"
+ bbnote "nothing to configure"
fi
}
autotools_do_install() {
oe_runmake 'DESTDIR=${D}' install
-
- for i in `find ${D} -name "*.la"` ; do \
- sed -i -e s:${STAGING_LIBDIR}:${libdir}:g $i
- sed -i -e s:${D}::g $i
- sed -i -e 's:-I${WORKDIR}\S*: :g' $i
- sed -i -e 's:-L${WORKDIR}\S*: :g' $i
- done
-}
-
-STAGE_TEMP="${WORKDIR}/temp-staging"
-
-autotools_stage_includes() {
- if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ]
- then
- rm -rf ${STAGE_TEMP}
- mkdir -p ${STAGE_TEMP}
- make DESTDIR="${STAGE_TEMP}" install
- cp -pPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR}
- rm -rf ${STAGE_TEMP}
+ # Info dir listing isn't interesting at this point so remove it if it exists.
+ if [ -e "${D}${infodir}/dir" ]; then
+ rm -f ${D}${infodir}/dir
fi
}
-autotools_stage_dir() {
- from="$1"
- to="$2"
- # This will remove empty directories so we can ignore them
- rmdir "$from" 2> /dev/null || true
- if [ -d "$from" ]; then
- mkdir -p "$to"
- cp -fpPR "$from"/* "$to"
- fi
-}
-
-autotools_stage_libdir() {
- from="$1"
- to="$2"
-
- olddir=`pwd`
- cd $from
- las=$(find . -name \*.la -type f)
- cd $olddir
- echo "Found la files: $las"
- for i in $las
- do
- sed -e 's/^installed=yes$/installed=no/' \
- -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \
- -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \
- -i $from/$i
- done
- autotools_stage_dir $from $to
-}
-
-
-autotools_stage_all() {
- if [ "${INHIBIT_AUTO_STAGE}" = "1" ]
- then
- return
- fi
- rm -rf ${STAGE_TEMP}
- mkdir -p ${STAGE_TEMP}
- oe_runmake DESTDIR="${STAGE_TEMP}" install
- autotools_stage_dir ${STAGE_TEMP}/${includedir} ${STAGING_INCDIR}
- if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
- autotools_stage_dir ${STAGE_TEMP}/${bindir} ${STAGING_DIR_HOST}${layout_bindir}
- autotools_stage_dir ${STAGE_TEMP}/${sbindir} ${STAGING_DIR_HOST}${layout_sbindir}
- autotools_stage_dir ${STAGE_TEMP}/${base_bindir} ${STAGING_DIR_HOST}${layout_base_bindir}
- autotools_stage_dir ${STAGE_TEMP}/${base_sbindir} ${STAGING_DIR_HOST}${layout_base_sbindir}
- autotools_stage_dir ${STAGE_TEMP}/${libexecdir} ${STAGING_DIR_HOST}${layout_libexecdir}
- fi
- if [ -d ${STAGE_TEMP}/${libdir} ]
- then
- autotools_stage_libdir ${STAGE_TEMP}/${libdir} ${STAGING_LIBDIR}
- fi
- if [ -d ${STAGE_TEMP}/${base_libdir} ]
- then
- autotools_stage_libdir ${STAGE_TEMP}/${base_libdir} ${STAGING_DIR_HOST}${layout_base_libdir}
- fi
- rm -rf ${STAGE_TEMP}/${mandir} || true
- rm -rf ${STAGE_TEMP}/${infodir} || true
- autotools_stage_dir ${STAGE_TEMP}/${datadir} ${STAGING_DATADIR}
- #rm -rf ${STAGE_TEMP}
-}
+inherit siteconfig
EXPORT_FUNCTIONS do_configure do_install