aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-devtools/codexl/codexl/0003-set-the-scons-construction-environment.patch
blob: 7b790d9227bae4fb0fead94d31c4e8be1d2e602a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
From cc891c91c99e0240baad53a839f4a58219718248 Mon Sep 17 00:00:00 2001
From: Adeel Arshad <adeel_arshad@mentor.com>
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 <adeel_arshad@mentor.com>
---
 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