Commit 5e6f91c6 authored by Misha Efimov's avatar Misha Efimov Committed by Commit Bot

[Cronet] Add package_mac.py script to build dbg and opt packages for Mac.

This could be used to make consistent builds of Cronet before official builders are available.

Bug: 786559
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;master.tryserver.chromium.android:android_cronet_tester
Change-Id: I5154f9e4461cdae1cbe07dc7e4309978d98d8508
Reviewed-on: https://chromium-review.googlesource.com/c/1273824Reviewed-by: default avatarPaul Jensen <pauljensen@chromium.org>
Commit-Queue: Misha Efimov <mef@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599284}
parent 15087953
...@@ -116,7 +116,13 @@ if (!is_ios && !is_android) { ...@@ -116,7 +116,13 @@ if (!is_ios && !is_android) {
} }
} }
_cronet_shared_lib_name = "cronet.$chrome_version_full"
_cronet_shared_lib_file_name =
"$shlib_prefix$_cronet_shared_lib_name$shlib_extension"
shared_library("cronet") { shared_library("cronet") {
output_name = _cronet_shared_lib_name
deps = [ deps = [
"//base", "//base",
"//components/cronet:cronet_common", "//components/cronet:cronet_common",
...@@ -131,7 +137,7 @@ if (!is_ios && !is_android) { ...@@ -131,7 +137,7 @@ if (!is_ios && !is_android) {
if (is_mac && !is_component_build) { if (is_mac && !is_component_build) {
ldflags = [ ldflags = [
"-install_name", "-install_name",
"@rpath/lib${target_name}.dylib", "@rpath/$_cronet_shared_lib_file_name",
] ]
public_configs = [ ":shared_library_public_config" ] public_configs = [ ":shared_library_public_config" ]
} }
...@@ -201,28 +207,16 @@ if (!is_ios && !is_android) { ...@@ -201,28 +207,16 @@ if (!is_ios && !is_android) {
# Copy boiler-plate files into the package. # Copy boiler-plate files into the package.
copy("cronet_package_copy") { copy("cronet_package_copy") {
sources = [ sources = [
"$root_out_dir/$_cronet_shared_lib_file_name",
"//AUTHORS", "//AUTHORS",
"//chrome/VERSION", "//chrome/VERSION",
] ]
outputs = [
"$_package_dir/{{source_file_part}}",
]
}
# Copy shared library adding the version to the file name.
copy("cronet_package_shlib") {
sources = [
"$root_out_dir/${shlib_prefix}cronet${shlib_extension}",
]
outputs = [
"$_package_dir/${shlib_prefix}cronet.${chrome_version_full}${shlib_extension}",
]
deps = [ deps = [
":cronet", ":cronet",
] ]
outputs = [
"$_package_dir/{{source_file_part}}",
]
} }
# Copy headers. # Copy headers.
...@@ -238,7 +232,6 @@ if (!is_ios && !is_android) { ...@@ -238,7 +232,6 @@ if (!is_ios && !is_android) {
deps = [ deps = [
":cronet_package_copy", ":cronet_package_copy",
":cronet_package_headers", ":cronet_package_headers",
":cronet_package_shlib",
":generate_license", ":generate_license",
] ]
} }
......
...@@ -60,6 +60,34 @@ def stack(out_dir): ...@@ -60,6 +60,34 @@ def stack(out_dir):
return run('adb logcat -d | CHROMIUM_OUTPUT_DIR=' + out_dir + return run('adb logcat -d | CHROMIUM_OUTPUT_DIR=' + out_dir +
' third_party/android_platform/development/scripts/stack') ' third_party/android_platform/development/scripts/stack')
def use_goma:
home_goma = os.path.expanduser("~/goma")
if os.path.exists(home_goma) or os.environ.get("GOMA_DIR") or \
os.environ.get("GOMADIR"):
return 'use_goma=true '
return ''
def gn_args(target_os, is_release):
gn_args = 'target_os="' + target_os + '" enable_websockets=false '+ \
'disable_file_support=true disable_ftp_support=true '+ \
'disable_brotli_filter=false ' + \
'is_component_build=false ' + \
'use_crash_key_stubs=true ' + \
'ignore_elf32_limitations=true use_partition_alloc=false ' + \
'include_transport_security_state_preload_list=false ' + use_goma()
if (is_release):
gn_args += 'is_debug=false is_official_build=true '
return gn_args
def gn_args_mac(is_release):
return gn_args('mac', is_release) + \
'disable_histogram_support=true ' + \
'use_platform_icu_alternatives=false ' + \
'enable_dsyms=true '
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('command', parser.add_argument('command',
...@@ -75,8 +103,6 @@ def main(): ...@@ -75,8 +103,6 @@ def main():
'stack', 'stack',
'debug', 'debug',
'build-debug']) 'build-debug'])
parser.add_argument('-g', '--gn', action='store_true',
help='use gn output directory suffix')
parser.add_argument('-d', '--out_dir', action='store', parser.add_argument('-d', '--out_dir', action='store',
help='name of the build directory') help='name of the build directory')
parser.add_argument('-i', '--iphoneos', action='store_true', parser.add_argument('-i', '--iphoneos', action='store_true',
...@@ -127,22 +153,13 @@ def main(): ...@@ -127,22 +153,13 @@ def main():
gn_args += 'is_asan=true is_clang=true is_debug=false ' gn_args += 'is_asan=true is_clang=true is_debug=false '
out_dir_suffix += '-asan' out_dir_suffix += '-asan'
gn_args += 'target_os="' + target_os + '" enable_websockets=false '+ \ gn_args += gn_args(target_os, options.release) + \
'disable_file_support=true disable_ftp_support=true '+ \ 'use_platform_icu_alternatives=true '
'disable_brotli_filter=false ' + \
'use_platform_icu_alternatives=true '+ \
'is_component_build=false ' + \
'use_crash_key_stubs=true ' + \
'ignore_elf32_limitations=true use_partition_alloc=false ' + \
'include_transport_security_state_preload_list=false '
extra_options = ' '.join(extra_options_list) extra_options = ' '.join(extra_options_list)
if options.gn:
out_dir_suffix += "-gn"
if options.release: if options.release:
out_dir = 'out/Release' + out_dir_suffix out_dir = 'out/Release' + out_dir_suffix
gn_args += 'is_debug=false is_official_build=true '
else: else:
out_dir = 'out/Debug' + out_dir_suffix out_dir = 'out/Debug' + out_dir_suffix
......
#!/usr/bin/python
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
package_mac.py - Build and Package Release and Debug libraries for Mac OS X.
"""
import argparse
import cr_cronet
import glob
import os
import shutil
import sys
def package_mac(out_dir, gn_args, build_config):
target_dir = out_dir + '/' + build_config
build_dir = "out/build_temp/" + build_config
print 'Generating Ninja ' + gn_args
gn_result = cr_cronet.run('gn gen %s --args=\'%s\'' % (build_dir, gn_args))
if gn_result != 0:
return gn_result
print 'Building ' + build_dir
build_result = cr_cronet.run('ninja -C %s cronet_package -j200' % build_dir)
if build_result != 0:
return build_result
print 'Copying to ' + target_dir
if (not os.path.exists(out_dir)):
shutil.copytree(build_dir + "/cronet", out_dir,
ignore=shutil.ignore_patterns('libcronet*'))
os.mkdir(target_dir)
for libcronet in glob.glob(build_dir + "/cronet/libcronet*"):
shutil.copy(libcronet, target_dir)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('out_dir', help='path to output directory')
options, _ = parser.parse_known_args()
out_dir = options.out_dir
# Make sure that the output directory does not exist
if os.path.exists(out_dir):
print >>sys.stderr, 'The output directory already exists: ' + out_dir
return 1
return package_mac(out_dir, cr_cronet.gn_args_mac(True), "opt") or \
package_mac(out_dir, cr_cronet.gn_args_mac(False), "dbg")
if __name__ == '__main__':
sys.exit(main())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment