# WARNING: This package is synced with FC # # WARNING, READ FIRST: # # This is a special package that needs special treatment. Due to the amount of # security updates it needs, it's common to ship new upstream versions instead of patching. # That means this package MUST be BUILDABLE for stable official releases. # This also means only STABLE upstream releases, NO betas. # This is a discussed topic. Please, do not flame it again. # Stay on ESR for stable releases and for cauldron before mageia 7. # /!\ Do not update more than FF 60 for mga7. /!\ # ff 60 -> 68 # Tentative workaround for rust's "error: the lock file needs to be updated but --locked was passed to prevent this": %global _smp_ncpus_max 8 %global system_nss 1 %global hardened_build 1 %global disable_elfhack 1 %global build_with_clang 0 %ifarch x86_64 aarch64 %global build_with_clang 0 %endif %global build_with_pgo 0 %global use_bundled_cbindgen 1 %global major 66 %global ff_epoch 0 # (tpg) set version HERE !!! %global extra %nil %global realver %{version}%extra %global firefox_appid \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\} # (tpg) MOZILLA_FIVE_HOME %global pluginsdir %{_libdir}/mozilla/plugins # libxul.so is provided by libxulrunnner2.0. %global __requires_exclude libxul.so # exclude libnss from provides (eg: when system_nss is disabled) %global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^libnss|^libnspr # exclude libnss from requires when system_nss is disabled (requires on ourselves): %if !%{?system_nss} %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^libnss|^libnspr %endif # Build as a debug package? %global debug_build 0 # Minimal required versions %global cairo_version 1.13.1 %global freetype_version 2.1.9 %global libnotify_version 0.7.0 %global libvpx_version 1.5.0 # this seems fragile, so require the exact version or later (#58754) %global nspr_version 4.19 %global nspr_build_version %(pkg-config --silence-errors --modversion nspr 2>/dev/null || echo 65536) %global nss_version 3.40.1 %global nss_build_version %(pkg-config --silence-errors --modversion nss 2>/dev/null || echo 65536) %global sqlite_version 3.22.0 %global mozappdir %{_libdir}/%{name} %global tarballdir firefox-%{version} %global official_branding 1 %global update_channel %{extra}%major Summary: Mozilla Firefox Web browser Name: firefox Version: %{major}.0.4 Epoch: %{ff_epoch} Release: %mkrel 2 License: MPLv1.1 or GPLv2+ or LGPLv2+ Group: Networking/WWW Url: https://www.mozilla.org/firefox/organizations/ Source0: https://ftp.mozilla.org/pub/firefox/releases/%{version}%{?prerel}/source/firefox-%{version}%{?pre_version}.source.tar.xz Source2: cbindgen-vendor.tar.xz Source4: %{name}.desktop Source8: %{name}-searchengines-duckduckgo.xml Source9: kde.js # From Fedora: Source10: firefox-mozconfig Source12: firefox-mageia-default-prefs.js Source23: firefox.1 Source24: mozilla-api-key Source26: distribution.ini Source27: google-api-key # Fedora patches: Patch3: mozilla-build-arm.patch # Also fixes s390x: https://bugzilla.mozilla.org/show_bug.cgi?id=1376268 Patch29: build-big-endian.patch # Always feel lucky for unsupported platforms: # https://bugzilla.mozilla.org/show_bug.cgi?id=1347128 Patch37: build-jit-atomic-always-lucky.patch Patch40: build-aarch64-skia.patch Patch41: build-disable-elfhack.patch Patch42: mozilla-1515641-av1-build-1.patch Patch43: mozilla-1515641-av1-build-2.patch Patch44: build-arm-libopus.patch Patch45: mozilla-1533969.patch Patch219: rhbz-1173156.patch Patch224: mozilla-1170092.patch Patch225: mozilla-1005640-accept-lang.patch #ARM run-time patch Patch226: rhbz-1354671.patch Patch229: firefox-nss-version.patch # Upstream patches Patch402: mozilla-1196777.patch Patch412: mozilla-1337988.patch Patch413: mozilla-1353817.patch Patch417: bug1375074-save-restore-x28.patch Patch418: mozilla-1526653.patch # Mageia patches: Patch1000: firefox-lang.patch Patch1001: firefox-npapi-missing-include.patch # (OpenSuse) add patch to make firefox always use /usr/bin/firefox when "make firefox # the default web browser" is used fix mdv bug#58784 Patch1005: firefox-66.0-appname.patch # Patches for kde integration of FF # (doktor5000) if the patches need updating, grab both from the branch corresponding with the current firefox version at # http://www.rosenauer.org/hg/mozilla Patch1011: http://www.rosenauer.org/hg/mozilla/file/tip/mozilla-kde.patch # (fwang) please modify patch12 with `sed -e 's/MozillaFirefox/firefox/'` to fit our desktop filename Patch1012: http://www.rosenauer.org/hg/mozilla/file/tip/firefox-kde.patch Patch1037: firefox-38.0-nss-version.patch Patch1039: firefox-59.0-optimize-dont-force-O3.patch Patch1040: no-MOZ_SIGNAL_TRAMPOLINE.patch %if %{?system_nss} BuildRequires: pkgconfig(nspr) >= %{nspr_version} BuildRequires: pkgconfig(nss) >= %{nss_version} %endif BuildRequires: nss-static-devel >= %{nss_version} BuildRequires: pkgconfig(xinerama) BuildRequires: pkgconfig(xscrnsaver) BuildRequires: pkgconfig(libpng) >= 1.6.31 BuildRequires: pkgconfig(libjpeg) BuildRequires: zip BuildRequires: bzip2-devel BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(libIDL-2.0) BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(gtk+-2.0) BuildRequires: pkgconfig(pango) BuildRequires: pkgconfig(freetype2) >= %{freetype_version} BuildRequires: pkgconfig(xt) BuildRequires: pkgconfig(hunspell) BuildRequires: pkgconfig(libstartup-notification-1.0) BuildRequires: pkgconfig(libnotify) >= %{libnotify_version} BuildRequires: pkgconfig(dri) %if %mgaver > 5 BuildRequires: pkgconfig(libvpx) >= %{libvpx_version} %endif BuildRequires: autoconf2.1 BuildRequires: pkgconfig(libpulse) BuildRequires: pkgconfig(gconf-2.0) BuildRequires: yasm BuildRequires: llvm BuildRequires: llvm-devel BuildRequires: clang %if 0%{?build_with_clang} BuildRequires: lld %endif BuildRequires: nodejs BuildRequires: nasm >= 1.13 %if %{?system_nss} Requires: %{mklibname nss 3} >= 2:%{nss_build_version} Requires: %{mklibname nspr 4} >= 2:%{nspr_build_version} %endif BuildRequires: python2-devel BuildRequires: pkgconfig(libffi) BuildRequires: rootcerts >= 1:20130411.00 BuildRequires: doxygen BuildRequires: libiw-devel BuildRequires: python-virtualenv BuildRequires: pkgconfig(libproxy-1.0) BuildRequires: rust BuildRequires: cargo BuildRequires: clang-devel Provides: %{name} = %{epoch}:%{version} Provides: mozilla-firefox = %{epoch}:%{version}-%{release} Provides: webclient Requires: indexhtml Requires: xdg-utils # fixes bug #42096 Requires: mailcap Recommends: hunspell-en Requires: %{_lib}notify4 # make sure our default bookmarks are present Requires: desktop-common-data # try to fix mga#1344 (automatic installation of proper -l10n package) # packages requiring locales-XX will be automatically preferred when locales-XX # is already installed Recommends: firefox-l10n Recommends: %{_lib}canberra0 Recommends: %{_lib}cups2 Obsoletes: firefox-ext-weave-sync Obsoletes: firefox-beta < 25 %description Mozilla Firefox is an open-source web browser, designed for standards compliance, performance and portability. %package devel Summary: Development files for %{name} Group: Development/Other Obsoletes: firefox-beta-devel < 25 %description devel Files and macros mainly for building Firefox extensions. %prep %if 0%{?extra} #setup -q -n mozilla-%{update_channel} %setup -q -n firefox-%{version}esr %else %setup -q -n %{tarballdir} %endif # Fedora patches: %if 0%{?big_endian} %patch29 -p1 -b .big-endian %endif #patch37 -p1 -b .jit-atomic-lucky # TODO Fix later #patch40 -p1 -b .aarch64-skia %if 0%{?disable_elfhack} %patch41 -p1 -b .disable-elfhack %endif %patch3 -p1 -b .arm %patch42 -p1 -b .mozilla-1515641 %patch43 -p1 -b .mozilla-1515641 %patch44 -p1 -b .build-arm-libopus %patch45 -p1 -b .mozilla-1533969 %patch219 -p1 -b .rhbz-1173156 %patch224 -p1 -b .1170092 %patch225 -p1 -b .1005640-accept-lang %ifarch aarch64 %patch226 -p1 -b .1354671 %endif %patch402 -p1 -b .1196777 %patch413 -p1 -b .1353817 %patch418 -p0 -b .1526653 # Mageia patches: %patch1000 -p1 -b .lang #patch1001 -p1 -b .npapi-missing-include %patch1005 -p1 -b .appname #patch1011 -p1 -b .mozkde #patch1012 -p1 -b .ffkde %patch1037 -p0 %patch1039 -p1 -b .noo3_noos %patch1040 -p1 -b .1238661 pushd js/src autoconf-2.13 popd autoconf-2.13 %{__rm} -f .mozconfig %{__cp} %{SOURCE10} .mozconfig # Mageia specific options: cat << EOF >> .mozconfig ac_add_options --enable-libproxy ac_add_options --with-system-png ac_add_options --with-distribution-id=org.mageia ac_add_options --enable-update-channel=release EOF # Options shared with FC: echo "ac_add_options --enable-default-toolkit=cairo-gtk3" >> .mozconfig %if %{official_branding} echo "ac_add_options --enable-official-branding" >> .mozconfig %endif %{__cp} %{SOURCE24} mozilla-api-key %{__cp} %{SOURCE27} google-api-key %if %{?system_nss} echo "ac_add_options --with-system-nspr" >> .mozconfig echo "ac_add_options --with-system-nss" >> .mozconfig %else echo "ac_add_options --without-system-nspr" >> .mozconfig echo "ac_add_options --without-system-nss" >> .mozconfig %endif echo "ac_add_options --enable-system-ffi" >> .mozconfig %ifarch %{arm} echo "ac_add_options --disable-elf-hack" >> .mozconfig %endif %if %{?debug_build} echo "ac_add_options --enable-debug" >> .mozconfig echo "ac_add_options --disable-optimize" >> .mozconfig %else %global optimize_flags "none" %ifarch armv7hl # ARMv7 needs that (rhbz#1426850) %global optimize_flags "-g -O2 -fno-schedule-insns" # Disable libaom due to rhbz#1641623 echo "ac_add_options --disable-av1" >> .mozconfig %endif %ifarch ppc64le aarch64 %global optimize_flags "-g -O2" %endif %if %{optimize_flags} != "none" echo 'ac_add_options --enable-optimize=%{?optimize_flags}' >> .mozconfig %else echo 'ac_add_options --enable-optimize' >> .mozconfig %endif echo "ac_add_options --disable-debug" >> .mozconfig %endif # Second arches fail to start with jemalloc enabled %ifnarch %{ix86} x86_64 echo "ac_add_options --disable-jemalloc" >> .mozconfig %endif %ifnarch %{ix86} x86_64 echo "ac_add_options --disable-webrtc" >> .mozconfig %endif echo "ac_add_options --disable-crashreporter" >> .mozconfig echo "ac_add_options --with-system-jpeg" >> .mozconfig %if %mgaver > 5 #echo "ac_add_options --with-system-libvpx" >> .mozconfig %else # Using the bundled libvpx because the mgav5 one is too old. echo "ac_add_options --disable-system-libvpx" >> .mozconfig %endif # Remove executable bit to make brp-mangle-shebangs happy. chmod -x third_party/rust/itertools/src/lib.rs #--------------------------------------------------------------------- %build %if 0%{?use_bundled_cbindgen} mkdir -p my_rust_vendor cd my_rust_vendor %{__tar} xf %{SOURCE2} cd - mkdir -p .cargo cat > .cargo/config <> .mozconfig %endif %endif %ifarch %{arm} %{ix86} export RUSTFLAGS="-Cdebuginfo=0" %endif export CFLAGS=$MOZ_OPT_FLAGS export CXXFLAGS=$MOZ_OPT_FLAGS export LDFLAGS=$MOZ_LINK_FLAGS export PREFIX='%{_prefix}' export LIBDIR='%{_libdir}' %if 0%{?build_with_clang} export LLVM_PROFDATA="llvm-profdata" export AR="llvm-ar" export NM="llvm-nm" export RANLIB="llvm-ranlib" echo "ac_add_options --enable-linker=lld" >> .mozconfig %else export CC=gcc export CXX=g++ export AR="gcc-ar" export NM="gcc-nm" export RANLIB="gcc-ranlib" %endif %if 0%{?build_with_pgo} echo "ac_add_options MOZ_PGO=1" >> .mozconfig echo "ac_add_options --enable-lto" >> .mozconfig %endif MOZ_SMP_FLAGS=-j1 # 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} [ -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 aarch64 [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" [ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 [ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 %ifnarch aarch64 [ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 %endif %endif export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" export MOZ_SERVICES_SYNC="1" export STRIP=/bin/true ./mach build %install make -C objdir/browser/installer STRIP=/bin/true MOZ_PKG_FATAL_WARNINGS=0 # Copy files to buildroot %{__mkdir_p} %{buildroot}%{mozappdir} cp -rf objdir/dist/firefox/* %{buildroot}%{mozappdir} %{__mkdir_p} %{buildroot}%{_bindir} ln -sf %{mozappdir}/firefox %{buildroot}%{_bindir}/firefox pushd %{buildroot}%{_bindir} ln -sf firefox mozilla-firefox popd mkdir -p %{buildroot}%{mozappdir}/browser/defaults/preferences/ install -m 644 %{SOURCE9} %{buildroot}%{mozappdir}/browser/defaults/preferences/kde.js # Create and own %{_libdir}/mozilla/plugins & firefox extensions directories %{__mkdir_p} %{buildroot}%{pluginsdir} %{__mkdir_p} %{buildroot}%{_libdir}/mozilla/extensions/%{firefox_appid} %{__mkdir_p} %{buildroot}%{_datadir}/mozilla/extensions/%{firefox_appid} # (tpg) desktop entry %{__mkdir_p} %{buildroot}%{_datadir}/applications install -m 644 %{SOURCE4} %{buildroot}%{_datadir}/applications/%{name}.desktop # (tpg) icons #%{__cp} %{buildroot}%{mozappdir}/browser/chrome/icons/default/default16.png %{buildroot}/%{mozappdir}/browser/icons/ for i in 16 22 24 32 48 256; do %{__mkdir_p} %{buildroot}%{_iconsdir}/hicolor/"$i"x"$i"/apps %{__install} -m 644 browser/branding/official/default$i.png %{buildroot}%{_iconsdir}/hicolor/"$i"x"$i"/apps/%{name}.png ; done %{__mkdir_p} %{buildroot}{%{_liconsdir},%{_iconsdir},%{_miconsdir}} ln -sf %{mozappdir}/browser/chrome/icons/default/default48.png %{buildroot}%{_liconsdir}/%{name}.png ln -sf %{mozappdir}/browser/chrome/icons/default/default32.png %{buildroot}%{_iconsdir}/%{name}.png ln -sf %{mozappdir}/browser/chrome/icons/default/default16.png %{buildroot}%{_miconsdir}/%{name}.png %{__install} -p -D -m 644 %{SOURCE23} %{buildroot}%{_mandir}/man1/firefox.1 # exclusions rm -f %{buildroot}%{mozappdir}/README.txt rm -f %{buildroot}%{mozappdir}/removed-files rm -f %{buildroot}%{mozappdir}/precomplete # display icon for Firefox button %{__mkdir_p} %{buildroot}%{mozappdir}/browser/defaults/profile/chrome cat << EOF > %{buildroot}%{mozappdir}/browser/defaults/profile/chrome/userChrome.css #appmenu-toolbar-button { list-style-image: url("chrome://branding/content/icon16.png"); } EOF # files in this directory are read on every startup, and can change/add # preferences for existing profiles # extensions.autoDisableScopes is a new preference added in firefox 8 # it defines "scopes" where newly installed addons are disabled by default # this is an additive bit field, and the value defaults to 15 (1+2+4+8) # we need to remove system scope (8) from it so language packs and other addons # which are installed systemwide won't get marked as 3rd party and disabled # documentation: http://kb.mozillazine.org/About:config_entries#Extensions. # or in toolkit/mozapps/extensions/AddonManager.jsm # we also need to disable the "disable addon selection dialog" # (doktor5000) - path has changed since FF 21 # http://mike.kaply.com/2013/04/24/major-changes-coming-in-firefox-21/ cat << EOF > %{buildroot}%{mozappdir}/browser/defaults/preferences/mga.js pref("general.useragent.locale", "chrome://global/locale/intl.properties"); pref("extensions.autoDisableScopes", 0); pref("extensions.shownSelectionUI", true); EOF # FIXME: Add it back in mga.js when this search engine will be used by default. # user_pref("browser.search.selectedEngine","duckduckgo.com"); # Use the system hunspell dictionaries %{__rm} -rf %{buildroot}%{mozappdir}/dictionaries ln -s %{_datadir}/hunspell %{buildroot}%{mozappdir}/dictionaries # Default %{__cp} %{SOURCE12} %{buildroot}%{mozappdir}/browser/defaults/preferences # Copy over run-mozilla.sh %{__cp} build/unix/run-mozilla.sh %{buildroot}%{mozappdir} # Add distribution.ini %{__mkdir_p} %{buildroot}%{mozappdir}/distribution %{__cp} %{SOURCE26} %{buildroot}%{mozappdir}/distribution # (lm) touch and %ghost bookmarks.html to a proper uninstall touch %{buildroot}%{mozappdir}/browser/defaults/profile/bookmarks.html # Add stuff to build a plugin to -devel mkdir -p %{buildroot}%{_includedir} cp -a dom/plugins/base/np*.h %{buildroot}%{_includedir} mkdir -p %{buildroot}/%{_datadir}/pkgconfig cat <%{buildroot}/%{_datadir}/pkgconfig/mozilla-plugin.pc Name: Mozilla Plug-In API Description: Mozilla Plug-In API Version: %{version} Cflags: -I%{_includedir} -DXP_UNIX EOF mkdir -p %{buildroot}%{_sys_macros_dir} cat <%{buildroot}%{_sys_macros_dir}/%{name}.macros # Macros from %{name} package %%firefox_major %{version} %%firefox_epoch %{ff_epoch} %%firefox_version %{version} %%firefox_mozillapath %{mozappdir} %%firefox_pluginsdir %{pluginsdir} %%firefox_appid \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\} %%firefox_extdir %%(if [ "%%_target_cpu" = "noarch" ]; then echo %%{_datadir}/mozilla/extensions/%%{firefox_appid}; else echo %%{_libdir}/mozilla/extensions/%%{firefox_appid}; fi) FIN # temp build fix: mkdir -p %{buildroot}%{mozappdir}/browser/searchplugins cp -f %{SOURCE8} %{buildroot}%{mozappdir}/browser/searchplugins/duckduckgo.xml %post if [ ! -r /etc/sysconfig/oem ]; then case `grep META_CLASS /etc/sysconfig/system` in *powerpack) bookmark="mozilla-powerpack.html" ;; *desktop) bookmark="mozilla-one.html";; *) bookmark="mozilla-download.html";; esac ln -s -f %{_prefix}/share/mga/bookmarks/mozilla/$bookmark %{mozappdir}/browser/defaults/profile/bookmarks.html fi %files %{_bindir}/%{name} %{_bindir}/mozilla-firefox %doc %{_mandir}/man1/* %{_iconsdir}/hicolor/*/apps/*.png %{_miconsdir}/%{name}.png %{_iconsdir}/%{name}.png %{_liconsdir}/%{name}.png %{_datadir}/applications/*.desktop %{mozappdir} %ghost %{mozappdir}/browser/defaults/profile/bookmarks.html %dir %{_libdir}/mozilla %dir %{pluginsdir} %dir %{_libdir}/mozilla/extensions/%{firefox_appid} %dir %{_datadir}/mozilla/extensions/%{firefox_appid} %files devel %{_sys_macros_dir}/%{name}.macros %{_includedir}/np*.h %{_datadir}/pkgconfig/mozilla-plugin.pc