2023-03-08 00:21:26 +08:00
# Produce a build suitable for release, i.e. use PGO/LTO. You can turn it off
# when building locally to reduce build time.
2020-08-21 17:30:26 +08:00
%global release_build 1
2023-03-08 00:21:26 +08:00
# Run Mozilla test suite as a part of compile rpm section. Turn off when
# building locally and don't want to spend 24 hours waiting for results.
%global run_firefox_tests 0
# Don't create debuginfo rpm packages. It reduces build time as
# exctracting debuginfo takes long time.
%global create_debuginfo 1
# Produce debug (non-optimized) package build. Suitable for debugging only
# as the build is *very* slow.
2020-08-21 17:30:26 +08:00
%global debug_build 0
2023-03-08 00:21:26 +08:00
%global system_nss 1
2020-08-21 17:30:26 +08:00
%global build_with_asan 0
2023-03-08 00:21:26 +08:00
%if %{run_firefox_tests}
%global test_on_wayland 1
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
%global llvm_version 7.0
%if "%{toolchain}" == "clang"
%global build_with_clang 1
%else
%global build_with_clang 0
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
%ifarch armv7hl
%global create_debuginfo 0
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
# Temporary disabled due to
%global enable_mozilla_crashreporter 0
2020-08-21 17:30:26 +08:00
%global system_ffi 1
%ifarch armv7hl
%global system_libvpx 1
%else
%global system_libvpx 0
%endif
%global hardened_build 1
%global system_jpeg 1
%global disable_elfhack 1
%global use_bundled_cbindgen 1
2023-03-08 00:21:26 +08:00
%if %{debug_build}
%global release_build 0
%endif
# Build PGO+LTO on x86_64 only due to build issues
# on other arches.
2020-08-21 17:30:26 +08:00
%global build_with_pgo 0
2023-03-08 00:21:26 +08:00
%ifarch x86_64
%if %{release_build}
2020-08-21 17:30:26 +08:00
%global build_with_pgo 0
%endif
%endif
2023-03-08 00:21:26 +08:00
%global dts_version 10
%global rust_version 1.62
2020-11-28 15:31:40 +08:00
%global wayland_backend_default 0
2020-08-21 17:30:26 +08:00
%if 0%{?flatpak}
2020-11-28 15:31:40 +08:00
%global wayland_backend_default 0
2020-08-21 17:30:26 +08:00
%global build_with_pgo 0
%endif
2023-03-08 00:21:26 +08:00
# Big endian platforms
2020-08-21 17:30:26 +08:00
%ifarch ppc64 s390x
%global big_endian 1
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if 0%{?build_with_pgo}
%global use_xvfb 1
%global build_tests 1
%endif
2023-03-08 00:21:26 +08:00
%if 0%{?run_firefox_tests}
2020-08-21 17:30:26 +08:00
%global use_xvfb 1
%global build_tests 1
%endif
2023-03-08 00:21:26 +08:00
%global launch_wayland_compositor 0
%if %{build_with_pgo} && 0%{?test_on_wayland}
%global launch_wayland_compositor 1
%endif
%if %{run_firefox_tests} && 0%{?test_on_wayland}
%global launch_wayland_compositor 1
%endif
# We need to use full path because of flatpak where datadir is /app/share
%global default_bookmarks_file /usr/share/bookmarks/default-bookmarks.html
2020-08-21 17:30:26 +08:00
%global firefox_app_id \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\}
2023-03-08 00:21:26 +08:00
# Minimal required versions
2020-08-21 17:30:26 +08:00
%global cairo_version 1.13.1
%global freetype_version 2.1.9
%global libnotify_version 0.7.0
%if %{?system_libvpx}
%global libvpx_version 1.8.2
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if %{?system_nss}
2023-03-08 00:21:26 +08:00
%global nspr_version 4.34
2020-08-21 17:30:26 +08:00
%global nspr_build_version %{nspr_version}
2023-03-08 00:21:26 +08:00
%global nss_version 3.79
2020-08-21 17:30:26 +08:00
%global nss_build_version %{nss_version}
%endif
2023-03-08 00:21:26 +08:00
%global mozappdir %{_libdir} /firefox
%global mozappdirdev %{_libdir} /firefox-devel-%{version}
%global langpackdir %{mozappdir} /browser/extensions
2020-08-21 17:30:26 +08:00
%global tarballdir firefox-%{version}
2023-03-08 00:21:26 +08:00
%define bundled_install_path %{mozappdir}/bundled
2020-08-21 17:30:26 +08:00
%global official_branding 1
2023-03-08 00:21:26 +08:00
# We could use %%include, but in %%files, %%post and other sections, but in these
# sections it could lead to syntax errors about unclosed %%if. Work around it by
# using the following macro
%define include_file() %{expand:%(cat '%1')}
2020-08-21 17:30:26 +08:00
%bcond_without langpacks
2023-03-08 00:21:26 +08:00
%global pre_version esr
2020-08-21 17:30:26 +08:00
%if !%{release_build}
%global pre_tag .npgo
%endif
%if %{build_with_clang}
%global pre_tag .clang
%endif
%if %{build_with_asan}
%global pre_tag .asan
%global build_with_pgo 0
%endif
%if !%{system_nss}
%global nss_tag .nss
%endif
2023-03-08 00:21:26 +08:00
%if %{debug_build}
%global pre_tag .debug
%endif
# Exclude private libraries from autogenerated provides and requires
%global __provides_exclude_from ^%{mozappdir}
%global __requires_exclude ^(%%(find %{buildroot} %{mozappdir} -name '*.so' | xargs -n1 basename | sort -u | paste -s -d '|' -))
Summary : Mozilla Firefox Web browser
Name : firefox
2023-09-20 16:10:30 +08:00
Version : 102.15.0
2023-03-08 00:21:26 +08:00
Release : 1
URL : https://www.mozilla.org/firefox/
License : MPLv1.1 or GPLv2+ or LGPLv2+
# We can't use the official tarball as it contains some test files that use
# licenses that are rejected.
# The official tarball has to be always processed by the process-official-tarball
# script
# Link to original tarball: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
2023-07-06 14:07:04 +08:00
Source0 : firefox-%{version} %{?pre_version} .processed-source.tar.xz
2020-08-21 17:30:26 +08:00
%if %{with langpacks}
2023-07-06 14:07:04 +08:00
# wget -r -np -nH -R index.html https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/linux-x86_64/xpi/
2023-09-20 16:10:30 +08:00
Source1 : firefox-langpacks-%{version} %{?pre_version} -20230824.tar.xz
2023-03-08 00:21:26 +08:00
%endif
Source2 : cbindgen-vendor.tar.xz
Source3 : process-official-tarball
Source10 : firefox-mozconfig
Source12 : firefox-openeuler-default-prefs.js
Source20 : firefox.desktop
Source21 : firefox.sh.in
Source23 : firefox.1
Source24 : mozilla-api-key
Source25 : firefox-symbolic.svg
Source26 : distribution.ini
Source27 : google-api-key
Source30 : firefox-x11.sh.in
Source31 : firefox-x11.desktop
Source32 : node-stdout-nonblocking-wrapper
Source33 : firefox.appdata.xml.in
Source34 : firefox-search-provider.ini
Source35 : google-loc-api-key
Source37 : mochitest-python.tar.gz
Source38 : print_results
Source39 : print-errors
Source40 : run-tests-x11
Source41 : run-tests-wayland
Source42 : psummary
Source43 : print_failures
Source44 : print-error-reftest
Source45 : run-wayland-compositor
# Build patches
Patch3 : mozilla-build-arm.patch
Patch25 : rhbz-1219542-s390-build.patch
# Fixing missing cacheFlush when JS_CODEGEN_NONE is used (s390x)
Patch40 : build-aarch64-skia.patch
Patch41 : build-disable-elfhack.patch
Patch44 : build-arm-libopus.patch
Patch49 : build-arm-libaom.patch
Patch53 : firefox-gcc-build.patch
Patch54 : mozilla-1669639.patch
Patch71 : 0001-GLIBCXX-fix-for-GCC-12.patch
Patch72 : build-remove-dav1d-from-wayland-dep.patch
Patch75 : build-big-endian-errors.patch
Patch76 : firefox-nss-version.patch
Patch77 : mozilla-1775202.patch
# Test patches
# Generate without context by
# GENDIFF_DIFF_ARGS=-U0 gendiff firefox-xxxx .firefox-tests-xpcshell
# GENDIFF_DIFF_ARGS=-U0 gendiff firefox-xxxx .firefox-tests-reftest
Patch102 : firefox-tests-xpcshell-freeze.patch
# Fedora specific patches
Patch215 : firefox-enable-addons.patch
Patch219 : rhbz-1173156.patch
Patch224 : mozilla-1170092.patch
#ARM run-time patch
Patch226 : rhbz-1354671.patch
Patch229 : firefox-nss-addon-hack.patch
Patch230 : D110204-fscreen.patch
Patch231 : webrtc-nss-fix.patch
# Backported WebRTC changes for PipeWire/Wayland screen sharing support
Patch232 : libwebrtc-screen-cast-sync.patch
# Upstream patches
Patch415 : mozilla-1670333.patch
Patch416 : mozilla-bmo1005535.patch
Patch417 : mozilla-bmo1504834-part1.patch
Patch418 : mozilla-bmo1504834-part3.patch
Patch419 : mozilla-bmo849632.patch
Patch420 : mozilla-bmo998749.patch
Patch421 : mozilla-s390x-skia-gradient.patch
Patch422 : one_swizzle_to_rule_them_all.patch
Patch423 : svg-rendering.patch
Patch424 : D158770.patch
Patch425 : disable-glean-sdk,psutil,zstandard.patch
2023-07-06 14:07:04 +08:00
Patch426 : mozilla-1833330.patch
2023-03-08 00:21:26 +08:00
# PGO/LTO patches
Patch600 : pgo.patch
Patch602 : mozilla-1516803.patch
2020-08-21 17:30:26 +08:00
%if %{?system_nss}
2023-03-08 00:21:26 +08:00
BuildRequires : pkgconfig(nspr) >= %{nspr_version}
BuildRequires : pkgconfig(nss) >= %{nss_version}
BuildRequires : nss-static >= %{nss_version}
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
BuildRequires : pkgconfig(libpng)
2020-08-21 17:30:26 +08:00
%if %{?system_jpeg}
2023-03-08 00:21:26 +08:00
BuildRequires : libjpeg-devel
%endif
BuildRequires : zip
BuildRequires : bzip2-devel
BuildRequires : pkgconfig(zlib)
BuildRequires : pkgconfig(gtk+-3.0)
BuildRequires : pkgconfig(gtk+-2.0)
BuildRequires : pkgconfig(krb5)
BuildRequires : pkgconfig(pango)
BuildRequires : pkgconfig(freetype2) >= %{freetype_version}
BuildRequires : pkgconfig(xt)
BuildRequires : pkgconfig(xtst)
BuildRequires : pkgconfig(xrender)
BuildRequires : pkgconfig(libstartup-notification-1.0)
BuildRequires : pkgconfig(libnotify) >= %{libnotify_version}
BuildRequires : pkgconfig(dri)
BuildRequires : pkgconfig(libcurl)
BuildRequires : pkgconfig(alsa)
BuildRequires : libstdc++-devel
BuildRequires : libstdc++-static
BuildRequires : dbus-glib-devel
2020-08-21 17:30:26 +08:00
%if %{?system_libvpx}
2023-03-08 00:21:26 +08:00
BuildRequires : libvpx-devel >= %{libvpx_version}
%endif
BuildRequires : m4
BuildRequires : pkgconfig(libpulse)
BuildRequires : gcc
BuildRequires : gcc-c++
BuildRequires : nodejs >= 10.21
BuildRequires : cargo
BuildRequires : rust >= %{rust_version}
BuildRequires : llvm >= %{llvm_version}
BuildRequires : llvm-devel >= %{llvm_version}
BuildRequires : clang >= %{llvm_version}
BuildRequires : clang-devel >= %{llvm_version}
BuildRequires : rustfmt >= %{rust_version}
BuildRequires : pipewire-devel
2020-08-21 17:30:26 +08:00
%if !0%{?use_bundled_cbindgen}
2023-03-08 00:21:26 +08:00
BuildRequires : cbindgen
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
BuildRequires : nasm >= 1.13
BuildRequires : libappstream-glib
2020-08-21 17:30:26 +08:00
%if 0%{?big_endian}
2023-03-08 00:21:26 +08:00
BuildRequires : icu
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
Requires : mozilla-filesystem
#Recommends: mozilla-openh264 >= 2.1.1
#Recommends: libva
Requires : p11-kit-trust
Requires : pciutils-libs
2020-08-21 17:30:26 +08:00
%if %{?system_nss}
2023-03-08 00:21:26 +08:00
Requires : nspr >= %{nspr_build_version}
Requires : nss >= %{nss_build_version}
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
BuildRequires : python3-devel
BuildRequires : python3-setuptools
BuildRequires : desktop-file-utils
#%if !0%{?flatpak}
#TODO
#BuildRequires: system-bookmarks
#%endif
2020-08-21 17:30:26 +08:00
%if %{?system_ffi}
2023-03-08 00:21:26 +08:00
BuildRequires : pkgconfig(libffi)
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if 0%{?use_xvfb}
2023-03-08 00:21:26 +08:00
BuildRequires : xorg-x11-server-Xvfb
2020-08-21 17:30:26 +08:00
%endif
%if %{build_with_asan}
2023-03-08 00:21:26 +08:00
BuildRequires : libasan
BuildRequires : libasan-static
%endif
BuildRequires : perl-interpreter
#BuildRequires: fdk-aac-free-devel not on openEuler
%if 0%{?test_on_wayland}
BuildRequires : mutter
BuildRequires : gsettings-desktop-schemas
BuildRequires : gnome-settings-daemon
BuildRequires : mesa-dri-drivers
BuildRequires : xorg-x11-server-Xwayland
BuildRequires : dbus-x11
BuildRequires : gnome-keyring
%endif
%if 0%{?run_firefox_tests}
BuildRequires : procps-ng
BuildRequires : nss-tools
BuildRequires : dejavu-sans-mono-fonts
BuildRequires : dejavu-sans-fonts
BuildRequires : dejavu-serif-fonts
BuildRequires : dbus-x11
BuildRequires : gnome-keyring
BuildRequires : mesa-dri-drivers
# ----------------------------------------
BuildRequires : liberation-fonts-common
BuildRequires : liberation-mono-fonts
BuildRequires : liberation-sans-fonts
BuildRequires : liberation-serif-fonts
# ----------------------------------
BuildRequires : google-crosextra-carlito-fonts
BuildRequires : google-droid-sans-fonts
BuildRequires : google-noto-fonts-common
BuildRequires : google-noto-cjk-fonts-common
BuildRequires : google-noto-sans-cjk-ttc-fonts
BuildRequires : google-noto-sans-gurmukhi-fonts
BuildRequires : google-noto-sans-fonts
BuildRequires : google-noto-emoji-color-fonts
BuildRequires : google-noto-sans-sinhala-vf-fonts
# -----------------------------------
BuildRequires : thai-scalable-fonts-common
BuildRequires : thai-scalable-waree-fonts
BuildRequires : khmeros-base-fonts
BuildRequires : jomolhari-fonts
# ----------------------------------
BuildRequires : lohit-tamil-fonts
BuildRequires : lohit-telugu-fonts
# ----------------------------------
BuildRequires : paktype-naskh-basic-fonts
BuildRequires : paratype-pt-sans-fonts
BuildRequires : smc-meera-fonts
BuildRequires : stix-fonts
BuildRequires : abattis-cantarell-fonts
BuildRequires : xorg-x11-fonts-ISO8859-1-100dpi
BuildRequires : xorg-x11-fonts-misc
%endif
BuildRequires : make
BuildRequires : pciutils-libs
Obsoletes : mozilla <= 37:1.7.13
Provides : webclient
# Bundled libraries
Provides : bundled(angle)
Provides : bundled(audioipc-2)
Provides : bundled(brotli)
Provides : bundled(cairo)
Provides : bundled(cfworker)
Provides : bundled(d3.js)
Provides : bundled(double-conversion)
Provides : bundled(expat)
Provides : bundled(fdlibm)
Provides : bundled(ffvpx)
Provides : bundled(freetype2)
Provides : bundled(graphite2)
Provides : bundled(harfbuzz)
Provides : bundled(highway)
Provides : bundled(intgemm)
Provides : bundled(kissfft)
Provides : bundled(libaom)
Provides : bundled(libcubeb)
Provides : bundled(libdav1d)
Provides : bundled(libjpeg)
Provides : bundled(libjxl)
Provides : bundled(libjxl)
Provides : bundled(libmar)
Provides : bundled(libmkv)
Provides : bundled(libnestegg)
Provides : bundled(libogg)
Provides : bundled(libopus)
Provides : bundled(libpng)
Provides : bundled(libprio)
Provides : bundled(libsoundtouch)
Provides : bundled(libspeex_resampler)
Provides : bundled(libsrtp)
Provides : bundled(libtheora)
Provides : bundled(libtremor)
Provides : bundled(libvorbis)
Provides : bundled(libvpx)
Provides : bundled(libwebp)
Provides : bundled(libwebrtc)
Provides : bundled(libyuv)
Provides : bundled(mp4parse-rust)
Provides : bundled(mp4parse-rust)
Provides : bundled(msgpack-c)
Provides : bundled(msgpack-c)
Provides : bundled(mtransport)
Provides : bundled(openmax_dl)
Provides : bundled(openmax_il)
Provides : bundled(openmax_il)
Provides : bundled(ots)
Provides : bundled(qcms)
Provides : bundled(rlbox_sandboxing_api)
Provides : bundled(sfntly)
Provides : bundled(sipcc)
Provides : bundled(skia)
Provides : bundled(sqlite3)
Provides : bundled(thebes)
Provides : bundled(wasm2c)
Provides : bundled(WebRender)
Provides : bundled(woff2)
Provides : bundled(xz-embedded)
Provides : bundled(ycbcr)
Provides : bundled(zlib)
2020-02-27 03:49:17 -05:00
%description
Mozilla Firefox is an open-source web browser, designed for standards
compliance, performance and portability.
2023-03-08 00:21:26 +08:00
%if 0%{?run_firefox_tests}
%global testsuite_pkg_name %{name} -testresults
%package -n %{testsuite_pkg_name}
Summary : Results of testsuite
%description -n %{testsuite_pkg_name}
This package contains results of tests executed during build.
%files -n %{testsuite_pkg_name}
/%{version} -%{release} /test_results
/%{version} -%{release} /test_summary.txt
/%{version} -%{release} /failures-*
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
%if 0%{?wayland_backend_default}
2020-08-21 17:30:26 +08:00
%package x11
2023-03-08 00:21:26 +08:00
Summary : Firefox X11 launcher.
Requires : %{name}
2020-08-21 17:30:26 +08:00
%description x11
The firefox-x11 package contains launcher and desktop file
to run Firefox explicitly on X11.
%files x11
%{_bindir} /firefox-x11
%{_datadir} /applications/firefox-x11.desktop
%endif
2020-02-27 03:49:17 -05:00
2023-03-08 00:21:26 +08:00
#---------------------------------------------------------------------
2020-02-27 03:49:17 -05:00
2020-08-21 17:30:26 +08:00
%prep
%setup -q -n %{tarballdir}
2023-03-08 00:21:26 +08:00
# Build patches, can't change backup suffix from default because during build
# there is a compare of config and js/config directories and .orig suffix is
# ignored during this compare.
2020-08-21 17:30:26 +08:00
%ifarch s390
%patch25 -p1 -b .rhbz-1219542-s390
%endif
%patch40 -p1 -b .aarch64-skia
%if 0%{?disable_elfhack}
%patch41 -p1 -b .disable-elfhack
%endif
%patch3 -p1 -b .arm
%patch44 -p1 -b .build-arm-libopus
%patch49 -p1 -b .build-arm-libaom
2023-03-08 00:21:26 +08:00
%patch53 -p1 -b .firefox-gcc-build
%patch54 -p1 -b .1669639
%patch71 -p1 -b .0001-GLIBCXX-fix-for-GCC-12
%patch72 -p1 -b .build-remove-dav1d-from-wayland-dep
%patch75 -p1 -b .build-big-endian-errors
%patch76 -p1 -b .firefox-nss-version
#ppc64le build failure because of webrtc
%patch77 -p1 -b .mozilla-1775202
# Test patches
%patch102 -p1 -b .firefox-tests-xpcshell-freeze
# Fedora patches
2020-08-21 17:30:26 +08:00
%patch215 -p1 -b .addons
%patch219 -p1 -b .rhbz-1173156
%patch224 -p1 -b .1170092
2023-03-08 00:21:26 +08:00
#ARM run-time patch
2020-08-21 17:30:26 +08:00
%ifarch aarch64
%patch226 -p1 -b .1354671
%endif
2023-03-08 00:21:26 +08:00
%patch229 -p1 -b .firefox-nss-addon-hack
%patch230 -p1 -b .D110204-fscreen.diff
%patch231 -p1 -b .webrtc-nss-fix
%patch232 -p1 -b .libwebrtc-screen-cast-sync
%patch415 -p1 -b .1670333
%patch416 -p1 -b .mozilla-bmo1005535
%patch417 -p1 -b .mozilla-bmo1504834-part1
%patch418 -p1 -b .mozilla-bmo1504834-part3
%patch419 -p1 -b .mozilla-bmo849632
%patch420 -p1 -b .mozilla-bmo998749
%patch421 -p1 -b .mozilla-s390x-skia-gradient
%patch422 -p1 -b .one_swizzle_to_rule_them_all
%patch423 -p1 -b .svg-rendering
%patch424 -p1 -b .D158770.diff
%patch425 -p1
2023-07-06 14:07:04 +08:00
%patch426 -p1 -b .mozilla-1833330
2023-03-08 00:21:26 +08:00
# PGO patches
%if %{build_with_pgo}
%if !%{build_with_clang}
2020-08-21 17:30:26 +08:00
%patch600 -p1 -b .pgo
%patch602 -p1 -b .1516803
2023-03-08 00:21:26 +08:00
%endif
%endif
2021-08-12 09:00:08 +08:00
2020-08-21 17:30:26 +08:00
%{__rm} -f .mozconfig
%{__cp} %{SOURCE10} .mozconfig
2020-02-27 03:49:17 -05:00
echo " a c _ a d d _ o p t i o n s - - e n a b l e - d e f a u l t - t o o l k i t = c a i r o - g t k 3 - w a y l a n d " >> .mozconfig
2020-08-21 17:30:26 +08:00
%if %{official_branding}
echo " a c _ a d d _ o p t i o n s - - e n a b l e - o f f i c i a l - b r a n d i n g " >> .mozconfig
%endif
%{__cp} %{SOURCE24} mozilla-api-key
%{__cp} %{SOURCE27} google-api-key
2023-03-08 00:21:26 +08:00
%{__cp} %{SOURCE35} google-loc-api-key
2020-08-21 17:30:26 +08:00
echo " a c _ a d d _ o p t i o n s - - p r e f i x = \" %{_prefix} \" " >> .mozconfig
echo " a c _ a d d _ o p t i o n s - - l i b d i r = \" %{_libdir} \" " >> .mozconfig
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if %{?system_nss}
echo " a c _ a d d _ o p t i o n s - - w i t h - s y s t e m - n s p r " >> .mozconfig
echo " a c _ a d d _ o p t i o n s - - w i t h - s y s t e m - n s s " >> .mozconfig
%else
echo " a c _ a d d _ o p t i o n s - - w i t h o u t - s y s t e m - n s p r " >> .mozconfig
echo " a c _ a d d _ o p t i o n s - - w i t h o u t - s y s t e m - n s s " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if %{?system_ffi}
echo " a c _ a d d _ o p t i o n s - - e n a b l e - s y s t e m - f f i " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%ifarch %{arm}
echo " a c _ a d d _ o p t i o n s - - d i s a b l e - e l f - h a c k " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if %{?debug_build}
echo " a c _ a d d _ o p t i o n s - - e n a b l e - d e b u g " >> .mozconfig
echo " a c _ a d d _ o p t i o n s - - d i s a b l e - o p t i m i z e " >> .mozconfig
%else
%global optimize_flags " n o n e "
2023-03-08 00:21:26 +08:00
%ifarch s390x
%global optimize_flags " - g - O 1 "
%endif
2020-08-21 17:30:26 +08:00
%ifarch ppc64le aarch64
%global optimize_flags " - g - O 2 "
%endif
%if %{optimize_flags} != "none"
echo 'ac_add_options --enable-optimize=%{?optimize_flags}' >> .mozconfig
%else
echo 'ac_add_options --enable-optimize' >> .mozconfig
%endif
echo " a c _ a d d _ o p t i o n s - - d i s a b l e - d e b u g " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
# Second arches fail to start with jemalloc enabled
2020-08-21 17:30:26 +08:00
%ifnarch %{ix86} x86_64
echo " a c _ a d d _ o p t i o n s - - d i s a b l e - j e m a l l o c " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if 0%{?build_tests}
echo " a c _ a d d _ o p t i o n s - - e n a b l e - t e s t s " >> .mozconfig
%else
echo " a c _ a d d _ o p t i o n s - - d i s a b l e - t e s t s " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if !%{?system_jpeg}
echo " a c _ a d d _ o p t i o n s - - w i t h o u t - s y s t e m - j p e g " >> .mozconfig
%else
echo " a c _ a d d _ o p t i o n s - - w i t h - s y s t e m - j p e g " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if %{?system_libvpx}
echo " a c _ a d d _ o p t i o n s - - w i t h - s y s t e m - l i b v p x " >> .mozconfig
%else
echo " a c _ a d d _ o p t i o n s - - w i t h o u t - s y s t e m - l i b v p x " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%ifarch s390 s390x
2023-03-08 00:21:26 +08:00
echo " a c _ a d d _ o p t i o n s - - d i s a b l e - j i t " >> .mozconfig
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if %{build_with_asan}
echo " a c _ a d d _ o p t i o n s - - e n a b l e - a d d r e s s - s a n i t i z e r " >> .mozconfig
echo " a c _ a d d _ o p t i o n s - - d i s a b l e - j e m a l l o c " >> .mozconfig
%endif
2023-03-08 00:21:26 +08:00
%if !%{enable_mozilla_crashreporter}
echo " a c _ a d d _ o p t i o n s - - d i s a b l e - c r a s h r e p o r t e r " >> .mozconfig
%endif
# api keys full path
2020-08-21 17:30:26 +08:00
echo " a c _ a d d _ o p t i o n s - - w i t h - m o z i l l a - a p i - k e y f i l e = ` p w d ` / m o z i l l a - a p i - k e y " >> .mozconfig
2023-03-08 00:21:26 +08:00
# It seems that the api key we have is for the safe browsing only
echo " a c _ a d d _ o p t i o n s - - w i t h - g o o g l e - l o c a t i o n - s e r v i c e - a p i - k e y f i l e = ` p w d ` / g o o g l e - l o c - a p i - k e y " >> .mozconfig
2020-08-21 17:30:26 +08:00
echo " a c _ a d d _ o p t i o n s - - w i t h - g o o g l e - s a f e b r o w s i n g - a p i - k e y f i l e = ` p w d ` / g o o g l e - a p i - k e y " >> .mozconfig
2023-03-08 00:21:26 +08:00
#echo 'export NODEJS="%{_buildrootdir}/bin/node-stdout-nonblocking-wrapper"' >> .mozconfig
# Remove executable bit to make brp-mangle-shebangs happy.
2020-02-27 03:49:17 -05:00
chmod -x third_party/rust/itertools/src/lib.rs
2020-08-21 17:30:26 +08:00
chmod a-x third_party/rust/ash/src/extensions/ext/*.rs
chmod a-x third_party/rust/ash/src/extensions/khr/*.rs
2023-03-08 00:21:26 +08:00
chmod a-x third_party/rust/ash/src/extensions/nv/*.rs
#---------------------------------------------------------------------
2020-02-27 03:49:17 -05:00
%build
2023-03-08 00:21:26 +08:00
# Disable LTO to work around rhbz#1883904
%define _lto_cflags %{nil}
export PATH=" %{_buildrootdir} / b i n : $ P A T H "
# Cleanup buildroot for existing rpms from bundled nss/nspr and other packages
rm -rf %{_buildrootdir} /*
function install_rpms_to_current_dir() {
PACKAGE_RPM=$(eval echo $1)
PACKAGE_DIR=%{_rpmdir}
if [ ! -f $PACKAGE_DIR/$PACKAGE_RPM ]; then
# Hack for tps tests
ARCH_STR=%{_arch}
%ifarch %{ix86}
ARCH_STR=" i ? 8 6 "
%endif
PACKAGE_DIR=" $ P A C K A G E _ D I R / $ A R C H _ S T R "
fi
for package in $(ls $PACKAGE_DIR/$PACKAGE_RPM)
do
echo " $ p a c k a g e "
rpm2cpio " $ p a c k a g e " | cpio -idu
done
}
env
which gcc
which c++
which g++
which ld
which nasm
which node
2020-08-21 17:30:26 +08:00
%if 0%{?use_bundled_cbindgen}
mkdir -p my_rust_vendor
cd my_rust_vendor
%{__tar} xf %{SOURCE2}
mkdir -p .cargo
cat > .cargo/config <<EOL
[source.crates-io]
replace-with = " v e n d o r e d - s o u r c e s "
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
[source.vendored-sources]
directory = " ` p w d ` "
EOL
2023-03-08 00:21:26 +08:00
%ifarch aarch64
#export RUSTFLAGS="-Cdebuginfo=0 -Clinker=/opt/rh/gcc-toolset-12/root/usr/bin/gcc"
%endif
2020-08-21 17:30:26 +08:00
env CARGO_HOME=.cargo cargo install cbindgen
export PATH=`pwd`/.cargo/bin:$PATH
cd -
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
mkdir %{_buildrootdir} /bin || :
cp %{SOURCE32} %{_buildrootdir} /bin || :
2023-03-08 00:21:26 +08:00
ls -l %{_buildrootdir} /bin
ls -l %{_buildrootdir}
chmod a+x %{_buildrootdir} /bin
# Update the various config.guess to upstream release for aarch64 support
# Do not update config.guess in the ./third_party/rust because that would break checksums
2020-08-21 17:30:26 +08:00
find ./ -path ./third_party/rust -prune -o -name config.guess -exec cp /usr/lib/rpm/config.guess {} ';'
2023-03-08 00:21:26 +08:00
2020-02-27 03:49:17 -05:00
MOZ_OPT_FLAGS=$(echo " %{optflags} " | %{__sed} -e 's/-Wall//' )
2020-08-21 17:30:26 +08:00
MOZ_OPT_FLAGS=$(echo " $ M O Z _ O P T _ F L A G S " | %{__sed} -e 's/-Werror=format-security//' )
MOZ_OPT_FLAGS=" $ M O Z _ O P T _ F L A G S - f p e r m i s s i v e "
%if %{?hardened_build}
2020-02-27 03:49:17 -05:00
MOZ_OPT_FLAGS=" $ M O Z _ O P T _ F L A G S - f P I C - W l , - z , r e l r o - W l , - z , n o w "
2020-08-21 17:30:26 +08:00
%endif
%if %{?debug_build}
MOZ_OPT_FLAGS=$(echo " $ M O Z _ O P T _ F L A G S " | %{__sed} -e 's/-O2//' )
%endif
%ifarch s390
MOZ_OPT_FLAGS=$(echo " $ M O Z _ O P T _ F L A G S " | %{__sed} -e 's/-g/-g1/' )
2023-03-08 00:21:26 +08:00
# If MOZ_DEBUG_FLAGS is empty, firefox's build will default it to "-g" which
# overrides the -g1 from line above and breaks building on s390/arm
# (OOM when linking, rhbz#1238225)
2020-08-21 17:30:26 +08:00
export MOZ_DEBUG_FLAGS=" "
%endif
%ifarch %{arm} %{ix86}
MOZ_OPT_FLAGS=$(echo " $ M O Z _ O P T _ F L A G S " | %{__sed} -e 's/-g/-g0/' )
export MOZ_DEBUG_FLAGS=" "
%endif
2023-03-08 00:21:26 +08:00
%if !%{build_with_clang}
%ifarch s390x ppc aarch64 %{ix86}
2020-02-27 03:49:17 -05:00
MOZ_LINK_FLAGS=" - W l , - - n o - k e e p - m e m o r y - W l , - - r e d u c e - m e m o r y - o v e r h e a d s "
2020-08-21 17:30:26 +08:00
%endif
%ifarch %{arm}
MOZ_LINK_FLAGS=" - W l , - - n o - k e e p - m e m o r y - W l , - - s t r i p - d e b u g "
echo " a c _ a d d _ o p t i o n s - - e n a b l e - l i n k e r = g o l d " >> .mozconfig
%endif
%endif
%if 0%{?flatpak}
2023-03-08 00:21:26 +08:00
# Make sure the linker can find libraries in /app/lib64 as we don't use
# __global_ldflags that normally sets this.
2020-08-21 17:30:26 +08:00
MOZ_LINK_FLAGS=" $ M O Z _ L I N K _ F L A G S - L %{_libdir} "
%endif
2023-03-08 00:21:26 +08:00
%ifarch %{arm} %{ix86} %{s390x}
export RUSTFLAGS=" - C d e b u g i n f o = 0 "
echo 'export RUSTFLAGS="-Cdebuginfo=0"' >> .mozconfig
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
#%ifarch aarch64
#export RUSTFLAGS="-Cdebuginfo=0 -Clinker=/opt/rh/gcc-toolset-12/root/usr/bin/gcc"
#echo 'export RUSTFLAGS="-Cdebuginfo=0 -Clinker=/opt/rh/gcc-toolset-12/root/usr/bin/gcc"' >> .mozconfig
#%endif
2020-08-21 17:30:26 +08:00
%if %{build_with_asan}
MOZ_OPT_FLAGS=" $ M O Z _ O P T _ F L A G S - f s a n i t i z e = a d d r e s s - D x m a l l o c = m y x m a l l o c "
MOZ_LINK_FLAGS=" $ M O Z _ L I N K _ F L A G S - f s a n i t i z e = a d d r e s s - l d l "
%endif
2023-03-08 00:21:26 +08:00
# We don't wantfirefox to use CK_GCM_PARAMS_V3 in nss
2020-08-21 17:30:26 +08:00
MOZ_OPT_FLAGS=" $ M O Z _ O P T _ F L A G S - D N S S _ P K C S 1 1 _ 3 _ 0 _ S T R I C T "
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
echo " e x p o r t C F L A G S = \" $ M O Z _ O P T _ F L A G S \" " >> .mozconfig
echo " e x p o r t C X X F L A G S = \" $ M O Z _ O P T _ F L A G S \" " >> .mozconfig
echo " e x p o r t L D F L A G S = \" $ M O Z _ L I N K _ F L A G S \" " >> .mozconfig
2023-03-08 00:21:26 +08:00
%if %{build_with_clang}
2020-08-21 17:30:26 +08:00
echo " e x p o r t L L V M _ P R O F D A T A = \" l l v m - p r o f d a t a \" " >> .mozconfig
echo " e x p o r t A R = \" l l v m - a r \" " >> .mozconfig
echo " e x p o r t N M = \" l l v m - n m \" " >> .mozconfig
echo " e x p o r t R A N L I B = \" l l v m - r a n l i b \" " >> .mozconfig
echo " a c _ a d d _ o p t i o n s - - e n a b l e - l i n k e r = l l d " >> .mozconfig
%else
echo " e x p o r t C C = g c c " >> .mozconfig
echo " e x p o r t C X X = g + + " >> .mozconfig
echo " e x p o r t A R = \" g c c - a r \" " >> .mozconfig
echo " e x p o r t N M = \" g c c - n m \" " >> .mozconfig
echo " e x p o r t R A N L I B = \" g c c - r a n l i b \" " >> .mozconfig
%endif
%if 0%{?build_with_pgo}
echo " a c _ a d d _ o p t i o n s M O Z _ P G O = 1 " >> .mozconfig
2023-03-08 00:21:26 +08:00
# PGO build doesn't work with ccache
export CCACHE_DISABLE=1
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
2020-02-27 03:49:17 -05:00
MOZ_SMP_FLAGS=-j1
2023-03-08 00:21:26 +08:00
# On x86_64 architectures, Mozilla can build up to 4 jobs at once in parallel,
# however builds tend to fail on other arches when building in parallel.
#%ifarch %{ix86} s390x %{arm} aarch64 ppc64le
#[ -z "$RPM_BUILD_NCPUS" ] && \
# RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"
#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2
#%endif
#%ifarch x86_64 ppc ppc64 ppc64le
2020-08-21 17:30:26 +08:00
[ -z " $RPM_BUILD_NCPUS " ] && \
2023-03-08 00:21:26 +08:00
RPM_BUILD_NCPUS=" ` / u s r / b i n / g e t c o n f _ N P R O C E S S O R S _ O N L N ` "
2020-02-27 03:49:17 -05:00
[ " $RPM_BUILD_NCPUS " -ge 2 ] && MOZ_SMP_FLAGS=-j2
[ " $RPM_BUILD_NCPUS " -ge 4 ] && MOZ_SMP_FLAGS=-j4
[ " $RPM_BUILD_NCPUS " -ge 8 ] && MOZ_SMP_FLAGS=-j8
2023-03-08 00:21:26 +08:00
[ " $RPM_BUILD_NCPUS " -ge 16 ] && MOZ_SMP_FLAGS=-j16
#%endif
echo " m k _ a d d _ o p t i o n s M O Z _ M A K E _ F L A G S = \" $ M O Z _ S M P _ F L A G S \" " >> .mozconfig
echo " m k _ a d d _ o p t i o n s M O Z _ S E R V I C E S _ S Y N C = 1 " >> .mozconfig
2020-08-21 17:30:26 +08:00
echo " e x p o r t S T R I P = / b i n / t r u e " >> .mozconfig
2023-03-08 00:21:26 +08:00
#export MACH_USE_SYSTEM_PYTHON=1
%if %{launch_wayland_compositor}
cp %{SOURCE45} .
. ./run-wayland-compositor
%endif
%if %{build_with_pgo}
%if 0%{?test_on_wayland}
env | grep " W A Y L A N D "
MOZ_ENABLE_WAYLAND=1 ./mach build -v 2>&1 || exit 1
2020-08-21 17:30:26 +08:00
%else
2023-03-08 00:21:26 +08:00
xvfb-run ./mach build -v 2>&1 || exit 1
2020-08-21 17:30:26 +08:00
%endif
%else
2023-03-08 00:21:26 +08:00
./mach build -v 2>&1 || exit 1
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
#---------------------------------------------------------------------
%install
export MACH_USE_SYSTEM_PYTHON=1
function install_rpms_to_current_dir() {
PACKAGE_RPM=$(eval echo $1)
PACKAGE_DIR=%{_rpmdir}
if [ ! -f $PACKAGE_DIR/$PACKAGE_RPM ]; then
# Hack for tps tests
ARCH_STR=%{_arch}
%ifarch %{ix86}
ARCH_STR=" i ? 8 6 "
%endif
PACKAGE_DIR=" $ P A C K A G E _ D I R / $ A R C H _ S T R "
fi
for package in $(ls $PACKAGE_DIR/$PACKAGE_RPM)
do
echo " $ p a c k a g e "
rpm2cpio " $ p a c k a g e " | cpio -idu
done
}
%if %{launch_wayland_compositor}
cp %{SOURCE45} .
. ./run-wayland-compositor
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
%if 0%{?run_firefox_tests}
mkdir -p objdir/_virtualenvs/init_py3
%{__cat} > objdir/_virtualenvs/init_py3/pip.conf << EOF
[global]
find-links=`pwd`/mochitest-python
no-index=true
EOF
tar xf %{SOURCE37}
cp %{SOURCE40} %{SOURCE41} %{SOURCE42} %{SOURCE38} %{SOURCE39} %{SOURCE43} %{SOURCE44} .
mkdir -p test_results
%if %{?test_on_wayland}
./run-tests-wayland || true
%else
./run-tests-x11 || true
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
./print_results > test_summary.txt 2>&1 || true
./print_failures || true
2020-08-21 17:30:26 +08:00
%endif
2020-02-27 03:49:17 -05:00
2023-03-08 00:21:26 +08:00
# set up our default bookmarks
#%if !0%{?flatpak}
#%{__cp} -p %{default_bookmarks_file} objdir/dist/bin/browser/chrome/browser/content/browser/default-bookmarks.html
#%endif
# Make sure locale works for langpacks
2020-08-21 17:30:26 +08:00
%{__cat} > objdir/dist/bin/browser/defaults/preferences/firefox-l10n.js << EOF
2020-02-27 03:49:17 -05:00
pref(" g e n e r a l . u s e r a g e n t . l o c a l e " , " c h r o m e : / / g l o b a l / l o c a l e / i n t l . p r o p e r t i e s " );
EOF
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
DESTDIR=%{buildroot} make -C objdir install
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%{__mkdir_p} %{buildroot} {%{_libdir} ,%{_bindir} ,%{_datadir} /applications}
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
desktop-file-install --dir %{buildroot} %{_datadir} /applications %{SOURCE20}
%if 0%{?wayland_backend_default}
desktop-file-install --dir %{buildroot} %{_datadir} /applications %{SOURCE31}
%endif
2023-03-08 00:21:26 +08:00
# set up the firefox start script
2020-08-21 17:30:26 +08:00
%{__rm} -rf %{buildroot} %{_bindir} /firefox
2023-03-08 00:21:26 +08:00
%{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE21} > %{buildroot} %{_bindir} /firefox
2020-08-21 17:30:26 +08:00
%{__chmod} 755 %{buildroot} %{_bindir} /firefox
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%if 0%{?flatpak}
sed -i -e 's|%FLATPAK_ENV_VARS%|export TMPDIR="$XDG_CACHE_HOME/tmp"|' %{buildroot} %{_bindir} /firefox
%else
sed -i -e 's|%FLATPAK_ENV_VARS%||' %{buildroot} %{_bindir} /firefox
%endif
2023-03-08 00:21:26 +08:00
# Run firefox under wayland only on RHEL9 and newer
%if !0%{?wayland_backend_default}
sed -i -e 's|%DISABLE_WAYLAND_PLACEHOLDER%|export MOZ_DISABLE_WAYLAND=1|' %{buildroot} %{_bindir} /firefox
%else
sed -i -e 's|%DISABLE_WAYLAND_PLACEHOLDER%||' %{buildroot} %{_bindir} /firefox
# firefox-x11 launch script for RHEL9 only
2020-08-21 17:30:26 +08:00
%{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE30} > %{buildroot} %{_bindir} /firefox-x11
%{__chmod} 755 %{buildroot} %{_bindir} /firefox-x11
%endif
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%{__install} -p -D -m 644 %{SOURCE23} %{buildroot} %{_mandir} /man1/firefox.1
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%{__rm} -f %{buildroot} /%{mozappdir} /firefox-config
%{__rm} -f %{buildroot} /%{mozappdir} /update-settings.ini
2023-03-08 00:21:26 +08:00
2020-02-27 03:49:17 -05:00
for s in 16 22 24 32 48 256; do
2020-08-21 17:30:26 +08:00
%{__mkdir_p} %{buildroot} %{_datadir} /icons/hicolor/${s}x${s}/apps
%{__cp} -p browser/branding/official/default${s}.png \
%{buildroot} %{_datadir} /icons/hicolor/${s}x${s}/apps/firefox.png
2020-02-27 03:49:17 -05:00
done
2023-03-08 00:21:26 +08:00
# Install hight contrast icon
2020-08-21 17:30:26 +08:00
%{__mkdir_p} %{buildroot} %{_datadir} /icons/hicolor/symbolic/apps
%{__cp} -p %{SOURCE25} \
%{buildroot} %{_datadir} /icons/hicolor/symbolic/apps
2023-03-08 00:21:26 +08:00
2020-02-27 03:49:17 -05:00
echo > %{name} .lang
2020-08-21 17:30:26 +08:00
%if %{with langpacks}
2023-03-08 00:21:26 +08:00
# Extract langpacks, make any mods needed, repack the langpack, and install it.
2020-08-21 17:30:26 +08:00
%{__mkdir_p} %{buildroot} %{langpackdir}
%{__tar} xf %{SOURCE1}
2020-02-27 03:49:17 -05:00
for langpack in `ls firefox-langpacks/*.xpi`; do
language=`basename $langpack .xpi`
extensionID=langpack-$language@firefox.mozilla.org
2020-08-21 17:30:26 +08:00
%{__mkdir_p} $extensionID
2020-02-27 03:49:17 -05:00
unzip -qq $langpack -d $extensionID
find $extensionID -type f | xargs chmod 644
2023-03-08 00:21:26 +08:00
2020-02-27 03:49:17 -05:00
cd $extensionID
zip -qq -r9mX ../${extensionID}.xpi *
cd -
2023-03-08 00:21:26 +08:00
2020-08-21 17:30:26 +08:00
%{__install} -m 644 ${extensionID}.xpi %{buildroot} %{langpackdir}
2020-02-27 03:49:17 -05:00
language=`echo $language | sed -e 's/-/_/g' `
2020-08-21 17:30:26 +08:00
%if 0%{?flatpak}
echo " %{langpackdir} / $ { e x t e n s i o n I D } . x p i " >> %{name} .lang
%else
echo " % % l a n g ( $ l a n g u a g e ) %{langpackdir} / $ { e x t e n s i o n I D } . x p i " >> %{name} .lang
%endif
2020-02-27 03:49:17 -05:00
done
2020-08-21 17:30:26 +08:00
%{__rm} -rf firefox-langpacks
2023-03-08 00:21:26 +08:00
# Install langpack workaround (see #707100, #821169)
2020-02-27 03:49:17 -05:00
function create_default_langpack() {
language_long=$1
language_short=$2
2020-08-21 17:30:26 +08:00
cd %{buildroot} %{langpackdir}
2020-02-27 03:49:17 -05:00
ln -s langpack-$language_long@firefox.mozilla.org.xpi langpack-$language_short@firefox.mozilla.org.xpi
cd -
2020-08-21 17:30:26 +08:00
echo " % % l a n g ( $ l a n g u a g e _ s h o r t ) %{langpackdir} / l a n g p a c k - $ l a n g u a g e _ s h o r t @ f i r e f o x . m o z i l l a . o r g . x p i " >> %{name} .lang
2020-02-27 03:49:17 -05:00
}
2023-03-08 00:21:26 +08:00
# Table of fallbacks for each language
#create_default_langpack "bn-IN" "bn"
2020-02-27 03:49:17 -05:00
create_default_langpack " e s - A R " " e s "
create_default_langpack " f y - N L " " f y "
create_default_langpack " g a - I E " " g a "
create_default_langpack " g u - I N " " g u "
create_default_langpack " h i - I N " " h i "
create_default_langpack " h y - A M " " h y "
create_default_langpack " n b - N O " " n b "
create_default_langpack " n n - N O " " n n "
create_default_langpack " p a - I N " " p a "
create_default_langpack " p t - P T " " p t "
create_default_langpack " s v - S E " " s v "
create_default_langpack " z h - T W " " z h "
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
# Keep compatibility with the old preference location.
%{__mkdir_p} %{buildroot} %{mozappdir} /browser/defaults/preferences
# Default preferences
%{__cp} %{SOURCE12} %{buildroot} %{mozappdir} /browser/defaults/preferences/firefox.js
sed -i -e 's|%PREFIX%|%{_prefix}|' %{buildroot} %{mozappdir} /browser/defaults/preferences/firefox.js
# System config dir
2020-08-21 17:30:26 +08:00
%{__mkdir_p} %{buildroot} /%{_sysconfdir} /%{name} /pref
2023-03-08 00:21:26 +08:00
# System extensions
2020-08-21 17:30:26 +08:00
%{__mkdir_p} %{buildroot} %{_datadir} /mozilla/extensions/%{firefox_app_id}
%{__mkdir_p} %{buildroot} %{_libdir} /mozilla/extensions/%{firefox_app_id}
2023-03-08 00:21:26 +08:00
# Copy over the LICENSE
2020-08-21 17:30:26 +08:00
%{__install} -p -c -m 644 LICENSE %{buildroot} /%{mozappdir}
2023-03-08 00:21:26 +08:00
# Use the system hunspell dictionaries
2020-08-21 17:30:26 +08:00
%{__rm} -rf %{buildroot} %{mozappdir} /dictionaries
ln -s %{_datadir} /myspell %{buildroot} %{mozappdir} /dictionaries
2023-03-08 00:21:26 +08:00
%if 0%{?run_firefox_tests}
%{__mkdir_p} %{buildroot} /%{version} -%{release} /test_results
%{__cp} test_results/* %{buildroot} /%{version} -%{release} /test_results
%{__cp} test_summary.txt %{buildroot} /%{version} -%{release} /
%{__cp} failures-* %{buildroot} /%{version} -%{release} / || true
2020-08-21 17:30:26 +08:00
%endif
2023-03-08 00:21:26 +08:00
# Copy over run-mozilla.sh
2020-08-21 17:30:26 +08:00
%{__cp} build/unix/run-mozilla.sh %{buildroot} %{mozappdir}
2023-03-08 00:21:26 +08:00
# Add distribution.ini
2020-08-21 17:30:26 +08:00
%{__mkdir_p} %{buildroot} %{mozappdir} /distribution
%{__cp} %{SOURCE26} %{buildroot} %{mozappdir} /distribution
2023-03-08 00:21:26 +08:00
# Install appdata file
2020-08-21 17:30:26 +08:00
mkdir -p %{buildroot} %{_datadir} /metainfo
2023-03-08 00:21:26 +08:00
%{__sed} -e " s / _ _ V E R S I O N _ _ / %{version} / " \
-e " s / _ _ D A T E _ _ / $ ( d a t e ' + % Y - % m - % d ' ) / " \
%{SOURCE33} > %{buildroot} %{_datadir} /metainfo/firefox.appdata.xml
# Install Gnome search provider files
2020-08-21 17:30:26 +08:00
mkdir -p %{buildroot} %{_datadir} /gnome-shell/search-providers
%{__cp} %{SOURCE34} %{buildroot} %{_datadir} /gnome-shell/search-providers
2023-03-08 00:21:26 +08:00
# Remove gtk2 support as flash plugin is no longer supported
rm -rf %{buildroot} %{mozappdir} /gtk2/
# Remove copied libraries to speed up build
2020-08-21 17:30:26 +08:00
rm -f %{buildroot} %{mozappdirdev} /sdk/lib/libmozjs.so
rm -f %{buildroot} %{mozappdirdev} /sdk/lib/libmozalloc.so
rm -f %{buildroot} %{mozappdirdev} /sdk/lib/libxul.so
2020-02-27 03:49:17 -05:00
2023-03-08 00:21:26 +08:00
# Create a symlink to replace libnssckbi.so with p11-kit-client.so
# instead of p11-kit-trust.so, so that Firefox can see the system
# trust store on the host through the p11-kit RPC protocol. A symlink
# to libnss3.so is also needed, because Firefox tries to load
# libnssckbi.so from the same directory where libnss3.so is loaded (as
# of Firefox 89).
%if 0%{?flatpak}
ln -sf /usr/lib64/libnss3.so %{buildroot} %{_libdir} /libnss3.so
ln -sf /usr/lib64/pkcs11/p11-kit-client.so %{buildroot} %{_libdir} /libnssckbi.so
%endif
#---------------------------------------------------------------------
2020-02-27 03:49:17 -05:00
2020-08-21 17:30:26 +08:00
%check
appstream-util validate-relax --nonet %{buildroot} %{_datadir} /metainfo/*.appdata.xml
2020-02-27 03:49:17 -05:00
%preun
2023-03-08 00:21:26 +08:00
# is it a final removal?
2020-02-27 03:49:17 -05:00
if [ $1 -eq 0 ]; then
2020-08-21 17:30:26 +08:00
%{__rm} -rf %{mozappdir} /components
%{__rm} -rf %{mozappdir} /extensions
%{__rm} -rf %{mozappdir} /plugins
2020-02-27 03:49:17 -05:00
fi
%post
update-desktop-database &> /dev/null || :
touch --no-create %{_datadir} /icons/hicolor &>/dev/null || :
%postun
update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir} /icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir} /icons/hicolor &>/dev/null || :
2023-03-08 00:21:26 +08:00
%{__rm} -rf %{langpackdir}
2020-02-27 03:49:17 -05:00
fi
%posttrans
gtk-update-icon-cache %{_datadir} /icons/hicolor &>/dev/null || :
%files -f %{name}.lang
%{_bindir} /firefox
2020-08-21 17:30:26 +08:00
%{mozappdir} /firefox
%{mozappdir} /firefox-bin
%doc %{_mandir} /man1/*
2020-02-27 03:49:17 -05:00
%dir %{_sysconfdir} /%{name}
%dir %{_sysconfdir} /%{name} /*
%dir %{_datadir} /mozilla/extensions/*
%dir %{_libdir} /mozilla/extensions/*
%{_datadir} /applications/%{name} .desktop
2020-08-21 17:30:26 +08:00
%{_datadir} /metainfo/*.appdata.xml
%{_datadir} /gnome-shell/search-providers/*.ini
%dir %{mozappdir}
%license %{mozappdir} /LICENSE
%{mozappdir} /browser/chrome
%{mozappdir} /browser/defaults/preferences/firefox.js
%{mozappdir} /browser/features/*.xpi
%{mozappdir} /distribution/distribution.ini
2023-03-08 00:21:26 +08:00
# That's Windows only
2020-08-21 17:30:26 +08:00
%ghost %{mozappdir} /browser/features/aushelper@mozilla.org.xpi
%if %{with langpacks}
%dir %{langpackdir}
%endif
%{mozappdir} /browser/omni.ja
%{mozappdir} /run-mozilla.sh
%{mozappdir} /application.ini
%{mozappdir} /pingsender
%exclude %{mozappdir} /removed-files
2023-03-08 00:21:26 +08:00
%if 0%{?flatpak}
%{_libdir} /libnss3.so
%{_libdir} /libnssckbi.so
%endif
2020-02-27 03:49:17 -05:00
%{_datadir} /icons/hicolor/16x16/apps/firefox.png
%{_datadir} /icons/hicolor/22x22/apps/firefox.png
%{_datadir} /icons/hicolor/24x24/apps/firefox.png
%{_datadir} /icons/hicolor/256x256/apps/firefox.png
%{_datadir} /icons/hicolor/32x32/apps/firefox.png
%{_datadir} /icons/hicolor/48x48/apps/firefox.png
2020-08-21 17:30:26 +08:00
%{_datadir} /icons/hicolor/symbolic/apps/firefox-symbolic.svg
%if %{enable_mozilla_crashreporter}
%{mozappdir} /crashreporter
%{mozappdir} /crashreporter.ini
%{mozappdir} /minidump-analyzer
%{mozappdir} /Throbber-small.gif
%{mozappdir} /browser/crashreporter-override.ini
%endif
%{mozappdir} /*.so
%{mozappdir} /defaults/pref/channel-prefs.js
%{mozappdir} /dependentlibs.list
%{mozappdir} /dictionaries
%{mozappdir} /omni.ja
%{mozappdir} /platform.ini
%{mozappdir} /plugin-container
%{mozappdir} /gmp-clearkey
%{mozappdir} /fonts/TwemojiMozilla.ttf
%if !%{?system_nss}
%exclude %{mozappdir} /libnssckbi.so
%endif
%if %{build_with_asan}
%{mozappdir} /llvm-symbolizer
%endif
2020-02-27 03:49:17 -05:00
%changelog
2023-09-20 16:10:30 +08:00
* Wed Sep 20 2023 lvfei <lvfei@kylinos.cn> - 102.15.0-1
- Update to 102.15.0
- Fix CVE-2023-4573 CVE-2023-4574 CVE-2023-4575 CVE-2023-4576 CVE-2023-4581 CVE-2023-4584
2023-08-08 09:39:32 +08:00
* Tue Aug 08 2023 wangkai <13474090681@163.com> - 102.14.0-1
- Update to 102.14.0
- Fix CVE-2023-4045 CVE-2023-4046 CVE-2023-4047 CVE-2023-4048 CVE-2023-4049 CVE-2023-4050 CVE-2023-4054 CVE-2023-4055 CVE-2023-4056
2023-07-06 14:07:04 +08:00
* Thu Jul 06 2023 wangkai <13474090681@163.com> - 102.13.0-1
- Update to 102.13.0
- Fix CVE-2023-34416 CVE-2023-34414 CVE-2023-37201 CVE-2023-37202 CVE-2023-37207 CVE-2023-37208 CVE-2023-37211
- Remove unused patch
2023-05-10 17:22:08 +08:00
* Wed May 10 2023 wangkai <13474090681@163.com> - 102.11.0-1
- Update to 102.11.0
2023-03-31 11:47:09 +08:00
* Fri Mar 31 2023 wangkai <wangkai385@h-partners.com> - 102.9.0-1
- Update to 102.9.0
2023-03-08 00:21:26 +08:00
* Fri Mar 03 2023 wangkai <wangkai385@h-partners.com> - 102.8.0-1
- Update to 102.8.0
2023-02-14 16:34:01 +08:00
* Tue Feb 14 2023 Ge Wang <wangge20@h-partners.com> - 79.0-14
- Fix build failure due to arc4random feature activated
2022-07-21 15:10:41 +08:00
* Thu Jul 21 2022 xu_ping <xuping33@h-partners.com> - 79.0-13
- Fix attribute error module distutils has no attribute sysconfig
2022-05-06 11:55:03 +08:00
* Fri May 6 2022 liyanan <liyanan32@h-partners.com> - 79.0-12
- Fix compilation failure by python3.10 and wayland 1.20
2021-10-14 11:23:49 +08:00
* Thu Oct 14 2021 zhangweiguo <zhangweiguo2@huawei.com> - 79.0-11
- Set RUSTFLAGS:debuginfo to 1
2021-08-23 16:49:28 +08:00
* Mon Aug 23 2021 lingsheng <lingsheng@huawei.com> - 79.0-10
- Fix firefox tab crash with clone3 in glibc 2.34
2021-08-12 09:00:08 +08:00
* Wed Aug 11 2021 caodongxia <caodongxia@huawei.com> - 79.0-9
- Fix glibc dynstack
2021-07-08 15:18:30 +08:00
* Wed Jul 7 2021 lingsheng <lingsheng@huawei.com> - 79.0-8
- Fix firefox video tab crash with rust 1.51
2021-07-05 15:55:47 +08:00
* Mon Jul 05 2021 caodongxia <caodongxia@huawei.com> - 79.0-7
- Fix build with pipewire 0.3
2021-05-14 15:37:53 +08:00
* Fri May 14 2021 lingsheng <lingsheng@huawei.com> - 79.0-6
- Fix build with rust 1.51
2021-01-07 15:15:15 +08:00
* Thu Jan 07 2021 wangxiao <wangxiao65@huawei.com> - 79.0-5
- Fix CVE-2020-15969 CVE-2020-15999 CVE-2020-16012 CVE-2020-26951
CVE-2020-26953 CVE-2020-26956 CVE-2020-26957 CVE-2020-26958
CVE-2020-26959 CVE-2020-26960 CVE-2020-26961 CVE-2020-26963
CVE-2020-26965 CVE-2020-25966 CVE-2020-26967
2020-12-18 11:52:37 +08:00
* Wed Dec 16 2020 wangxiao <wangxiao65@huawei.com> - 79.0-4
- Fix CVE-2020-15664 CVE-2020-15665 CVE-2020-15666 CVE-2020-15667
CVE-2020-15668 CVE-2020-15676 CVE-2020-15677 CVE-2020-15678
2020-11-28 15:31:40 +08:00
* Thu Nov 28 2020 Jeffery.Gao <gaojianxing@huawei.com> - 79.0-3
- Fix firefox downgrade error
2020-10-27 12:47:12 +08:00
* Mon Oct 26 2020 lingsheng <lingsheng@huawei.com> - 79.0-2
- Fix firefox remove warning
2020-08-21 17:30:26 +08:00
* Mon Aug 17 2020 zhangjiapeng <zhangjiapeng9@huawei.com> - 79.0-1
- Update to 79.0-1
2020-07-27 16:48:25 +08:00
* Wed Jul 22 2020 lingsheng <lingsheng@huawei.com> - 62.0.3-7
- Fix firefox build with rust 1.38
2020-05-25 16:41:12 +08:00
* Mon May 25 2020 huanghaitao <huanghaitao8@huawei.com> - 62.0.3-6
- Type:cves
- ID: CVE-2020-6811 CVE-2020-6814
- SUG:restart
- DESC: fix CVE-2020-6811 CVE-2020-6814
2020-05-25 14:27:36 +08:00
* Mon May 25 2020 Captain Wei<captain.a.wei@gmail.com> - 62.0.3-5
- fix unstable_name_collisions problem when compile
2020-02-27 03:49:17 -05:00
* Wen Feb 26 2020 xuxijian<xuxijian@huawei.com> - 62.0.3-4
- Package init