| OLD | NEW |
| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 # Do an optimized build. | 114 # Do an optimized build. |
| 115 make_args.append('BUILD_OPT=1') | 115 make_args.append('BUILD_OPT=1') |
| 116 # Set USE_64=1 on x86_64 systems. | 116 # Set USE_64=1 on x86_64 systems. |
| 117 if platform.architecture()[0] == '64bit': | 117 if platform.architecture()[0] == '64bit': |
| 118 make_args.append('USE_64=1') | 118 make_args.append('USE_64=1') |
| 119 # Passing C(XX)FLAGS overrides the defaults, and EXTRA_C(XX)FLAGS is not | 119 # Passing C(XX)FLAGS overrides the defaults, and EXTRA_C(XX)FLAGS is not |
| 120 # supported. Append our extra flags to CC/CXX. | 120 # supported. Append our extra flags to CC/CXX. |
| 121 make_args.append('CC="%s %s"' % (environment['CC'], environment['CFLAGS'])) | 121 make_args.append('CC="%s %s"' % (environment['CC'], environment['CFLAGS'])) |
| 122 make_args.append('CXX="%s %s"' % | 122 make_args.append('CXX="%s %s"' % |
| 123 (environment['CXX'], environment['CXXFLAGS'])) | 123 (environment['CXX'], environment['CXXFLAGS'])) |
| 124 # We need to override ZDEFS_FLAGS at least to prevent -Wl,-z,defs. | 124 # We need to override ZDEFS_FLAG at least to prevent -Wl,-z,defs. |
| 125 # Might as well use this to pass the linker flags, since ZDEF_FLAGS is always | 125 # Might as well use this to pass the linker flags, since ZDEF_FLAG is always |
| 126 # added during linking on Linux. | 126 # added during linking on Linux. |
| 127 make_args.append('ZDEFS_FLAG="-Wl,-z,nodefs %s"' % environment['LDFLAGS']) | 127 make_args.append('ZDEFS_FLAG="-Wl,-z,nodefs %s"' % environment['LDFLAGS']) |
| 128 make_args.append('NSPR_INCLUDE_DIR=/usr/include/nspr') | 128 make_args.append('NSPR_INCLUDE_DIR=/usr/include/nspr') |
| 129 make_args.append('NSPR_LIB_DIR=%s/lib' % install_prefix) | 129 make_args.append('NSPR_LIB_DIR=%s/lib' % install_prefix) |
| 130 make_args.append('NSS_ENABLE_ECC=1') | 130 make_args.append('NSS_ENABLE_ECC=1') |
| 131 # Make sure we don't override the default flags. |
| 132 for variable in ['CFLAGS', 'CXXFLAGS', 'LDFLAGS']: |
| 133 del environment[variable] |
| 131 with ScopedChangeDirectory('nss') as cd_nss: | 134 with ScopedChangeDirectory('nss') as cd_nss: |
| 132 # -j is not supported | 135 # -j is not supported |
| 133 shell_call('make %s' % ' '.join(make_args), parsed_arguments.verbose, | 136 shell_call('make %s' % ' '.join(make_args), parsed_arguments.verbose, |
| 134 environment) | 137 environment) |
| 135 # 'make install' is not supported. Copy the DSOs manually. | 138 # 'make install' is not supported. Copy the DSOs manually. |
| 136 install_dir = '%s/lib/' % install_prefix | 139 install_dir = '%s/lib/' % install_prefix |
| 137 for (dirpath, dirnames, filenames) in os.walk('./lib/'): | 140 for (dirpath, dirnames, filenames) in os.walk('./lib/'): |
| 138 for filename in filenames: | 141 for filename in filenames: |
| 139 if filename.endswith('.so'): | 142 if filename.endswith('.so'): |
| 140 full_path = os.path.join(dirpath, filename) | 143 full_path = os.path.join(dirpath, filename) |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 os.chdir(get_script_absolute_path()) | 361 os.chdir(get_script_absolute_path()) |
| 359 # Ensure all build dependencies are installed. | 362 # Ensure all build dependencies are installed. |
| 360 if parsed_arguments.check_build_deps: | 363 if parsed_arguments.check_build_deps: |
| 361 check_package_build_dependencies(parsed_arguments.package) | 364 check_package_build_dependencies(parsed_arguments.package) |
| 362 | 365 |
| 363 download_build_install(parsed_arguments) | 366 download_build_install(parsed_arguments) |
| 364 | 367 |
| 365 | 368 |
| 366 if __name__ == '__main__': | 369 if __name__ == '__main__': |
| 367 main() | 370 main() |
| OLD | NEW |