Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/angle
Path: blob/main_old/scripts/roll_aosp.sh
1693 views
1
#!/bin/bash
2
3
# Copyright The ANGLE Project Authors. All rights reserved.
4
# Use of this source code is governed by a BSD-style license that can be
5
# found in the LICENSE file.
6
#
7
# Generates a roll CL within the ANGLE repository of AOSP.
8
9
# exit when any command fails
10
set -eE -o functrace
11
12
failure() {
13
local lineno=$1
14
local msg=$2
15
echo "Failed at $lineno: $msg"
16
}
17
trap 'failure ${LINENO} "$BASH_COMMAND"' ERR
18
19
# Change the working directory to the ANGLE root directory
20
cd "${0%/*}/.."
21
22
GN_OUTPUT_DIRECTORY=out/Android
23
24
function generate_Android_bp_file() {
25
rm -rf ${GN_OUTPUT_DIRECTORY}
26
27
abis=(
28
"arm"
29
"arm64"
30
"x86"
31
"x64"
32
)
33
34
for abi in "${abis[@]}"; do
35
# generate gn build files and convert them to blueprints
36
gn_args=(
37
"target_os = \"android\""
38
"is_component_build = false"
39
"is_debug = false"
40
"dcheck_always_on = false"
41
"symbol_level = 0"
42
"angle_standalone = false"
43
"angle_build_all = false"
44
45
# Build for 64-bit CPUs
46
"target_cpu = \"$abi\""
47
48
# Target ndk API 26 to make sure ANGLE can use the Vulkan backend on Android
49
"android32_ndk_api_level = 26"
50
"android64_ndk_api_level = 26"
51
52
# Disable all backends except Vulkan
53
"angle_enable_vulkan = true"
54
"angle_enable_gl = false"
55
"angle_enable_d3d9 = false"
56
"angle_enable_d3d11 = false"
57
"angle_enable_null = false"
58
"angle_enable_metal = false"
59
60
# SwiftShader is loaded as the system Vulkan driver on Android, not compiled by ANGLE
61
"angle_enable_swiftshader = false"
62
63
# Disable all shader translator targets except desktop GL (for Vulkan)
64
"angle_enable_essl = false"
65
"angle_enable_glsl = false"
66
"angle_enable_hlsl = false"
67
68
"angle_enable_commit_id = false"
69
70
# Disable histogram/protobuf support
71
"angle_has_histograms = false"
72
73
# Disable _LIBCPP_ABI_UNSTABLE, since it breaks std::string
74
"libcxx_abi_unstable = false"
75
76
# rapidJSON is used for ANGLE's frame capture (among other things), which is unnecessary for AOSP builds.
77
"angle_has_rapidjson = false"
78
)
79
80
if [[ "$1" == "--enableApiTrace" ]]; then
81
gn_args=(
82
"${gn_args[@]}"
83
"angle_enable_trace = true"
84
"angle_enable_trace_android_logcat = true"
85
)
86
fi
87
88
gn gen ${GN_OUTPUT_DIRECTORY} --args="${gn_args[*]}"
89
gn desc ${GN_OUTPUT_DIRECTORY} --format=json "*" > ${GN_OUTPUT_DIRECTORY}/desc.$abi.json
90
done
91
92
python scripts/generate_android_bp.py \
93
${GN_OUTPUT_DIRECTORY}/desc.arm.json \
94
${GN_OUTPUT_DIRECTORY}/desc.arm64.json \
95
${GN_OUTPUT_DIRECTORY}/desc.x86.json \
96
${GN_OUTPUT_DIRECTORY}/desc.x64.json > Android.bp
97
98
rm -rf ${GN_OUTPUT_DIRECTORY}
99
}
100
101
102
if [[ "$1" == "--genAndroidBp" ]];then
103
generate_Android_bp_file "$2"
104
exit 0
105
fi
106
107
# Check out depot_tools locally and add it to the path
108
DEPOT_TOOLS_DIR=_depot_tools
109
rm -rf ${DEPOT_TOOLS_DIR}
110
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git ${DEPOT_TOOLS_DIR}
111
export PATH=`pwd`/${DEPOT_TOOLS_DIR}:$PATH
112
113
third_party_deps=(
114
"third_party/abseil-cpp"
115
"third_party/vulkan-deps/glslang/src"
116
"third_party/vulkan-deps/spirv-headers/src"
117
"third_party/vulkan-deps/spirv-tools/src"
118
"third_party/vulkan-deps/vulkan-headers/src"
119
"third_party/vulkan_memory_allocator"
120
"third_party/zlib"
121
)
122
123
# Only add the parts of NDK and vulkan-deps that are required by ANGLE. The entire dep is too large.
124
delete_only_deps=(
125
"third_party/vulkan-deps"
126
)
127
128
# Delete dep directories so that gclient can check them out
129
for dep in "${third_party_deps[@]}" "${delete_only_deps[@]}"; do
130
rm -rf "$dep"
131
done
132
133
# Sync all of ANGLE's deps so that 'gn gen' works
134
python scripts/bootstrap.py
135
gclient sync --reset --force --delete_unversioned_trees
136
137
generate_Android_bp_file
138
139
# Delete all unsupported 3rd party dependencies. Do this after generate_Android_bp_file, so
140
# it has access to all of the necessary BUILD.gn files.
141
# Any 3rd party dependencies that are added to this list must have their licenses verified.
142
find third_party/ -maxdepth 2 -type d ! -path third_party/ \
143
! -path 'third_party/abseil-cpp*' \
144
! -path 'third_party/vulkan-deps' \
145
! -path 'third_party/vulkan-deps/glslang*' \
146
! -path 'third_party/vulkan-deps/spirv-headers*' \
147
! -path 'third_party/vulkan-deps/spirv-tools*' \
148
! -path 'third_party/vulkan-deps/vulkan-headers*' \
149
! -path 'third_party/vulkan_memory_allocator*' \
150
! -path 'third_party/zlib*' \
151
-print0 | xargs --null rm -rf
152
# Special handling for zlib's contrib/ (third_party) folder, since there are some
153
# missing license files.
154
find third_party/zlib/contrib/ -maxdepth 1 -type d ! -path third_party/zlib/contrib/ \
155
! -path 'third_party/zlib/contrib/optimizations*' \
156
-print0 | xargs --null rm -rf
157
158
git add Android.bp
159
160
# Delete the .git files in each dep so that it can be added to this repo. Some deps like jsoncpp
161
# have multiple layers of deps so delete everything before adding them.
162
for dep in "${third_party_deps[@]}"; do
163
rm -rf "$dep"/.git
164
done
165
166
extra_removal_files=(
167
# Some third_party deps have OWNERS files which contains users that have not logged into
168
# the Android gerrit. Repo cannot upload with these files present.
169
"third_party/abseil-cpp/OWNERS"
170
"third_party/vulkan_memory_allocator/OWNERS"
171
"third_party/zlib/OWNERS"
172
"third_party/zlib/google/OWNERS"
173
"third_party/zlib/contrib/tests/OWNERS"
174
"third_party/zlib/contrib/bench/OWNERS"
175
"third_party/zlib/contrib/tests/fuzzers/OWNERS"
176
# Remove Android.mk files to prevent automated CLs:
177
# "[LSC] Add LOCAL_LICENSE_KINDS to external/angle"
178
"Android.mk"
179
"third_party/vulkan-deps/glslang/src/Android.mk"
180
"third_party/vulkan-deps/glslang/src/ndk_test/Android.mk"
181
"third_party/vulkan-deps/spirv-tools/src/Android.mk"
182
"third_party/vulkan-deps/spirv-tools/src/android_test/Android.mk"
183
)
184
185
for removal_file in "${extra_removal_files[@]}"; do
186
rm -f "$removal_file"
187
done
188
189
# Add all changes to third_party/ so we delete everything not explicitly allowed.
190
git add -f "third_party/*"
191
192
# Done with depot_tools
193
rm -rf $DEPOT_TOOLS_DIR
194
195