On 23/11/16 01:23, Vinson Lee wrote:
Signed-off-by: Vinson Lee <v...@freedesktop.org>
---
 scons/llvm.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/scons/llvm.py b/scons/llvm.py
index 977e47a..a27bf00 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -194,11 +194,16 @@ def generate(env):
                 # that.
                 env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
     else:
-        if not env.Detect('llvm-config'):
+        if os.environ.has_key('LLVM_CONFIG'):
+            env['LLVM_CONFIG'] = os.environ['LLVM_CONFIG']
+        else:
+            env['LLVM_CONFIG'] = 'llvm-config'

Instead of the if, you could just do here

   env['LLVM_CONFIG'] = os.environ.get('LLVM_CONFIG', 'llvm-config')

I also don't see the need of setting env['LLVM_CONFIG']. You could just store in a local var, llvm_config:

  llvm_config = os.environ.get('LLVM_CONFIG', 'llvm-config')

And it's better upddate common.py too:

diff --git a/common.py b/common.py
index 704ad2e..24a7e8a 100644
--- a/common.py
+++ b/common.py
@@ -59,7 +59,7 @@ if target_platform == 'windows' and host_platform != 'windows':


 # find default_llvm value
-if 'LLVM' in os.environ:
+if 'LLVM' in os.environ or 'LLVM_CONFIG' in os.environ:
     default_llvm = 'yes'
 else:
     default_llvm = 'no'



Otherwise looks good.

Jose

+
+        if not env.Detect(env['LLVM_CONFIG']):
             print 'scons: llvm-config script not found'
             return

-        llvm_version = env.backtick('llvm-config --version').rstrip()
+        llvm_version = env.backtick('%s --version' % 
env['LLVM_CONFIG']).rstrip()
         llvm_version = distutils.version.LooseVersion(llvm_version)

         if llvm_version < 
distutils.version.LooseVersion(required_llvm_version):
@@ -208,7 +213,7 @@ def generate(env):
         try:
             # Treat --cppflags specially to prevent NDEBUG from disabling
             # assertion failures in debug builds.
-            cppflags = env.ParseFlags('!llvm-config --cppflags')
+            cppflags = env.ParseFlags('!%s --cppflags' % env['LLVM_CONFIG'])
             try:
                 cppflags['CPPDEFINES'].remove('NDEBUG')
             except ValueError:
@@ -216,16 +221,16 @@ def generate(env):
             env.MergeFlags(cppflags)

             # Match llvm --fno-rtti flag
-            cxxflags = env.backtick('llvm-config --cxxflags').split()
+            cxxflags = env.backtick('%s --cxxflags' % 
env['LLVM_CONFIG']).split()
             if '-fno-rtti' in cxxflags:
                 env.Append(CXXFLAGS = ['-fno-rtti'])

             components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 
'mcdisassembler', 'irreader']

-            env.ParseConfig('llvm-config --libs ' + ' '.join(components))
-            env.ParseConfig('llvm-config --ldflags')
+            env.ParseConfig('%s --libs ' % env['LLVM_CONFIG'] + ' 
'.join(components))
+            env.ParseConfig('%s --ldflags' % env['LLVM_CONFIG'])
             if llvm_version >= distutils.version.LooseVersion('3.5'):
-                env.ParseConfig('llvm-config --system-libs')
+                env.ParseConfig('%s --system-libs' % env['LLVM_CONFIG'])
                 env.Append(CXXFLAGS = ['-std=c++11'])
         except OSError:
             print 'scons: llvm-config version %s failed' % llvm_version


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to