diff options
Diffstat (limited to 'scons')
-rw-r--r-- | scons/crossmingw.py | 3 | ||||
-rw-r--r-- | scons/custom.py | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | scons/gallium.py | 52 | ||||
-rw-r--r-- | scons/llvm.py | 4 | ||||
-rw-r--r-- | scons/udis86.py | 44 |
5 files changed, 54 insertions, 51 deletions
diff --git a/scons/crossmingw.py b/scons/crossmingw.py index 8af0d93f01a..cc046229e2c 100644 --- a/scons/crossmingw.py +++ b/scons/crossmingw.py @@ -194,5 +194,8 @@ def generate(env): env.AppendUnique(SHLINKFLAGS = ['-Wl,--enable-stdcall-fixup']) #env.AppendUnique(SHLINKFLAGS = ['-Wl,--kill-at']) + # Avoid depending on gcc runtime DLLs + env.AppendUnique(LINKFLAGS = ['-static-libgcc']) + def exists(env): return find(env) diff --git a/scons/custom.py b/scons/custom.py index 364da292dd3..7c59fe985d0 100644 --- a/scons/custom.py +++ b/scons/custom.py @@ -56,6 +56,8 @@ def quietCommandLines(env): env['SHLINKCOMSTR'] = " Linking $TARGET ..." env['LDMODULECOMSTR'] = " Linking $TARGET ..." env['SWIGCOMSTR'] = " Generating $TARGET ..." + env['LEXCOMSTR'] = " Generating $TARGET ..." + env['YACCCOMSTR'] = " Generating $TARGET ..." env['CODEGENCOMSTR'] = " Generating $TARGET ..." diff --git a/scons/gallium.py b/scons/gallium.py index 75e9b9e7fc3..4dcb8d0a423 100644..100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -35,6 +35,7 @@ import os import os.path import re import subprocess +import platform as _platform import SCons.Action import SCons.Builder @@ -141,6 +142,10 @@ def pkg_config_modules(env, name, modules): def generate(env): """Common environment generation code""" + # Tell tools which machine to compile for + env['TARGET_ARCH'] = env['machine'] + env['MSVS_ARCH'] = env['machine'] + # Toolchain platform = env['platform'] if env['toolchain'] == 'default': @@ -175,6 +180,10 @@ def generate(env): env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-') env['msvc'] = env['CC'] == 'cl' + if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64': + # MSVC x64 support is broken in earlier versions of scons + env.EnsurePythonVersion(2, 0) + # shortcuts machine = env['machine'] platform = env['platform'] @@ -183,6 +192,27 @@ def generate(env): gcc = env['gcc'] msvc = env['msvc'] + # Determine whether we are cross compiling; in particular, whether we need + # to compile code generators with a different compiler as the target code. + host_platform = _platform.system().lower() + if host_platform.startswith('cygwin'): + host_platform = 'cygwin' + host_machine = os.environ.get('PROCESSOR_ARCHITEW6432', os.environ.get('PROCESSOR_ARCHITECTURE', _platform.machine())) + host_machine = { + 'x86': 'x86', + 'i386': 'x86', + 'i486': 'x86', + 'i586': 'x86', + 'i686': 'x86', + 'ppc' : 'ppc', + 'AMD64': 'x86_64', + 'x86_64': 'x86_64', + }.get(host_machine, 'generic') + env['crosscompile'] = platform != host_platform + if machine == 'x86_64' and host_machine != 'x86_64': + env['crosscompile'] = True + env['hostonly'] = False + # Backwards compatability with the debug= profile= options if env['build'] == 'debug': if not env['debug']: @@ -349,12 +379,15 @@ def generate(env): '-m32', #'-march=pentium4', ] - if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2'): + if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2') \ + and (platform != 'windows' or env['build'] == 'debug' or True): # NOTE: We need to ensure stack is realigned given that we # produce shared objects, and have no control over the stack # alignment policy of the application. Therefore we need # -mstackrealign ore -mincoming-stack-boundary=2. # + # XXX: -O and -mstackrealign causes stack corruption on MinGW + # # XXX: We could have SSE without -mstackrealign if we always used # __attribute__((force_align_arg_pointer)), but that's not # always the case. @@ -402,13 +435,19 @@ def generate(env): '/Od', # disable optimizations '/Oi', # enable intrinsic functions '/Oy-', # disable frame pointer omission - '/GL-', # disable whole program optimization ] else: ccflags += [ '/O2', # optimize for speed + ] + if env['build'] == 'release': + ccflags += [ '/GL', # enable whole program optimization ] + else: + ccflags += [ + '/GL-', # disable whole program optimization + ] ccflags += [ '/fp:fast', # fast floating point '/W3', # warning level @@ -498,7 +537,7 @@ def generate(env): else: env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group' if msvc: - if env['build'] != 'debug': + if env['build'] == 'release': # enable Link-time Code Generation linkflags += ['/LTCG'] env.Append(ARFLAGS = ['/LTCG']) @@ -551,13 +590,18 @@ def generate(env): env.Append(LINKFLAGS = linkflags) env.Append(SHLINKFLAGS = shlinkflags) + # We have C++ in several libraries, so always link with the C++ compiler + if env['gcc']: + env['LINK'] = env['CXX'] + # Default libs env.Append(LIBS = []) # Load tools + env.Tool('lex') + env.Tool('yacc') if env['llvm']: env.Tool('llvm') - env.Tool('udis86') pkg_config_modules(env, 'x11', ['x11', 'xext']) pkg_config_modules(env, 'drm', ['libdrm']) diff --git a/scons/llvm.py b/scons/llvm.py index 1b033acb1b3..b89899bbf87 100644 --- a/scons/llvm.py +++ b/scons/llvm.py @@ -142,13 +142,11 @@ def generate(env): try: env.ParseConfig('llvm-config --cppflags') - env.ParseConfig('llvm-config --libs jit interpreter nativecodegen bitwriter') + env.ParseConfig('llvm-config --libs') env.ParseConfig('llvm-config --ldflags') except OSError: print 'scons: llvm-config version %s failed' % llvm_version return - else: - env['LINK'] = env['CXX'] assert llvm_version is not None env['llvm'] = True diff --git a/scons/udis86.py b/scons/udis86.py deleted file mode 100644 index bb91d3c35cf..00000000000 --- a/scons/udis86.py +++ /dev/null @@ -1,44 +0,0 @@ -"""udis86 - -Tool-specific initialization for udis86 - -""" - -# -# Copyright (c) 2009 VMware, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -def generate(env): - conf = env.Configure() - - if conf.CheckHeader('udis86.h'): # and conf.CheckLib('udis86'): - env['UDIS86'] = True - env.Prepend(LIBS = ['udis86']) - else: - env['UDIS86'] = False - - conf.Finish() - -def exists(env): - return True - -# vim:set ts=4 sw=4 et: |