# 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 pkgver=75.0 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 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-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 $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=('dee00e2461b18425f119ef6a6e52e17118d330b7d9277dded631c80299a731171df1dc3247625bb102beadac6edbf0d45e86988e45cf82f7ec89e930df524710' 'SKIP' 'b4683a33448cf7a891d629e4e1fd290622fcf96cacf593cb733eb4daad2fd66909e125e64e5129096051ba0d2453b831b14c8faf98d345f248f2132e3931355d' '51d7eb22cb568f0437ece2433091d8b54012324edd2fe52ec52cc00f1ad0d4bd84a4d549d78b4d77bbd6ae1c1e7d029d9d4dbff61c60f714362ef791f09fba8b' '877eda442eb4730600dccf209a6e961ad3122ab456bbfda4ff041e8493ebaaf96224ac218360931259ff4214482f6bf65b3a3052f977ade1a274f38ffd859535' '1e88c2ba69ffd167c7b5bf2aed816e54740782e55eadd5db59f601c11b56ef31a3514126b91c7710e72c67906dc9f6f220ebac98ff305870b1ff749dcd9e6d5d' '503dd9566de9ef21201d3440374a4c829c65d6e33abc7fa658a9656fdfc175343a214d5191d6fa479bb5407bd1aef64af4f667fa6bd02102d2170b95a57e6d7d' 'b552f33654fe47946ec7778a4e8e240e79b780493124281856204a137f2950cde3cde027960a2b5fd4ddb669330e386d2a933a29753f43b6ce57859499eb29e1' '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 - <