# Maintainer: Thaodan # Contributor: Weng Xuetian # For common issues regarding GCC and firefox see: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45375 # enable this if you run out of memory during linking #_lowmem=true # build with PGO _pgo=true _pkgname=firefox pkgname=$_pkgname-kde-opensuse pkgver=121.0.1 pkgrel=1 pkgdesc="Standalone web browser from mozilla.org with OpenSUSE patch, integrate better with KDE" arch=('i686' 'x86_64') license=('MPL' 'GPL' 'LGPL') url="https://github.com/openSUSE/firefox-maintenance" depends=('libxt' 'mime-types' 'dbus-glib' 'hicolor-icon-theme' 'libevent' 'nss>=3.28.3' 'nspr>=4.10.6' 'hunspell' 'sqlite' 'kmozillahelper' 'ffmpeg' ) makedepends=('unzip' 'zip' 'diffutils' 'yasm' 'mesa' 'imake' 'xorg-server-xvfb' 'libpulse' 'inetutils' 'autoconf2.13' 'cargo' 'mercurial' 'llvm' 'clang' 'rust' 'jack' 'nodejs' 'cbindgen' 'nasm' 'xz' 'python' 'python-zstandard' 'dump_syms' # system av1 'dav1d' 'aom' # system harfbuzz 'harfbuzz' # system graphite 'graphite' # system webp 'libwebp' # system libevent 'libevent' # system icu 'icu' # system libvpx 'libvpx' # gtk 'gtk3' 'libnotify' 'libpulse' ) changeslog=$pkgname.changes # https://bugs.gentoo.org/792705 # needs fixes from GCC 11.2 makedepends+=('gcc>=11.2.0') optdepends=('networkmanager: Location detection via available WiFi networks' 'speech-dispatcher: Text-to-Speech' 'pulseaudio: Audio support' 'libnotify: Notification integration' 'xdg-desktop-portal: Screensharing with Wayland') provides=("firefox=${pkgver}") conflicts=('firefox') _patchrev=22b224bf3e8c1431d2d9d961ca351cf3c50fdc15 options=('!emptydirs' !lto) source=(https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz{,.asc} mozconfig firefox.desktop vendor.js 0001-Bug-1504834-Rough-progress-patch.patch 0002-Bug-1504834-XULText-AA-fix-BE.patch 0003-mozilla-bmo998749.patch.patch 0004-mozilla-libavcodec58_91.patch.patch 0005-mozilla-silence-no-return-type.patch-to-fix-build-er.patch 0006-Bug-531915-mozilla-bmo531915.patch.patch 0007-imported-patch-one_swizzle_to_rule_them_all.patch.patch 0008-imported-patch-svg-rendering.patch.patch 0009-Bug-1792159-Add-missing-includes-to-AtomicOperations.patch 0010-mozilla-s390-context.patch.patch 0011-bsc-991344-Rpi3-Firefox-crashes-after-a-few-seconds-.patch 0012-mozilla-fix-aarch64-libopus.patch.patch 0013-Bug-634334-call-to-the-ntlm_auth-helper-fails.patch 0014-Make-PGO-use-toolchain.patch 0015-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch 0016-Fix-building-with-PGO-when-using-GCC.patch 0017-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch 0018-Bug-1516081-Disable-watchdog-during-FDO-train.patch 0019-Bug-559213-Support-system-av1.patch 0020-Bug-847568-Support-system-harfbuzz.patch 0021-Bug-847568-Support-system-graphite2.patch 0022-Bug-1611386-Reenable-support-for-enable-system-sqlit.patch 0023-Bug-1419151-Add-Unity-menubar-support.patch 0024-Do-not-use-gconf-for-proxy-settings-if-not-running-w.patch 0025-Add-KDE-integration-to-Firefox-toolkit-parts.patch 0026-Add-KDE-integration-to-Firefox.patch 0027-Imported-patch-firefox-branded-icons.patch.patch 0028-Allow-Eme-for-arm-and-Aarch64.patch 0029-Shut-up-warnings-about-future-Rust-version-incompati.patch 0030-Partially-revert-Bug-1768632-Make-EnumSet-compile-fo.patch 0031-Bug-1796523-Workaround-source-locations-for-function.patch 0032-Bug-1822730-Add-basic-blob-protocol-handling-for-blo.patch ) validpgpkeys=( # Mozilla Software Releases # https://blog.mozilla.org/security/2023/05/11/updated-gpg-key-for-signing-firefox-releases/ 14F26682D0916CDD81E37B6D61B7B526D98F0353 ) # 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. _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM _google_default_client_id=413772536636.apps.googleusercontent.com _google_default_client_secret=0ZChLK6AxeA3Isu96MkwqDR4 # Mozilla API keys (see https://location.services.mozilla.com/api) # Note: These are for Arch Linux use ONLY. For your own distribution, please # get your own set of keys. Feel free to contact heftig@archlinux.org for # more information. _mozilla_api_key=e05d56db0a694edc8b5aaebda3f2db6a prepare() { cd firefox-$pkgver cp "$srcdir/mozconfig" .mozconfig echo -n "$_google_api_key" >google-api-key echo "ac_add_options --with-google-location-service-api-keyfile=\"$PWD/google-api-key\"" >>.mozconfig echo -n "$_google_default_client_id $_google_default_client_secret" >google-oauth-api-key echo "ac_add_options --with-google-safebrowsing-api-keyfile=\"$PWD/google-oauth-api-key\"" >>.mozconfig echo -n "$_mozilla_api_key" >mozilla-api-key echo "ac_add_options --with-mozilla-api-keyfile=\"$PWD/mozilla-api-key\"" >>.mozconfig for patch in "$srcdir"/*.patch ; do echo "Applying $patch" patch -p1 -i "$patch" done } build() { #export CXXFLAGS="${CFLAGS}" cd firefox-$pkgver export MOZ_SOURCE_REPO="$_repo" export MOZBUILD_STATE_PATH="$srcdir/mozbuild" export MOZ_APP_REMOTINGNAME=$pkgname export CARGO_HOME="$srcdir"/.cargo export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system # LTO needs more open files ulimit -n 4096 export CC=gcc export CXX=g++ export AR="gcc-ar" export NM="gcc-nm" export RANLIB="gcc-ranlib" export MOZ_MAKE_FLAGS="$MAKEFLAGS" export MOZ_SMP_FLAGS="$MAKEFLAGS" export STRIP=/bin/true if [[ -n $_lowmem || $CARCH == i686 ]]; then LDFLAGS+=" -Xlinker --no-keep-memory" fi if [[ -n $_pgo ]]; then export DISPLAY=:99 export MOZ_PGO=1 export TMPDIR="$srcdir/tmp" mkdir -p "$TMPDIR" xvfb-run \ -a \ -s "-extension GLX -screen 0 1280x1024x24" \ ./mach build else ./mach build fi ./mach buildsymbols } package() { # The .so dependencies have to be added here so # pacman doesn't try to install the build time dependencies # by trying to resolve so names. # Doing so makes pacman ask for which have to be installed even thou # they are already specificied in makedepends depends+=( # system av1 'libdav1d.so' 'libaom.so' # system harfbuzz 'libharfbuzz.so' # system icu 'libicuuc.so' 'libicui18n.so' # system vpx 'libvpx.so' # gtk 'libgtk-3.so' ) cd firefox-$pkgver [[ "$CARCH" == "i686" ]] && cp "$srcdir/kde.js" obj-i686-pc-linux-gnu/dist/bin/defaults/pref [[ "$CARCH" == "x86_64" ]] && cp "$srcdir/kde.js" obj-x86_64-pc-linux-gnu/dist/bin/defaults/pref DESTDIR="$pkgdir" ./mach install install -Dm644 "$srcdir/vendor.js" "$pkgdir/usr/lib/firefox/browser/defaults/preferences/vendor.js" install -Dm644 "$srcdir/kde.js" "$pkgdir/usr/lib/firefox/browser/defaults/preferences/kde.js" _distini="$pkgdir/usr/lib/firefox/distribution/distribution.ini" install -Dm644 /dev/stdin "$_distini" <