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

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

Issue 253613002: Instrumented libraries: pass MSan, TSan blacklists when building. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use "cp -f" in destdir builds Created 6 years, 8 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 make_command = 'make -j%s DESTDIR=%s BUILDROOT=%s' % ( 120 make_command = 'make -j%s DESTDIR=%s BUILDROOT=%s' % (
121 parsed_arguments.jobs, destdir, destdir), 121 parsed_arguments.jobs, destdir, destdir),
122 run_shell_commands([ 122 run_shell_commands([
123 configure_command, 123 configure_command,
124 make_command, 124 make_command,
125 '%s install' % make_command, 125 '%s install' % make_command,
126 # Kill the .la files. They contain absolute paths, and will cause build 126 # Kill the .la files. They contain absolute paths, and will cause build
127 # errors in dependent libraries. 127 # errors in dependent libraries.
128 'rm %s/lib/*.la -f' % destdir, 128 'rm %s/lib/*.la -f' % destdir,
129 # Now move the contents of the temporary destdir to their final place. 129 # Now move the contents of the temporary destdir to their final place.
130 'cp %s/* %s/ -rd' % (destdir, install_prefix)], 130 'cp %s/* %s/ -rdf' % (destdir, install_prefix)],
131 parsed_arguments.verbose, environment) 131 parsed_arguments.verbose, environment)
132 132
133 133
134 def prefix_configure_make_install(parsed_arguments, environment, 134 def prefix_configure_make_install(parsed_arguments, environment,
135 install_prefix): 135 install_prefix):
136 configure_command = './configure %s --prefix=%s' % ( 136 configure_command = './configure %s --prefix=%s' % (
137 parsed_arguments.custom_configure_flags, install_prefix) 137 parsed_arguments.custom_configure_flags, install_prefix)
138 shell_call(configure_command, parsed_arguments.verbose, environment) 138 shell_call(configure_command, parsed_arguments.verbose, environment)
139 shell_call('make -j%s' % parsed_arguments.jobs, 139 shell_call('make -j%s' % parsed_arguments.jobs,
140 parsed_arguments.verbose, environment) 140 parsed_arguments.verbose, environment)
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 def download_build_install(parsed_arguments): 256 def download_build_install(parsed_arguments):
257 sanitizer_params = SUPPORTED_SANITIZERS[parsed_arguments.sanitizer_type] 257 sanitizer_params = SUPPORTED_SANITIZERS[parsed_arguments.sanitizer_type]
258 258
259 environment = os.environ.copy() 259 environment = os.environ.copy()
260 # Usage of environment variables CC and CXX prefers usage flags --c-compiler 260 # Usage of environment variables CC and CXX prefers usage flags --c-compiler
261 # and --cxx-compiler 261 # and --cxx-compiler
262 if 'CC' not in environment and parsed_arguments.c_compiler: 262 if 'CC' not in environment and parsed_arguments.c_compiler:
263 environment['CC'] = parsed_arguments.c_compiler 263 environment['CC'] = parsed_arguments.c_compiler
264 if 'CXX' not in environment and parsed_arguments.cxx_compiler: 264 if 'CXX' not in environment and parsed_arguments.cxx_compiler:
265 environment['CXX'] = parsed_arguments.cxx_compiler 265 environment['CXX'] = parsed_arguments.cxx_compiler
266 environment['CFLAGS'] = '%s %s' % (sanitizer_params['compiler_flags'], 266
267 product_directory = os.path.normpath('%s/%s' % (
268 get_script_absolute_path(),
269 parsed_arguments.product_directory))
270
271 compiler_flags = sanitizer_params['compiler_flags']
272 if parsed_arguments.sanitizer_blacklist:
273 compiler_flags += ' -fsanitize-blacklist=%s/%s' % (
274 product_directory,
275 parsed_arguments.sanitizer_blacklist)
276 environment['CFLAGS'] = '%s %s' % (compiler_flags,
267 parsed_arguments.custom_c_compiler_flags) 277 parsed_arguments.custom_c_compiler_flags)
268 environment['CXXFLAGS'] = '%s %s' % ( 278 environment['CXXFLAGS'] = '%s %s' % (
269 sanitizer_params['compiler_flags'], 279 compiler_flags,
270 parsed_arguments.custom_cxx_compiler_flags) 280 parsed_arguments.custom_cxx_compiler_flags)
271 281
272 install_prefix = '%s/%s/instrumented_libraries/%s' % ( 282 install_prefix = '%s/instrumented_libraries/%s' % (
273 get_script_absolute_path(), 283 product_directory,
274 parsed_arguments.product_directory,
275 parsed_arguments.sanitizer_type) 284 parsed_arguments.sanitizer_type)
276 285
277 # Make sure the linker searches the instrumented libraries dir for 286 # Make sure the linker searches the instrumented libraries dir for
278 # library dependencies. 287 # library dependencies.
279 environment['LDFLAGS'] = '%s -L%s/lib %s' % ( 288 environment['LDFLAGS'] = '%s -L%s/lib %s' % (
280 sanitizer_params['linker_flags'], 289 sanitizer_params['linker_flags'],
281 install_prefix, parsed_arguments.custom_linker_flags) 290 install_prefix, parsed_arguments.custom_linker_flags)
282 291
283 library_directory = '%s/%s' % (parsed_arguments.intermediate_directory, 292 library_directory = '%s/%s' % (parsed_arguments.intermediate_directory,
284 parsed_arguments.library) 293 parsed_arguments.library)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 argument_parser.add_argument('-s', '--sanitizer-type', required=True, 350 argument_parser.add_argument('-s', '--sanitizer-type', required=True,
342 choices=SUPPORTED_SANITIZERS.keys()) 351 choices=SUPPORTED_SANITIZERS.keys())
343 argument_parser.add_argument('-v', '--verbose', action='store_true') 352 argument_parser.add_argument('-v', '--verbose', action='store_true')
344 argument_parser.add_argument('--check-build-deps', action='store_true') 353 argument_parser.add_argument('--check-build-deps', action='store_true')
345 argument_parser.add_argument('--c-compiler') 354 argument_parser.add_argument('--c-compiler')
346 argument_parser.add_argument('--cxx-compiler') 355 argument_parser.add_argument('--cxx-compiler')
347 # This should be a shell script to run before building specific libraries 356 # This should be a shell script to run before building specific libraries
348 # e.g. extracting archives with sources, patching makefiles, etc. 357 # e.g. extracting archives with sources, patching makefiles, etc.
349 argument_parser.add_argument('--run-before-build', default='') 358 argument_parser.add_argument('--run-before-build', default='')
350 argument_parser.add_argument('--build-method', default='destdir') 359 argument_parser.add_argument('--build-method', default='destdir')
360 argument_parser.add_argument('--sanitizer-blacklist', default='')
351 361
352 # Ignore all empty arguments because in several cases gyp passes them to the 362 # Ignore all empty arguments because in several cases gyp passes them to the
353 # script, but ArgumentParser treats them as positional arguments instead of 363 # script, but ArgumentParser treats them as positional arguments instead of
354 # ignoring (and doesn't have such options). 364 # ignoring (and doesn't have such options).
355 parsed_arguments = argument_parser.parse_args( 365 parsed_arguments = argument_parser.parse_args(
356 [arg for arg in sys.argv[1:] if len(arg) != 0]) 366 [arg for arg in sys.argv[1:] if len(arg) != 0])
357 # Ensure current working directory is this script directory. 367 # Ensure current working directory is this script directory.
358 os.chdir(get_script_absolute_path()) 368 os.chdir(get_script_absolute_path())
359 # Ensure all build dependencies are installed. 369 # Ensure all build dependencies are installed.
360 if parsed_arguments.check_build_deps: 370 if parsed_arguments.check_build_deps:
361 check_library_build_dependencies(parsed_arguments.library) 371 check_library_build_dependencies(parsed_arguments.library)
362 372
363 download_build_install(parsed_arguments) 373 download_build_install(parsed_arguments)
364 374
365 375
366 if __name__ == '__main__': 376 if __name__ == '__main__':
367 main() 377 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