# 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=68.8.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 mozilla-common libxt startup-notification 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 python-setuptools yasm mesa imake inetutils xorg-server-xvfb autoconf2.13 rust clang llvm jack gtk2 python nodejs python2-psutil cbindgen nasm) 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} no-relinking.patch 0001-Use-remoting-name-for-GDK-application-names.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=('19be922cdadc705a267f35450e742cf9cf2f793a3e74dd9a397f898ff879cf9d7e59ccc148a9fa47f3c637c30887c205f01069e689f0586fb9ef82f4e6b160ce' 'SKIP' '30e0eb38e6e5b25c47475ff45c908acbaa14ba6e0a29891767b4ea07bf707ac19f63a3f31e399b155749bd3102d1cfa0a5b8146032a476ede388f05b2eaffbda' '08c821bece2e71483668eedc0ab3211b1fa5057b7b99fdc9104a1dbab4707d74463f3cbcdce353a1ec4777e479b3ac27a585dd35115339fccb81c83bc0ef763b' '51d7eb22cb568f0437ece2433091d8b54012324edd2fe52ec52cc00f1ad0d4bd84a4d549d78b4d77bbd6ae1c1e7d029d9d4dbff61c60f714362ef791f09fba8b' '877eda442eb4730600dccf209a6e961ad3122ab456bbfda4ff041e8493ebaaf96224ac218360931259ff4214482f6bf65b3a3052f977ade1a274f38ffd859535' '9c51f5a5207a13791f7b1ff98f12b1c72b1dd7b50bc2152396ebecb0458ebcaefc0677fa9ab8f14582a3b6639d5a4141816a0148344d8012d541a105b89dc8f4' '056a9f859e1ebea8b10d9e2b9a520bc6585e6543c4b238d91e80ddb8613f98a47a6b659023cab31a29caa3f9880a11577c489e553c746b9de900910153ac17da' '7eed022ab6b9325c5a918e9700ba25bcb9aa51c8612a282611f641032b5d8a6db5d4b59ecd3382d2ef31f6bc62832650784d7be49264cff291e4424ad04d4235' '2579551298fc7670f4c8a3e3c496e2c92c39614d0960e87c30fa7cf581cd4ebc9d30d86ef69dd000294bafe618fa2087fbd9fd772d9ce2b1613ed8e540469206' '087ea758132905cab848e3a13a13537b42f70ba3a8bfd1ef4e2933d3e874e94038b50ee583b9e7e0c7b7cc7c2cf570f7f613b661f47121b7bf207f433b939f3d' '4c0f100c52721f9d9a840d7de1f1d5310578ef7fbc350c62341d96b2af23d8bcb774a289429693153635964860cbb05074149bf043941dec87a1d86655b4d4b6' '635a84c64ea9dccf41fbde33b58a72a8123ecd841995ad045bd329e23855f56ffce05670fe2d69a12c4cef7a7399bc6becfc5f40bfd8cea9a4006074672a634d') validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases prepare() { # mkdir mozbuild cd ${_pkgname}-${pkgver} # Avoid relinking during buildsymbols patch -Np1 -i ../no-relinking.patch # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052 patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch 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 if [[ ! -s merged.profdata ]]; then echo "No profile data produced." return 1 fi if [[ ! -s jarlog ]]; then echo "No jar log produced." return 1 fi 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 - <