Build: Export pkg-config when cross compiling using yocto
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 12 May 2016 17:48:14 +0000 (19:48 +0200)
committerJon A. Cruz <jon@joncruz.org>
Tue, 14 Jun 2016 06:01:37 +0000 (06:01 +0000)
Without this change, host's /usr/include may be used which is unwanted.
This was obsevered when building with Yocto jethro setup
with security checks (LfAgl).

While this change has been done for crosscompiling purpose,
it make sense to have this in all contexts.
(ie: those which don't set CROSS_COMPILE variable)

Bug-AGL: https://jira.automotivelinux.org/browse/SPEC-158
Origin: https://github.com/tizenteam/iotivity
Change-Id: I3027642c77cc27f2072cdc22886aa09e124cdf4c
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8125
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: David Antler <david.a.antler@intel.com>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
build_common/SConscript

index 2be70ce3c2552d755a736797bee8bc51aaf6c633..c5651f6c4f4b42d0301bb08dc4979acdf74976c2 100644 (file)
@@ -180,6 +180,14 @@ if target_os in targets_support_cc:
        if prefix or tc_path:
                print tc_set_msg
 
+# If cross-compiling, honor environment settings for toolchain to avoid picking up native tools
+if os.environ.get('PKG_CONFIG') != None:
+       env["ENV"]["PKG_CONFIG"] = os.environ.get("PKG_CONFIG")
+if os.environ.get('PKG_CONFIG_PATH') != None:
+       env["ENV"]["PKG_CONFIG_PATH"] = os.environ.get("PKG_CONFIG_PATH")
+if os.environ.get('PKG_CONFIG_SYSROOT_DIR') != None:
+       env["ENV"]["PKG_CONFIG_SYSROOT_DIR"] = os.environ.get("PKG_CONFIG_SYSROOT_DIR")
+
 # Ensure scons be able to change its working directory
 env.SConscriptChdir(1)