blob: 0bd99a91679214264f528a0e1603b0c8b7e2ba4b [file] [log] [blame]
Patrick Rohr6d722af2023-01-05 07:16:46 -08001#!/bin/bash
2set -x
3
4# Run this script inside a full chromium checkout.
Patrick Rohr6d722af2023-01-05 07:16:46 -08005
6OUT_PATH="out/cronet"
7
8#######################################
Motomu Utsumieb19dca2023-01-25 15:25:08 +09009# Apply patches in external/cronet.
10# Globals:
11# ANDROID_BUILD_TOP
12# Arguments:
13# None
14#######################################
15function apply_patches() {
16 local -r patch_root="${ANDROID_BUILD_TOP}/external/cronet/patches"
17
18 local upstream_patches
19 upstream_patches=$(ls "${patch_root}/upstream-next")
20 local patch
21 for patch in ${upstream_patches}; do
22 git am --3way "${patch_root}/upstream-next/${patch}"
23 done
24
25 local local_patches
26 local_patches=$(ls "${patch_root}/local")
27 for patch in ${local_patches}; do
28 git am --3way "${patch_root}/local/${patch}"
29 done
30}
31
32#######################################
Patrick Rohr6d722af2023-01-05 07:16:46 -080033# Generate desc.json for a specified architecture.
34# Globals:
35# OUT_PATH
36# Arguments:
37# target_cpu, string
38#######################################
39function gn_desc() {
40 local -a gn_args=(
41 "target_os = \"android\""
42 "enable_websockets = false"
43 "disable_file_support = true"
44 "disable_brotli_filter = false"
45 "is_component_build = false"
46 "use_crash_key_stubs = true"
47 "use_partition_alloc = false"
48 "include_transport_security_state_preload_list = false"
49 "use_platform_icu_alternatives = true"
50 "default_min_sdk_version = 19"
51 "use_errorprone_java_compiler = true"
52 "enable_reporting = true"
53 "use_hashed_jni_names = true"
54 "treat_warnings_as_errors = false"
55 "enable_base_tracing = false"
Motomu Utsumiedf300c2023-01-12 17:52:21 +090056 "is_cronet_build = true"
Motomu Utsumidaaf73b2023-01-27 13:21:49 +090057 "is_debug = false"
58 "is_official_build = true"
Mohannad Farraga6f43302023-02-09 16:24:29 +000059 "use_nss_certs = false"
Patrick Rohr6d722af2023-01-05 07:16:46 -080060 )
61 gn_args+=("target_cpu = \"${1}\"")
62
63 # Only set arm_use_neon on arm architectures to prevent warning from being
64 # written to json output.
65 if [[ "$1" =~ ^arm ]]; then
66 gn_args+=("arm_use_neon = false")
67 fi
68
69 # Configure gn args.
70 gn gen "${OUT_PATH}" --args="${gn_args[*]}"
71
72 # Generate desc.json.
73 local -r out_file="desc_${1}.json"
74 gn desc "${OUT_PATH}" --format=json --all-toolchains "//*" > "${out_file}"
75}
76
Motomu Utsumieb19dca2023-01-25 15:25:08 +090077apply_patches
Patrick Rohr6d722af2023-01-05 07:16:46 -080078gn_desc x86
79gn_desc x64
80gn_desc arm
81gn_desc arm64
82