From cc891c91c99e0240baad53a839f4a58219718248 Mon Sep 17 00:00:00 2001 From: Adeel Arshad Date: Fri, 7 Oct 2016 14:58:17 +0500 Subject: [PATCH] set the scons construction environment propogate the external environment to scons construction environment. Signed-off-by: Adeel Arshad --- CodeXL/Components/GpuProfiling/Build/SConstruct | 18 ++++++++++++++++++ CodeXL/Components/Graphics/SConstruct | 19 +++++++++++++++++++ CodeXL/SConstruct | 18 ++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/CodeXL/Components/GpuProfiling/Build/SConstruct b/CodeXL/Components/GpuProfiling/Build/SConstruct index 90a36bb..94f5b6a 100755 --- a/CodeXL/Components/GpuProfiling/Build/SConstruct +++ b/CodeXL/Components/GpuProfiling/Build/SConstruct @@ -13,6 +13,24 @@ from CXL_init import * # CXL_vars = Variables(None) +# update CXL_env as per the external environment +# Set defaults from environment. Note that scons doesn't cope well +# with multi-word CPPFLAGS/LDFLAGS/SHLINKFLAGS values; you'll have to +# explicitly quote them or (better yet) use the "=" form of GNU option +# settings. + +for key, value in os.environ.items(): + if key in ("CFLAGS", "CCFLAGS", "LINKFLAGS"): + CXL_env.Replace(**{key: Split(os.getenv(key))}) + elif key in ("LDFLAGS", "SHLINKFLAGS"): + pass + else: + CXL_env.Replace(**{key: os.getenv(key)}) + +for flag in ["LDFLAGS", "SHLINKFLAGS"]: + if os.environ.has_key(flag): + CXL_env.MergeFlags({flag : [os.getenv(flag)]}) + # Initial CXL_vars scons construction variables initCXLVars(CXL_vars) diff --git a/CodeXL/Components/Graphics/SConstruct b/CodeXL/Components/Graphics/SConstruct index 92998aa..71defea 100644 --- a/CodeXL/Components/Graphics/SConstruct +++ b/CodeXL/Components/Graphics/SConstruct @@ -20,6 +20,25 @@ GPS_vars.Add('GPS_arch', 'Set to x86 for 32 bit build', 0) GPS_env = Environment( variables = GPS_vars, ENV = os.environ) + +# update GPS_env as per the external environment +# Set defaults from environment. Note that scons doesn't cope well +# with multi-word CPPFLAGS/LDFLAGS/SHLINKFLAGS values; you'll have to +# explicitly quote them or (better yet) use the "=" form of GNU option +# settings. + +for key, value in os.environ.items(): + if key in ("CFLAGS", "CCFLAGS", "LINKFLAGS"): + GPS_env.Replace(**{key: Split(os.getenv(key))}) + elif key in ("LDFLAGS", "SHLINKFLAGS"): + pass + else: + GPS_env.Replace(**{key: os.getenv(key)}) + +for flag in ["LDFLAGS", "SHLINKFLAGS"]: + if os.environ.has_key(flag): + GPS_env.MergeFlags({flag : [os.getenv(flag)]}) + Help(GPS_vars.GenerateHelpText(GPS_env)) # Set the version of PerfAPI that is being used diff --git a/CodeXL/SConstruct b/CodeXL/SConstruct index a602f6a..8923020 100755 --- a/CodeXL/SConstruct +++ b/CodeXL/SConstruct @@ -34,6 +34,24 @@ CXL_env = Environment( variables = CXL_vars, ENV = os.environ) +# update CXL_env as per the external environment +# Set defaults from environment. Note that scons doesn't cope well +# with multi-word CPPFLAGS/LDFLAGS/SHLINKFLAGS values; you'll have to +# explicitly quote them or (better yet) use the "=" form of GNU option +# settings. + +for key, value in os.environ.items(): + if key in ("CFLAGS", "CCFLAGS", "LINKFLAGS"): + CXL_env.Replace(**{key: Split(os.getenv(key))}) + elif key in ("LDFLAGS", "SHLINKFLAGS"): + pass + else: + CXL_env.Replace(**{key: os.getenv(key)}) + +for flag in ["LDFLAGS", "SHLINKFLAGS"]: + if os.environ.has_key(flag): + CXL_env.MergeFlags({flag : [os.getenv(flag)]}) + # CXL build initialization initCXLBuild (CXL_env) -- 1.9.1