diff options
author | earthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-25 15:44:47 +0000 |
---|---|---|
committer | earthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-25 15:44:47 +0000 |
commit | eda8b2ce66247210eaab98652c43bd86eee0cc78 (patch) | |
tree | 9b943f701c3e49941cf915101728238bb99df879 | |
parent | df84c5378331d859148ad916a706fe2d9be441fd (diff) | |
download | chromium_src-eda8b2ce66247210eaab98652c43bd86eee0cc78.zip chromium_src-eda8b2ce66247210eaab98652c43bd86eee0cc78.tar.gz chromium_src-eda8b2ce66247210eaab98652c43bd86eee0cc78.tar.bz2 |
Instrumented libraries: refactor build scripts.
Mostly naming changes. Also, improve verbosity flag handling.
BUG=313751
R=glider@chromium.org
NOTRY=true
TEST=msan
Review URL: https://codereview.chromium.org/255923002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266199 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed, 56 insertions, 55 deletions
diff --git a/third_party/instrumented_libraries/download_build_install.py b/third_party/instrumented_libraries/download_build_install.py index de5ee0a..40cb135 100755 --- a/third_party/instrumented_libraries/download_build_install.py +++ b/third_party/instrumented_libraries/download_build_install.py @@ -113,7 +113,7 @@ def run_shell_commands(commands, verbose=False, environment=None): def destdir_configure_make_install(parsed_arguments, environment, install_prefix): - configure_command = './configure %s' % parsed_arguments.custom_configure_flags + configure_command = './configure %s' % parsed_arguments.extra_configure_flags configure_command += ' --libdir=/lib/' # Installing to a temporary directory allows us to safely clean up the .la # files below. @@ -136,7 +136,7 @@ def destdir_configure_make_install(parsed_arguments, environment, def prefix_configure_make_install(parsed_arguments, environment, install_prefix): configure_command = './configure %s --prefix=%s' % ( - parsed_arguments.custom_configure_flags, install_prefix) + parsed_arguments.extra_configure_flags, install_prefix) shell_call(configure_command, parsed_arguments.verbose, environment) shell_call('make -j%s' % parsed_arguments.jobs, parsed_arguments.verbose, environment) @@ -243,9 +243,9 @@ def build_and_install(parsed_arguments, environment, install_prefix): elif parsed_arguments.build_method == 'custom_libcap': libcap2_make_install(parsed_arguments, environment, install_prefix) elif parsed_arguments.build_method == 'custom_pango': - parsed_arguments.custom_configure_flags += \ + parsed_arguments.extra_configure_flags += \ ' --x-libraries=%s/lib' % install_prefix - parsed_arguments.custom_configure_flags += \ + parsed_arguments.extra_configure_flags += \ ' --x-includes=%s/include' % install_prefix prefix_configure_make_install(parsed_arguments, environment, install_prefix) elif parsed_arguments.build_method == 'custom_libpci3': @@ -261,10 +261,10 @@ def download_build_install(parsed_arguments): environment = os.environ.copy() # Usage of environment variables CC and CXX prefers usage flags --c-compiler # and --cxx-compiler - if 'CC' not in environment and parsed_arguments.c_compiler: - environment['CC'] = parsed_arguments.c_compiler - if 'CXX' not in environment and parsed_arguments.cxx_compiler: - environment['CXX'] = parsed_arguments.cxx_compiler + if 'CC' not in environment and parsed_arguments.cc: + environment['CC'] = parsed_arguments.cc + if 'CXX' not in environment and parsed_arguments.cxx: + environment['CXX'] = parsed_arguments.cxx product_directory = os.path.normpath('%s/%s' % ( get_script_absolute_path(), @@ -276,10 +276,10 @@ def download_build_install(parsed_arguments): product_directory, parsed_arguments.sanitizer_blacklist) environment['CFLAGS'] = '%s %s' % (compiler_flags, - parsed_arguments.custom_c_compiler_flags) + parsed_arguments.extra_cflags) environment['CXXFLAGS'] = '%s %s' % ( compiler_flags, - parsed_arguments.custom_cxx_compiler_flags) + parsed_arguments.extra_cxxflags) install_prefix = '%s/instrumented_libraries/%s' % ( product_directory, @@ -289,7 +289,7 @@ def download_build_install(parsed_arguments): # library dependencies. environment['LDFLAGS'] = '%s -L%s/lib %s' % ( sanitizer_params['linker_flags'], - install_prefix, parsed_arguments.custom_linker_flags) + install_prefix, parsed_arguments.extra_ldflags) library_directory = '%s/%s' % (parsed_arguments.intermediate_directory, parsed_arguments.library) @@ -345,16 +345,16 @@ def main(): argument_parser.add_argument( '-m', '--intermediate-directory', default='.', help='Relative path to the directory for temporary build files') - argument_parser.add_argument('--custom-configure-flags', default='') - argument_parser.add_argument('--custom-c-compiler-flags', default='') - argument_parser.add_argument('--custom-cxx-compiler-flags', default='') - argument_parser.add_argument('--custom-linker-flags', default='') + argument_parser.add_argument('--extra-configure-flags', default='') + argument_parser.add_argument('--extra-cflags', default='') + argument_parser.add_argument('--extra-cxxflags', default='') + argument_parser.add_argument('--extra-ldflags', default='') argument_parser.add_argument('-s', '--sanitizer-type', required=True, choices=SUPPORTED_SANITIZERS.keys()) argument_parser.add_argument('-v', '--verbose', action='store_true') argument_parser.add_argument('--check-build-deps', action='store_true') - argument_parser.add_argument('--c-compiler') - argument_parser.add_argument('--cxx-compiler') + argument_parser.add_argument('--cc') + argument_parser.add_argument('--cxx') # This should be a shell script to run before building specific libraries # e.g. extracting archives with sources, patching makefiles, etc. argument_parser.add_argument('--run-before-build', default='') diff --git a/third_party/instrumented_libraries/instrumented_libraries.gyp b/third_party/instrumented_libraries/instrumented_libraries.gyp index a2ac31e..a0bab49 100644 --- a/third_party/instrumented_libraries/instrumented_libraries.gyp +++ b/third_party/instrumented_libraries/instrumented_libraries.gyp @@ -4,10 +4,10 @@ { # Default value for all libraries. - 'custom_configure_flags': '', - 'custom_c_compiler_flags': '', - 'custom_cxx_compiler_flags': '', - 'custom_linker_flags': '', + 'extra_configure_flags': '', + 'extra_cflags': '', + 'extra_cxxflags': '', + 'extra_ldflags': '', 'run_before_build': '', 'build_method': 'destdir', @@ -31,11 +31,6 @@ 'sanitizer_type': 'tsan', 'sanitizer_blacklist': '<(tsan_blacklist)', }], - ['verbose_libraries_build==1', { - 'verbose_libraries_build_flag': '--verbose', - }, { - 'verbose_libraries_build_flag': '', - }], ['use_goma==1', { 'cc': '<(gomadir)/gomacc <!(cd <(DEPTH) && pwd -P)/<(make_clang_dir)/bin/clang', 'cxx': '<(gomadir)/gomacc <!(cd <(DEPTH) && pwd -P)/<(make_clang_dir)/bin/clang++', @@ -144,7 +139,7 @@ { 'library_name': 'libcairo2', 'dependencies=': [], - 'custom_configure_flags': '--disable-gtk-doc', + 'extra_configure_flags': '--disable-gtk-doc', 'includes': ['standard_instrumented_library_target.gypi'], }, { @@ -161,7 +156,7 @@ ], # Use system dbus-binding-tool. The just-built one is instrumented but # doesn't have the correct RPATH, and will crash. - 'custom_configure_flags': '--with-dbus-binding-tool=dbus-binding-tool', + 'extra_configure_flags': '--with-dbus-binding-tool=dbus-binding-tool', 'includes': ['standard_instrumented_library_target.gypi'], }, { @@ -179,7 +174,7 @@ 'dependencies=': [ '<(_sanitizer_type)-freetype', ], - 'custom_configure_flags': [ + 'extra_configure_flags': [ '--disable-docs', '--sysconfdir=/etc/', # From debian/rules. @@ -191,13 +186,13 @@ { 'library_name': 'libgcrypt11', 'dependencies=': [], - 'custom_linker_flags': '-Wl,-z,muldefs', + 'extra_ldflags': '-Wl,-z,muldefs', 'includes': ['standard_instrumented_library_target.gypi'], }, { 'library_name': 'libglib2.0-0', 'dependencies=': [], - 'custom_configure_flags': [ + 'extra_configure_flags': [ '--disable-gtk-doc', '--disable-gtk-doc-html', '--disable-gtk-doc-pdf', @@ -212,7 +207,7 @@ { 'library_name': 'libnspr4', 'dependencies=': [], - 'custom_configure_flags': '--enable-64bit', + 'extra_configure_flags': '--enable-64bit', 'run_before_build': 'libnspr4.sh', 'includes': ['standard_instrumented_library_target.gypi'], }, @@ -224,7 +219,7 @@ { 'library_name': 'libpcre3', 'dependencies=': [], - 'custom_configure_flags': [ + 'extra_configure_flags': [ '--enable-utf8', '--enable-unicode-properties', ], @@ -245,7 +240,7 @@ { 'library_name': 'libx11-6', 'dependencies=': [], - 'custom_configure_flags': '--disable-specs', + 'extra_configure_flags': '--disable-specs', 'includes': ['standard_instrumented_library_target.gypi'], }, { @@ -256,7 +251,7 @@ { 'library_name': 'libxcb1', 'dependencies=': [], - 'custom_configure_flags': '--disable-build-docs', + 'extra_configure_flags': '--disable-build-docs', 'includes': ['standard_instrumented_library_target.gypi'], }, { @@ -277,13 +272,13 @@ { 'library_name': 'libxdmcp6', 'dependencies=': [], - 'custom_configure_flags': '--disable-docs', + 'extra_configure_flags': '--disable-docs', 'includes': ['standard_instrumented_library_target.gypi'], }, { 'library_name': 'libxext6', 'dependencies=': [], - 'custom_configure_flags': '--disable-specs', + 'extra_configure_flags': '--disable-specs', 'includes': ['standard_instrumented_library_target.gypi'], }, { @@ -294,7 +289,7 @@ { 'library_name': 'libxi6', 'dependencies=': [], - 'custom_configure_flags': [ + 'extra_configure_flags': [ '--disable-specs', '--disable-docs', ], @@ -323,7 +318,7 @@ { 'library_name': 'libxtst6', 'dependencies=': [], - 'custom_configure_flags': '--disable-specs', + 'extra_configure_flags': '--disable-specs', 'includes': ['standard_instrumented_library_target.gypi'], }, { @@ -360,7 +355,7 @@ 'dependencies=': [], 'run_before_build': 'libcups2.sh', 'jobs': 1, - 'custom_configure_flags': [ + 'extra_configure_flags': [ # All from debian/rules. '--localedir=/usr/share/cups/locale', '--enable-slp', @@ -392,7 +387,7 @@ 'dependencies=': [ '<(_sanitizer_type)-libglib2.0-0', ], - 'custom_configure_flags': [ + 'extra_configure_flags': [ # Avoid https://bugs.gentoo.org/show_bug.cgi?id=425620 '--enable-introspection=no', ], @@ -408,7 +403,7 @@ { 'library_name': 'libudev0', 'dependencies=': [], - 'custom_configure_flags': [ + 'extra_configure_flags': [ # Without this flag there's a linking step that doesn't honor LDFLAGS # and fails. # TODO(earthdok): find a better fix. @@ -423,19 +418,19 @@ }, { 'library_name': 'libgnome-keyring0', - 'custom_configure_flags': [ + 'extra_configure_flags': [ # Build static libs (from debian/rules). '--enable-static', '--enable-tests=no', ], - 'custom_linker_flags': '-Wl,--as-needed', + 'extra_ldflags': '-Wl,--as-needed', 'dependencies=': [], 'includes': ['standard_instrumented_library_target.gypi'], }, { 'library_name': 'libgtk2.0-0', - 'custom_c_compiler_flags': '-Wno-return-type', - 'custom_configure_flags': [ + 'extra_cflags': '-Wno-return-type', + 'extra_configure_flags': [ # From debian/rules. '--prefix=/usr', '--sysconfdir=/etc', @@ -449,7 +444,7 @@ }, { 'library_name': 'libgdk-pixbuf2.0-0', - 'custom_configure_flags': [ + 'extra_configure_flags': [ # From debian/rules. '--with-libjasper', '--with-x11', @@ -469,7 +464,7 @@ }, { 'library_name': 'libdbusmenu-glib4', - 'custom_configure_flags': [ + 'extra_configure_flags': [ # From debian/rules. '--disable-scrollkeeper', '--enable-gtk-doc', diff --git a/third_party/instrumented_libraries/standard_instrumented_library_target.gypi b/third_party/instrumented_libraries/standard_instrumented_library_target.gypi index c23de19..3aaf862 100644 --- a/third_party/instrumented_libraries/standard_instrumented_library_target.gypi +++ b/third_party/instrumented_libraries/standard_instrumented_library_target.gypi @@ -24,18 +24,24 @@ '--library=<(_library_name)', '--intermediate-directory=<(INTERMEDIATE_DIR)', '--sanitizer-type=<(_sanitizer_type)', - '--custom-configure-flags=<(_custom_configure_flags)', - '--custom-c-compiler-flags=<(_custom_c_compiler_flags)', - '--custom-cxx-compiler-flags=<(_custom_cxx_compiler_flags)', - '--custom-linker-flags=<(_custom_linker_flags)', + '--extra-configure-flags=<(_extra_configure_flags)', + '--extra-cflags=<(_extra_cflags)', + '--extra-cxxflags=<(_extra_cxxflags)', + '--extra-ldflags=<(_extra_ldflags)', '--run-before-build=<(_run_before_build)', - '<(_verbose_libraries_build_flag)', - '--c-compiler=<(_cc)', - '--cxx-compiler=<(_cxx)', + '--cc=<(_cc)', + '--cxx=<(_cxx)', '--jobs=<(_jobs)', '--build-method=<(_build_method)', '--sanitizer-blacklist=<(_sanitizer_blacklist)', ], + 'conditions': [ + ['verbose_libraries_build==1', { + 'action+': [ + '--verbose', + ], + }], + ] }, ], } |