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

Side by Side Diff: third_party/instrumented_libraries/download_build_install.py

Issue 376733006: Re-land: Instrumented libraries: turn off leak detection when building with ASan. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-land Created 6 years, 5 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
« no previous file with comments | « no previous file | third_party/instrumented_libraries/instrumented_libraries.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium 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 """Downloads, builds (with instrumentation) and installs shared libraries.""" 6 """Downloads, builds (with instrumentation) and installs shared libraries."""
7 7
8 import argparse 8 import argparse
9 import os 9 import os
10 import platform 10 import platform
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 def build_and_install(parsed_arguments, environment, install_prefix): 198 def build_and_install(parsed_arguments, environment, install_prefix):
199 if parsed_arguments.build_method == 'destdir': 199 if parsed_arguments.build_method == 'destdir':
200 destdir_configure_make_install( 200 destdir_configure_make_install(
201 parsed_arguments, environment, install_prefix) 201 parsed_arguments, environment, install_prefix)
202 elif parsed_arguments.build_method == 'custom_nss': 202 elif parsed_arguments.build_method == 'custom_nss':
203 nss_make_and_copy(parsed_arguments, environment, install_prefix) 203 nss_make_and_copy(parsed_arguments, environment, install_prefix)
204 elif parsed_arguments.build_method == 'custom_libcap': 204 elif parsed_arguments.build_method == 'custom_libcap':
205 libcap2_make_install(parsed_arguments, environment, install_prefix) 205 libcap2_make_install(parsed_arguments, environment, install_prefix)
206 elif parsed_arguments.build_method == 'custom_libpci3': 206 elif parsed_arguments.build_method == 'custom_libpci3':
207 libpci3_make_install(parsed_arguments, environment, install_prefix) 207 libpci3_make_install(parsed_arguments, environment, install_prefix)
208 elif parsed_arguments.build_method == 'custom_libappindicator1':
209 environment['CSC'] = '/usr/bin/mono-csc'
210 destdir_configure_make_install(
211 parsed_arguments, environment, install_prefix)
212 else: 208 else:
213 raise Exception('Unrecognized build method: %s' % 209 raise Exception('Unrecognized build method: %s' %
214 parsed_arguments.build_method) 210 parsed_arguments.build_method)
215 211
212
216 def unescape_flags(s): 213 def unescape_flags(s):
217 # GYP escapes the build flags as if they are going to be inserted directly 214 # GYP escapes the build flags as if they are going to be inserted directly
218 # into the command line. Since we pass them via CFLAGS/LDFLAGS, we must drop 215 # into the command line. Since we pass them via CFLAGS/LDFLAGS, we must drop
219 # the double quotes accordingly. 216 # the double quotes accordingly.
220 return ' '.join(shlex.split(s)) 217 return ' '.join(shlex.split(s))
221 218
222 def download_build_install(parsed_arguments): 219
220 def build_environment(parsed_arguments, product_directory, install_prefix):
223 environment = os.environ.copy() 221 environment = os.environ.copy()
224 # The CC/CXX environment variables take precedence over the command line 222 # The CC/CXX environment variables take precedence over the command line
225 # flags. 223 # flags.
226 if 'CC' not in environment and parsed_arguments.cc: 224 if 'CC' not in environment and parsed_arguments.cc:
227 environment['CC'] = parsed_arguments.cc 225 environment['CC'] = parsed_arguments.cc
228 if 'CXX' not in environment and parsed_arguments.cxx: 226 if 'CXX' not in environment and parsed_arguments.cxx:
229 environment['CXX'] = parsed_arguments.cxx 227 environment['CXX'] = parsed_arguments.cxx
230 228
231 product_directory = os.path.normpath('%s/%s' % (
232 get_script_absolute_path(),
233 parsed_arguments.product_directory))
234
235 cflags = unescape_flags(parsed_arguments.cflags) 229 cflags = unescape_flags(parsed_arguments.cflags)
236 if parsed_arguments.sanitizer_blacklist: 230 if parsed_arguments.sanitizer_blacklist:
237 cflags += ' -fsanitize-blacklist=%s/%s' % ( 231 cflags += ' -fsanitize-blacklist=%s/%s' % (
238 product_directory, 232 product_directory,
239 parsed_arguments.sanitizer_blacklist) 233 parsed_arguments.sanitizer_blacklist)
240 environment['CFLAGS'] = cflags 234 environment['CFLAGS'] = cflags
241 environment['CXXFLAGS'] = cflags 235 environment['CXXFLAGS'] = cflags
242 236
243 install_prefix = '%s/instrumented_libraries/%s' % (
244 product_directory,
245 parsed_arguments.sanitizer_type)
246
247 ldflags = unescape_flags(parsed_arguments.ldflags) 237 ldflags = unescape_flags(parsed_arguments.ldflags)
248 # Make sure the linker searches the instrumented libraries dir for 238 # Make sure the linker searches the instrumented libraries dir for
249 # library dependencies. 239 # library dependencies.
250 environment['LDFLAGS'] = '%s -L%s/lib' % (ldflags, install_prefix) 240 environment['LDFLAGS'] = '%s -L%s/lib' % (ldflags, install_prefix)
251 241
242 if parsed_arguments.sanitizer_type == 'asan':
243 # Do not report leaks during the build process.
244 environment['ASAN_OPTIONS'] = '%s:detect_leaks=0' % \
245 environment.get('ASAN_OPTIONS', '')
246
247 # libappindicator1 needs this.
248 environment['CSC'] = '/usr/bin/mono-csc'
249 return environment
250
251
252
253 def download_build_install(parsed_arguments):
254 product_directory = os.path.normpath('%s/%s' % (
255 get_script_absolute_path(),
256 parsed_arguments.product_directory))
257
258 install_prefix = '%s/instrumented_libraries/%s' % (
259 product_directory,
260 parsed_arguments.sanitizer_type)
261
262 environment = build_environment(parsed_arguments, product_directory,
263 install_prefix)
264
252 package_directory = '%s/%s' % (parsed_arguments.intermediate_directory, 265 package_directory = '%s/%s' % (parsed_arguments.intermediate_directory,
253 parsed_arguments.package) 266 parsed_arguments.package)
254 267
255 # Clobber by default, unless the developer wants to hack on the package's 268 # Clobber by default, unless the developer wants to hack on the package's
256 # source code. 269 # source code.
257 clobber = (environment.get('INSTRUMENTED_LIBRARIES_NO_CLOBBER', '') != '1') 270 clobber = (environment.get('INSTRUMENTED_LIBRARIES_NO_CLOBBER', '') != '1')
258 271
259 download_source = True 272 download_source = True
260 if os.path.exists(package_directory): 273 if os.path.exists(package_directory):
261 if clobber: 274 if clobber:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 os.chdir(get_script_absolute_path()) 358 os.chdir(get_script_absolute_path())
346 # Ensure all build dependencies are installed. 359 # Ensure all build dependencies are installed.
347 if parsed_arguments.check_build_deps: 360 if parsed_arguments.check_build_deps:
348 check_package_build_dependencies(parsed_arguments.package) 361 check_package_build_dependencies(parsed_arguments.package)
349 362
350 download_build_install(parsed_arguments) 363 download_build_install(parsed_arguments)
351 364
352 365
353 if __name__ == '__main__': 366 if __name__ == '__main__':
354 main() 367 main()
OLDNEW
« no previous file with comments | « no previous file | third_party/instrumented_libraries/instrumented_libraries.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698