Mesa (master): scons: Only override scons CC selection in the embedded platform.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Feb 4 19:38:48 UTC 2010


Module: Mesa
Branch: master
Commit: 9f151f93e69e988508d480beb36adb7674434ea7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f151f93e69e988508d480beb36adb7674434ea7

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Feb  4 19:37:30 2010 +0000

scons: Only override scons CC selection in the embedded platform.

---

 scons/gallium.py |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/scons/gallium.py b/scons/gallium.py
index a9a8b83..7f42c76 100644
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -110,8 +110,21 @@ def generate(env):
             env['toolchain'] = 'wcesdk'
     env.Tool(env['toolchain'])
 
-    if os.environ.has_key('CC'):
-        env['CC'] = os.environ['CC']
+    if env['platform'] == 'embedded':
+        # Allow overriding compiler from environment
+        if os.environ.has_key('CC'):
+            env['CC'] = os.environ['CC']
+            # Update CCVERSION to match
+            pipe = SCons.Action._subproc(env, [env['CC'], '--version'],
+                                         stdin = 'devnull',
+                                         stderr = 'devnull',
+                                         stdout = subprocess.PIPE)
+            if pipe.wait() == 0:
+                line = pipe.stdout.readline()
+                match = re.search(r'[0-9]+(\.[0-9]+)+', line)
+                if match:
+                    env['CCVERSION'] = match.group(0)
+            
 
     env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
     env['msvc'] = env['CC'] == 'cl'
@@ -238,16 +251,7 @@ def generate(env):
     cxxflags = [] # C++
     ccflags = [] # C & C++
     if gcc:
-        ccversion = ''
-        pipe = SCons.Action._subproc(env, [env['CC'], '--version'],
-                                     stdin = 'devnull',
-                                     stderr = 'devnull',
-                                     stdout = subprocess.PIPE)
-        if pipe.wait() == 0:
-            line = pipe.stdout.readline()
-            match = re.search(r'[0-9]+(\.[0-9]+)+', line)
-            if match:
-            	ccversion = match.group(0)
+        ccversion = env['CCVERSION']
         if debug:
             ccflags += ['-O0', '-g3']
         elif ccversion.startswith('4.2.'):




More information about the mesa-commit mailing list