# Maintainer: jc_gargma # Maintainer (Arch): Jan Alexander Steffens (heftig) # Contributor: Aqua-sama # Contributor (Arch): Ionut Biru # Contributor (Arch): Jakub Schmidtke # # I maintain this because: # Arch version uses eme # Arch version uses git # Arch version uses python2 # Arch version uses clang # Arch version requires signed addons # Arch version doesn't remove system addons # Arch version enables debug symbols # Arch version lacks privacy and security by default _modclang=0 #_modclang=1 # FIXME _testgcc=0 pkgname=firefox pkgver=81.0 pkgrel=2 pkgdesc="Standalone web browser from mozilla.org" arch=(x86_64 aarch64) license=(MPL GPL LGPL) url="https://www.mozilla.org/firefox/" depends=(gtk3 libxt mime-types dbus-glib ffmpeg ttf-font libpulse alsa-lib bzip2 libffi icu libjpeg-turbo libevent libvpx nspr nss pixman libpng sqlite libwebp zlib) makedepends=(unzip zip diffutils yasm mesa imake inetutils xorg-server-xvfb autoconf2.13 rust clang llvm jack gtk2 nodejs cbindgen nasm python-setuptools python-psutil python-zstandard lld) optdepends=('networkmanager: Location detection via available WiFi networks' 'libnotify: Notification integration' 'alsa-utils: ALSA support' 'jack: Jack support' 'pulseaudio: PulseAudio support' 'speech-dispatcher: Text-to-Speech' 'hunspell-en_CA: Spell checking, Canadian English' 'firefox-preferences: Custom vendor.js with security by default' 'firefox-preferences-basic: Custom vendor.js with less breaking changes') options=(!emptydirs !makeflags) conflicts=(firefox-esr) source=( "https://archive.mozilla.org/pub/$pkgname/releases/$pkgver/source/$pkgname-$pkgver.source.tar.xz"{,.asc} 0001-Use-remoting-name-for-GDK-application-names.patch 0002-Bug-1660901-Support-the-fstat-like-subset-of-fstatat.patch 0003-Bug-1660901-ignore-AT_NO_AUTOMOUNT-in-fstatat-system.patch $pkgname.desktop distribution.ini mozconfig.in mozconfig.in.pgo mozconfig.in.clang mozconfig.in.clang.pgo mozconfig.common.override arc4_enable-lto-for-gcc.patch arc4_enable-pgo-for-gcc.patch arc4_remove-health-reporting.patch arc4_remove-system-addons.patch ) b2sums=('0546bad15aa89a7e4d2ca0cc000fed2170b9529f8f2cc1c1c4907649ffbcf72e8ee800083b63a767fc07b643cacb298b424ebc1ce827de209f366716e3a5135b' 'SKIP' '870f33f4dcb411e3aa2f94c5068bccad0f07a5c4a6b5356fc55ba363bdc2ff8ba8b76d507618b7349ae190ed09deadf4c0b8b500a6692f76cd01e7f83411a2db' '799ff9c88aafde5c60d852c9c9006090adce002f558985c95d5759e34aec9f6713298d3ff7e9220183053f932d8c7d849d0b715d66315ae58bc21aef891d136a' '32b1b153c3affb5a6b92425813d565124603e09a654f23347206f2cbf6f928377385917312c100b8c19a556fe75066499fb5b2fe15a2fd2cf569963df12ff1c3' 'e18f2c22e394ca3b6758bc130245b254947e4d15921be3da443d6d7c3c4b0d22ead1b39fbc10a4f896edd19e2a1dffbd1cbb34dc4beb0621a6ddb70ccc53b3a7' '877eda442eb4730600dccf209a6e961ad3122ab456bbfda4ff041e8493ebaaf96224ac218360931259ff4214482f6bf65b3a3052f977ade1a274f38ffd859535' 'f8b01cf39b9e149f1acfd1c68ab55028f758a139f972138dbd51a423633f31bdaaa08acf785e81e16a4c2353f322a8917cd07a0fb706093b4019ecca0bd7673f' '08d4e0768c2323b4905b3ba539594e88132b487a4eac2ab61df36020fe6f933c338afba918aea0becd10ecf29795bf94146cefc4f6b111ea658a20fdf6e899cd' 'aa87016dabc182a4da3db1f29f4a6b274095be883febf848ddbe86615639b6a85f12b2c78ce6b18bba18516982330fb775083f4bab330738d95ee26d70f02dfa' 'ffb7ca117004a084b1bd7baed6a11b0914ec391459d662fc8887edc3206eb25c41b09f713e9bfe0ed474333d9537295842b0617dd29e9ce222fde548cd9111aa' '1c7ac58af8b817067c7d79ffef8d9100f513d77f4fc1a2bce2684ff8d8d3cbc3d37b31865c7e5d873fd71d4649374bbd25ca08166d8afb25ffbd597759655063' '087ea758132905cab848e3a13a13537b42f70ba3a8bfd1ef4e2933d3e874e94038b50ee583b9e7e0c7b7cc7c2cf570f7f613b661f47121b7bf207f433b939f3d' '1250b2d4a713b241d9768dc386ecf9130d295587efd5070c2e494185436ca9d99a465b97ed80fe23ab14d6d07ecde8537a3a3d11ba843c4e3791b4df52e08f27' '020695637162ce981929f54ea556100bf17e92931179a5849ca8265dfc0016f1b6599d9f77e9f71f192a1a4bb3b2d1eadbf5d5554e6c33bfa3f9388b0a3c7c6e' '635a84c64ea9dccf41fbde33b58a72a8123ecd841995ad045bd329e23855f56ffce05670fe2d69a12c4cef7a7399bc6becfc5f40bfd8cea9a4006074672a634d') validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases prepare() { # mkdir mozbuild cd ${pkgname}-${pkgver} # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052 patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch # https://bugs.archlinux.org/task/67978 # https://bugzilla.mozilla.org/show_bug.cgi?id=1660901 patch -Np1 -i ../0002-Bug-1660901-Support-the-fstat-like-subset-of-fstatat.patch patch -Np1 -i ../0003-Bug-1660901-ignore-AT_NO_AUTOMOUNT-in-fstatat-system.patch if [ "${_modclang}" != "1" ]; then # Apply gcc pgo patches patch -p0 $srcdir/${pkgname}-${pkgver}/security/sandbox/linux/moz.build $srcdir/arc4_enable-lto-for-gcc.patch fi if [ "${_testgcc}" == "1" ]; then # Apply gcc pgo patches patch -p0 $srcdir/${pkgname}-${pkgver}/security/sandbox/linux/moz.build $srcdir/arc4_enable-pgo-for-gcc.patch fi if [ "${_modclang}" == "1" ]; then # Add the custom mozconfig for clang pgo cp $srcdir/mozconfig.in.clang.pgo $srcdir/${pkgname}-${pkgver}/.mozconfig elif [ "${_testgcc}" == "1" ]; then # Add the custom mozconfig for gcc pgo cp $srcdir/mozconfig.in.pgo $srcdir/${pkgname}-${pkgver}/.mozconfig else # Add the custom mozconfig cp $srcdir/mozconfig.in $srcdir/${pkgname}-${pkgver}/.mozconfig fi # MOZ_TELEMETRY_REPORTING only applied correctly when set in this override file cp $srcdir/mozconfig.common.override $srcdir/${pkgname}-${pkgver}/build/mozconfig.common.override # Disable various components at the source level #sed -i 's|[;]1|;0|' $srcdir/${pkgname}-${pkgver}/toolkit/components/telemetry/TelemetryStartup.manifest sed -i 's/;1/;0/' $srcdir/${pkgname}-${pkgver}/toolkit/components/telemetry/components.conf # Patch out health reporting so that MOZ_DATA_REPORTING=0 can be applied. patch -p0 $srcdir/${pkgname}-${pkgver}/browser/moz.configure $srcdir/arc4_remove-health-reporting.patch # Remove @RESPATH@/browser/features/* to prevent system addons from being part of the output package. patch -p0 $srcdir/${pkgname}-${pkgver}/browser/installer/package-manifest.in $srcdir/arc4_remove-system-addons.patch # Hide mobile promo # echo ".fxaMobilePromo { display: none !important; }" >> browser/themes/shared/incontentprefs/preferences.inc.css # Hide plugindeprecation-notice echo "#plugindeprecation-notice { display: none !important; }" >> toolkit/mozapps/extensions/content/extensions.css # Hide warnings on unsigned extensions echo ".warning{display: none!important; } .addon[notification=warning]{background-image: none!important;}" >> toolkit/mozapps/extensions/content/extensions.css } build() { cd ${pkgname}-${pkgver} export MOZ_NOSPAM=1 export MOZBUILD_STATE_PATH="$srcdir/mozbuild" export MACH_USE_SYSTEM_PYTHON=1 # -flto breaks cargo export CFLAGS="$CFLAGS -O3 -fstack-protector-all -fPIC" export CXXFLAGS="$CXXFLAGS -O3 -fstack-protector-all -fPIC" # LTO needs more open files ulimit -n 4096 if [ "${_modclang}" == "1" ]; then # clang does not support -fstack-clash-protection, so remove it export CFLAGS="$(echo $CFLAGS | sed 's/ -fstack-clash-protection//' - )" export CXXFLAGS="$(echo $CXXFLAGS | sed 's/ -fstack-clash-protection//' - )" # Do 3-tier PGO echo "Building instrumented browser..." ./mach build echo "Profiling instrumented browser..." ./mach package LLVM_PROFDATA=llvm-profdata \ JARLOG_FILE="$PWD/jarlog" \ xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \ ./mach python build/pgo/profileserver.py stat -c "Profile data found (%s bytes)" merged.profdata test -s merged.profdata stat -c "Jar log found (%s bytes)" jarlog test -s jarlog echo "Removing instrumented browser..." ./mach clobber echo "Building optimized browser..." # Add the custom mozconfig cp $srcdir/mozconfig.in.clang $srcdir/${pkgname}-${pkgver}/.mozconfig cat >.mozconfig - <.mozconfig - <