# 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.0.2 _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) 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 $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=('5bff46a7d80f8dc164a3355dd2d780ea943c4e77fd8de529e0a63c21b4ac4098ec08d3b201b0bfa3d4ca2c89267ada18aa0e91843ada9c205987e9e27944ca6a' 'SKIP' 'e4cf5d0ddd2c7271f1723b5c313f0aa8a7bf2242fb301ceba1ab5a4dca655ca7b9461d0aaebe5eaccf84b2f7a4c4199cbb0c18eab2bdaff273fcb730ec27219e' '1c3af4cc5199cf7b9f3aad9ceab98b3e8a3dc0d38f50896ed2f32ac648f1e904a1cdda5da559964885989edbfab4c4bf65448e9a0f71d946c77ec0ab5a6aff4c' '877eda442eb4730600dccf209a6e961ad3122ab456bbfda4ff041e8493ebaaf96224ac218360931259ff4214482f6bf65b3a3052f977ade1a274f38ffd859535' '1be3d28b1ab3db98308aaa32c036e519a5826257dec4652de8cf368a158d6956ffd4a4a56b6bb7c0386fbddda5ea2056b007825b0c5c72a963340ba37e14d309' '37bad485ac0ab9f3c47560a079ea62163936e1d79f4888e2ce82af08e0b99dc33434e46403f453ccf35fd219482043d649659d829705a404c566833e780a9060' '8a83555c9ea1f790ea22945d1b2f00eb7ba3f1b079e4593b5546ee2a0f8ac8dc293af09a5ca5b63bc202ea2feb2c4bdc57b026c5fea74dd214b6ad0ff78c1b3a' '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 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 - <