# 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 _pkgname=firefox pkgname=${_pkgname}-esr pkgver=78.1.0 _pkgver=${pkgver}esr pkgrel=1 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 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) provides=(firefox) 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 rust-145.patch $pkgname.desktop distribution.ini mozconfig.in mozconfig.in.clang mozconfig.in.clang.pgo mozconfig.common.override arc4_enable-pgo-for-gcc.patch arc4_remove-health-reporting.patch arc4_remove-system-addons.patch ) b2sums=('7e51c68d48acf1985b40830382f1f9cd6dda769db73c601fd10fafad6fa627995ebc8207d4381eca41fddb62b977ee6253427e09915d2cefccd072abd808f51d' 'SKIP' 'e4cf5d0ddd2c7271f1723b5c313f0aa8a7bf2242fb301ceba1ab5a4dca655ca7b9461d0aaebe5eaccf84b2f7a4c4199cbb0c18eab2bdaff273fcb730ec27219e' '56e9264effe081af3fe9e5432cb0ee5acbe80dead170439e72062b9c5f34411f5b9aa06d2de6055efb7cb36e59a70c0e1d094605de78a3a1f185478be442ef8d' '1c3af4cc5199cf7b9f3aad9ceab98b3e8a3dc0d38f50896ed2f32ac648f1e904a1cdda5da559964885989edbfab4c4bf65448e9a0f71d946c77ec0ab5a6aff4c' '877eda442eb4730600dccf209a6e961ad3122ab456bbfda4ff041e8493ebaaf96224ac218360931259ff4214482f6bf65b3a3052f977ade1a274f38ffd859535' '1be3d28b1ab3db98308aaa32c036e519a5826257dec4652de8cf368a158d6956ffd4a4a56b6bb7c0386fbddda5ea2056b007825b0c5c72a963340ba37e14d309' '471d01a9d0914d8c1b62cd5ebe5c6ee319a28f3bc629b415bb39edaa280383919e09967ecaa3fdeab7bbce12ccba4e0440bf18474f538addc528672cee618e3a' 'bd967166ec95f134114d26de85559c8e4a0d18a40ea63d1fc045897198274ed6e523bb320632395e9b5277eb122c49e41d989413a3a019f8a868f7ab7743dc0d' '1e8cdc2968a78fa395b77b654496dbbf21d37308a7fd560ab5cff8dc092d9b5123c374af8a5a18dec7fd2a053f411a1478ebfd928365208d22042391da444b4b' '087ea758132905cab848e3a13a13537b42f70ba3a8bfd1ef4e2933d3e874e94038b50ee583b9e7e0c7b7cc7c2cf570f7f613b661f47121b7bf207f433b939f3d' '4c0f100c52721f9d9a840d7de1f1d5310578ef7fbc350c62341d96b2af23d8bcb774a289429693153635964860cbb05074149bf043941dec87a1d86655b4d4b6' '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://bugzilla.mozilla.org/show_bug.cgi?id=1654465 patch -Np1 -i ../rust-145.patch || true sed -e 's/1.31.0/1.38.0/' -i build/moz.configure/rust.configure if [ "${_modclang}" != "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 pgo cp $srcdir/mozconfig.in.clang.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 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//' - )" # # -fno-plt with cross-LTO causes obscure LLVM errors # # LLVM ERROR: Function Import: link error # CFLAGS="${CFLAGS/-fno-plt/}" # CXXFLAGS="${CXXFLAGS/-fno-plt/}" # 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 - <