Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: site_scons/site_tools/naclsdk.py

Issue 639113003: Add nacl-clang testing to SCons (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 tool_prefix = tooldir 92 tool_prefix = tooldir
93 # The lib directory may have an alternate name, i.e. 93 # The lib directory may have an alternate name, i.e.
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'
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 []
110
102 env.Replace(# Replace header and lib paths. 111 env.Replace(# Replace header and lib paths.
103 # where to put nacl extra sdk headers 112 # where to put nacl extra sdk headers
104 # TODO(robertm): switch to using the mechanism that 113 # TODO(robertm): switch to using the mechanism that
105 # passes arguments to scons 114 # passes arguments to scons
106 NACL_SDK_INCLUDE='%s/%s/include' % (sdk_path, tool_prefix), 115 NACL_SDK_INCLUDE='%s/%s/include' % (sdk_path, tool_prefix),
107 # where to find/put nacl generic extra sdk libraries 116 # where to find/put nacl generic extra sdk libraries
108 NACL_SDK_LIB='%s/%s' % (sdk_path, libdir), 117 NACL_SDK_LIB='%s/%s' % (sdk_path, libdir),
109 # Replace the normal unix tools with the NaCl ones. 118 # Replace the normal unix tools with the NaCl ones.
110 CC=os.path.join(bin_path, '%s-gcc' % tool_prefix), 119 CC=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)),
111 CXX=os.path.join(bin_path, '%s-g++' % tool_prefix), 120 CXX=os.path.join(bin_path, '%s-%s' % (tool_prefix, cxx)),
112 AR=os.path.join(bin_path, '%s-ar' % tool_prefix), 121 AR=os.path.join(bin_path, '%s-ar' % tool_prefix),
113 AS=os.path.join(bin_path, '%s-as' % tool_prefix), 122 AS=os.path.join(bin_path, '%s-as' % tool_prefix),
114 ASPP=os.path.join(bin_path, '%s-gcc' % tool_prefix), 123 ASPP=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)),
115 GDB=os.path.join(bin_path, '%s-gdb' % tool_prefix), 124 GDB=os.path.join(bin_path, '%s-gdb' % tool_prefix),
116 # NOTE: use g++ for linking so we can handle C AND C++. 125 # NOTE: use g++ for linking so we can handle C AND C++.
117 LINK=os.path.join(bin_path, '%s-g++' % tool_prefix), 126 LINK=os.path.join(bin_path, '%s-%s' % (tool_prefix, cxx)),
118 # Grrr... and sometimes we really need ld. 127 # Grrr... and sometimes we really need ld.
119 LD=os.path.join(bin_path, '%s-ld' % tool_prefix) + ld_mode_flag, 128 LD=os.path.join(bin_path, '%s-ld' % tool_prefix) + ld_mode_flag,
120 RANLIB=os.path.join(bin_path, '%s-ranlib' % tool_prefix), 129 RANLIB=os.path.join(bin_path, '%s-ranlib' % tool_prefix),
121 NM=os.path.join(bin_path, '%s-nm' % tool_prefix), 130 NM=os.path.join(bin_path, '%s-nm' % tool_prefix),
122 OBJDUMP=os.path.join(bin_path, '%s-objdump' % tool_prefix), 131 OBJDUMP=os.path.join(bin_path, '%s-objdump' % tool_prefix),
123 STRIP=os.path.join(bin_path, '%s-strip' % tool_prefix), 132 STRIP=os.path.join(bin_path, '%s-strip' % tool_prefix),
124 ADDR2LINE=os.path.join(bin_path, '%s-addr2line' % tool_prefix), 133 ADDR2LINE=os.path.join(bin_path, '%s-addr2line' % tool_prefix),
125 BASE_LINKFLAGS=[cc_mode_flag], 134 BASE_LINKFLAGS=[cc_mode_flag],
126 BASE_CFLAGS=[cc_mode_flag], 135 BASE_CFLAGS=[cc_mode_flag],
127 BASE_CXXFLAGS=[cc_mode_flag], 136 BASE_CXXFLAGS=[cc_mode_flag],
128 BASE_ASFLAGS=[as_mode_flag], 137 BASE_ASFLAGS=[as_mode_flag],
129 BASE_ASPPFLAGS=[cc_mode_flag], 138 BASE_ASPPFLAGS=[cc_mode_flag],
130 CFLAGS=['-std=gnu99'], 139 CFLAGS=['-std=gnu99'],
131 CCFLAGS=['-O3', 140 CCFLAGS=['-O3',
132 '-Werror', 141 '-Werror',
133 '-Wall', 142 '-Wall',
134 '-Wno-variadic-macros', 143 '-Wno-variadic-macros',
135 '-Wswitch-enum', 144 '-Wswitch-enum',
136 '-g', 145 '-g',
137 '-fno-stack-protector', 146 '-fno-stack-protector',
138 '-fdiagnostics-show-option', 147 '-fdiagnostics-show-option',
139 '-pedantic', 148 '-pedantic',
140 '-D__linux__', 149 '-D__linux__',
141 ], 150 ],
142 ASFLAGS=[], 151 ASFLAGS=as_flags,
143 ) 152 )
144 153
145 # NaClSdk environment seems to be inherited from the host environment. 154 # NaClSdk environment seems to be inherited from the host environment.
146 # 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
147 # introduces nothing except problems. 156 # introduces nothing except problems.
148 # For now, simply override the environment settings as in 157 # For now, simply override the environment settings as in
149 # <scons>/engine/SCons/Platform/posix.py 158 # <scons>/engine/SCons/Platform/posix.py
150 env.Replace(LIBPREFIX='lib', 159 env.Replace(LIBPREFIX='lib',
151 LIBSUFFIX='.a', 160 LIBSUFFIX='.a',
152 SHLIBPREFIX='$LIBPREFIX', 161 SHLIBPREFIX='$LIBPREFIX',
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 # translation. 718 # translation.
710 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'): 719 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'):
711 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator', 720 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator',
712 'FEATURE_VERSION') 721 'FEATURE_VERSION')
713 if os.path.exists(version_file): 722 if os.path.exists(version_file):
714 with open(version_file, 'r') as fh: 723 with open(version_file, 'r') as fh:
715 version = int(fh.read()) 724 version = int(fh.read())
716 else: 725 else:
717 version = 0 726 version = 0
718 env.Replace(TOOLCHAIN_FEATURE_VERSION=version) 727 env.Replace(TOOLCHAIN_FEATURE_VERSION=version)
OLDNEW
« no previous file with comments | « SConstruct ('k') | src/untrusted/stubs/crti_x86_32.S » ('j') | tests/threads/race_test.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698