autotools.bbclass: Specify a value of sysroot instead of asking the compiler
authorKhem Raj <raj.khem@gmail.com>
Fri, 22 Oct 2010 22:10:08 +0000 (15:10 -0700)
committerKhem Raj <raj.khem@gmail.com>
Sun, 24 Oct 2010 01:56:15 +0000 (18:56 -0700)
If we just use --with-libtool-sysroot then it asks the compiler at
configure time to supply the sysroot which will not work with external
toolchains because they may have different default sysroot encoded into
them. Therefore we specify the sysroot so the configure can use that
value and not depend upon compiler to supply one.

We do not do it for native recipes as the native compiler should
fall back to /usr prefix and not solely depend on sysroot otherwise
we end up staging everything in native sysroot before we start to build
target recipes

Signed-off-by: Khem Raj <raj.khem@gmail.com>
classes/autotools.bbclass

index 97bc47c..3d8bcb5 100644 (file)
@@ -57,6 +57,14 @@ def autotools_set_crosscompiling(d):
                return " cross_compiling=yes"
        return ""
 
+def append_libtool_sysroot(d):
+       if bb.data.getVar('LIBTOOL_HAS_SYSROOT', d, 1) == "yes":
+               if bb.data.getVar('BUILD_SYS', d, 1) == bb.data.getVar('HOST_SYS', d, 1):
+                       return '--with-libtool-sysroot'
+               else:
+                       return '--with-libtool-sysroot=${STAGING_DIR}/${MULTIMACH_HOST_SYS}'
+       return ''
+
 # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
 
 CONFIGUREOPTS = " --build=${BUILD_SYS} \
@@ -76,7 +84,7 @@ CONFIGUREOPTS = " --build=${BUILD_SYS} \
                  --oldincludedir=${oldincludedir} \
                  --infodir=${infodir} \
                  --mandir=${mandir} \
-                 ${@["","--with-libtool-sysroot"][bb.data.getVar('LIBTOOL_HAS_SYSROOT', d, 1) == "yes"]} \
+                 ${@append_libtool_sysroot(d)} \
                "
 
 oe_runconf () {