aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/APKBUILD
blob: 222b7cf10b0638ed694680f83f13d867b9a6d1f6 (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
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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=chromium
pkgver=56.0.2924.76
pkgrel=1
pkgdesc="chromium web browser"
url="http://www.chromium.org/"
arch="x86_64"
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
	cups-dev
	dbus-glib-dev
	eudev-dev
	ffmpeg-dev
	findutils
	flac-dev
	freetype-dev
	gnutls-dev
	gperf
	gtk+-dev
	gzip
	harfbuzz-dev
	hunspell-dev
	hwdata-usb
	jpeg-dev
	jsoncpp-dev
	krb5-dev
	libbsd-dev
	libcap-dev
	libelf-dev
	libevent-dev
	libexif-dev
	libgcrypt-dev
	libgnome-keyring-dev
	libjpeg-turbo-dev
	libpng-dev
	libre2-dev
	libvpx-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
	nss-dev
	paxmark
	pciutils-dev
	perl
	python2
	snappy-dev
	speex-dev
	sqlite-dev
	xdg-utils
	yasm
	zlib-dev
	"
install=""
options=suid
subpackages="$pkgname-doc $pkgname-chromedriver"
source="https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz
	chromium-launcher.sh
	chromium.conf
	chromium.desktop
	google-api.keys

	chromium-widevine.patch
	default-pthread-stacksize.patch
	gcc6.patch
	gn_bootstrap.patch
	last-commit-position.patch
	musl-fixes.patch
	musl-sandbox.patch
	no-execinfo.patch
	no-getcontext.patch
	no-mallinfo.patch
	resolver.patch
	unset-madv_free.patch
	"

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

case "${CARCH}" in
	x86_64) target_arch=x64;;
	x86) target_arch=ia32;;
	arm) target_arch=arm;;
esac

prepare() {
	cd "$builddir"

	local i
	cd "$builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p0 -i "$srcdir"/$i || return 1;;
		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 || return 1
	# 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 device/usb/BUILD.gn
}

_gn_flags() {
	echo $*
}

build() {
	cd "$builddir"
	# currently does not build with system vpx 1.4
	# remoting/codec/video_encoder_vpx.cc:308:10: error:
	# 'vpx_codec_control_VP9E_GET_ACTIVEMAP' was not declared in this scope
	local vpx=0
	# reusable system library settings
	local use_system="
		flac
		harfbuzz-ng
		libevent
		libjpeg
		libpng
		libwebp
		libxslt
		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/*" \
			\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
			-delete
	done

	# Work around bug in v8 in which GCC 6 optimizes away null pointer checks
	# https://bugs.chromium.org/p/v8/issues/detail?id=3782
	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69234
	CFLAGS="$CFLAGS -fno-delete-null-pointer-checks"

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

	##############################################################
	# 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=false \
		use_sysroot=false \
		treat_warnings_as_errors=false \
		fatal_linker_warnings=false \
		binutils_path=\"/usr/bin\" \
		use_gconf=false \
		use_gold=true \
		use_allocator=\"none\" \
		use_experimental_allocator_shim=false \
	)

	python tools/gn/bootstrap/bootstrap.py --gn-gen-args "$_c"\
		|| return 1

	_c=$(_gn_flags \
		google_api_key=\"$_google_api_key\" \
		google_default_client_id=\"$_google_default_client_id\" \
		google_default_client_secret=\"$_google_default_client_secret\" \
		treat_warnings_as_errors=false \
		is_clang=false \
		is_debug=false \
		symbol_level=0 \
		linux_link_cups=true \
		linux_link_gsettings=true \
		linux_link_libpci=true \
		linux_link_libspeechd=false \
		linux_use_bundled_binutils=false \
		linux_use_bundled_gold=false \
		linux_use_gold_flags=false \
		icu_use_data_file_flag=true \
		logging_like_official_build=true \
		libspeechd_h_prefix=\"speech-dispatcher/\" \
		ffmpeg_branding=\"Chrome\" \
		proprietary_codecs=true \
		use_allocator=\"none\" \
		use_experimental_allocator_shim=false \
		use_gnome_keyring=false \
		usb_ids_path=\"/usr/share/hwdata/usb.ids\" \
		use_mojo=false \
		use_gconf=false \
		use_sysroot=false \
		use_pulseaudio=false \
		enable_hotwording=false \
		disable_fatal_linker_warnings=true \
		disable_glibc=true \
		enable_nacl=false \
		enable_nacl_nonsfi=false \
		target_arch=\"$target_arch\" \
		release_extra_cflags=\"$CFLAGS\" \
		disable_sse2=true \
		fieldtrial_testing_like_official_build=true \
	)

	out/Release/gn gen out/Release --args="$_c" || return 1

#	build/gyp_chromium --depth=. \
#		${use_system} \
#		-Dgoogle_api_key="$_google_api_key" \
#		-Dgoogle_default_client_id="$_google_default_client_id" \
#		-Dgoogle_default_client_secret="$_google_default_client_secret" \
#		-Dwerror= \
#		-Dclang=0 \
#		-Dpython_ver=2.7 \
#		-Dlinux_link_cups=1 \
#		-Dlinux_link_gsettings=1 \
#		-Dlinux_link_libpci=1 \
#		-Dlinux_link_libspeechd=0 \
#		-Dlinux_strip_binary=1 \
#		-Dlinux_use_bundled_binutils=0 \
#		-Dlinux_use_bundled_gold=0 \
#		-Dlinux_use_gold_flags=0 \
#		-Dicu_use_data_file_flag=1 \
#		-Dlogging_like_official_build=1 \
#		-Dlibspeechd_h_prefix=speech-dispatcher/ \
#		-Dffmpeg_branding=Chrome \
#		-Dproprietary_codecs=1 \
#		-Duse_allocator=none \
#		-Duse_experimental_allocator_shim=false \
#		-Duse_gnome_keyring=0 \
#		-Dusb_ids_path=/usr/share/hwdata/usb.ids \
#		-Duse_mojo=0 \
#		-Duse_gconf=0 \
#		-Duse_sysroot=0 \
#		-Duse_pulseaudio=0 \
#		-Denable_hotwording=0 \
#		-Ddisable_fatal_linker_warnings=1 \
#		-Ddisable_glibc=1 \
#		-Ddisable_nacl=1 \
#		-Ddisable_pnacl=1 \
#		-Dtarget_arch="$target_arch" \
#		-Drelease_extra_cflags="$CFLAGS" \
#		-Ddisable_sse2=1 \
#		|| return 1
#
	msg "Ninja turtles GO!"
	# build mksnapshot and paxmark it
	ninja -C out/Release mksnapshot || return 1
	paxmark -m out/Release/mksnapshot || return 1

	# finish rest of the build
	ninja -C out/Release chrome chrome_sandbox chromedriver || return 1
	paxmark -m out/Release/chrome || return 1
}

package() {
	cd "$builddir"
	local bin pak

	for bin in chrome natives_blob.bin snapshot_blob.bin; do
		install -Dm755 out/Release/$bin \
			"$pkgdir"/usr/lib/$pkgname/$bin || return 1
	done

        install -Dm4755 "$builddir"/out/Release/chrome_sandbox \
		"$pkgdir"/usr/lib/$pkgname/chrome-sandbox || return 1

	install -m644 "$builddir"/out/Release/icudtl.dat \
		"$pkgdir"/usr/lib/$pkgname/icudtl.dat || return 1

	for pak in out/Release/*.pak; do
		install -Dm644 $pak \
			"$pkgdir"/usr/lib/$pkgname/${pak##*/} || return 1
	done

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

	cp -r out/Release/locales "$pkgdir"/usr/lib/$pkgname/ || return 1

        install -Dm644 out/Release/chrome.1 \
                "$pkgdir"/usr/share/man/man1/chrome.1 || return 1

	install -Dm644 out/Release/chrome.1 \
		"$pkgdir"/usr/share/man/man1/chromium.1 || return 1

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

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

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

	for size in 22 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

	install -Dm755 "$builddir"/out/Release/chromedriver \
		"$pkgdir"/usr/lib/$pkgname/chromedriver || return 1
	ln -sf /usr/lib/$pkgname/chromedriver "$pkgdir"/usr/bin/ || return 1
}

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/ || return 1
	mv "$pkgdir"/usr/bin/chromedriver "$subpkgdir"/usr/bin || return 1
}

md5sums="db1efe3e0c843e4237052432f2a46d58  chromium-56.0.2924.76.tar.xz
b6d015c1da85aa65ee21bc974c7fc7d2  chromium-launcher.sh
c5aa73a87d4b88cce9f1a680ca691bb6  chromium.conf
2962ac6259e39a797d441daf43aa49c9  chromium.desktop
2d2ee5f22d65c756871301b4a407f4ca  google-api.keys
7c3504d7362e8b0a1b186cbebec6af8d  chromium-widevine.patch
815a36d63207a84657fe67e71ba5bc7c  default-pthread-stacksize.patch
8b37a7bc4e46b0268d278b44b588ecb0  gcc6.patch
9698bd0a1002fbfb99975a7ad45cacb7  gn_bootstrap.patch
463e62c1aa93ff4457abee86c336962f  last-commit-position.patch
3b22c6fbed9c7129d535febe0beda858  musl-fixes.patch
c805e026abc748d9925fab8250760bcc  musl-sandbox.patch
d232b8dcb4d4db9a868c89e3a48ee716  no-execinfo.patch
886bc4ce1423a185b4d969ec2daa5933  no-getcontext.patch
69fa53e833ae7a4cd30fc387b781602a  no-mallinfo.patch
f99a4572c0be2c2123acc2478905e01f  resolver.patch
bff9e1de1e5fa119b41bf6705926cd9e  unset-madv_free.patch"
sha256sums="cfb08e226b9c16ad887eb96d715a9cc4ab097d1a79e2e68c8749a7a4164b3c38  chromium-56.0.2924.76.tar.xz
89f1eb19d1ed998a190045ea173959f01faee3490d58a6a34ca3fe21228e569f  chromium-launcher.sh
b466559340a36998354a0577325fe533d9e6b74c24a15b7599671171506bf128  chromium.conf
3ae90cea7503d0039de53448ed112b9bc0cb5a09f6b0045506eb777fc23517e5  chromium.desktop
267ba8ff50574e51d2582c4fca9b9e14f7225c1fa064d135cbceff9cef2324ac  google-api.keys
95fd28debaafbf5eb78f589054f984382c2b23ed4ce0572f25c4af93cf33e5ca  chromium-widevine.patch
230f4b9d368c38f39ec6a3d49c3aa776609ea1a2b5478f0d6e44c17b76647d71  default-pthread-stacksize.patch
20526e0cf4d8ef6947675346243b5a12670f6929f198a19b9e4f14fe23c949e9  gcc6.patch
ef7ff14f3e91a72d1d7437b5edf5d3cf1ac04e1c80cfb8c2f2fe5c93bc80bb27  gn_bootstrap.patch
2ade69c40f553889e11d11eccef68e4729ed74c8dfe53e6e32e743a645dd3d46  last-commit-position.patch
9081abe6666bc9f1096d993b6814f49f9a1735dbcda5f429d2624a1ceddf8ac7  musl-fixes.patch
3d0303f9ea04b2c24e16068ea2d423fce0e37ebb2b89dde342f9e8f9d0b149b4  musl-sandbox.patch
18ee716e709da867d6e8b8dcf4c5e33dc9def31781ff40f2ec3fc2860705dd24  no-execinfo.patch
855edf1062e199ceaa7619d5bb81ff6939cc5ee1c947dfd15b50e0cba18548e2  no-getcontext.patch
375473b274691ec565bee26ffbca4c917efc646df86051ea00402540c308223c  no-mallinfo.patch
914c513bb54d4d97cd2a7622647f6af5cd0c8d29a0aa2962a60fdbed88f54429  resolver.patch
e9c1f901c7bc8102a31ef2cc2235892671357362c04a4a1f009f54830449ef5f  unset-madv_free.patch"
sha512sums="ddcb2f0c76bdad3b87dc9219367764cb9adb900d7581dc5a371184ebfe2581f6ecbfc9aae02115e87291a5b90587fc145dada2b0940ae60fc19d25f5c505022d  chromium-56.0.2924.76.tar.xz
b9a810416dd7a8ffc3a5ced85ad9acebda1665bd08a57eec7b189698cc5f74d2c3fd69044e20fcb83297a43214b2772a1312b2c6122ea0eb716abacf39524d60  chromium-launcher.sh
f6d962b9e4c22dd42183df3db5d3202dab33eccecafb1bf63ca678147289581262db1e5e64cbe8f9c212beefb0a6717bb8d311e497f56b55fe95b8bab2db493f  chromium.conf
e182c998a43d22d1c76a86c561619afd1fca8c2be668265ad5e2f81a3806f7a154272cc027a2f8b370fb69446892c69e5967a4be76082325c14245ee7915234c  chromium.desktop
2d8237a940ea691bd10b08315429677a587f7ef9692a0cca53bfd066eae82998a6c71f402a8669e9de39f94d7f3280745d1628ea6eac5d76ca7116844d4e0dac  google-api.keys
55921cc33d623e0751e94d4fef2ddd69afb57381da6115995b1f318e2398978b9173e80f6ffbc6e6c0c0c55a04e934e0e34a46c32e03947cc31f0f5a226e7725  chromium-widevine.patch
0f296d24ca6de1bf340a67f294b53304c44e7b46b6bb0936e10ae33786d5b3b6b523914e1f9eb7bc0995623c2404c8e1d5d27596cbfbc3cc36ca00fb92bc17e7  default-pthread-stacksize.patch
08300afd0bbcdc62bc96c52b11a40fb51b31ef2fb874873438a40ce70d80eb91779e1e0d9b64e020b28c3744f14630d576020cf73d626b720e51e474912a0127  gcc6.patch
0a15b178fadffdc31f1f7bc814b95817cbcea9dd90b1ed84f7bab2d840f36453573742bd8501d79edecfa38c0ec2147843aef03c7b2c9bcfd0e3d22b72c25c4b  gn_bootstrap.patch
8fbfd67a0b6bbdf08364e810bd85b4a80dda9af73fefe3aba8010d9b33022d458a785c628515bbda9c743b8a0293d57cfe18fcc5aa2313c845c6fb948c2335f9  last-commit-position.patch
88f70ac8453c744c8735c1ccd3cf638e2c03f73295454e6b224b1dfe9f4576f3674f1803f87aa729e1fb836fafa62ec41c6d46ed706566b2aa38eca277ad5570  musl-fixes.patch
ce8276bb35a8d72cf58868a6331e85286b350a1aad694525ebf637499819219dd4d87ab67dd3b938830a6bd3e7172fc9bcd9c8971820d0ed95c0d141867a24fe  musl-sandbox.patch
fef119b4e23269cc6252e940e23029a312c9852b8d2115ee155ef9a4f5788b6b7dc8c1cab2e32fb4f25c2956a4dd2305375cbd1847c58d7159d15907d6b17a5d  no-execinfo.patch
a57858e45cfbb7e97f77b3b308502e377543d61d3d0085798ed73bc53da456828f5e010308d0de05fee4fe52071362d074f5af205f98f41d67222d997857d626  no-getcontext.patch
7eac76f78b734404510d6e850b3eb55d10ae74ed48072dd318a751cc6fd806363eb82544602f5b6724548a34b418658b9fb0941c88ced0dc4f0ee77cfb172d0d  no-mallinfo.patch
d60407a8faadfd2a8294570163b4d1b1112c8a70a6f8e778fc3aff25d20613a2e26c66cd87e69c54953cc1b984e4038015ad04797b0495df13932541b05398fe  resolver.patch
5eafc0b92d6aa3a4a94bce544461d57121a9405784e2687b9ed382371a7c10e4db5fd6325057344a66b7df32dca963bc12b7f67b256f1f1295bf6519400b0b8e  unset-madv_free.patch"