| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 '%s -j%s' % (make_command, parsed_arguments.jobs), | 104 '%s -j%s' % (make_command, parsed_arguments.jobs), |
| 105 # Parallel install is flaky for some packages. | 105 # Parallel install is flaky for some packages. |
| 106 '%s install -j1' % make_command, | 106 '%s install -j1' % make_command, |
| 107 # Kill the .la files. They contain absolute paths, and will cause build | 107 # Kill the .la files. They contain absolute paths, and will cause build |
| 108 # errors in dependent libraries. | 108 # errors in dependent libraries. |
| 109 'rm %s/lib/*.la -f' % destdir | 109 'rm %s/lib/*.la -f' % destdir |
| 110 ] | 110 ] |
| 111 run_shell_commands(build_and_install_in_destdir, | 111 run_shell_commands(build_and_install_in_destdir, |
| 112 parsed_arguments.verbose, environment) | 112 parsed_arguments.verbose, environment) |
| 113 fix_rpaths(destdir) | 113 fix_rpaths(destdir) |
| 114 shell_call( | 114 run_shell_commands([ |
| 115 # Now move the contents of the temporary destdir to their final place. | 115 # Now move the contents of the temporary destdir to their final place. |
| 116 'cp %s/* %s/ -rdf' % (destdir, install_prefix), | 116 # We only care for the contents of lib/. |
| 117 parsed_arguments.verbose, environment) | 117 'mkdir -p %s/lib' % install_prefix, |
| 118 'cp %s/lib/* %s/lib/ -rdf' % (destdir, install_prefix)], |
| 119 parsed_arguments.verbose, environment) |
| 118 | 120 |
| 119 | 121 |
| 120 def nss_make_and_copy(parsed_arguments, environment, install_prefix): | 122 def nss_make_and_copy(parsed_arguments, environment, install_prefix): |
| 121 # NSS uses a build system that's different from configure/make/install. All | 123 # NSS uses a build system that's different from configure/make/install. All |
| 122 # flags must be passed as arguments to make. | 124 # flags must be passed as arguments to make. |
| 123 make_args = [] | 125 make_args = [] |
| 124 # Do an optimized build. | 126 # Do an optimized build. |
| 125 make_args.append('BUILD_OPT=1') | 127 make_args.append('BUILD_OPT=1') |
| 126 # Set USE_64=1 on x86_64 systems. | 128 # Set USE_64=1 on x86_64 systems. |
| 127 if platform.architecture()[0] == '64bit': | 129 if platform.architecture()[0] == '64bit': |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 'DESTDIR=%s' % destdir, | 171 'DESTDIR=%s' % destdir, |
| 170 # Do not install in lib64/. | 172 # Do not install in lib64/. |
| 171 'lib=lib', | 173 'lib=lib', |
| 172 # Skip a step that requires sudo. | 174 # Skip a step that requires sudo. |
| 173 'RAISE_SETFCAP=no' | 175 'RAISE_SETFCAP=no' |
| 174 ] | 176 ] |
| 175 shell_call('make -j%s install %s' % | 177 shell_call('make -j%s install %s' % |
| 176 (parsed_arguments.jobs, ' '.join(install_args)), | 178 (parsed_arguments.jobs, ' '.join(install_args)), |
| 177 parsed_arguments.verbose, environment) | 179 parsed_arguments.verbose, environment) |
| 178 fix_rpaths(destdir) | 180 fix_rpaths(destdir) |
| 179 shell_call([ | 181 run_shell_commands([ |
| 180 # Now move the contents of the temporary destdir to their final place. | 182 # Now move the contents of the temporary destdir to their final place. |
| 181 'cp %s/* %s/ -rdf' % (destdir, install_prefix)], | 183 # We only care for the contents of lib/. |
| 182 parsed_arguments.verbose, environment) | 184 'mkdir -p %s/lib' % install_prefix, |
| 185 'cp %s/lib/* %s/lib/ -rdf' % (destdir, install_prefix)], |
| 186 parsed_arguments.verbose, environment) |
| 183 | 187 |
| 184 | 188 |
| 185 def libpci3_make_install(parsed_arguments, environment, install_prefix): | 189 def libpci3_make_install(parsed_arguments, environment, install_prefix): |
| 186 # pciutils doesn't have a configure script | 190 # pciutils doesn't have a configure script |
| 187 # This build script follows debian/rules. | 191 # This build script follows debian/rules. |
| 188 | 192 |
| 189 # Find out the package version. We'll use this when creating symlinks. | 193 # Find out the package version. We'll use this when creating symlinks. |
| 190 dir_name = os.path.split(os.getcwd())[-1] | 194 dir_name = os.path.split(os.getcwd())[-1] |
| 191 match = re.match('pciutils-(\d+\.\d+\.\d+)', dir_name) | 195 match = re.match('pciutils-(\d+\.\d+\.\d+)', dir_name) |
| 192 if match is None: | 196 if match is None: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 213 ] | 217 ] |
| 214 install_args = ['DESTDIR=%s' % destdir] | 218 install_args = ['DESTDIR=%s' % destdir] |
| 215 run_shell_commands([ | 219 run_shell_commands([ |
| 216 'mkdir -p %s-udeb/usr/bin' % destdir, | 220 'mkdir -p %s-udeb/usr/bin' % destdir, |
| 217 'make -j%s %s' % (parsed_arguments.jobs, ' '.join(make_args + paths)), | 221 'make -j%s %s' % (parsed_arguments.jobs, ' '.join(make_args + paths)), |
| 218 'make -j%s %s install' % ( | 222 'make -j%s %s install' % ( |
| 219 parsed_arguments.jobs, | 223 parsed_arguments.jobs, |
| 220 ' '.join(install_args + paths))], | 224 ' '.join(install_args + paths))], |
| 221 parsed_arguments.verbose, environment) | 225 parsed_arguments.verbose, environment) |
| 222 fix_rpaths(destdir) | 226 fix_rpaths(destdir) |
| 223 # Now move the contents of the temporary destdir to their final place. | 227 # Now install the DSOs to their final place. |
| 224 run_shell_commands([ | 228 run_shell_commands([ |
| 225 'cp %s/* %s/ -rd' % (destdir, install_prefix), | 229 'mkdir -p %s/lib' % install_prefix, |
| 226 'mkdir -p %s/lib/' % install_prefix, | |
| 227 'install -m 644 lib/libpci.so* %s/lib/' % install_prefix, | 230 'install -m 644 lib/libpci.so* %s/lib/' % install_prefix, |
| 228 'ln -sf libpci.so.%s %s/lib/libpci.so.3' % (version, install_prefix)], | 231 'ln -sf libpci.so.%s %s/lib/libpci.so.3' % (version, install_prefix)], |
| 229 parsed_arguments.verbose, environment) | 232 parsed_arguments.verbose, environment) |
| 230 | 233 |
| 231 | 234 |
| 232 def build_and_install(parsed_arguments, environment, install_prefix): | 235 def build_and_install(parsed_arguments, environment, install_prefix): |
| 233 if parsed_arguments.build_method == 'destdir': | 236 if parsed_arguments.build_method == 'destdir': |
| 234 destdir_configure_make_install( | 237 destdir_configure_make_install( |
| 235 parsed_arguments, environment, install_prefix) | 238 parsed_arguments, environment, install_prefix) |
| 236 elif parsed_arguments.build_method == 'custom_nss': | 239 elif parsed_arguments.build_method == 'custom_nss': |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 os.chdir(SCRIPT_ABSOLUTE_PATH) | 395 os.chdir(SCRIPT_ABSOLUTE_PATH) |
| 393 # Ensure all build dependencies are installed. | 396 # Ensure all build dependencies are installed. |
| 394 if parsed_arguments.check_build_deps: | 397 if parsed_arguments.check_build_deps: |
| 395 check_package_build_dependencies(parsed_arguments.package) | 398 check_package_build_dependencies(parsed_arguments.package) |
| 396 | 399 |
| 397 download_build_install(parsed_arguments) | 400 download_build_install(parsed_arguments) |
| 398 | 401 |
| 399 | 402 |
| 400 if __name__ == '__main__': | 403 if __name__ == '__main__': |
| 401 main() | 404 main() |
| OLD | NEW |