diff options
Diffstat (limited to 'import-layers/yocto-poky/meta/classes/autotools.bbclass')
-rw-r--r-- | import-layers/yocto-poky/meta/classes/autotools.bbclass | 112 |
1 files changed, 79 insertions, 33 deletions
diff --git a/import-layers/yocto-poky/meta/classes/autotools.bbclass b/import-layers/yocto-poky/meta/classes/autotools.bbclass index 6649f5df7..c43ea9a7e 100644 --- a/import-layers/yocto-poky/meta/classes/autotools.bbclass +++ b/import-layers/yocto-poky/meta/classes/autotools.bbclass @@ -19,15 +19,13 @@ def autotools_dep_prepend(d): 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, False)}" +export CONFIG_SITE = "${@siteinfo_get_files(d)}" acpaths = "default" EXTRA_AUTORECONF = "--exclude=autopoint" @@ -77,6 +75,8 @@ CONFIGUREOPTS = " --build=${BUILD_SYS} \ ${@append_libtool_sysroot(d)}" CONFIGUREOPT_DEPTRACK ?= "--disable-dependency-tracking" +CACHED_CONFIGUREVARS ?= "" + AUTOTOOLS_SCRIPT_PATH ?= "${S}" CONFIGURE_SCRIPT ?= "${AUTOTOOLS_SCRIPT_PATH}/configure" @@ -85,7 +85,7 @@ AUTOTOOLS_AUXDIR ?= "${AUTOTOOLS_SCRIPT_PATH}" oe_runconf () { # Use relative path to avoid buildpaths in files cfgscript_name="`basename ${CONFIGURE_SCRIPT}`" - cfgscript=`python -c "import os; print os.path.relpath(os.path.dirname('${CONFIGURE_SCRIPT}'), '.')"`/$cfgscript_name + cfgscript=`python3 -c "import os; print(os.path.relpath(os.path.dirname('${CONFIGURE_SCRIPT}'), '.'))"`/$cfgscript_name if [ -x "$cfgscript" ] ; then bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@" if ! ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"; then @@ -129,12 +129,16 @@ autotools_postconfigure(){ EXTRACONFFUNCS ??= "" +EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" + do_configure[prefuncs] += "autotools_preconfigure autotools_copy_aclocals ${EXTRACONFFUNCS}" do_configure[postfuncs] += "autotools_postconfigure" -ACLOCALDIR = "${B}/aclocal-copy" +ACLOCALDIR = "${WORKDIR}/aclocal-copy" python autotools_copy_aclocals () { + import copy + s = d.getVar("AUTOTOOLS_SCRIPT_PATH", True) if not os.path.exists(s + "/configure.in") and not os.path.exists(s + "/configure.ac"): if not d.getVar("AUTOTOOLS_COPYACLOCAL", False): @@ -163,36 +167,63 @@ python autotools_copy_aclocals () { if start is None: bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?") - # We need to find configure tasks which are either from <target> -> <target> - # or <native> -> <native> but not <target> -> <native> unless they're direct - # dependencies. This mirrors what would get restored from sstate. - done = [start] - next = [start] + # We need to figure out which m4 files we need to expose to this do_configure task. + # This needs to match what would get restored from sstate, which is controlled + # ultimately by calls from bitbake to setscene_depvalid(). + # That function expects a setscene dependency tree. We build a dependency tree + # condensed to do_populate_sysroot -> do_populate_sysroot dependencies, similar to + # that used by setscene tasks. We can then call into setscene_depvalid() and decide + # which dependencies we can "see" and should expose the m4 files for. + setscenedeps = copy.deepcopy(taskdepdata) + + start = set([start]) + + # Create collapsed do_populate_sysroot -> do_populate_sysroot tree + for dep in taskdepdata: + data = setscenedeps[dep] + if data[1] != "do_populate_sysroot": + for dep2 in setscenedeps: + data2 = setscenedeps[dep2] + if dep in data2[3]: + data2[3].update(setscenedeps[dep][3]) + data2[3].remove(dep) + if dep in start: + start.update(setscenedeps[dep][3]) + start.remove(dep) + del setscenedeps[dep] + + # Remove circular references + for dep in setscenedeps: + if dep in setscenedeps[dep][3]: + setscenedeps[dep][3].remove(dep) + + # Direct dependencies should be present and can be depended upon + for dep in start: + configuredeps.append(setscenedeps[dep][0]) + + # Call into setscene_depvalid for each sub-dependency and only copy m4 files + # for ones that would be restored from sstate. + done = list(start) + next = list(start) while next: new = [] for dep in next: - data = taskdepdata[dep] + data = setscenedeps[dep] for datadep in data[3]: if datadep in done: continue - if (not data[0].endswith("-native")) and taskdepdata[datadep][0].endswith("-native") and dep != start: + taskdeps = {} + taskdeps[dep] = setscenedeps[dep][:2] + taskdeps[datadep] = setscenedeps[datadep][:2] + retval = setscene_depvalid(datadep, taskdeps, [], d) + if retval: + bb.note("Skipping setscene dependency %s for m4 macro copying" % datadep) continue done.append(datadep) new.append(datadep) - if taskdepdata[datadep][1] == "do_configure": - configuredeps.append(taskdepdata[datadep][0]) + configuredeps.append(setscenedeps[datadep][0]) next = new - #configuredeps2 = [] - #for dep in taskdepdata: - # data = taskdepdata[dep] - # if data[1] == "do_configure" and data[0] != pn: - # configuredeps2.append(data[0]) - #configuredeps.sort() - #configuredeps2.sort() - #bb.warn(str(configuredeps)) - #bb.warn(str(configuredeps2)) - cp = [] if nodeps: bb.warn("autotools: Unable to find task dependencies, -b being used? Pulling in all m4 files") @@ -222,11 +253,14 @@ python autotools_copy_aclocals () { t = os.path.join(aclocaldir, os.path.basename(c)) if not os.path.exists(t): os.symlink(c, t) - - d.setVar("CONFIG_SITE", siteinfo_get_files(d, False)) + + # Refresh variable with cache files + d.setVar("CONFIG_SITE", siteinfo_get_files(d, aclocalcache=True)) } autotools_copy_aclocals[vardepsexclude] += "MACHINE SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA" +CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am" + autotools_do_configure() { # WARNING: gross hack follows: # An autotools built package generally needs these scripts, however only @@ -236,6 +270,9 @@ autotools_do_configure() { # for a package whose autotools are old, on an x86_64 machine, which the old # config.sub does not support. Work around this by installing them manually # regardless. + + PRUNE_M4="" + for ac in `find ${S} -ignore_readdir_race -name configure.in -o -name configure.ac`; do rm -f `dirname $ac`/configure done @@ -246,7 +283,7 @@ autotools_do_configure() { if [ x"${acpaths}" = xdefault ]; then acpaths= for i in `find ${AUTOTOOLS_SCRIPT_PATH} -ignore_readdir_race -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \ - grep -v 'acinclude.m4' | grep -v 'aclocal-copy' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do + grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do acpaths="$acpaths -I $i" done else @@ -285,17 +322,22 @@ autotools_do_configure() { cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/ fi fi - for i in gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4; do - for j in `find ${S} -ignore_readdir_race -name $i | grep -v aclocal-copy`; do - rm $j - done - done + PRUNE_M4="$PRUNE_M4 gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4" fi mkdir -p m4 if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then + if ! echo "${DEPENDS}" | grep -q intltool-native; then + bbwarn "Missing DEPENDS on intltool-native" + fi + PRUNE_M4="$PRUNE_M4 intltool.m4" bbnote Executing intltoolize --copy --force --automake intltoolize --copy --force --automake fi + + for i in $PRUNE_M4; do + find ${S} -ignore_readdir_race -name $i -delete + done + bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths ACLOCAL="$ACLOCAL" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || die "autoreconf execution failed." cd $olddir @@ -307,6 +349,10 @@ autotools_do_configure() { fi } +autotools_do_compile() { + oe_runmake +} + autotools_do_install() { oe_runmake 'DESTDIR=${D}' install # Info dir listing isn't interesting at this point so remove it if it exists. @@ -317,6 +363,6 @@ autotools_do_install() { inherit siteconfig -EXPORT_FUNCTIONS do_configure do_install +EXPORT_FUNCTIONS do_configure do_compile do_install B = "${WORKDIR}/build" |