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")
+# Import env variables only if reproductibility is ensured
+if target_os in ['yocto']:
+ env['CONFIG_ENVIRONMENT_IMPORT'] = True
+else:
+ env['CONFIG_ENVIRONMENT_IMPORT'] = False
+
+if env['CONFIG_ENVIRONMENT_IMPORT'] == True:
+ print "warning: importing some environment variables for OS: %s" % target_os
+ for ev in ['PATH', 'PKG_CONFIG', 'PKG_CONFIG_PATH', 'PKG_CONFIG_SYSROOT_DIR']:
+ if os.environ.get(ev) != None:
+ env['ENV'][ev] = os.environ.get(ev)
+ if os.environ['LDFLAGS'] != None:
+ env.AppendUnique(LINKFLAGS = Split(os.environ['LDFLAGS']))
# Ensure scons be able to change its working directory
env.SConscriptChdir(1)
env[tool] = os.path.join(path, os.environ[tool])
break
env['CROSS_COMPILE'] = target_prefix[:len(target_prefix) - 1]
- if os.environ['LDFLAGS'] != None:
- env.AppendUnique(LINKFLAGS = Split(os.environ['LDFLAGS']))
except:
print "ERROR in Yocto cross-toolchain environment"
Exit(1)