aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/APKBUILD
blob: c6342f5d99909c84badf0d49d6ea7a557e6f8f35 (plain) (blame)
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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=chromium
pkgver=86.0.4240.111
pkgrel=0
pkgdesc="Chromium web browser"
url="https://www.chromium.org/Home"
arch="x86_64 aarch64"	# x86: ./v8_context_snapshot_generator segfaults
			# armv7: /usr/bin/ld: final link failed: memory exhausted when linking chrome
license="BSD-3-Clause"
depends="xdg-utils"
makedepends="
	alsa-lib-dev
	bash
	binutils-gold
	bison flex
	bsd-compat-headers
	bzip2-dev
	cairo-dev
	clang-dev
	cups-dev
	dbus-glib-dev
	elfutils-dev
	eudev-dev
	ffmpeg-dev
	findutils
	flac-dev
	freetype-dev
	gnutls-dev
	gperf
	gtk+3.0-dev
	gzip
	harfbuzz-dev
	hunspell-dev
	hwids-usb
	jpeg-dev
	jsoncpp-dev
	krb5-dev
	libbsd-dev
	libcap-dev
	libevent-dev
	libexif-dev
	libgcrypt-dev
	libgnome-keyring-dev
	libjpeg-turbo-dev
	libpng-dev
	libusb-dev
	libva-dev
	libwebp-dev
	libxcomposite-dev
	libxcursor-dev
	libxinerama-dev
	libxml2-dev
	libxrandr-dev
	libxscrnsaver-dev
	libxslt-dev
	linux-headers
	mesa-dev
	minizip-dev
	ninja
	nodejs
	nss-dev
	openjdk8
	opus-dev
	pciutils-dev
	perl
	python2
	re2-dev
	snappy-dev
	speex-dev
	sqlite-dev
	xcb-proto
	xdg-utils
	zlib-dev
	py2-setuptools
	"
# explicit depends for --headless
depends="eudev-libs ttf-opensans"
options="suid"
subpackages="$pkgname-chromedriver"
source="https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
	pstables-2.8.h::https://git.savannah.gnu.org/cgit/freetype/freetype2.git/plain/src/psnames/pstables.h?h=VER-2-8
	chromium-launcher.sh
	chromium.conf
	chromium.desktop
	google-api.keys

	default-pthread-stacksize.patch
	musl-fixes.patch
	musl-fixes-breakpad.patch
	musl-hacks.patch
	musl-libc++.patch
	musl-sandbox.patch
	no-execinfo.patch
	no-mallinfo.patch
	resolver.patch
	swiftshader.patch
	create-extra-view-redefinition.patch

	chromium-use-alpine-target.patch
	media-base.patch
	musl-crashpad.patch
	musl-v8-monotonic-pthread-cont_timedwait.patch
	nasm.patch

	gcc-fno-delete-null-pointer-checks.patch
	gcc-arm.patch
	aarch64-fixes.patch
	elf-arm.patch

	chromium-size_t-defined.patch
	check-for-enable-accelerated-video-decode-on-Linux.patch
	fix-invalid-end-iterator-usage-in-CookieMonster.patch
	only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch
	remove-dead-reloc-in-nonalloc-LD-flags.patch
	xproto-fix-underflow-in-Fp1616ToDouble.patch
	"

# secfixes:
#   83.0.4103.116-r0:
#     - CVE-2020-6505
#     - CVE-2020-6506
#     - CVE-2020-6507
#     - CVE-2020-6509
#   72.0.3626.121-r0:
#     - CVE-2019-5786

if [ -n "$DEBUG" ]; then
	_buildtype=Debug
	_is_debug=true
else
	_buildtype=Release
	_is_debug=false
fi

prepare() {
	patch_args="-p0"
	default_prepare

	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
	touch chrome/test/data/webui/i18n_process_css_test.html
	# Use the file at run time instead of effectively compiling it in
	sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' \
		-i services/device/public/cpp/usb/BUILD.gn

	mkdir -p third_party/node/linux/node-linux-x64/bin
	ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/

	# reusable system library settings
	local use_system="
		ffmpeg
		flac
		fontconfig
		freetype
		harfbuzz-ng
		libdrm
		libevent
		libjpeg
		libpng
		libwebp
		libxml
		libxslt
		opus
		re2
		snappy
		"
	for _lib in $use_system libjpeg_turbo; do
		msg "Removing buildscripts for system provided $_lib"
		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' \
			\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
			-delete
	done

	msg "Replacing gn files"
	python2 build/linux/unbundle/replace_gn_files.py --system-libraries \
		$use_system
	third_party/libaddressinput/chromium/tools/update-strings.py

}

_gn_flags() {
	echo $*
}

build() {
	##############################################################
	# Please dont use these keys outside of Alpine Linux project #
	# You can create your own at:                                #
	# http://www.chromium.org/developers/how-tos/api-keys        #
	##############################################################
	eval "$(base64 -d < $srcdir/google-api.keys)"

	msg "Bootstrapping GN"
	local _c=$(_gn_flags is_clang=true \
		use_sysroot=false \
		treat_warnings_as_errors=false \
		fatal_linker_warnings=false \
		use_custom_libcxx=false \
		use_gold=false \
		use_allocator=\"none\" \
		use_allocator_shim=false \
		use_vaapi=true \
	)

#	AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \
	CC="${CC:-clang}" CXX="${CXX:-clang++}" LD="${CXX:-clang++}" \
		python2 tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "$_c"

	msg "Configuring build"
	_c=$(_gn_flags \
		blink_symbol_level=0 \
		clang_use_chrome_plugins=false \
		closure_compile=true \
		custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \
		enable_hangout_services_extension=true \
		enable_nacl_nonsfi=false \
		enable_nacl=false \
		enable_precompiled_headers=false \
		fatal_linker_warnings=false \
		ffmpeg_branding=\"Chrome\" \
		fieldtrial_testing_like_official_build=true \
		gold_path=\"/usr/bin/ld.gold\" \
		google_api_key=\"$_google_api_key\" \
		google_default_client_id=\"$_google_default_client_id\" \
		google_default_client_secret=\"$_google_default_client_secret\" \
		host_toolchain=\"//build/toolchain/linux/unbundle:default\" \
		icu_use_data_file=true \
		is_clang=true \
		is_component_build=false \
		is_debug=$_is_debug \
		is_desktop_linux=true \
		linux_use_bundled_binutils=false \
		proprietary_codecs=true \
		symbol_level=0 \
		treat_warnings_as_errors=false \
		use_allocator_shim=false \
		use_allocator=\"none\" \
		use_cups=true \
		use_custom_libcxx=false \
		use_gnome_keyring=false \
		use_gold=false \
		use_lld=false \
		use_pulseaudio=false \
		use_sysroot=false \
		use_system_harfbuzz=true \
	)

	AR="ar" CC="clang" CXX="clang++" LD="clang++" NM=/usr/bin/nm \
		out/Release/gn gen out/$_buildtype --args="$_c $_ca"

	# Make xcbgen available to ui/gfx/x/gen_xproto.py running under Python 2
	ln -sf /usr/lib/python3.*/site-packages/xcbgen .
	export PYTHONPATH="$PWD"

	msg "Ninja turtles GO!"

	# build mksnapshot
	ninja -C out/$_buildtype mksnapshot
	ninja -C out/$_buildtype v8_context_snapshot_generator

	if [ "$CARCH" = "x86" ]; then
		# x86 only - dependency issues compiling obj/chrome/browser/devtools/devtools/cast_handler.o
		ninja -C out/$_buildtype obj/chrome/common/media_router/mojom/media_router__generator.stamp
	fi

	# final link needs lots of file descriptors
	ulimit -n 2048

	# finish rest of the build
	ninja -C out/$_buildtype chrome chrome_sandbox chromedriver
}

package() {
	cd out/$_buildtype
	local bin pak
	for bin in chrome chromedriver *.bin; do
		install -Dm755 $bin "$pkgdir"/usr/lib/$pkgname/$bin
	done

	install -Dm755 swiftshader/libEGL.so "$pkgdir"/usr/lib/$pkgname/swiftshader/libEGL.so
	install -Dm755 swiftshader/libGLESv2.so "$pkgdir"/usr/lib/$pkgname/swiftshader/libGLESv2.so

	install -Dm4755 chrome_sandbox "$pkgdir"/usr/lib/$pkgname/chrome-sandbox
	install -m644 icudtl.dat "$pkgdir"/usr/lib/$pkgname/icudtl.dat

	install -Dm755 xdg-mime "$pkgdir"/usr/lib/$pkgname/xdg-mime
	install -Dm755 xdg-settings "$pkgdir"/usr/lib/$pkgname/xdg-settings

	for pak in *.pak; do
		install -Dm644 $pak "$pkgdir"/usr/lib/$pkgname/$pak
	done

	install -Dm755 "$srcdir"/chromium-launcher.sh \
		"$pkgdir"/usr/lib/$pkgname/chromium-launcher.sh

	cp -a locales "$pkgdir"/usr/lib/$pkgname/
	cp -a MEIPreload "$pkgdir"/usr/lib/$pkgname/

	# It is important that we name the target "chromium-browser",
	# xdg-utils expect it; bug #355517.
	mkdir -p "$pkgdir"/usr/bin
	cd "$pkgdir"/usr/bin
	ln -sf /usr/lib/$pkgname/chromium-launcher.sh chromium-browser
	ln -sf /usr/lib/$pkgname/chromedriver "$pkgdir"/usr/bin/

	install -Dm644 "$srcdir"/chromium.conf \
		"$pkgdir"/etc/chromium/chromium.conf

	install -Dm644 "$srcdir"/chromium.desktop \
		"$pkgdir"/usr/share/applications/chromium.desktop

	cd "$builddir"
	for size in 24 48 64 128 256; do
		install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
			"$pkgdir/usr/share/icons/hicolor/"$size"x"$size"/apps/chromium.png"
	done

	for size in 16 32; do
		install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
			"$pkgdir/usr/share/icons/hicolor/"$size"x"$size"/apps/chromium.png"
	done
}

chromedriver() {
	pkgdesc="WebDriver driver for the Chromium Browser"
	mkdir -p "$subpkgdir"/usr/lib/$pkgname "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/lib/$pkgname/chromedriver \
		"$subpkgdir"/usr/lib/$pkgname/
	mv "$pkgdir"/usr/bin/chromedriver "$subpkgdir"/usr/bin
}

sha512sums="809bcab82c44976f109f0db0ce0470f88893a0999596b057e82675093f8fa0fc0badae4431a9160b4e94ae09219fa01914cad4b3143cebc530c71d420e7add54  chromium-86.0.4240.111.tar.xz
a3bb959c65944ae2fb765725cedcffd743a58bc0c2cd1f1999d15fe79801d00f3474b08b4ed7b48859ed921eb57093d0ad09d90f201d729ed9b8a419a591ed29  pstables-2.8.h
b9a810416dd7a8ffc3a5ced85ad9acebda1665bd08a57eec7b189698cc5f74d2c3fd69044e20fcb83297a43214b2772a1312b2c6122ea0eb716abacf39524d60  chromium-launcher.sh
f6d962b9e4c22dd42183df3db5d3202dab33eccecafb1bf63ca678147289581262db1e5e64cbe8f9c212beefb0a6717bb8d311e497f56b55fe95b8bab2db493f  chromium.conf
e182c998a43d22d1c76a86c561619afd1fca8c2be668265ad5e2f81a3806f7a154272cc027a2f8b370fb69446892c69e5967a4be76082325c14245ee7915234c  chromium.desktop
2d8237a940ea691bd10b08315429677a587f7ef9692a0cca53bfd066eae82998a6c71f402a8669e9de39f94d7f3280745d1628ea6eac5d76ca7116844d4e0dac  google-api.keys
b726ef2ecfe7d471e60d67de1e05847d214df6093b41bb2055652a9028327af19a8b10e7175467240f4dfec9e3ae97a6c4666bfd2cd6cb436c54656a085653ae  default-pthread-stacksize.patch
4620f7515717eb185339af1f52f40e5c6ccd15b9162986517eb5cf3cbaf29740134f520997e2a1337ea51fd69dc0354b297f6cc4d1555ed546ffdc1dbcb51f5c  musl-fixes.patch
e8675aff9fccd8b58cc839ef1d9e0e022d66aa94f72baa72e7acf92ceb2691f6a7907cc60ec3a87f894efdd639a3dec7fe702c97d446fcdea99452caec57e002  musl-fixes-breakpad.patch
ddacc7ab0374eaa110a392c9d0912c250eb102f060cac284b170902fa9358f8670cbe26676582208d1291662058761e31795ebac75115b38a1e3ad8681895b38  musl-hacks.patch
919f13a2cd65673f267321cf95c5410e65bc5264d6704d0791b25d39111282bedb425bd9824dde3b67422cfb874c86a9383ded686e39cfd4aac239edaf41cfc8  musl-libc++.patch
ef43fa90b05e2407b6daa822193121cdeef6ee9068175572f0928f156f186be9c77539dfa06863adfaa25afd498ec1b5081f9e476543616f9472b9033fd921dc  musl-sandbox.patch
129ec746fd951ee6d0bf0b4389b7c988523870507de1f92f5706f4eb49039d4a49ed30e92b0634e3ae521fc3e129adc1c6edc7435922fc91658d8c087520c707  no-execinfo.patch
06d6b4c466fa48f2d22c338e20458d8fa50bbbf744468f41bc3c1892e739002b1fbc5c133a37252cec4ff4f804847add6b9c0cc1f84fb276939471c09e467fb6  no-mallinfo.patch
f60c89076bbc458e2e38d9dad26027f9604179fd59e0c2b988a86340b9ef78a4c346c84ac3e7e4e70badaff69d71edf49d7b9030e5fadb96afde4f977a98c412  resolver.patch
f4265df7532625070c51ac43466e3e0f21e696f90c3b6040ef62a21defa7666203ff8219d9c9a5bebc011024aff300fbcbd941cebd0df59c4bc068d8f290221e  swiftshader.patch
5b88c065819a44684ceea87239320f8120cfde0dc2f6dd739a007488dea6608c11584c56f3876a062641c9ca6fa82f43877c547ad470766aec31f5151bb2bdc1  create-extra-view-redefinition.patch
cf9970ef403ff7a68bf08c0ba5e681eec459fcb1afb6859e5a80f4874f1b9a656377b4540eeb5208ddec570efa206f147e32718c687fa29ca3acc4fde6e8cbe8  chromium-use-alpine-target.patch
599f5ef338b5797e04436bdc88921c31365d2dea2613d40053be6e774f654e2889efb0c0bd55c2c5044a6805510fbc337da555971169a75d584fac93e18256ac  media-base.patch
2e5a83826239849d096aead033eb519338b84e6fbbf58abfcd7cfe40d0b3070b66bcc825ec84406484d73d1a333f1b9d23a8ab44987ab5c8b187076c84cd668b  musl-crashpad.patch
556cc2ba28184a75745f13c673605327f5be590be179eb3f941dc0abded854a814e5da1432a28fb8d4dcdcd66ffd4c94ee1a8824d2cd93b632f48e9310dbc3fa  musl-v8-monotonic-pthread-cont_timedwait.patch
7957aae04e8ef3badbc98c982ba1acb1b9ef5e665440116c704512f11554d7b64ba3643b7ff7d00476a6686324033b0cf762deb78ce798619226380953b9dc9c  nasm.patch
56a357668c0928bc488ccec8f53fd37fccbaefe0a185ceaf067c8c39e0fae3d2b61ca010ccabc785bec0f2e86b19f37cebb3ac344225aa8d7651c822e48c6064  gcc-fno-delete-null-pointer-checks.patch
ad4ddc25df7aa1de2038b7adb86d27679ecdb7e3e16c0eec994e947a08c41504b6fb41166f7868ff5f58ce8191c78800cbb91d259c864840fa5af1d7ba5d43a1  gcc-arm.patch
cc67d2a77910663e5a1ad5f66606ee2544867aa1fef25e1a1bc355a8db765d5928edb72f158e6a2ece4195c9b62b875dcdcab4e4055e7611edab405e8cfd658e  aarch64-fixes.patch
9b1441fe42421ef9ead86a5143bf997d989bd53a8969cdfdf4e0c45f847efc8c1d127e15fb05e2ef5dbefbb228cbdc2849404d74997ca56265599e12e5efd6e4  elf-arm.patch
17ed804782df7161e58cb1c125b2cdee22a63008a240da6d3409a7b7a356dc4bd5971aa61217b7aefcfa130e3e12a753bc0fe96882cde842917cf5d6df46083f  chromium-size_t-defined.patch
6bda2c9d622a77d50832b56c36239a2d79eb8dce7825e9cf99b82132d0a6e58ba23e253ec1a71cf6600111afe4c0917d26ba54ab1b6d7ceea5d57bb8e5f8e4c1  check-for-enable-accelerated-video-decode-on-Linux.patch
a239bb09ea79875d821a53f8769ef19997c60012dc474139a21f6818a031e77fe16aed6dee9fb8b9fd9411bbaf9901f674de480012badae51ff17e9bea35fd70  fix-invalid-end-iterator-usage-in-CookieMonster.patch
a8088aea5e27723b34bec232406a743f93cf4ebcaa7b48bda1669d8a8fbc3083eec4d3921c2ab1e002eb443f74205c7f1e73cd0bb303fa20f0f1a1f255dcbdcb  only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch
862fbd405a06e570891d84634a3aff943f0eb1458308211d7ac98d84a9f57c779deba7e91e4b1efbbce15a8b14734dc86ed625165bf3ce8d31ef67d26ba7cecf  remove-dead-reloc-in-nonalloc-LD-flags.patch
b425d6ab3da04b6a8d32303d1c39feb9c1be813fac9b38eb53fd5d020ff08b4b3e247897d5b5c5dac3a7a213c5d3eaf3ea2342c97d22089f2c623e28a124f00d  xproto-fix-underflow-in-Fp1616ToDouble.patch"