APKBUILD 11.6 KB
Newer Older
Carlo Landmeter's avatar
Carlo Landmeter committed
1
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
2
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
Carlo Landmeter's avatar
Carlo Landmeter committed
3
pkgname=chromium
4 5
pkgver=72.0.3626.109
pkgrel=0
Carlo Landmeter's avatar
Carlo Landmeter committed
6 7
pkgdesc="chromium web browser"
url="http://www.chromium.org/"
8
arch="x86_64" # aarch64 armhf armv7 temp disable because we need clang for arm
Carlo Landmeter's avatar
Carlo Landmeter committed
9
license="BSD"
10
depends="xdg-utils"
11
depends_dev=""
12 13 14
makedepends="$depends_dev
	alsa-lib-dev
	bash
15
	binutils-gold
16 17 18 19 20 21 22 23 24 25 26 27 28
	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
29
	gtk+3.0-dev
30 31 32 33 34 35 36 37 38 39
	gzip
	harfbuzz-dev
	hunspell-dev
	hwdata-usb
	jpeg-dev
	jsoncpp-dev
	krb5-dev
	libbsd-dev
	libcap-dev
	libelf-dev
40
	libevent-dev
41 42 43 44 45
	libexif-dev
	libgcrypt-dev
	libgnome-keyring-dev
	libjpeg-turbo-dev
	libpng-dev
46
	libusb-dev
47
	libva-dev
48 49 50 51 52 53 54 55 56 57 58 59 60 61
	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
62
	nodejs
63
	nss-dev
64
	opus-dev
65 66 67 68
	paxmark
	pciutils-dev
	perl
	python2
69
	re2-dev
70 71 72 73 74 75 76
	snappy-dev
	speex-dev
	sqlite-dev
	xdg-utils
	yasm
	zlib-dev
	"
Carlo Landmeter's avatar
Carlo Landmeter committed
77
install=""
78 79
# explicit depends for --headless
depends="eudev-libs ttf-opensans"
Carlo Landmeter's avatar
Carlo Landmeter committed
80
options=suid
81
subpackages="$pkgname-chromedriver"
Carlo Landmeter's avatar
Carlo Landmeter committed
82
source="https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz
83
	pstables-2.8.h::https://git.savannah.gnu.org/cgit/freetype/freetype2.git/plain/src/psnames/pstables.h?h=VER-2-8
84
	chromium-launcher.sh
85
	chromium.conf
86
	chromium.desktop
87
	google-api.keys
88

89
	default-pthread-stacksize.patch
Carlo Landmeter's avatar
Carlo Landmeter committed
90
	musl-fixes.patch
91
	musl-fixes-breakpad.patch
92
	musl-hacks.patch
93
	musl-libc++.patch
94
	musl-sandbox.patch
Carlo Landmeter's avatar
Carlo Landmeter committed
95
	no-execinfo.patch
96 97
	no-mallinfo.patch
	resolver.patch
98
	swiftshader.patch
99
	secure_getenv.patch
100

101
	chromium-use-alpine-target.patch
102
	chromium-gcc-r1.patch
103 104
	media-base.patch
	musl-crashpad.patch
105 106
	musl-v8-fix-deadlock.patch
	musl-v8-monotonic-pthread-cont_timedwait.patch
107
	gcc8-alignof.patch
108
	gcc-fno-delete-null-pointer-checks.patch
Carlo Landmeter's avatar
Carlo Landmeter committed
109 110
	"

111
builddir="$srcdir"/$pkgname-$pkgver
Carlo Landmeter's avatar
Carlo Landmeter committed
112

113 114 115 116 117 118 119 120
if [ -n "$DEBUG" ]; then
	_buildtype=Debug
	_is_debug=true
else
	_buildtype=Release
	_is_debug=false
fi

Carlo Landmeter's avatar
Carlo Landmeter committed
121
prepare() {
122 123
	cd "$builddir"

Carlo Landmeter's avatar
Carlo Landmeter committed
124
	local i
125
	cd "$builddir"
Carlo Landmeter's avatar
Carlo Landmeter committed
126 127
	for i in $source; do
		case $i in
128
		*.patch) msg $i; patch -p0 -i "$srcdir"/$i;;
Carlo Landmeter's avatar
Carlo Landmeter committed
129 130
		esac
	done
131

132
	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
133
	touch chrome/test/data/webui/i18n_process_css_test.html
134 135 136
	# 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
137 138 139

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

141
	# reusable system library settings
Carlo Landmeter's avatar
Carlo Landmeter committed
142
	local use_system="
143
		ffmpeg
144
		flac
145
		fontconfig
146
		freetype
147
		harfbuzz-ng
148
		libdrm
149
		libevent
150 151 152
		libjpeg
		libpng
		libwebp
153
		libxml
154
		libxslt
155 156
		opus
		re2
157 158
		snappy
		yasm
Carlo Landmeter's avatar
Carlo Landmeter committed
159
		"
160 161 162
	for _lib in ${use_system} libjpeg_turbo; do
		msg "Removing buildscripts for system provided $_lib"
		find -type f -path "*third_party/$_lib/*" \
163 164
			\! -path "*third_party/$_lib/chromium/*" \
			\! -path "*third_party/$_lib/google/*" \
165 166 167
			\! -path './base/third_party/icu/*' \
			\! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
			\! -path './third_party/yasm/run_yasm.py' \
168 169 170
			\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
			-delete
	done
171

Carlo Landmeter's avatar
Carlo Landmeter committed
172
	msg "Replacing gyp files"
173
	python build/linux/unbundle/replace_gn_files.py --system-libraries \
174
		${use_system}
175
	third_party/libaddressinput/chromium/tools/update-strings.py
176 177 178 179 180 181 182 183
}

_gn_flags() {
	echo $*
}

build() {
	cd "$builddir"
Carlo Landmeter's avatar
Carlo Landmeter committed
184

185 186 187 188 189 190 191
	##############################################################
	# 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)"

192
	msg "Bootstrapping GN"
193
	local _c=$(_gn_flags is_clang=false \
194 195 196 197
		use_sysroot=false \
		treat_warnings_as_errors=false \
		fatal_linker_warnings=false \
		binutils_path=\"/usr/bin\" \
198
		use_gold=false \
199
		use_allocator=\"none\" \
200
		use_allocator_shim=false \
201
		use_vaapi=true \
202 203
	)

204
	AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \
205
		python tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "$_c"
Carlo Landmeter's avatar
Carlo Landmeter committed
206

207
	msg "Configuring build"
208
	_c=$(_gn_flags \
209
		clang_use_chrome_plugins=false \
210
		closure_compile=false \
211 212
		custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \
		enable_hangout_services_extension=true \
213 214 215
		enable_nacl=false \
		enable_nacl_nonsfi=false \
		enable_precompiled_headers=false \
216
		fatal_linker_warnings=false \
217 218
		ffmpeg_branding=\"Chrome\" \
		fieldtrial_testing_like_official_build=true \
219
		gold_path=\"/usr/bin/ld.gold\" \
220 221 222
		google_api_key=\"$_google_api_key\" \
		google_default_client_id=\"$_google_default_client_id\" \
		google_default_client_secret=\"$_google_default_client_secret\" \
223 224
		host_toolchain=\"//build/toolchain/linux/unbundle:default\" \
		icu_use_data_file=true \
225
		is_clang=false \
226
		is_component_build=false \
227
		is_debug=$_is_debug \
228
		is_desktop_linux=true \
229 230
		linux_use_bundled_binutils=false \
		proprietary_codecs=true \
231
		remove_webcore_debug_symbols=true \
232 233
		symbol_level=0 \
		treat_warnings_as_errors=false \
234
		use_allocator=\"none\" \
235
		use_allocator_shim=false \
236 237
		use_cups=true \
		use_custom_libcxx=false \
238
		use_gnome_keyring=false \
239
		use_gold=false \
240
		use_lld=false \
241
		use_pulseaudio=false \
242
		use_sysroot=false \
243
		use_system_harfbuzz=true \
244 245
	)

246
	AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" NM=/usr/bin/nm \
Timo Teräs's avatar
Timo Teräs committed
247
		out/Release/gn gen out/$_buildtype --args="$_c $_ca"
248

Carlo Landmeter's avatar
Carlo Landmeter committed
249
	msg "Ninja turtles GO!"
250
	# workaround parallel build
251
	ninja -C out/Release gen/ui/accessibility/ax_enums.p
252

Carlo Landmeter's avatar
Carlo Landmeter committed
253
	# build mksnapshot and paxmark it
254 255
	ninja -C out/$_buildtype mksnapshot
	paxmark -m out/$_buildtype/mksnapshot
256 257 258
	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
259

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

Carlo Landmeter's avatar
Carlo Landmeter committed
263
	# finish rest of the build
264
	ninja -C out/$_buildtype chrome chrome_sandbox chromedriver
Carlo Landmeter's avatar
Carlo Landmeter committed
265 266 267
}

package() {
268
	cd "$builddir"/out/$_buildtype
269
	local bin pak
270
	# paxmark inside chroot too
271
	paxmark -m mksnapshot
272

273 274
	for bin in chrome chromedriver *.bin; do
		install -Dm755 $bin "$pkgdir"/usr/lib/$pkgname/$bin
Carlo Landmeter's avatar
Carlo Landmeter committed
275
	done
276
	paxmark -m "$pkgdir"/usr/lib/$pkgname/chrome
277

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

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

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

288
	cp -a locales "$pkgdir"/usr/lib/$pkgname/
Carlo Landmeter's avatar
Carlo Landmeter committed
289

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

297
	install -Dm644 "$srcdir"/chromium.conf \
298
		"$pkgdir"/etc/chromium/chromium.conf
299 300 301 302

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

303
	cd "$builddir"
304 305 306 307 308 309 310 311 312
	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
Carlo Landmeter's avatar
Carlo Landmeter committed
313 314
}

315 316
chromedriver() {
	pkgdesc="WebDriver driver for the Chromium Browser"
317 318
	mkdir -p "$subpkgdir"/usr/lib/$pkgname "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/lib/$pkgname/chromedriver \
319 320
		"$subpkgdir"/usr/lib/$pkgname/
	mv "$pkgdir"/usr/bin/chromedriver "$subpkgdir"/usr/bin
321 322
}

323
sha512sums="1eb681d085657c7ae3485164f8e2e80c12f65361072f0101d3659c6161e2bf1d647226e98860cbcda8ff1f44542ac32508eb19f3a645886e87c37fae6affeb1c  chromium-72.0.3626.109.tar.xz
324
a3bb959c65944ae2fb765725cedcffd743a58bc0c2cd1f1999d15fe79801d00f3474b08b4ed7b48859ed921eb57093d0ad09d90f201d729ed9b8a419a591ed29  pstables-2.8.h
325
b9a810416dd7a8ffc3a5ced85ad9acebda1665bd08a57eec7b189698cc5f74d2c3fd69044e20fcb83297a43214b2772a1312b2c6122ea0eb716abacf39524d60  chromium-launcher.sh
326
f6d962b9e4c22dd42183df3db5d3202dab33eccecafb1bf63ca678147289581262db1e5e64cbe8f9c212beefb0a6717bb8d311e497f56b55fe95b8bab2db493f  chromium.conf
327
e182c998a43d22d1c76a86c561619afd1fca8c2be668265ad5e2f81a3806f7a154272cc027a2f8b370fb69446892c69e5967a4be76082325c14245ee7915234c  chromium.desktop
328
2d8237a940ea691bd10b08315429677a587f7ef9692a0cca53bfd066eae82998a6c71f402a8669e9de39f94d7f3280745d1628ea6eac5d76ca7116844d4e0dac  google-api.keys
329
230d1819b9d644ebaa6e194e948d662add8d237a99cc3d6b0f8a2fc2b331b43a3cd0766746f1c76c1a114f1730b40504c532d0c40aafa8cbc45022663cbcc245  default-pthread-stacksize.patch
330
9cd1defffb55cd1290e82b233a623e962775e19f001b26ae8f74330f3467499fd16067d607ca8e2b0b9b8d8988cd7ea2af93df65d7cc3d9299b8bc2b472c712e  musl-fixes.patch
331
90efbc89151c77f32434364dcbaabaf9d9a207f4a77f147cd51b3fe100832fbfb3a9fb665303a79a3d788e400f4f41890de202ccbb7bd1fc6252e33c6e74e429  musl-fixes-breakpad.patch
332
0aa3176f1021332088740d6e4fe2eadbe375240df0690c8449426a42a674fdf58e8a1fda85ca527dc1b4451e964d54564283fd81e3b7df059f5bcfccb8e07e84  musl-hacks.patch
333
95ead57f7338649351948d100e32e5ec1eeadb02bffa136ff15c6c515eceb8013c444be092d777c1b62b945bfb83b97778ba4d3a0ccc2d7c2c9a0a8cd8ee0f01  musl-libc++.patch
334
9b75d6ac720d1b8ddc597f0f472bc400ff866a733f12b3a4cd3e7e18e724549c5f8e056c7e0d0462ef083bff5e677f8cef6b89b22f4740a40ad6398978269373  musl-sandbox.patch
335
6403abf957e3497c19578c19567582d65846d532e071211421166944614219dad21e31a3589b484836919d7c1e5904d4dd8c6faf40dc514c043fe14a2ff718ef  no-execinfo.patch
336 337
db7f676d3476820c29f234b1f8f17a74e82b72d67fc727c715307734fd238e3cb0f99d8b5320d45f820b62c01163283c4829caa37afd6a9ca7592a54d3c65819  no-mallinfo.patch
6833054ef89da20c0de63faac2f87ff250b5aca3ac785fc404da4a9e03c4e00df9d7da009788e611d113cdf3be2ba50f933d85d6baf20f2df6a3711cceff5152  resolver.patch
338
6b0812725a0fc562527f3556dc4979fec72d1ba92f26a5e78ff2016c39bb2c155a0ff95fc22101f9c097d14b84182d6615276f4247f60ae7833ab45da8366e6d  swiftshader.patch
339
1b8647ab4081ec27f142eb564841b603dbf4c41118502e43b061d06f8866ebd1418d676457ed9ee0dc0a759e0369a29219bea98e74f687ddcba5d4513ca460ba  secure_getenv.patch
340
246c43a0ab557671119ebc4ecb292925ebfee25312fb50e739a179dc085d23b9623bec2d7baecdd37ebd9318f8770664f20c12de6383def74cd89b7845d149ce  chromium-use-alpine-target.patch
341
6e2bcbed44786c6c0d3beda935269f30fdcdf07c400defa6bf73f8359a60b1d59cc2f80dbc106be651a535635995641321d9e524b18919d3975bd6008a641d59  chromium-gcc-r1.patch
342 343
589a7acf149d44db081da2dd24a7769f2b9572a8cc64d2aad78577a64768d3b6fb2bfa02292b5260acd2c4a28c3ae9b82847ff901ce8a21baeca0b46dcda0ca9  media-base.patch
05c1af43038f76014f5f8b605085310414242f2bfad0e3258ddb29a08e7f4307de31b2d551b0a291986cc7d5a01cf3a003ac864216877195bb4310fd33193f0f  musl-crashpad.patch
344 345
2c22e0d56b2557bafc842043911ecd0f8f70589013aeb7d3e8c7c8a5622bdbfe1f249e7223991ebf6130c7a45c7771a02dcc096dd03c48e2559ea4741147cfce  musl-v8-fix-deadlock.patch
6953e83d4034f7a016dd055fed152a8a448f741a4c4f7a8f3b03cc7a4589d3d3c03775f844d76d6d4478ac15c655fee0be7355f0d5062ddc7fa9f6ce4b011116  musl-v8-monotonic-pthread-cont_timedwait.patch
346
9bfc532fd1e84e30362ac41fcd68253e17ee4cb5e986ceb5bb122e3235e4617e295ce9dddfdfbbd0b9d3e67267096152da2a19e3bb4bb9111c7fdb22fa398872  gcc8-alignof.patch
347
bb0f3dc1ade429a398d487ae190a278948533398c4a1085aeb35ff57fefb90a1e598008ba839423ca0acd30ba4c992950f395dba3b9994d3c7187fe68b9a93d7  gcc-fno-delete-null-pointer-checks.patch"