1 # Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
2 # Contributor: Ionut Biru <ibiru@archlinux.org>
3 # Contributor: Jakub Schmidtke <sjakub@gmail.com>
8 pkgdesc="Standalone web browser from mozilla.org"
9 url="https://www.mozilla.org/firefox/"
51 'hunspell-en_US: Spell checking, American English'
52 'libnotify: Notification integration'
53 'networkmanager: Location detection via available WiFi networks'
54 'pulseaudio: Audio support'
55 'speech-dispatcher: Text-to-Speech'
56 'xdg-desktop-portal: Screensharing with Wayland'
66 https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz{,.asc}
68 identity-icons-brand.svg
69 0001-Bug-1831691-Use-the-vendored-glean_parser-for-all-of.patch
72 '14F26682D0916CDD81E37B6D61B7B526D98F0353' # Mozilla Software Releases <release@mozilla.com>
74 sha256sums=('7a266044cb9d0c63079b3453507ea0c80a23389f4cbf6a4f6fd15146c6072627'
76 '298eae9de76ec53182f38d5c549d0379569916eebf62149f9d7f4a7edef36abf'
77 'a9b8b4a0a1f4a7b4af77d5fc70c2686d624038909263c795ecc81e0aec7711e9'
78 '1976c0c5e98b0f67e83de778a4fd7729de9b140efa47b77b5879ea2e907987e9')
79 b2sums=('1506901352ea84b8016080aa81a0f431b8620c64c0c54364ec56d1878b6413ad965c2d9f39a9bb06d2356c206702283400918b4fb0fa3dac380360f54e60b146'
81 'e18f2c22e394ca3b6758bc130245b254947e4d15921be3da443d6d7c3c4b0d22ead1b39fbc10a4f896edd19e2a1dffbd1cbb34dc4beb0621a6ddb70ccc53b3a7'
82 '63a8dd9d8910f9efb353bed452d8b4b2a2da435857ccee083fc0c557f8c4c1339ca593b463db320f70387a1b63f1a79e709e9d12c69520993e26d85a3d742e34'
83 '4ac97b908afb915911212686e41c09137bfa909023dc6fa0808cb6cb12f2dcef9597f0d679c98ad1a6b110d11a92025435cd30dd7b87194428b693c555e2bae7')
85 # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
86 # Note: These are for Arch Linux use ONLY. For your own distribution, please
87 # get your own set of keys. Feel free to contact foutrelis@archlinux.org for
89 _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM
91 # Mozilla API keys (see https://location.services.mozilla.com/api)
92 # Note: These are for Arch Linux use ONLY. For your own distribution, please
93 # get your own set of keys. Feel free to contact heftig@archlinux.org for
95 _mozilla_api_key=e05d56db0a694edc8b5aaebda3f2db6a
101 # https://bugzilla.mozilla.org/show_bug.cgi?id=1831691
102 patch -Np1 -i ../0001-Bug-1831691-Use-the-vendored-glean_parser-for-all-of.patch
104 echo -n "$_google_api_key" >google-api-key
105 echo -n "$_mozilla_api_key" >mozilla-api-key
107 cat >../mozconfig <<END
108 ac_add_options --enable-application=browser
109 mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
111 ac_add_options --prefix=/usr
112 ac_add_options --enable-release
113 ac_add_options --enable-hardening
114 ac_add_options --enable-optimize
115 ac_add_options --enable-rust-simd
116 ac_add_options --enable-linker=lld
117 ac_add_options --disable-elf-hack
118 ac_add_options --disable-bootstrap
119 ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
122 ac_add_options --enable-official-branding
123 ac_add_options --enable-update-channel=release
124 ac_add_options --with-distribution-id=org.archlinux
125 ac_add_options --with-unsigned-addon-scopes=app,system
126 ac_add_options --allow-addon-sideload
127 export MOZILLA_OFFICIAL=1
128 export MOZ_APP_REMOTINGNAME=${pkgname//-/}
131 ac_add_options --with-google-location-service-api-keyfile=${PWD@Q}/google-api-key
132 ac_add_options --with-google-safebrowsing-api-keyfile=${PWD@Q}/google-api-key
133 ac_add_options --with-mozilla-api-keyfile=${PWD@Q}/mozilla-api-key
136 ac_add_options --with-system-nspr
137 ac_add_options --with-system-nss
140 ac_add_options --enable-alsa
141 ac_add_options --enable-jack
142 ac_add_options --enable-crashreporter
143 ac_add_options --disable-updater
144 ac_add_options --disable-tests
152 export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
153 export MOZ_ENABLE_FULL_SYMBOLS=1
154 export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=pip
156 # LTO needs more open files
160 echo "Building instrumented browser..."
161 cat >.mozconfig ../mozconfig - <<END
162 ac_add_options --enable-profile-generate=cross
166 echo "Profiling instrumented browser..."
168 LLVM_PROFDATA=llvm-profdata \
169 JARLOG_FILE="$PWD/jarlog" \
170 xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
171 ./mach python build/pgo/profileserver.py
173 stat -c "Profile data found (%s bytes)" merged.profdata
174 test -s merged.profdata
176 stat -c "Jar log found (%s bytes)" jarlog
179 echo "Removing instrumented browser..."
182 echo "Building optimized browser..."
183 cat >.mozconfig ../mozconfig - <<END
184 ac_add_options --enable-lto=cross
185 ac_add_options --enable-profile-use=cross
186 ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
187 ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog
191 echo "Building symbol archive..."
197 DESTDIR="$pkgdir" ./mach install
199 local vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
200 install -Dvm644 /dev/stdin "$vendorjs" <<END
201 // Use LANG environment variable to choose locale
202 pref("intl.locale.requested", "");
204 // Use system-provided dictionaries
205 pref("spellchecker.dictionary_path", "/usr/share/hunspell");
207 // Disable default browser checking.
208 pref("browser.shell.checkDefaultBrowser", false);
210 // Don't disable extensions in the application directory
211 pref("extensions.autoDisableScopes", 11);
214 local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
215 install -Dvm644 /dev/stdin "$distini" <<END
219 about=Mozilla Firefox for Arch Linux
222 app.distributor=archlinux
223 app.distributor.channel=$pkgname
224 app.partner.archlinux=archlinux
227 local i theme=official
228 for i in 16 22 24 32 48 64 128 256; do
229 install -Dvm644 browser/branding/$theme/default$i.png \
230 "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
232 install -Dvm644 browser/branding/$theme/content/about-logo.png \
233 "$pkgdir/usr/share/icons/hicolor/192x192/apps/$pkgname.png"
234 install -Dvm644 browser/branding/$theme/content/about-logo@2x.png \
235 "$pkgdir/usr/share/icons/hicolor/384x384/apps/$pkgname.png"
236 install -Dvm644 browser/branding/$theme/content/about-logo.svg \
237 "$pkgdir/usr/share/icons/hicolor/scalable/apps/$pkgname.svg"
238 install -Dvm644 ../identity-icons-brand.svg \
239 "$pkgdir/usr/share/icons/hicolor/symbolic/apps/$pkgname-symbolic.svg"
241 install -Dvm644 ../$pkgname.desktop \
242 "$pkgdir/usr/share/applications/$pkgname.desktop"
244 # Install a wrapper to avoid confusion about binary path
245 install -Dvm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" <<END
247 exec /usr/lib/$pkgname/firefox "\$@"
250 # Replace duplicate binary with wrapper
251 # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
252 ln -srfv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/lib/$pkgname/firefox-bin"
254 # Use system certificates
255 local nssckbi="$pkgdir/usr/lib/$pkgname/libnssckbi.so"
256 if [[ -e $nssckbi ]]; then
257 ln -srfv "$pkgdir/usr/lib/libnssckbi.so" "$nssckbi"
260 export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE="$startdir/.crash-stats-api.token"
261 if [[ -f $SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE ]]; then
262 make -C obj uploadsymbols
264 cp -fvt "$startdir" obj/dist/*crashreporter-symbols-full.tar.zst
268 # vim:set sw=2 sts=-1 et: