aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/APKBUILD
blob: 88a36fda8d6999052e9184e5232ef6481673fc37 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=chromium
pkgver=58.0.3029.110
pkgrel=0
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
	nodejs
	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
	fix-gn_bootstrap.patch
	gcc6.patch
	gn_bootstrap.patch
	last-commit-position.patch
	musl-fixes.patch
	musl-hacks.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

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

_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
		libxml
		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_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
}

package() {
	cd "$builddir"
	local bin pak
	# paxmark inside chroot too
	paxmark -m out/Release/mksnapshot || return 1

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

        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
}

sha512sums="412dc94e23d6699b959f23956f5f82f4c600050649a8a2e694bb2c6e166245e3670f4549ee1c08a0df05b4e361f040d1739515180b8631adbfac9c907af8d93f  chromium-58.0.3029.110.tar.xz
b9a810416dd7a8ffc3a5ced85ad9acebda1665bd08a57eec7b189698cc5f74d2c3fd69044e20fcb83297a43214b2772a1312b2c6122ea0eb716abacf39524d60  chromium-launcher.sh
f6d962b9e4c22dd42183df3db5d3202dab33eccecafb1bf63ca678147289581262db1e5e64cbe8f9c212beefb0a6717bb8d311e497f56b55fe95b8bab2db493f  chromium.conf
e182c998a43d22d1c76a86c561619afd1fca8c2be668265ad5e2f81a3806f7a154272cc027a2f8b370fb69446892c69e5967a4be76082325c14245ee7915234c  chromium.desktop
2d8237a940ea691bd10b08315429677a587f7ef9692a0cca53bfd066eae82998a6c71f402a8669e9de39f94d7f3280745d1628ea6eac5d76ca7116844d4e0dac  google-api.keys
55921cc33d623e0751e94d4fef2ddd69afb57381da6115995b1f318e2398978b9173e80f6ffbc6e6c0c0c55a04e934e0e34a46c32e03947cc31f0f5a226e7725  chromium-widevine.patch
05fb6d9434565a7a73f5c18d470ae600bf4afbe15d0e4a7c2770bf2596a0bd2788cdfeb37e0b566fc3d26ff2d0791b70488b2c184e3286cff5a1fa25e17582cd  default-pthread-stacksize.patch
077ad46b90305306789a833f22e263d9ada5abcd9f1cd5799782f807c6872378a2000dcc0f29e93c32393b1b305de236a814e099f401727aae29502add9cf062  fix-gn_bootstrap.patch
88928afcc33843e17daa082435a4b88c2106b0252a202ad19f684021c027859366a0c12970700c0d1b010211eef95d295362dc6afdea1b00199dd8d2efbdcfe7  gcc6.patch
0a15b178fadffdc31f1f7bc814b95817cbcea9dd90b1ed84f7bab2d840f36453573742bd8501d79edecfa38c0ec2147843aef03c7b2c9bcfd0e3d22b72c25c4b  gn_bootstrap.patch
8fbfd67a0b6bbdf08364e810bd85b4a80dda9af73fefe3aba8010d9b33022d458a785c628515bbda9c743b8a0293d57cfe18fcc5aa2313c845c6fb948c2335f9  last-commit-position.patch
cab92f22a9922ab073d3f8fcecc523803ef6d1961699f9348b2785d6e10c03bc29138f3c76cc921181a73948b1477079d2c6aad853475b02c7336fe571b6de7d  musl-fixes.patch
17164a6b38409f466bd7da6bf0d4e71f3114bec38950414c924f57da6b7f536203e368100c7f3d8239ae52a8edf6f588e7b07281a71b5fc5847460da409af0e3  musl-hacks.patch
ce8276bb35a8d72cf58868a6331e85286b350a1aad694525ebf637499819219dd4d87ab67dd3b938830a6bd3e7172fc9bcd9c8971820d0ed95c0d141867a24fe  musl-sandbox.patch
f11db647ef78d70232e32cf15fb278f8541b27c68ff5d0c3764127eb9df76fe58e2bd842d857e795178b7dd10af64caed56b901f39524f37426ce9fb50689b05  no-execinfo.patch
a57858e45cfbb7e97f77b3b308502e377543d61d3d0085798ed73bc53da456828f5e010308d0de05fee4fe52071362d074f5af205f98f41d67222d997857d626  no-getcontext.patch
b5436f3f2fe8fa28f7019516edd3e7cbada40299e50640e3ca136abdfcb81d32a2f59011d5aea0add1997df30fd699694cdf65ae4b80862e0f5229b446f47c24  no-mallinfo.patch
d60407a8faadfd2a8294570163b4d1b1112c8a70a6f8e778fc3aff25d20613a2e26c66cd87e69c54953cc1b984e4038015ad04797b0495df13932541b05398fe  resolver.patch
27dd7916be3324294a0a913c43c856e9c00be767a2aec4f3da2455fb84e74ebb0017d1aa586b40dd9d989ada6b60fc531522f503d57e04324726a2171bf3a85e  unset-madv_free.patch"