-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathtemplate
More file actions
409 lines (347 loc) · 13.7 KB
/
template
File metadata and controls
409 lines (347 loc) · 13.7 KB
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
402
403
404
405
406
407
408
409
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
version=147.0.7727.55
revision=1
_rollup=4.22.4
archs="i686* x86_64* aarch64* armv7l*"
_llvmver=22
hostmakedepends="
$(vopt_if clang "clang${_llvmver} lld${_llvmver} llvm${_llvmver} compiler-rt${_llvmver}")
bison git gperf hwids ninja nodejs perl pkg-config python3
libepoxy-devel libglib-devel rust rust-bindgen
gn $(vopt_if qt6 qt6-base)"
makedepends="
alsa-lib-devel libdav1d-devel brotli-devel cups-devel elfutils-devel
fontconfig-devel freetype-devel gtk+3-devel libXScrnSaver-devel
libXcomposite-devel libXcursor-devel libXdamage-devel libXi-devel libXrandr-devel
libavif-devel libcap-devel libcurl-devel libdrm-devel
libexif-devel libflac-devel libgcrypt-devel libjpeg-turbo-devel libmtp-devel
libpng-devel libva-devel libwebp-devel libxml2-devel libxshmfence-devel
libxslt-devel minizip-devel mit-krb5-devel nss-devel opus-devel
pciutils-devel snappy-devel speech-dispatcher-devel speex-devel
xcb-proto zlib-devel libaom-devel libffi-devel libevdev-devel
compiler-rt${_llvmver} rust-std
$(vopt_if pipewire pipewire-devel)
$(vopt_if pulseaudio pulseaudio-devel)
$(vopt_if sndio sndio-devel)
$(vopt_if qt6 qt6-base-devel)"
depends="desktop-file-utils hicolor-icon-theme hwids xdg-utils"
short_desc="Google's attempt at creating a safer, faster, and more stable browser"
maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
# distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${version}.tar.xz"
# distfiles="https://chromium-tarballs.distfiles.gentoo.org/chromium-${version}.tar.xz"
# distfiles="https://chromium.googlesource.com/chromium/src.git/+archive/refs/tags/${version}.tar.gz"
distfiles="https://github.com/chromium-linux-tarballs/chromium-tarballs/releases/download/${version}/chromium-${version}-linux.tar.xz
https://registry.npmjs.org/@rollup/wasm-node/-/wasm-node-${_rollup}.tgz"
checksum="39ee033238284174dc3bd1a24f6508ff63292134216bb02b217a5ad50ce32a26
ee49bf67bd9bee869405af78162d028e2af0fcfca80497404f56b1b99f272717"
skip_extraction="wasm-node-${_rollup}.tgz"
lib32disabled=yes
build_options="clang libcxx debug vaapi pulseaudio sndio pipewire lto drumbrake qt6"
build_options_default="clang libcxx vaapi pulseaudio pipewire qt6"
desc_option_clang="Use clang to build"
desc_option_libcxx="Use bundled libc++"
desc_option_debug="Build with debug symbols"
desc_option_lto="Enable Link Time Optimization"
desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
desc_option_drumbrake="WebAssembly Interpreter"
if [ "$XBPS_LIBC" = musl ]; then
hostmakedepends+=" musl-legacy-compat"
fi
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
makedepends+=" musl-legacy-compat"
fi
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
libjpeg-turbo-devel libXi-devel nss-devel libpng-devel libwebp-devel
libxml2-devel $(vopt_if pulseaudio pulseaudio-devel) libxslt-devel libxkbcommon-devel
$(vopt_if pipewire pipewire-devel) opus-devel pango-devel libva-devel
libcurl-devel snappy-devel libXrandr-devel libXcomposite-devel cups-devel
mit-krb5-devel alsa-lib-devel libXdamage-devel libepoxy-devel libevdev-devel
libavif-devel libaom-devel libdav1d-devel libflac-devel
libdrm-devel libgbm-devel $(vopt_if qt6 qt6-base-devel)"
fi
if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
broken="chromium (v8) can only be cross compiled if word size matches"
fi
case "${XBPS_TARGET_MACHINE}" in
i686*) broken="v8 mksnapshot segfault" ;;
esac
if [ "$CROSS_BUILD" ]; then
case "${XBPS_TARGET_MACHINE}" in
aarch64*) ;;
*) nocross="chromium can not be cross compiled for this architecture" ;;
esac
fi
subpackages="" # xbps-src does not reset the variable
if [ "$build_option_qt6" ]; then
subpackages+=" chromium-qt6"
fi
post_extract() {
rm -rv third_party/devtools-frontend/src/node_modules/rollup
mkdir third_party/devtools-frontend/src/node_modules/rollup
vsrcextract -C third_party/devtools-frontend/src/node_modules/rollup --strip-components=1 "wasm-node-${_rollup}.tgz"
}
post_patch() {
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
for f in "${FILESDIR}"/musl-patches/*.patch; do
echo "Applying $f"
patch -Np1 -i "$f"
done
fi
# prevent annoying errors when regenerating gni
vsed -i 's,^update_readme$,#update_readme,' \
third_party/libvpx/generate_gni.sh
# allow system dependencies in "official builds"
vsed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
tools/generate_shim_headers/generate_shim_headers.py
mkdir -p third_party/node/linux/node-linux-x64/bin
rm -f third_party/node/linux/node-linux-x64/bin/node
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
}
_setup_clang() {
export CC=clang
export CXX=clang++
export AR=llvm-ar
export NM=llvm-nm
export CFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=$wrksrc=."
export CXXFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=$wrksrc=."
export LDFLAGS=""
export BUILD_CC=clang
export BUILD_CXX=clang++
export BUILD_AR=llvm-ar
export BUILD_NM=llvm-nm
export BUILD_CFLAGS="-Wno-unknown-warning-option"
export BUILD_CXXFLAGS="-Wno-unknown-warning-option"
if [[ -n "$CROSS_BUILD" ]]; then
CFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
CXXFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
LDFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
if [[ -z "$build_option_libcxx" ]]; then
local gcc_version=$(gcc -dumpversion)
local clang_version=$(clang -dumpversion)
CFLAGS+=" --gcc-toolchain=/usr"
CFLAGS+=" -nostdinc"
CFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
CFLAGS+=" -isystem /usr/lib/clang/${clang_version}/include"
CXXFLAGS+=" --gcc-toolchain=/usr"
CXXFLAGS+=" -nostdinc++"
CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}"
CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET}"
CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward"
CXXFLAGS+=" -nostdinc"
CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
CXXFLAGS+=" -isystem /usr/lib/clang/${clang_version}/include"
LDFLAGS+=" --gcc-toolchain=/usr"
fi
fi
}
_setup_toolchain() {
if [ "$build_option_clang" ]; then
_setup_clang
fi
# XXX: need for error: the option `Z` is only accepted on the nightly compiler
export RUSTC_BOOTSTRAP=1
}
do_configure() {
local system=() conf=()
if false; then
# compile gn early, so it can be used to generate gni stuff
AR="ar" CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD LD=$CXX_FOR_BUILD \
CFLAGS=$CFLAGS_FOR_BUILD CXXFLAGS=$CXXFLAGS_FOR_BUILD LDFLAGS=$LDFLAGS_FOR_BUILD \
tools/gn/bootstrap/bootstrap.py ${makejobs} --skip-generate-buildfiles
fi
# Use system-provided libraries.
# TODO: use_system_hunspell (upstream changes needed).
# TODO: use_system_libsrtp.
# TODO: use_system_libusb (http://crbug.com/266149).
# TODO: use_system_ssl (http://crbug.com/58087).
# TODO: use_system_sqlite (http://crbug.com/22208).
# TODO: use_system_icu (segfaults)
# use_system_protobuf
# use_system_v8=1
# bzip2 xdg_utils speex
# XXX: harfbuzz-ng use builtin one until system-wide is updated >=3.0.0
# libcxx https://github.com/llvm/llvm-project/issues/61705:
# snappy
# ffmpeg: system ffmpeg is too old and makes the ffmpeg update not require
# rebuilding chromium
system=(
flac
fontconfig
freetype
libdrm
libjpeg
libpng
libwebp
libxml
libxslt
opus
)
# remove build scripts for system provided dependencies - basically does the
# same as the bundeled script to remove bundeled libs, but this way we don't
# have to list the remaining libs
for LIB in "${system[@]}" libjpeg_turbo; do
find "third_party/$LIB" -type f \
\! -path "third_party/$LIB/chromium/*" \
\! -path "third_party/$LIB/google/*" \
\! -path './base/third_party/icu/*' \
\! -path './third_party/harfbuzz-ng/utils/hb_scoped.h' \
\! -regex '.*\.\(gn\|gni\|isolate\)' \
-delete || :
done
# switch to system provided dependencies
build/linux/unbundle/replace_gn_files.py --system-libraries "${system[@]}"
third_party/libaddressinput/chromium/tools/update-strings.py
local clang_version="$(clang -dumpversion)"
conf=(
'use_sysroot=false'
'host_pkg_config="/usr/bin/pkg-config"'
"is_clang=$(vopt_if clang true false)"
"use_lld=$(vopt_if clang true false)"
'clang_use_chrome_plugins=false'
'clang_base_path="/usr"'
"clang_cross_path=\"${XBPS_CROSS_BASE}\""
"clang_version=\"${clang_version%%.*}\""
'use_clang_modules=false' # not yet supported with void's libcxx
"use_custom_libcxx=$(vopt_if libcxx true false)" # https://github.com/llvm/llvm-project/issues/61705
'enable_rust=true'
'rust_sysroot_absolute="/usr"'
"rust_cross_sysroot_absolute=\"${XBPS_CROSS_BASE}\""
'rust_bindgen_root="/usr"'
"rustc_version=\"$(rustc --version | cut -d' ' -f2)\""
'node_version_check=false'
# is_debug makes the build a debug build, changes some things.
# might be useful for real debugging vs just debug symbols.
"is_debug=false"
"blink_symbol_level=$(vopt_if debug 1 0)"
"symbol_level=$(vopt_if debug 1 0)"
'icu_use_data_file=true'
'enable_widevine=true'
'enable_hangout_services_extension=true'
'use_system_harfbuzz=false'
'use_system_libffi=true'
'use_qt5=false'
"use_qt6=$(vopt_if qt6 true false)"
'use_cups=true'
"use_vaapi=$(vopt_if vaapi true false)"
"use_pulseaudio=$(vopt_if pulseaudio true false)"
"link_pulseaudio=$(vopt_if pulseaudio true false)"
"rtc_use_pipewire=$(vopt_if pipewire true false)"
"use_sndio=$(vopt_if sndio true false)"
"v8_enable_drumbrake=$(vopt_if drumbrake true false)"
# Always support proprietary codecs.
# Enable H.264 support in bundled ffmpeg.
'proprietary_codecs=true'
'ffmpeg_branding="Chrome"'
# Make sure that -Werror doesn't get added to CFLAGS by the build system.
# Depending on GCC version the warnings are different and we don't want
# the build to fail because of that.
'treat_warnings_as_errors=false'
'fatal_linker_warnings=false'
# Save space by removing DLOG and DCHECK messages (about 6% reduction).
# 'logging_like_official_build=true'
'disable_fieldtrial_testing_config=true'
'is_official_build=true'
# segfaults with llvm-12.0.1
'is_cfi=false'
'use_cfi_icall=false'
"use_thin_lto=$(vopt_if lto true false)"
'chrome_pgo_phase=0'
)
if [ "$build_option_qt6" ];then
conf+=('moc_qt6_path="/usr/lib/qt6/libexec"')
fi
if [ "$CROSS_BUILD" ]; then
conf+=(
'custom_toolchain="//build/toolchain/linux/unbundle:default"'
'host_toolchain="//build/toolchain/linux/unbundle:host"'
'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:v8_snapshot_cross"'
)
else
conf+=(
'custom_toolchain="//build/toolchain/linux/unbundle:default"'
'host_toolchain="//build/toolchain/linux/unbundle:default"'
)
fi
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
conf+=( 'is_musl=true' )
fi
case "${XBPS_TARGET_MACHINE}" in
x86_64*) conf+=( 'target_cpu="x64"' ) ;;
i686*) conf+=( 'target_cpu="x86"' ) ;;
arm*) conf+=( 'target_cpu="arm"' ) ;;
aarch64*) conf+=( 'target_cpu="arm64"' ) ;;
esac
if [ "$CROSS_BUILD" ]; then
case "${XBPS_MACHINE}" in
x86_64*) conf+=( 'host_cpu="x64"' ) ;;
i686*) conf+=( 'host_cpu="x86"' ) ;;
arm*) conf+=( 'host_cpu="arm"' ) ;;
aarch64*) conf+=( 'host_cpu="arm64"' ) ;;
esac
fi
_setup_toolchain
if false; then
out/Release/gn gen out/Release --args="${conf[*]}"
else
gn gen out/Release --args="${conf[*]}"
fi
}
do_build() {
_setup_toolchain
CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
vinstall out/Release/vk_swiftshader_icd.json 755 usr/lib/${pkgname} vk_swiftshader_icd.json
if [ $build_option_qt6 ]; then
vinstall out/Release/libqt6_shim.so 755 usr/lib/${pkgname} libqt6_shim.so
fi
vcopy "out/Release/*.bin" usr/lib/chromium
vcopy "out/Release/*.pak" usr/lib/chromium
vmkdir usr/lib/chromium/locales
vcopy "out/Release/locales/*.pak" usr/lib/chromium/locales
vinstall out/Release/icudtl.dat 0644 usr/lib/chromium
for size in 24 48 64 128 256; do
vinstall "chrome/app/theme/chromium/product_logo_${size}.png" \
644 \
usr/share/icons/hicolor/${size}x${size}/apps chromium.png
done
for size in 16 32; do
vinstall "chrome/app/theme/default_100_percent/chromium/product_logo_${size}.png" \
644 \
usr/share/icons/hicolor/${size}x${size}/apps chromium.png
done
vbin ${FILESDIR}/chromium.sh chromium
vlicense LICENSE
ln -sf /usr/lib/chromium/chromedriver ${DESTDIR}/usr/bin/chromedriver
vinstall chrome/installer/linux/common/desktop.template 644 usr/share/applications chromium.desktop
vman chrome/app/resources/manpage.1.in chromium.1
sed -i \
-e 's/@@MENUNAME/Chromium/g' \
-e 's/@@PACKAGE/chromium/g' \
-e 's/@@usr_bin_symlink_name/chromium/g' \
-e 's/@@uri_scheme/x-scheme-handler\/chromium;/g' \
-e '/@@extra_desktop_entries/d' \
${DESTDIR}/usr/share/man/man1/chromium.1 \
${DESTDIR}/usr/share/applications/chromium.desktop
if grep '@@' "${DESTDIR}/usr/share/applications/chromium.desktop"; then
msg_error "missing substitution"
fi
}
chromium-qt6_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" - Qt6 integration"
pkg_install() {
vmove usr/lib/chromium/libqt6_shim.so
}
}