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

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

Issue 380623002: Revert of Instrumented libraries: turn off leak detection when building with ASan. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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)
208 else: 212 else:
209 raise Exception('Unrecognized build method: %s' % 213 raise Exception('Unrecognized build method: %s' %
210 parsed_arguments.build_method) 214 parsed_arguments.build_method)
211 215
212
213 def unescape_flags(s): 216 def unescape_flags(s):
214 # GYP escapes the build flags as if they are going to be inserted directly 217 # GYP escapes the build flags as if they are going to be inserted directly
215 # into the command line. Since we pass them via CFLAGS/LDFLAGS, we must drop 218 # into the command line. Since we pass them via CFLAGS/LDFLAGS, we must drop
216 # the double quotes accordingly. 219 # the double quotes accordingly.
217 return ' '.join(shlex.split(s)) 220 return ' '.join(shlex.split(s))
218 221
219 222 def download_build_install(parsed_arguments):
220 def build_environment(parsed_arguments, install_prefix):
221 environment = os.environ.copy() 223 environment = os.environ.copy()
222 # The CC/CXX environment variables take precedence over the command line 224 # The CC/CXX environment variables take precedence over the command line
223 # flags. 225 # flags.
224 if 'CC' not in environment and parsed_arguments.cc: 226 if 'CC' not in environment and parsed_arguments.cc:
225 environment['CC'] = parsed_arguments.cc 227 environment['CC'] = parsed_arguments.cc
226 if 'CXX' not in environment and parsed_arguments.cxx: 228 if 'CXX' not in environment and parsed_arguments.cxx:
227 environment['CXX'] = parsed_arguments.cxx 229 environment['CXX'] = parsed_arguments.cxx
228 230
231 product_directory = os.path.normpath('%s/%s' % (
232 get_script_absolute_path(),
233 parsed_arguments.product_directory))
234
229 cflags = unescape_flags(parsed_arguments.cflags) 235 cflags = unescape_flags(parsed_arguments.cflags)
230 if parsed_arguments.sanitizer_blacklist: 236 if parsed_arguments.sanitizer_blacklist:
231 cflags += ' -fsanitize-blacklist=%s/%s' % ( 237 cflags += ' -fsanitize-blacklist=%s/%s' % (
232 product_directory, 238 product_directory,
233 parsed_arguments.sanitizer_blacklist) 239 parsed_arguments.sanitizer_blacklist)
234 environment['CFLAGS'] = cflags 240 environment['CFLAGS'] = cflags
235 environment['CXXFLAGS'] = cflags 241 environment['CXXFLAGS'] = cflags
236 242
243 install_prefix = '%s/instrumented_libraries/%s' % (
244 product_directory,
245 parsed_arguments.sanitizer_type)
246
237 ldflags = unescape_flags(parsed_arguments.ldflags) 247 ldflags = unescape_flags(parsed_arguments.ldflags)
238 # Make sure the linker searches the instrumented libraries dir for 248 # Make sure the linker searches the instrumented libraries dir for
239 # library dependencies. 249 # library dependencies.
240 environment['LDFLAGS'] = '%s -L%s/lib' % (ldflags, install_prefix) 250 environment['LDFLAGS'] = '%s -L%s/lib' % (ldflags, install_prefix)
241 251
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, install_prefix)
263
264 package_directory = '%s/%s' % (parsed_arguments.intermediate_directory, 252 package_directory = '%s/%s' % (parsed_arguments.intermediate_directory,
265 parsed_arguments.package) 253 parsed_arguments.package)
266 254
267 # Clobber by default, unless the developer wants to hack on the package's 255 # Clobber by default, unless the developer wants to hack on the package's
268 # source code. 256 # source code.
269 clobber = (environment.get('INSTRUMENTED_LIBRARIES_NO_CLOBBER', '') != '1') 257 clobber = (environment.get('INSTRUMENTED_LIBRARIES_NO_CLOBBER', '') != '1')
270 258
271 download_source = True 259 download_source = True
272 if os.path.exists(package_directory): 260 if os.path.exists(package_directory):
273 if clobber: 261 if clobber:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 os.chdir(get_script_absolute_path()) 345 os.chdir(get_script_absolute_path())
358 # Ensure all build dependencies are installed. 346 # Ensure all build dependencies are installed.
359 if parsed_arguments.check_build_deps: 347 if parsed_arguments.check_build_deps:
360 check_package_build_dependencies(parsed_arguments.package) 348 check_package_build_dependencies(parsed_arguments.package)
361 349
362 download_build_install(parsed_arguments) 350 download_build_install(parsed_arguments)
363 351
364 352
365 if __name__ == '__main__': 353 if __name__ == '__main__':
366 main() 354 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