File LibreWolf.spec of Package LibreWolf
#
# spec file for package LibreWolf
#
# Copyright (c) 2022 SUSE LLC
# 2006-2022 Wolfgang Rosenauer <wr@rosenauer.org>
# 2021-2022 zzndb001 <zzndb001@gmail.com>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define _dwz_low_mem_die_limit 40000000
%define _dwz_max_die_limit 200000000
%define with_pipewire0_3 1
%define do_profiling 0
%define wayland_supported 1
%define use_ccache 0
# upstream default is clang (to use gcc for large parts set to 0)
%define clang_build 0
# use clang on aarch64 because of the out of memory issue
%ifarch %arm64 aarch64
%define clang_build 1
%endif
%define project librewolf-community
%define pkgname librewolf
%define major 111
%define mainver %{major}.0
# Firefox only supports i686
%ifarch %ix86
ExclusiveArch: i586 i686
BuildArch: i686
%{expand:%%global optflags %(echo "%optflags"|sed -e s/i586/i686/) -march=i686 -mtune=generic -msse2}
%endif
%{expand:%%global optflags %(echo "%optflags"|sed -e s/-Werror=return-type//) }
%{expand:%%global optflags %(echo "%optflags"|sed -e s/-flto=auto//) }
Name: LibreWolf
Version: %{mainver}
Release: 0
Summary: Community-maintained fork of Firefox, focused on privacy, security and freedom
License: MPL-2.0
URL: https://librewolf.net
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}/source/firefox-%{version}.source.tar.xz
Source1: source-master.tar.xz
Source2: settings-master.tar.xz
Source3: https://gitlab.com/%{project}/browser/arch/-/raw/master/%{pkgname}.desktop
Source4: https://gitlab.com/%{project}/browser/linux/-/raw/master/content/io.gitlab.%{project}.appdata.xml.in
# PATCH-FEATURE-UPSTREAM patches from upstream
Patch90: arm.patch
Patch92: context-menu.patch
Patch95: remove_addons.patch
Patch97: unity-menubar.patch
Patch98: urlbarprovider-interventions.patch
Patch99: allow-JXL-in-non-nightly-browser.patch
Patch101: mozilla_dirs.patch
Patch102: allow-ubo-private-mode.patch
# Patch103: mozilla-kde.patch
Patch104: dbus_name.patch
Patch105: custom-ubo-assets-bootstrap-location.patch
Patch106: librewolf-pref-pane.patch
Patch107: disable-data-reporting-at-compile-time.patch
Patch108: hide-passwordmgr.patch
Patch110: faster-package-multi-locale.patch
Patch112: firefox-view.patch
Patch113: librewolf-prefs.patch
# Patch114: firefox-kde.patch
Patch116: unified-extensions-dont-show-recommendations.patch
# PATCH-FEATURE-UPSTREAM sed patches from upstream
Patch190: allow-searchengines-non-esr.patch
Patch191: disable-pocket.patch
Patch193: stop-undesired-requests.patch
# PATCH-FEATURE-UPSTREAM ui patches from upstream
Patch257: pref-naming.patch
Patch258: remove-branding-urlbar.patch
Patch259: remove-cfrprefs.patch
Patch260: remove-organization-policy-banner.patch
Patch261: remove-snippets-from-home.patch
Patch263: privacy-preferences.patch
Patch265: hide-default-browser.patch
Patch266: handlers.patch
Patch267: lw-logo-devtools.patch
Patch268: website-appearance-ui-rfp.patch
# PATCH-FIX-OPENSUSE patches from mozilla/firefox${major}
# Gecko/Toolkit
Patch1: mozilla-nongnome-proxies.patch
Patch2: mozilla-kde.patch
Patch3: mozilla-ntlm-full-path.patch
Patch4: mozilla-aarch64-startup-crash.patch
Patch5: mozilla-fix-aarch64-libopus.patch
Patch6: mozilla-s390-context.patch
Patch7: mozilla-pgo.patch
Patch8: mozilla-reduce-rust-debuginfo.patch
Patch9: mozilla-bmo1005535.patch
Patch10: mozilla-bmo1568145.patch
Patch11: mozilla-bmo1504834-part1.patch
Patch13: mozilla-bmo1504834-part3.patch
Patch14: mozilla-bmo1512162.patch
Patch15: mozilla-fix-top-level-asm.patch
Patch17: mozilla-bmo849632.patch
Patch18: mozilla-bmo998749.patch
Patch20: mozilla-s390x-skia-gradient.patch
Patch21: mozilla-libavcodec58_91.patch
Patch22: mozilla-silence-no-return-type.patch
Patch23: mozilla-bmo531915.patch
Patch25: one_swizzle_to_rule_them_all.patch
Patch26: svg-rendering.patch
Patch27: mozilla-buildfixes.patch
# Firefox/browser
Patch64: firefox-kde.patch
# existing patches not update to repo
## 8 files changed, 99 insertions(+), 164 deletions(-)
## firefox/firefox-kde.patch | 16 ++++-----
## mozilla-bmo1568145.patch | 32 ++++++++---------
## mozilla-bmo531915.patch | 4 +--
## mozilla-buildfixes.patch | 48 ++------------------------
## mozilla-kde.patch | 58 +++++++++++++++----------------
## mozilla-pgo.patch | 30 ++++++++--------
## mozilla-s390-context.patch | 8 ++---
## mozilla-silence-no-return-type.patch | 67 +++++++++++++-----------------------
# PATCH-FIX-OPENSUSE additional (not pushed to repo) change from mozilla/firefox${major}
patch999: opensuse-upstram-changes-from-mozilla_firefox111.patch
# Patch-FIX-BUILD from AUR/firefox-appmenu
patch998: fix-wayland-build.patch
#
BuildRequires: autoconf213
%if 0%{?suse_version} < 1550 && 0%{?sle_version} < 150300
BuildRequires: cargo >= 1.65
BuildRequires: rust >= 1.65
%else
# Newer sle/leap/tw use parallel versioned rust releases which have
# a different method for provides that we can use to request a
# specific version
# minimal requirement:
BuildRequires: rust+cargo >= 1.65
# actually used upstream:
BuildRequires: cargo1.67
BuildRequires: rust1.67
%endif
%if 0%{?use_ccache}
BuildRequires: ccache
%endif
BuildRequires: clang-devel >= 5
%if 0%{?suse_version} < 1550 && 0%{?sle_version} <= 150500
BuildRequires: gcc11-c++
%else
BuildRequires: gcc-c++
%endif
BuildRequires: fdupes
BuildRequires: memory-constraints
BuildRequires: libXcomposite-devel
BuildRequires: libcurl-devel
BuildRequires: libproxy-devel
BuildRequires: llvm
BuildRequires: llvm-devel
BuildRequires: dejavu-fonts
BuildRequires: rust-cbindgen >= 0.24.3
BuildRequires: update-desktop-files
BuildRequires: libiw-devel
%if 0%{?do_profiling}
BuildRequires: xvfb-run
%endif
BuildRequires: nasm >= 2.14
BuildRequires: nodejs >= 10.22.1
BuildRequires: python3 >= 3.5
BuildRequires: python3-devel
BuildRequires: python3-curses
BuildRequires: unzip
BuildRequires: yasm
BuildRequires: zip
# BuildRequires: lld
BuildRequires: Mesa-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(nspr) >= 4.35
BuildRequires: pkgconfig(nss) >= 3.88.1
BuildRequires: pkgconfig(jack)
BuildRequires: pkgconfig(xt)
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(glib-2.0) >= 2.22
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(gtk+-3.0) >= 3.14.0
BuildRequires: pkgconfig(gtk+-unix-print-3.0)
BuildRequires: pkgconfig(libffi)
BuildRequires: pkgconfig(libpulse)
%if 0%{?with_pipewire0_3}
BuildRequires: pkgconfig(libpipewire-0.3)
%endif
# libavcodec is required for H.264 support but the
# openSUSE version is currently not able to play H.264
# therefore the Packman version is required
# minimum version of libavcodec is 53
Recommends: libavcodec-full >= 0.10.16
Recommends: libcanberra0
Recommends: libpulse0
Recommends: myspell-en
Requires(post): coreutils shared-mime-info desktop-file-utils
Requires(postun):shared-mime-info desktop-file-utils
%requires_ge mozilla-nspr
%requires_ge mozilla-nss
%requires_ge libfreetype6
Provides: %{pkgname}
Provides: appdata()
Provides: appdata(librewolf.appdata.xml)
%description
Community-maintained fork of Firefox, focused on privacy, security and freedom.
Some usefully links:
https://librewolf-community.gitlab.io/docs/
https://gitlab.com/librewolf-community/browser/linux/-/issues/147#note_483991577
%prep
%setup -q -n firefox-%{version} -b1 -b2
%define _default_patch_fuzz 2
pushd %{_sourcedir}
%patch999 -p1
popd
%patch998 -p1
# openSUSE
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch17 -p1
%patch18 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch64 -p1
#
# upstream
%ifarch aarch64 armv7l
# FIXME conflict with openSUSE patch
# %patch90 -p1
%endif
%patch92 -p1
%patch95 -p1
%patch98 -p1
%patch99 -p1
%patch101 -p1
# allow uBlockOrigin to run in private mode by default, without user intervention.
%patch102 -p1
# KDE menu and unity menubar
# patch -Np1 -i ${_patches_dir}/unity_kde/mozilla-kde.patch
# patch -Np1 -i ${_patches_dir}/unity_kde/firefox-kde.patch
# patch -Np1 -i ${_patches_dir}/unity_kde/unity-menubar.patch
# %patch103 -p1 # use patch from openSUSE firefox-maintenance with additional change from mozilla/firefox${major}
# %patch114 -p1
%patch116 -p1
%patch97 -p1
# somewhat experimental patch to fix bus/dbus/remoting names to io.gitlab.librewolf
# should not break things, buuuuuuuuuut we'll see.
%patch104 -p1
# add custom uBO assets (on first launch only)
%patch105 -p1
# pref pane
%patch106 -p1
# firefox view
%patch112 -p1
# new prefs (view, ubo)
%patch113 -p1
# fix telemetry removal, see https://gitlab.com/librewolf-community/browser/linux/-/merge_requests/17, for example
%patch107 -p1
# allows hiding the password manager (from the lw pref pane) / via a pref
%patch108 -p1
#
%patch110 -p1
# ui patches
# show a warning saying that changing language is not allowed through the UI,
# and that it requires to visit our FAQ, instead of telling the user to check his connection.
# %patch256 -p1
# remove references to firefox from the settings UI, change text in some of the links,
# explain that we force en-US and suggest enabling history near the session restore checkbox.
%patch257 -p1
# remove firefox references in the urlbar, when suggesting opened tabs.
%patch258 -p1
# remove cfr UI elements, as they are disabled and locked already.
%patch259 -p1
# do not display your browser is being managed by your organization in the settings.
%patch260 -p1
# hide "snippets" section from the home page settings, as it was already locked.
%patch261 -p1
# add patch to hide website appearance settings
%patch268 -p1
#
%patch266 -p1
#
%patch265 -p1
# Add LibreWolf logo to Debugging Page
%patch267 -p1
#
%patch263 -p1
# hack for arch desktop
sed -i 's#Exec=/usr/lib/librewolf#Exec=/usr/bin#g' %{S:3}
# Copying branding and source code changes to firefox source code
cp -r %{_sourcedir}/$(basename %{S:1} .tar.xz)/themes/browser .
# Dsiabling Pocket
%patch191 -p1
# allow SearchEngines option in non-ESR builds
%patch190 -p1
# remove search extensions (experimental)
cp -r %{_sourcedir}/$(basename %{S:1} .tar.xz)/assets/search-config.json services/settings/dumps/main/search-config.json
# stop some undesired requests (https://gitlab.com/librewolf-community/browser/common/-/issues/10)
%patch193 -p1
%build
%ifarch aarch64 %arm %ix86
# Limit RAM usage during link
export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
# A lie to prevent -Wl,--gc-sections being set which requires more memory than 32bit can offer
export GC_SECTIONS_BREAKS_DEBUG_RANGES=yes
%endif
export LDFLAGS="${LDFLAGS} -fPIC -Wl,-z,relro,-z,now"
%ifarch ppc64 ppc64le
%if 0%{?clang_build} == 0
export CFLAGS="$CFLAGS -mminimal-toc"
%endif
%endif
export CXXFLAGS="$CFLAGS"
export MOZ_NOSPAM=1
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
%ifarch aarch64 %arm ppc64 ppc64le riscv64
%limit_build -m 2500
%else
%limit_build -m 4000
%endif
export MOZCONFIG=%{_builddir}/firefox-%{version}/mozconfig
cat << END > $MOZCONFIG
export CFLAGS="%{optflags}"
%if 0%{?clang_build} == 0
export CC=gcc
export CXX=g++
%if 0%{?suse_version} < 1550 && 0%{?sle_version} <= 150500
export CC=gcc-11
export CXX=g++-11
%endif
%if 0%{?gcc_version:%{gcc_version}} >= 12
export CFLAGS="$CFLAGS -fimplicit-constexpr"
%endif
%else
export CC=clang
export CXX=clang++
%endif
ac_add_options --enable-application=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj
# This supposedly speeds up compilation (We test through dogfooding anyway)
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-bootstrap
ac_add_options --prefix=%{_prefix}
ac_add_options --libdir=%{_libdir}
ac_add_options --includedir=%{_includedir}
ac_add_options --enable-release
ac_add_options --enable-hardening
# ac_add_options --enable-rust-simd
# Branding
ac_add_options --enable-update-channel=release
ac_add_options --with-app-name=%{pkgname}
# ac_add_options --with-app-basename=%{name}
ac_add_options --with-branding=browser/branding/%{pkgname}
ac_add_options --with-distribution-id=io.gitlab.%{pkgname}-community
ac_add_options --with-unsigned-addon-scopes=app,system
ac_add_options --allow-addon-sideload
# at least temporary until the "wasi-sysroot" issue is solved
ac_add_options --without-wasm-sandboxed-libraries
%ifarch x86_64 aarch64
ac_add_options --enable-rust-simd
%endif
export MOZ_REQUIRE_SIGNING=
export MOZ_APP_REMOTINGNAME=%{name}
# System libraries
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-zlib
# Features
ac_add_options --enable-alsa
ac_add_options --enable-jack
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-tests
ac_add_options --disable-default-browser-agent
# Disables crash reporting, telemetry and other data gathering tools
# obsoleted?
# TODO: use source/assets/moczonfig in the future
# NOTE: let us use it for one last build, otherwise, there might be some conflicts
mk_add_options MOZ_CRASHREPORTER=0
mk_add_options MOZ_DATA_REPORTING=0
mk_add_options MOZ_SERVICES_HEALTHREPORT=0
mk_add_options MOZ_TELEMETRY_REPORTING=0
# options for ci / weaker build systems
# mk_add_options MOZ_MAKE_FLAGS="-j4"
# ac_add_options --enable-linker=gold
# experimental JXL support
ac_add_options --enable-jxl
ac_add_options --enable-optimize
# From mozilla/firefox${major}: LTO needs newer toolchain stack only (at least GCC 8.2.1 (r268506)
%ifarch x86_64
%if 0%{?suse_version} > 1500
ac_add_options --enable-lto
%if 0%{?do_profiling}
ac_add_options MOZ_PGO=1
%endif
%endif
%endif
%ifarch %arm %arm64 aarch64
ac_add_options --disable-lto
%endif
# ac_add_options --enable-linker=lld
# building with elf-hack started to fail everywhere with FF73
%ifarch %arm %ix86 x86_64
ac_add_options --disable-elf-hack
%endif
%if 0%{?wayland_supported}
ac_add_options --enable-default-toolkit=cairo-gtk3-wayland
%else
ac_add_options --enable-default-toolkit=cairo-gtk3
%endif
%if 0%{?use_ccache}
ac_add_options --with-ccache
%endif
%ifarch %arm
ac_add_options --with-fpu=vfpv3-d16
ac_add_options --with-float-abi=hard
%ifarch armv6l armv6hl
ac_add_options --with-arch=armv6
%else
ac_add_options --with-arch=armv7-a
%endif
%endif
END
%if 0%{?use_ccache}
ccache -s
%endif
%if 0%{?do_profiling}
xvfb-run --server-args="-screen 0 1920x1080x24" \
%endif
./mach build -v
%install
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
DESTDIR=%{buildroot} ./mach install
mkdir -p %{buildroot}/%{_libdir}/%{pkgname}
cp -r %{_sourcedir}/$(basename %{S:2} .tar.xz)/* %{buildroot}/%{_libdir}/%{pkgname}/
pushd %{buildroot}/%{_libdir}/%{pkgname} || exit
install -Dvm644 /dev/stdin defaults/pref/vendor.js <<END
// Use system-provided dictionaries
pref("spellchecker.dictionary_path", "/usr/share/myspell");
// Don't disable extensions in the application directory
// done in librewolf.cfg
// pref("extensions.autoDisableScopes", 11);
END
mkdir -p distribution
install -Dvm644 /dev/stdin "distribution/distribution.ini" <<END
[Global]
id=io.gitlab.%{pkgname}-community
version=1.0
about=LibreWolf - Build on openSUSE Build Service
[Preferences]
app.distributor="LibreWolf Community"
app.distributor.channel=%{pkgname}
app.partner.librewolf=%{pkgname}
END
popd || exit
# desktop
install -Dm 0644 -t %{buildroot}/%{_datadir}/applications/ %{S:3}
# icon
# install -Dm 0644 -T browser/branding/%{pkgname}/content/identity-icons-brand.svg %{buildroot}/%{_datadir}/icons/hicolor/symbolic/apps/%{pkgname}-symbolic.svg
pushd %{buildroot}/%{_libdir}/%{pkgname}/browser/chrome/icons/default || exit 1
for size in 16 32 48 64 128; do
install -Dm 0644 -T default${size}.png %{buildroot}/%{_datadir}/icons/hicolor/${size}x${size}/apps/%{pkgname}.png
done
popd || exit 1
# appdata
install -Dm 0644 -T %{S:4} %{buildroot}/%{_datadir}/metainfo/%{pkgname}.appdata.xml
# excludes
rm -f %{buildroot}/%{_libdir}/%{pkgname}/removed-files
%fdupes %{buildroot}/%{_libdir}/%{pkgname}
%fdupes %{buildroot}/%{_datadir}
# update mime and desktop database
%post
%mime_database_post
%desktop_database_post
%icon_theme_cache_post
exit 0
%postun
%desktop_database_postun
%mime_database_postun
%icon_theme_cache_postun
exit 0
%files
%{_bindir}/librewolf
%dir /usr/lib64/librewolf
%dir %{_libdir}/librewolf/docs
%license %{_libdir}/librewolf/LICENSE.txt
%doc %{_libdir}/librewolf/*.md
%doc %{_libdir}/librewolf/docs/*
%{_libdir}/librewolf/application.ini
%dir /usr/lib64/librewolf/browser
%dir /usr/lib64/librewolf/browser/chrome
%{_libdir}/librewolf/browser/chrome/icons/
%{_libdir}/librewolf/browser/features/
%{_libdir}/librewolf/browser/omni.ja
%{_libdir}/librewolf/defaults/
%{_libdir}/librewolf/dependentlibs.list
%dir /usr/lib64/librewolf/distribution
%{_libdir}/librewolf/distribution/
%{_libdir}/librewolf/fonts/
%{_libdir}/librewolf/gmp-clearkey/
%{_libdir}/librewolf/*.so
%{_libdir}/librewolf/librewolf
%{_libdir}/librewolf/librewolf-bin
%{_libdir}/librewolf/librewolf.cfg
%{_libdir}/librewolf/omni.ja
%{_libdir}/librewolf/pingsender
%{_libdir}/librewolf/platform.ini
%{_libdir}/librewolf/plugin-container
%{_datadir}/applications/%{pkgname}.desktop
%{_datadir}/icons/hicolor/
%{_datadir}/metainfo/
%changelog