| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """NaCl SDK tool SCons.""" | 6 """NaCl SDK tool SCons.""" |
| 7 | 7 |
| 8 import __builtin__ | 8 import __builtin__ |
| 9 import re | 9 import re |
| 10 import os | 10 import os |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 # 'lib32' in the x86_64-nacl tooldir. | 94 # 'lib32' in the x86_64-nacl tooldir. |
| 95 libdir = os.path.join(tooldir, subarch_spec.get('other_libdir', 'lib')) | 95 libdir = os.path.join(tooldir, subarch_spec.get('other_libdir', 'lib')) |
| 96 break | 96 break |
| 97 | 97 |
| 98 if tool_prefix is None: | 98 if tool_prefix is None: |
| 99 raise Exception("Cannot find a toolchain for %s in %s" % | 99 raise Exception("Cannot find a toolchain for %s in %s" % |
| 100 (env['TARGET_FULLARCH'], sdk_path)) | 100 (env['TARGET_FULLARCH'], sdk_path)) |
| 101 | 101 |
| 102 cc = 'clang' if env.Bit('nacl_clang') else 'gcc' | 102 cc = 'clang' if env.Bit('nacl_clang') else 'gcc' |
| 103 cxx = 'clang++' if env.Bit('nacl_clang') else 'g++' | 103 cxx = 'clang++' if env.Bit('nacl_clang') else 'g++' |
| 104 # Eventually nacl-clang will default to -no-integrated-as but for now we have |
| 105 # to use the integrated as for compilation because of |
| 106 # https://code.google.com/p/nativeclient/issues/detail?id=3966 |
| 107 # However clang's as' support of some of the nacl syntax is incomplete, so for |
| 108 # now use binutils as for our asm files. |
| 109 as_flags = '-no-integrated-as' if env.Bit('nacl_clang') else [] |
| 104 | 110 |
| 105 env.Replace(# Replace header and lib paths. | 111 env.Replace(# Replace header and lib paths. |
| 106 # where to put nacl extra sdk headers | 112 # where to put nacl extra sdk headers |
| 107 # TODO(robertm): switch to using the mechanism that | 113 # TODO(robertm): switch to using the mechanism that |
| 108 # passes arguments to scons | 114 # passes arguments to scons |
| 109 NACL_SDK_INCLUDE='%s/%s/include' % (sdk_path, tool_prefix), | 115 NACL_SDK_INCLUDE='%s/%s/include' % (sdk_path, tool_prefix), |
| 110 # where to find/put nacl generic extra sdk libraries | 116 # where to find/put nacl generic extra sdk libraries |
| 111 NACL_SDK_LIB='%s/%s' % (sdk_path, libdir), | 117 NACL_SDK_LIB='%s/%s' % (sdk_path, libdir), |
| 112 # Replace the normal unix tools with the NaCl ones. | 118 # Replace the normal unix tools with the NaCl ones. |
| 113 CC=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)), | 119 CC=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 135 '-Werror', | 141 '-Werror', |
| 136 '-Wall', | 142 '-Wall', |
| 137 '-Wno-variadic-macros', | 143 '-Wno-variadic-macros', |
| 138 '-Wswitch-enum', | 144 '-Wswitch-enum', |
| 139 '-g', | 145 '-g', |
| 140 '-fno-stack-protector', | 146 '-fno-stack-protector', |
| 141 '-fdiagnostics-show-option', | 147 '-fdiagnostics-show-option', |
| 142 '-pedantic', | 148 '-pedantic', |
| 143 '-D__linux__', | 149 '-D__linux__', |
| 144 ], | 150 ], |
| 145 ASFLAGS=[], | 151 ASFLAGS=as_flags, |
| 146 ) | 152 ) |
| 147 | 153 |
| 148 # NaClSdk environment seems to be inherited from the host environment. | 154 # NaClSdk environment seems to be inherited from the host environment. |
| 149 # On Linux host, this probably makes sense. On Windows and Mac, this | 155 # On Linux host, this probably makes sense. On Windows and Mac, this |
| 150 # introduces nothing except problems. | 156 # introduces nothing except problems. |
| 151 # For now, simply override the environment settings as in | 157 # For now, simply override the environment settings as in |
| 152 # <scons>/engine/SCons/Platform/posix.py | 158 # <scons>/engine/SCons/Platform/posix.py |
| 153 env.Replace(LIBPREFIX='lib', | 159 env.Replace(LIBPREFIX='lib', |
| 154 LIBSUFFIX='.a', | 160 LIBSUFFIX='.a', |
| 155 SHLIBPREFIX='$LIBPREFIX', | 161 SHLIBPREFIX='$LIBPREFIX', |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 # translation. | 728 # translation. |
| 723 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'): | 729 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'): |
| 724 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator', | 730 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator', |
| 725 'FEATURE_VERSION') | 731 'FEATURE_VERSION') |
| 726 if os.path.exists(version_file): | 732 if os.path.exists(version_file): |
| 727 with open(version_file, 'r') as fh: | 733 with open(version_file, 'r') as fh: |
| 728 version = int(fh.read()) | 734 version = int(fh.read()) |
| 729 else: | 735 else: |
| 730 version = 0 | 736 version = 0 |
| 731 env.Replace(TOOLCHAIN_FEATURE_VERSION=version) | 737 env.Replace(TOOLCHAIN_FEATURE_VERSION=version) |
| OLD | NEW |