# Maintainer: Jan Alexander Steffens (heftig) # Contributor: Ionut Biru # Contributor: Jakub Schmidtke # ALARM: Kevin Mihelich # - mozconfig changes for ARM # - revert change for clang that breaks gcc build on ARM # - disable rust lto for v7 # - use nodejs-lts-iron highmem=1 pkgname=firefox pkgver=132.0.1 pkgrel=1 pkgdesc="Fast, Private & Safe Web Browser" url="https://www.mozilla.org/firefox/" arch=(x86_64) license=(MPL-2.0) depends=( alsa-lib at-spi2-core bash cairo dbus ffmpeg fontconfig freetype2 gcc-libs gdk-pixbuf2 glib2 glibc gtk3 hicolor-icon-theme libpulse libx11 libxcb libxcomposite libxdamage libxext libxfixes libxrandr libxss libxt mime-types nspr nss pango ttf-font ) makedepends=( cbindgen clang diffutils imake jack lld llvm mesa nasm nodejs-lts-iron python rust unzip xorg-server-xvfb yasm zip ) optdepends=( 'hunspell-en_US: Spell checking, American English' 'libnotify: Notification integration' 'networkmanager: Location detection via available WiFi networks' 'speech-dispatcher: Text-to-Speech' 'xdg-desktop-portal: Screensharing with Wayland' ) options=( !emptydirs !lto !makeflags ) source=( https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz{,.asc} $pkgname-symbolic.svg $pkgname.desktop org.mozilla.$pkgname.metainfo.xml ) validpgpkeys=( # Mozilla Software Releases # https://blog.mozilla.org/security/2023/05/11/updated-gpg-key-for-signing-firefox-releases/ 14F26682D0916CDD81E37B6D61B7B526D98F0353 ) sha256sums=('5c031b572c1da726677e2ff97b6ad5a7e3b23387a6fc3963391cb562f80a5e48' 'SKIP' 'a9b8b4a0a1f4a7b4af77d5fc70c2686d624038909263c795ecc81e0aec7711e9' '71fe797430198ac8c00b538dce537284cf526e48be0496698cf5a980d70c16da' '58d78ce57b3ee936bc966458d6b20ab142d02a897bbe924b3f26717af0c5bee1') b2sums=('2773f6f74088954ab067df978e7069cbd92d96933190b32a24c7762ae7f300a8b4b9c95d6fee36ccceceebda86b51fd3842074d49869f8fa0cda5cb98402ed54' 'SKIP' '63a8dd9d8910f9efb353bed452d8b4b2a2da435857ccee083fc0c557f8c4c1339ca593b463db320f70387a1b63f1a79e709e9d12c69520993e26d85a3d742e34' '2c7936949ef922307fb593bd0480a13bde2eab8ae24fc89071d809d6659384705f9b7838b1ae8bc46b98a152ba01fcffad606d4c84796ad9bfaaf20166f0a0fd' '2ce33432f8a73a4f1a412b7a065d3c124e1ca9f6bdf3fad0407e897efc0840f8ef43eeeb1b9bef4a102d9fac0b2c4a2ef205726b817f83fe9c3742d076778b14') # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) # Note: These are for Arch Linux use ONLY. For your own distribution, please # get your own set of keys. Feel free to contact foutrelis@archlinux.org for # more information. # - Arch Linux ARM has obtained permission to use the Arch Linux keys. _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM prepare() { mkdir mozbuild cd firefox-$pkgver echo -n "$_google_api_key" >google-api-key cat >.mozconfig <> .mozconfig # https://bugzilla.redhat.com/show_bug.cgi?id=1641623 echo "ac_add_options --disable-av1" >> .mozconfig # reduce jobs due to RAM constraints MAKEFLAGS="-j1" # disable hard-coded LTO sed -i '/cargo_rustc_flags += -Clto/d' config/makefiles/rust.mk sed -i '/RUSTFLAGS += -Cembed-bitcode=yes/d' config/makefiles/rust.mk # increase codegen-units due to RAM constraints sed -i 's/codegen-units=1/codegen-units=16/' config/makefiles/rust.mk # webrtc on ARMv7 implies android, so disable it echo "ac_add_options --disable-webrtc" >> .mozconfig elif [[ $CARCH == "aarch64" ]]; then echo 'ac_add_options --enable-rust-simd' >> .mozconfig fi echo 'ac_add_options --enable-optimize="-g0 -O2"' >> .mozconfig echo "mk_add_options MOZ_MAKE_FLAGS=\"${MAKEFLAGS}\"" >> .mozconfig export MOZ_DEBUG_FLAGS=" " export CFLAGS+=" -g0" export CXXFLAGS+=" -g0" export LDFLAGS+=" -Wl,--no-keep-memory" export RUSTFLAGS="-Cdebuginfo=0" } build() { cd firefox-$pkgver export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=pip export MOZBUILD_STATE_PATH="$srcdir/mozbuild" export MOZ_BUILD_DATE="$(date -u${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH} +%Y%m%d%H%M%S)" export MOZ_NOSPAM=1 # malloc_usable_size is used in various parts of the codebase CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}" CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}" # Breaks compilation since https://bugzilla.mozilla.org/show_bug.cgi?id=1896066 CFLAGS="${CFLAGS/-fexceptions/}" CXXFLAGS="${CXXFLAGS/-fexceptions/}" # LTO needs more open files ulimit -n 4096 echo "Building optimized browser..." ./mach build --priority normal } package() { cd firefox-$pkgver DESTDIR="$pkgdir" ./mach install local vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js" install -Dvm644 /dev/stdin "$vendorjs" <