aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/APKBUILD
blob: bb3a931399945d800e07237b3f2dab81dafe6606 (plain)
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: Carlo Landmeter <clandmeter@gmail.com>
pkgname=chromium
pkgver=77.0.3865.120
pkgrel=0
pkgdesc="chromium web browser"
url="http://www.chromium.org/"
arch="x86_64 aarch64 armv7"
license="BSD"
depends="xdg-utils"
depends_dev=""
makedepends="$depends_dev
	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
	hwdata-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
	libxtst-dev
	linux-headers
	mesa-dev
	mesa-dev
	minizip-dev
	ninja
	nodejs
	nss-dev
	openjdk8
	opus-dev
	paxmark
	pciutils-dev
	perl
	python2
	re2-dev
	snappy-dev
	speex-dev
	sqlite-dev
	xdg-utils
	yasm
	zlib-dev
	"
install=""
# explicit depends for --headless
depends="eudev-libs ttf-opensans"
options=suid
subpackages="$pkgname-chromedriver"
source="https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$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
	secure_getenv.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
	musl-arm-limits.patch
	aarch64-fixes.patch
	one_euro_filter-build-fix.patch
	chromium-77.0.3865.75-harfbuzz-subset.patch
	chromium-77.0.3865.90-linked-hash-set.patch
	"

builddir="$srcdir"/$pkgname-$pkgver

# secfixes:
#   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() {
	cd "$builddir"

	local i
	cd "$builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p0 -i "$srcdir"/$i;;
		esac
	done

	# 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
		harfbuzz-ng
		libdrm
		libevent
		libjpeg
		libpng
		libwebp
		libxml
		libxslt
		opus
		re2
		snappy
		yasm
		"
	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/pdfium/third_party/freetype/include/pstables.h' \
			\! -path './third_party/yasm/run_yasm.py' \
			\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
			-delete
	done

	# workaround missing files for arm
	for i in safe_conversions_arm_impl.h safe_math_arm_impl.h; do
		ln -s ../../../../base/numerics/$i tools/gn/base/numerics/$i
	done

	msg "Replacing gyp files"
	python build/linux/unbundle/replace_gn_files.py --system-libraries \
		${use_system}
	third_party/libaddressinput/chromium/tools/update-strings.py
}

_gn_flags() {
	echo $*
}

build() {
	cd "$builddir"

	##############################################################
	# 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 \
		binutils_path=\"/usr/bin\" \
		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++}" \
		python tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "$_c"

	msg "Configuring build"
	_c=$(_gn_flags \
		clang_use_chrome_plugins=false \
		closure_compile=true \
		custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \
		enable_hangout_services_extension=true \
		enable_nacl=false \
		enable_nacl_nonsfi=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 \
		blink_symbol_level=0 \
		symbol_level=0 \
		treat_warnings_as_errors=false \
		use_allocator=\"none\" \
		use_allocator_shim=false \
		use_cups=true \
		use_custom_libcxx=false \
		use_gnome_keyring=false \
		use_gold=false \
		use_lld=false \
		use_jumbo_build=true \
		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"

	msg "Ninja turtles GO!"
	# workaround parallel build
	ninja -C out/Release gen/ui/accessibility/ax_enums.p

	# build mksnapshot and paxmark it
	ninja -C out/$_buildtype mksnapshot
	paxmark -m out/$_buildtype/mksnapshot
	ninja -C out/$_buildtype v8_context_snapshot_generator
	paxmark -m out/Release/v8_context_snapshot_generator \
		out/Release/obj/tools/v8_context_snapshot/v8_context_snapshot_generator

	# 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 "$builddir"/out/$_buildtype
	local bin pak
	# paxmark inside chroot too
	paxmark -m mksnapshot

	for bin in chrome chromedriver *.bin; do
		install -Dm755 $bin "$pkgdir"/usr/lib/$pkgname/$bin
	done
	paxmark -m "$pkgdir"/usr/lib/$pkgname/chrome

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

	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/

	# 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="4c72c9e9cd9a5d7f89e33c52d117018418ce0f5d23a57341b26ce47c8f90fa55f52a0c976b6959026dc273d5b37aa57306253a9b533172cd133a815edc7bccb4  chromium-77.0.3865.120.tar.xz
a3bb959c65944ae2fb765725cedcffd743a58bc0c2cd1f1999d15fe79801d00f3474b08b4ed7b48859ed921eb57093d0ad09d90f201d729ed9b8a419a591ed29  pstables-2.8.h
b9a810416dd7a8ffc3a5ced85ad9acebda1665bd08a57eec7b189698cc5f74d2c3fd69044e20fcb83297a43214b2772a1312b2c6122ea0eb716abacf39524d60  chromium-launcher.sh
f6d962b9e4c22dd42183df3db5d3202dab33eccecafb1bf63ca678147289581262db1e5e64cbe8f9c212beefb0a6717bb8d311e497f56b55fe95b8bab2db493f  chromium.conf
e182c998a43d22d1c76a86c561619afd1fca8c2be668265ad5e2f81a3806f7a154272cc027a2f8b370fb69446892c69e5967a4be76082325c14245ee7915234c  chromium.desktop
2d8237a940ea691bd10b08315429677a587f7ef9692a0cca53bfd066eae82998a6c71f402a8669e9de39f94d7f3280745d1628ea6eac5d76ca7116844d4e0dac  google-api.keys
230d1819b9d644ebaa6e194e948d662add8d237a99cc3d6b0f8a2fc2b331b43a3cd0766746f1c76c1a114f1730b40504c532d0c40aafa8cbc45022663cbcc245  default-pthread-stacksize.patch
ef31809702ef020e02445ac36857c621cf852dea14c2fdf291ea0700b6fc6d94e3704726a051e95d193aa10fe74ca53a870848fec5f8153fb262f2e184affe7f  musl-fixes.patch
90efbc89151c77f32434364dcbaabaf9d9a207f4a77f147cd51b3fe100832fbfb3a9fb665303a79a3d788e400f4f41890de202ccbb7bd1fc6252e33c6e74e429  musl-fixes-breakpad.patch
4640c175657f6a53f8a8d1c6bd2208ec30751d739a086b8f4f49250a88e522441a4919c1e47673cbee54c24c9cc65f18d386071fc4667662e4d13201f0bb7e64  musl-hacks.patch
95ead57f7338649351948d100e32e5ec1eeadb02bffa136ff15c6c515eceb8013c444be092d777c1b62b945bfb83b97778ba4d3a0ccc2d7c2c9a0a8cd8ee0f01  musl-libc++.patch
5bb41c9a17545e2504cbfd760a1c138897ae9241a03ae0fe54632ddff679c273ec61e80946a4cd70ff79f237d1a442ca9e6ff4d2f5b0f6458db9239de2d1d3d7  musl-sandbox.patch
83b4cc042d501bd94ce953d1bc94361adf9d6f0d1fa71c04c5d3688c0befb81fdb6ccf31e6cab6a22d0057db309b473bc6af75535675c61d167035e36dd1d6c6  no-execinfo.patch
db7f676d3476820c29f234b1f8f17a74e82b72d67fc727c715307734fd238e3cb0f99d8b5320d45f820b62c01163283c4829caa37afd6a9ca7592a54d3c65819  no-mallinfo.patch
81c590942e73a62027290684c56030796e4bb953dd5007db787733ba84a505326a65001267b820ac3f44212c7e903c102809961f8e4ad42c57e21c44ad41cfe6  resolver.patch
84732900f50799ee8d4c9a572a8703c1cd67c6a3b8f8dcf97f308319dcef6ac3d41ea5ddfb2ef4d695bdebdae691e30d5631a8d04e59b931935ba188b0308a61  swiftshader.patch
7f9b816ff9088f84929dc9853ab8cf0c705ef95fedb9e9c3e85bc50c8befb76e39ecf5e754fa3fc8b34b42397875ec41c0729f880a642262b675ebf79901810a  secure_getenv.patch
50e2c78bc2e7f343ed97d348bbe34350439ede6a15bf8ea1017eb13c391d4718b00a51db9c2eb40d8398d9733bf1925db42011f3bcbdd7d83329b1c7d534032b  chromium-use-alpine-target.patch
589a7acf149d44db081da2dd24a7769f2b9572a8cc64d2aad78577a64768d3b6fb2bfa02292b5260acd2c4a28c3ae9b82847ff901ce8a21baeca0b46dcda0ca9  media-base.patch
05c1af43038f76014f5f8b605085310414242f2bfad0e3258ddb29a08e7f4307de31b2d551b0a291986cc7d5a01cf3a003ac864216877195bb4310fd33193f0f  musl-crashpad.patch
6953e83d4034f7a016dd055fed152a8a448f741a4c4f7a8f3b03cc7a4589d3d3c03775f844d76d6d4478ac15c655fee0be7355f0d5062ddc7fa9f6ce4b011116  musl-v8-monotonic-pthread-cont_timedwait.patch
34013a1a960d0f3b20183d03df5be6b36e2eb9b3d3319fa2bcf3c69084968fde0239ad7304c9a6165b3284a2a55a220b3d207889e2b913dc4578268fdede9ea6  nasm.patch
bb0f3dc1ade429a398d487ae190a278948533398c4a1085aeb35ff57fefb90a1e598008ba839423ca0acd30ba4c992950f395dba3b9994d3c7187fe68b9a93d7  gcc-fno-delete-null-pointer-checks.patch
91296fcbdfc4b35899e2af949024c7041d85cc64644cf5fe73c8e46a0523b09d1fb8849f315bd212c1ac25caf57553e933cb4eeb8d1856960441d24b2dd20e27  gcc-arm.patch
3bcffb36f28a01d8bb91f1c1ee1e327caebb1e139d4e8772ad15460ee69cb5ea3307a235dc83184a9e09b687882d9617f3a3ce1a7b07cbd6e11b0a5d6a6ace81  musl-arm-limits.patch
f0a0fa663fd7a88346d69675a96dfd864364f6ba41d19a5adfbfb0f13fd784b194a60cd2c63edfcc21d6b049628eade690ff803f787dbdd29d84cd8312be4d4a  aarch64-fixes.patch
739eaab1d9e4ab73e9ae79c8315122751ada5a45a716853667b69f0c6d268a580afeef969fff4f64dfdf6574309d0148d338c5850d3e6de2400771685b74c104  one_euro_filter-build-fix.patch
009261f10d12fad86eb0c1d6b543d2b0c2a9ccca28cb85ea3b4b08c4ecc968df0dc62e18c56ae0d36fce99271ba80e34ba39d2022023c265edf2b71e41d445c8  chromium-77.0.3865.75-harfbuzz-subset.patch
8dd33aa2ffaff63477e164c744bd40840304939fba97201bc1c221e64e58fd00032095dd83a70c19e9dca3190115b3954ab155b870eacf935b71eb8e4e4a8d35  chromium-77.0.3865.90-linked-hash-set.patch"