-
Notifications
You must be signed in to change notification settings - Fork 312
/
Copy pathchromium.yaml
401 lines (370 loc) · 12.1 KB
/
chromium.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
#nolint:git-checkout-must-use-github-updates
# Note: To produce a debug build of Chromium, pass these options to gn:
# blink_symbol_level=2
# is_debug=true
# is_official_build=false
# symbol_level=2
# And remove the use of the strip pipeline below
package:
name: chromium
version: "134.0.6998.88"
epoch: 0
description: "Open souce version of Google's chrome web browser"
copyright:
- license: BSD-3-Clause
resources:
cpu: 65
memory: 128Gi
dependencies:
runtime:
- font-opensans
- fontconfig
- gtk-3
- icu-data-full
- libnss
- mesa
- mesa-glx
- nss
- systemd
- xdg-utils
environment:
contents:
packages:
- alsa-lib-dev
- at-spi2-core-dev
- bash
- bison
- brotli-dev
- build-base
- busybox
- bzip2-dev
- ca-certificates-bundle
- cairo-dev
- clang
- compiler-rt
- crc32c-dev
- cups-dev
- curl
- curl-dev
- dav1d-dev
- dbus-dev
- dbus-glib-dev
- default-jdk
- double-conversion-dev
- elfutils
- elfutils-dev
- expat-dev
- ffmpeg-dev
- findutils
- flac-dev
- flex
- fontconfig-dev
- freetype-dev
- fribidi-dev
- git
- glib-dev
- gn
- gnutar
- gperf
- gtk-3-dev
- gzip
- harfbuzz-dev
- harfbuzz-static
- hwdata-dev
- hwdata-usb
- icu-dev
- krb5-dev
- lcms2-dev
- libbsd-dev
- libcap-dev
- libffi-dev
- libgcrypt-dev
- libjpeg-turbo-dev
- libnspr-dev
- libnss-dev
- libogg-dev
- libpsl-dev
- libpsl-static
- libsecret-dev
- libusb-dev
- libva-dev
- libwebp-dev
- libxcomposite-dev
- libxcursor-dev
- libxdamage
- libxdamage-dev
- libxft-dev
- libxi-dev
- libxinerama-dev
- libxkbcommon
- libxkbcommon-dev
- libxml2-dev
- libxrandr-dev
- libxshmfence-dev
- libxslt-dev
- libxtst
- libxtst-dev
- linux-headers
- lld
- llvm-dev
- mesa-dev
- minizip
- nghttp2-dev
- nodejs
- openh264-dev
- opus-dev
- pango
- pango-dev
- pciutils
- pciutils-dev
- perl
- pulseaudio-dev
- py3-httplib2
- py3-setuptools
- python3
- qt5-qtbase-dev
- qt6-qtbase-dev
- rust
- rust-bindgen
- samurai
- scanelf
- speex-dev
- sqlite-dev
- systemd-dev
- wget
- xcb-proto
- xz
- zlib-dev
- zstd-dev
environment:
# Use host clang
AR: "llvm-ar"
CC: "clang"
CXX: "clang++"
NM: "llvm-nm"
# Allow unstable features with stable rust
RUSTC_BOOTSTRAP: 1
pipeline:
- name: Fetch Chromium tarball
uses: fetch
with:
# Fetch source and dependencies: takes about 11 minutes, requires 30 GB of disk
# Gentoo provides tarballs where they've already performed a client sync (which isn't possible on arm64)
#
# Tarballs are built using the instructions here:
# https://wiki.gentoo.org/wiki/Project:Chromium/How_to_make_a_Chromium_tarball
uri: https://chromium-tarballs.distfiles.gentoo.org/chromium-${{package.version}}-linux.tar.xz
expected-sha512: 298e5d87e0ac8bf9fb861c73e4cfd7f2dec7d3007a1d5c14afeba2770f1e219b602a2490013f21c5015f56e9cf5e8e8901fe3cc503059e235b4cb06b329885dd
- name: Remove binaries from source tree
runs: |
# These binaries are tools transient from the client sync Gentoo performs for us
# All we need is the Chromium source tree and its dependencies
scanelf -RA -F "%F" "$HOME" 2>/dev/null | while read -r elf; do
echo "Removing $elf"
rm -f "$elf"
done
- uses: patch
with:
patches: |
bindgen.patch \
fortify_level.patch
- name: Use system libraries
runs: |
# Use USB IDs already provided by hwdata-usb
sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' \
-i services/device/public/cpp/usb/BUILD.gn
# Define system libraries to use
# Chromium doesn't like our ffmpeg so removing it for now
system_libs="
brotli
crc32c
dav1d
double-conversion
flac
fontconfig
harfbuzz-ng
libjpeg
libsecret
libusb
libwebp
libxml
libxslt
openh264
opus
zlib
zstd
"
# Remove bundled libraries
for _lib in $system_libs libjpeg_turbo unrar; do
echo "Removing buildscripts for system provided $_lib"
_lib="${_lib/swiftshader-/swiftshader/third_party/}"
find . -type f -path "*third_party/$_lib/*" \
\! -path "*third_party/$_lib/chromium/*" \
\! -path "*third_party/$_lib/google/*" \
\! -path './base/third_party/icu/*' \
\! -path './third_party/libxml/*' \
\! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
\! -path './third_party/harfbuzz-ng/utils/hb_scoped.h' \
\! -path './third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h' \
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
-delete
done
# Update gn configuration to use system libraries
python3 build/linux/unbundle/replace_gn_files.py --system-libraries $system_libs
python3 third_party/libaddressinput/chromium/tools/update-strings.py
# Allow system dependencies in "official builds"
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
tools/generate_shim_headers/generate_shim_headers.py
# Use host node
mkdir -p third_party/node/linux/node-linux-x64/bin
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/node
# Use host java
mkdir -p third_party/jdk/current/bin
ln -s /usr/bin/java third_party/jdk/current/bin/java
# Upstream Rust moved from adler to adler2 in 1.86, and upstream Chromium
# have already followed that move: if we're building with 1.85.x (the
# current wolfi Rust version as of authoring), then instruct GN to use
# the older lib. (I figured this out based on the resolution of this
# build failure in Gentoo: https://bugs.gentoo.org/950040)
rust_version="$(rustc --version | awk '{ print $2;}')"
case $rust_version in
1.85.*)
sed -i 's/adler2/adler/' build/rust/std/BUILD.gn
;;
esac
- name: Generate gn config
runs: |
# Fetch clang version
# We could parse clang --version with awk, but this is cleaner
clang_version=$(basename $(clang --print-resource-dir))
# Generate config: takes about 30 minutes
time gn gen $HOME/out/Default --args="
blink_symbol_level=0
clang_base_path=\"/usr/lib/llvm-$clang_version\"
clang_use_chrome_plugins=false
clang_version=\"$clang_version\"
chrome_pgo_phase=0
custom_toolchain=\"//build/toolchain/linux/unbundle:default\"
enable_freetype=true
enable_nacl=false
enable_rust=true
enable_widevine=true
ffmpeg_branding=\"Chrome\"
icu_use_data_file=false
is_cfi=false
is_clang=true
is_component_build=false
is_component_ffmpeg=true
is_debug=false
is_official_build=true
link_pulseaudio=true
moc_qt6_path=\"/usr/lib/qt6/libexec\"
proprietary_codecs=true
rustc_version=\"$(rustc --version)\"
rust_bindgen_root=\"/usr\"
rust_sysroot_absolute=\"/usr\"
safe_browsing_use_unrar=false
symbol_level=0
treat_warnings_as_errors=false
use_lld=true
use_pulseaudio=true
use_qt6=true
use_safe_libstdcxx=false
use_sysroot=false
use_system_freetype=true
use_system_harfbuzz=true
use_system_lcms2=true
use_system_libffi=true
use_system_libjpeg=true
use_system_zlib=true
"
- name: Build
runs: |
# Disable compiler warnings encountered when using system provided libraries
export CFLAGS="$CFLAGS -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations -Wno-shift-count-overflow -Wno-ignored-attributes"
export CXXFLAGS="$CXXFLAGS -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations -Wno-invalid-constexpr"
export CPPFLAGS="${CPPFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS/} -D__DATE__= -D__TIME__= -D__TIMESTAMP__="
# Compile: takes about 3 hours, 60 GB of disk (on a 32xXeon, 128GBxRAM, 2TBxNVME system)
time ninja -C ./out/Default chrome chromedriver.unstripped chrome_crashpad_handler chrome_sandbox
- working-directory: /home/build/out/Default
name: Install binaries & libraries
runs: |
mkdir -p \
${{targets.contextdir}}/usr/bin \
${{targets.contextdir}}/usr/lib/${{package.name}} \
${{targets.contextdir}}/etc/chromium
# Install libraries
mv *.so* ${{targets.contextdir}}/usr/lib/${{package.name}}
# Install binaries
mv chrome chrome_crashpad_handler chrome_sandbox \
${{targets.contextdir}}/usr/lib/${{package.name}}
# Install resources
mv snapshot_blob.bin v8_context_snapshot.bin \
xdg-mime xdg-settings vk_swiftshader_icd.json \
*.pak locales \
${{targets.contextdir}}/usr/lib/${{package.name}}/
# Setup wrapper and symlinks
cd $HOME
mv chromium-launcher.sh ${{targets.destdir}}/usr/bin/chromium-browser
ln -s /usr/lib/${{package.name}}/chrome ${{targets.contextdir}}/usr/bin/chromium
ln -s /usr/lib/${{package.name}}/chromedriver ${{targets.contextdir}}/usr/bin/chromedriver
- uses: strip
with:
opts: -s
# Do not strip ChromeDriver
- working-directory: /home/build/out/Default
runs: |
mv chromedriver.unstripped ${{targets.destdir}}/usr/lib/${{package.name}}/chromedriver
subpackages:
- name: ${{package.name}}-lang
pipeline:
- runs: |
mkdir -p ${{targets.contextdir}}/usr/lib/${{package.name}}/locales
mv ${{targets.destdir}}/usr/lib/${{package.name}}/locales/* ${{targets.contextdir}}/usr/lib/${{package.name}}/locales/
# Ensure we provide one locale in the base package
mv ${{targets.subpkgdir}}/usr/lib/${{package.name}}/locales/en-US.pak ${{targets.destdir}}/usr/lib/${{package.name}}/locales/en-US.pak
# https://github.com/SeleniumHQ/docker-selenium/blob/trunk/NodeChrome/Dockerfile
- name: chromium-docker-selenium-compat
pipeline:
- runs: |
mkdir -p ${{targets.contextdir}}/opt/selenium
ln -s /usr/lib/chromium/chromedriver ${{targets.contextdir}}/opt/selenium/chromedriver-${{package.version}}
echo "chrome" > ${{targets.contextdir}}/opt/selenium/browser_name
echo ${{package.version}} > ${{targets.contextdir}}/opt/selenium/browser_version
echo "\"goog:chromeOptions\": {\"binary\": \"/usr/bin/chromium-browser\"}" > ${{targets.contextdir}}/opt/selenium/browser_binary_location
update:
enabled: true
release-monitor:
identifier: 13344
test:
environment:
contents:
packages:
- grep
- py3-pip
- python3
environment:
LD_LIBRARY_PATH: "/usr/lib/chromium"
pipeline:
- name: Check for lang pack
runs: |
test -f /usr/lib/chromium/locales/en-US.pak
- name: Check status page
runs: |
# Check status with new headless mode
chromium --no-sandbox --headless --disable-gpu --dump-dom https://www.chromestatus.com
# Test wrapper
CHROMIUM_USER_FLAGS="--no-sandbox --headless --disable-gpu --dump-dom" chromium-browser https://www.chromestatus.com
#- name: Test ChromeDriver with Selenium
# runs: |
# pip3 install selenium
# python3 ./test-chromedriver.py
- name: Version/help check
runs: |
chromedriver --version
chromedriver --help
chromium --version
chromium-browser --version
- uses: test/ldd-check
with:
packages: ${{package.name}}