aboutsummaryrefslogtreecommitdiffstats
path: root/testing/firefox/APKBUILD
blob: 00045fefa5db1867d406a872ba4bfe33a6ceedd8 (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
# Contributor:
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=firefox
pkgver=66.0.4
_pkgver=$pkgver
_xulver=$pkgver
pkgrel=4
pkgdesc="Firefox web browser"
url="https://www.firefox.com/"
# limited by rust and cargo
arch="x86_64"
license="GPL LGPL MPL"
depends=""
makedepends="
	alsa-lib-dev
	autoconf2.13
	automake
	bsd-compat-headers
	bzip2-dev
	cargo
	cbindgen
	clang-dev
	dbus-glib-dev
	ffmpeg-dev
	gconf-dev
	gtk+2.0-dev
	gtk+3.0-dev
	hunspell-dev
	icu-dev
	libevent-dev
	libidl-dev
	libjpeg-turbo-dev
	libnotify-dev
	libogg-dev
	libtheora-dev
	libtool
	libvorbis-dev
	libxt-dev
	libxcomposite-dev
	llvm5-dev
	mesa-dev
	nasm
	nodejs
	nspr-dev
	nss-dev>=3.26
	nss-static
	paxmark
	python3-dev
	sqlite-dev
	sed
	startup-notification-dev
	wireless-tools-dev
	yasm
	zip
	"

install=""
source="https://ftp.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz
	stab.h

	fix-fortify-system-wrappers.patch
	fix-fortify-inline.patch
	fix-seccomp-bpf.patch
	fix-toolkit.patch
	fix-tools.patch
	mallinfo.patch

	mozilla-build-arm.patch
	disable-moz-stackwalk.patch
	fix-rust-target.patch
	fix-bug-1261392.patch
	fix-webrtc-glibcisms.patch

	firefox.desktop
	firefox-safe.desktop"

builddir="${srcdir}/firefox-$pkgver"
_mozappdir=/usr/lib/firefox

# help our shared-object scanner to find the libs
ldpath="$_mozappdir"

prepare() {
	default_prepare

	cp "$srcdir"/stab.h toolkit/crashreporter/google-breakpad/src/
	# https://bugzilla.mozilla.org/show_bug.cgi?id=1341234
	mkdir -p "$builddir"/objdir
	echo "ac_add_options BINDGEN_CFLAGS='-I/usr/include/nspr -I/usr/include/pixman-1'" >>objdir/.mozconfig
}

build() {
	cd "$builddir"/objdir

	sed -e 's/checkImpl/checkFFImpl/g' -i ../js/src/vm/JSContext*.h

	export SHELL=/bin/sh
	export BUILD_OFFICIAL=1
	export MOZILLA_OFFICIAL=1
	export USE_SHORT_LIBNAME=1
	# gcc 6
	export CXXFLAGS="-fno-delete-null-pointer-checks -fno-schedule-insns2"

	# set rpath so linker finds the libs
	export LDFLAGS="$LDFLAGS -Wl,-rpath,${_mozappdir}"

	../configure \
		--prefix=/usr \
		\
		--disable-crashreporter \
		--disable-elf-hack \
		--disable-gold \
		--disable-install-strip \
		--disable-jemalloc \
		--disable-profiling \
		--disable-pulseaudio \
		--disable-strip \
		--disable-tests \
		--disable-updater \
		\
		--enable-alsa \
		--enable-default-toolkit=cairo-gtk3 \
		--enable-official-branding \
		--enable-optimize="$CFLAGS" \
		--enable-startup-notification \
		--enable-system-ffi \
		--enable-system-sqlite \
		--enable-ffmpeg \
		--enable-hardening \
		\
		--with-system-bz2 \
		--with-system-icu \
		--with-system-libevent \
		--with-system-nspr \
		--with-system-nss \
		--with-system-pixman \
		--with-system-png \
		--with-system-zlib \
		--with-clang-path=/usr/bin/clang \
		--with-libclang-path=/usr/lib
		# FIXME: fix build with --with-system-libvpx and libvpx 1.8.0
		# https://bugzilla.mozilla.org/show_bug.cgi?id=1525393
	make

	# paxmark outside fakeroot
	paxmark -msp dist/bin/xpcshell

}

package() {
	cd "$builddir"/objdir

	# only used for startupcache creation.
	local paxflags="-msp"
	paxmark "$paxflags" dist/bin/xpcshell

	make install \
		DESTDIR="$pkgdir" \
		MOZ_MAKE_FLAGS="$MAKEOPTS"

	install -m755 -d ${pkgdir}/usr/share/applications
	install -m755 -d ${pkgdir}/usr/share/pixmaps

	local png
	for png in ../browser/branding/official/default*.png; do
		local i=${_png%.png}
		i=${i##*/default}
		install -D -m644 "$png" "$pkgdir"/usr/share/icons/hicolor/${i}x${i}/apps/firefox.png
	done

	install -m644 "$builddir"/browser/branding/official/default48.png \
		${pkgdir}/usr/share/pixmaps/firefox.png
	install -m644 ${srcdir}/firefox.desktop ${pkgdir}/usr/share/applications/firefox.desktop
	install -m644 ${srcdir}/firefox-safe.desktop ${pkgdir}/usr/share/applications/firefox-safe.desktop

	# firefox currently does not work with mprotect. disable it for now
	local paxflags="-mp"
	[ "$CARCH" = "x86" ] && paxflags="-msp"

	paxmark "$paxflags" "$pkgdir"/$_mozappdir/firefox
	paxmark "$paxflags" "$pkgdir"/$_mozappdir/plugin-container

	# xulrunner stub launcher has changed to using a symlink overlay...
	# go figure
	ln -sf /usr/lib/xulrunner-${_xulver} ${pkgdir}/$_mozappdir/xulrunner

	# launcher as symlink is broken from firefox-7.0
	rm "$pkgdir"/usr/bin/firefox
	libgl=$(scanelf -qF '#F%S' /usr/lib/libGL.so)
	cat > "$pkgdir"/usr/bin/firefox << __EOF__
#!/bin/sh

exec $_mozappdir/firefox "\$@"
__EOF__
	chmod 755 "$pkgdir"/usr/bin/firefox

	# install our vendor prefs
	install -d "$pkgdir"/$_mozappdir/browser/defaults/preferences

	cat >> "$pkgdir"/$_mozappdir/browser/defaults/preferences/firefox-branding.js <<- EOF
	// Use LANG environment variable to choose locale
	pref("intl.locale.matchOS", true);

	// Disable default browser checking.
	pref("browser.shell.checkDefaultBrowser", false);

	// Don't disable our bundled extensions in the application directory
	pref("extensions.autoDisableScopes", 11);
	pref("extensions.shownSelectionUI", true);
	EOF

	# remove copied, huge, libraries
	rm -f "$pkgdir"/${_mozappdirdev}/sdk/lib/libmozjs.so
	rm -f "$pkgdir"/${_mozappdirdev}/sdk/lib/libmozalloc.so
	rm -f "$pkgdir"/${_mozappdirdev}/sdk/lib/libxul.so
}

sha512sums="5c1ff2b98ff387af8fd66fc4e76e08bb246e5f6c81a264050ae4c2b7ff0df0afd537a90e30dbb1f78841dc57cfd031b7bead986c0acd5862713854b53f77f12b  firefox-66.0.4.source.tar.xz
0b3f1e4b9fdc868e4738b5c81fd6c6128ce8885b260affcb9a65ff9d164d7232626ce1291aaea70132b3e3124f5e13fef4d39326b8e7173e362a823722a85127  stab.h
2f4f15974d52de4bb273b62a332d13620945d284bbc6fe6bd0a1f58ff7388443bc1d3bf9c82cc31a8527aad92b0cd3a1bc41d0af5e1800e0dcbd7033e58ffd71  fix-fortify-system-wrappers.patch
09bc32cf9ee81b9cc6bb58ddbc66e6cc5c344badff8de3435cde5848e5a451e0172153231db85c2385ff05b5d9c20760cb18e4138dfc99060a9e960de2befbd5  fix-fortify-inline.patch
183a4ef62cd79728117797235fe46ecd3e4336c008d615c2b2a64c707477e403aed1ee5e19feb86611b93ebecc00df339aa28a73735e045e38f0d1ce3080341b  fix-seccomp-bpf.patch
ded76edfbc43637cd2e73100ea2244f97d95d452af61b9cd4f2db341cb0dbae8a5e846edeb4eafbe47dc1d30724869407d188e42b06518c67c4701745ea9adfa  fix-toolkit.patch
48683964624bb58b5a2a2a5c89da56e3b8dcd04f8d42c6910bea5365010a77d6d82bdd48259774ca54341edc05b6768eaa6aa1b453718c02f760361197e78b52  fix-tools.patch
4ea267fbe395ed8865f3ec18dd129d1c78cdbf23983a9c6c9e70b0536cdf2de8953e36444a10dfbdbd522a638fd90a6a51b2f7d5396ef6c98084ddd1ea34d0ff  mallinfo.patch
3671bf7623c1825c977668efec62b57873bc6052becfd8a68ddcbc2d0ba96e0c3966c61b24716e6c48167d44280d3e690a4ff986907ceba5811a653e87770fff  mozilla-build-arm.patch
019ab248a050bef305637dc4229596c06d9596879bbb1db985b96c5a680211996d714d4a1f6e9a66544cc4562a80364b1ee37ecf7964eb974ffef2566c5c2986  disable-moz-stackwalk.patch
42cc44fda4b05259b38f055d6f51461746aa89a474cedc5e92fb9d20879da0d12b1b515b273a549e7302cda9c7eddde20d5fdba09853e5c658784ad6d0b20078  fix-rust-target.patch
8b776f0da8dfad0ae81670623fa55ddcff91b78a1a569bb5e6b5f5130392249dfbebe84752c846c8aa5b4878643f0369cd7d9bfaf2b9dd0c841af302dcb48896  fix-bug-1261392.patch
40768d2458adb87fc15ad17b430cf0bebabde583910e55624bf282d4a69b3f9b9165289a7a9c2b50bfb9de1a16e2546f8d0b5ce33c1920000cffb588410b9e9e  fix-webrtc-glibcisms.patch
f3b7c3e804ce04731012a46cb9e9a6b0769e3772aef9c0a4a8c7520b030fdf6cd703d5e9ff49275f14b7d738fe82a0a4fde3bc3219dff7225d5db0e274987454  firefox.desktop
5dcb6288d0444a8a471d669bbaf61cdb1433663eff38b72ee5e980843f5fc07d0d60c91627a2c1159215d0ad77ae3f115dcc5fdfe87e64ca704b641aceaa44ed  firefox-safe.desktop"