firefox-esr68/firefox.spec
Алексей-З 10e52ef4e4 Optimize spec
2019-04-22 14:39:01 +00:00

430 lines
14 KiB
RPMSpec

# No build in 62.0.2
#%%define debug_package %%{nil}
#
# 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.
%define major 66.0.3
%define ff_epoch 0
# (tpg) set version HERE !!!
%define realver %{major}
%define firefox_appid \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\}
# (tpg) MOZILLA_FIVE_HOME
%define mozillalibdir %{_libdir}/%{name}-%{major}
%define pluginsdir %{_libdir}/mozilla/plugins
# this seems fragile, so require the exact version or later (#58754)
#%%define sqlite3_version %%(pkg-config --modversion sqlite3 &>/dev/null && pkg-config --modversion sqlite3 2>/dev/null || echo 0)
%define nss_version %(pkg-config --modversion nss &>/dev/null && pkg-config --modversion nss 2>/dev/null || echo 0)
%define nspr_version %(pkg-config --modversion nspr &>/dev/null && pkg-config --modversion nspr 2>/dev/null |sed -e 's!\.0!!' || echo 0)
%define _use_syshunspell 0
%define toolkit_gtk3 1
# Firefox 61.0: ERROR: Only GCC 6.1 or newer is supported (found version 5.5.0).
%define clang 1
%define use_bundled_cbindgen 1
Summary: Next generation web browser
Name: firefox
Version: %{major}
Epoch: %{ff_epoch}
Release: 4
License: MPLv1+
Group: Networking/WWW
Url: http://www.mozilla.com/firefox/
Source0: https://archive.mozilla.org/pub/firefox/releases/%{realver}/source/%{name}-%{realver}.source.tar.xz
Source1: firefox.rpmlintrc
# https://www.mozilla.org/en-US/firefox/all/
Source2: firefox-dictionary-61.0.2.tar.bz2
Source4: %{name}.desktop
Source7: firefox.cfg
Source9: kde.js
Source10: mozilla-api-key
Source11: google-api-key
# Fedora
Source12: cbindgen-vendor.tar.xz
# Patches for kde integration of FF
# http://www.rosenauer.org/hg/mozilla/summary
Patch11: firefox-kde.patch
Patch12: mozilla-kde.patch
Patch13: mozilla-kde-background.patch
Patch35: firefox-37-build-with-time-independent-uuids.patch
# Fedora specific patches
# Unable to install addons from https pages
Patch215: firefox-enable-addons.patch
Patch219: mozilla-ntlm-full-path.patch
Patch300: firefox-56.0-build-error.patch
# Build errors in 62.0
Patch302: firefox-62.0.2-include-cmath.patch
BuildRequires: gtk+2-devel
%if %{toolkit_gtk3}
BuildRequires: gtk+3-devel
%endif
BuildRequires: rust
BuildRequires: cargo
BuildRequires: unzip
BuildRequires: zip
BuildRequires: clang
BuildRequires: clang-devel
%if 0%{?clang}
BuildRequires: lld
%endif
BuildRequires: nasm
BuildRequires: libatomic-devel
BuildRequires: pkgconfig(xinerama)
BuildRequires: pkgconfig(xscrnsaver)
BuildRequires: jpeg-devel
BuildRequires: zlib-devel
BuildRequires: glib2-devel
BuildRequires: pkgconfig(python)
BuildRequires: pkgconfig(python3)
BuildRequires: pkgconfig(libIDL-2.0)
BuildRequires: makedepend
BuildRequires: nodejs
BuildRequires: nss-devel >= 2:3.24
BuildRequires: nss-static-devel
BuildRequires: pkgconfig(nspr) >= 4.17
BuildRequires: startup-notification-devel
BuildRequires: dbus-glib-devel
%ifnarch %arm %mips
BuildRequires: java-rpmbuild
BuildRequires: java-1.8.0-openjdk-devel
BuildRequires: yasm >= 1.0.1
%endif
%ifarch %arm
BuildRequires: libffi-devel
%endif
BuildRequires: rootcerts >= 1:20110830.00
BuildRequires: pkgconfig(xt)
%if %_use_syshunspell
BuildRequires: hunspell-devel
%endif
BuildRequires: doxygen
BuildRequires: pkgconfig(alsa)
BuildRequires: wget
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(gl)
BuildRequires: autoconf2.1
BuildRequires: libiw-devel
BuildRequires: pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(gstreamer-plugins-base-1.0)
BuildRequires: pkgconfig(opus)
BuildRequires: pkgconfig(libpulse)
BuildRequires: bzip2-devel
BuildRequires: pkgconfig(theoradec)
BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(gconf-2.0)
BuildRequires: pkgconfig(fontconfig)
Provides: %{name} = %{EVRD}
Provides: mozilla-firefox = %{EVRD}
Provides: webclient
Requires: %{mklibname nss 3} >= 2:%{nss_version}
Requires: %{mklibname nspr 4} >= 2:%{nspr_version}
Requires: indexhtml
Requires: xdg-utils
# fixes bug #42096
Requires: mailcap
%if %_use_syshunspell
Suggests: hunspell-en
%endif
Suggests: %{_lib}canberra0
Suggests: %{_lib}cups2
%description
The award-winning Web browser is now faster, more secure, and fully
customizable to your online life. With Firefox(R), we've added powerful new
features that make your online experience even better. It is an 'open source'
product which is freely available, and is acquiring a growing proportion of
international web browser usage.
Firefox claims to offer a more secure web browsing experience than other
products, with better protection against spyware and other Internet-based
security threats. It includes all the standard features of a modern web
browser, like Internet searching, tracking recently visited sites, setting up
shortcuts to favourite sites, customising the software behaviour and so on.
Firefox also includes features like 'tabbed browsing' (opening several web
sites as sections within the same window) and methods for controlling pop-up
windows, cookies and downloaded files.
%files
%doc AUTHORS CLOBBER LEGAL LICENSE README.txt
%{_bindir}/%{name}
%{_bindir}/mozilla-firefox
%{_datadir}/applications/*.desktop
%{_datadir}/dict/mozilla
%{_iconsdir}/%{name}.png
%{_iconsdir}/hicolor/*/apps/*.png
%{_libdir}/%{name}-%{major}*
%{_liconsdir}/%{name}.png
%{_miconsdir}/%{name}.png
%dir %{_datadir}/mozilla/extensions/%{firefox_appid}
%dir %{_libdir}/mozilla
%dir %{_libdir}/mozilla/extensions
%dir %{_libdir}/mozilla/extensions/%{firefox_appid}
%dir %{pluginsdir}
#---------------------------------------------------------------------
%package devel
Summary: Development files for %{name}
Group: Development/Other
%description devel
Files and macros mainly for building Firefox extensions.
%files devel
%doc AUTHORS CLOBBER LEGAL LICENSE README.txt
%{_sys_macros_dir}/%{name}.macros
#---------------------------------------------------------------------
%prep
%setup -q
## KDE INTEGRATION
%patch11 -p1 -b .kdepatch
%patch12 -p1 -b .kdemoz
%patch13 -p1 -b .kdebackground #No work in 60.0
%patch35 -p1
# Fedora patches
%patch215 -p1 -b .addons
%patch219 -p1 -b .ntlm
%patch300 -p1
%patch302 -p1
pushd js/src
autoconf-2.13
popd
autoconf-2.13
# needed to regenerate certdata.c
pushd security/nss/lib/ckfw/builtins
perl ./certdata.perl /etc/pki/tls/mozilla/certdata.txt
popd
%if 0%{?use_bundled_cbindgen}
mkdir -p my_rust_vendor
cd my_rust_vendor
tar xf %{SOURCE12}
cd -
mkdir -p .cargo
cat > .cargo/config <<EOL
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "`pwd`/my_rust_vendor"
EOL
env CARGO_HOME=.cargo cargo install cbindgen
%endif
%build
%if 0%{?use_bundled_cbindgen}
export PATH=`pwd`/.cargo/bin:$PATH
%endif
%if %{mdkver} > 201610
export RUSTFLAGS="-Cdebuginfo=0"
%endif
%if 0%{?clang}
%define linker lld
export CC=clang
export CXX=clang++
%else
%define linker gold
CFLAGS="$CFLAGS -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object"
CXXFLAGS="$CXXFLAGS -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object"
export CFLAGS
export CXXFLAGS
%endif
export MOZCONFIG=`pwd`/mozconfig
cat << EOF > $MOZCONFIG
mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options MOZ_MAKE_FLAGS="%{_smp_mflags}"
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj
ac_add_options --disable-crashreporter
# debug
#ac_add_options --disable-debug
#ac_add_options --disable-debug-symbols
%if %{mdkver} > 201610
ac_add_options --disable-elf-hack
%endif
ac_add_options --disable-tests
ac_add_options --disable-updater
%if %{toolkit_gtk3}
ac_add_options --enable-default-toolkit=cairo-gtk3
%else
ac_add_options --enable-default-toolkit=cairo-gtk2
%endif
# # Enables security hardening compiler options
# ac_add_options --enable-hardening
# # https://bugzilla.mozilla.org/show_bug.cgi?id=1483822
# ac_add_options --enable-linker=%{linker}
# # Optimization for size is broken with gcc7 and later
# ac_add_options --enable-optimize="-O2"
ac_add_options --enable-official-branding
ac_add_options --enable-release
ac_add_options --enable-startup-notification
# # Enable compatibility with older libstdc++
# #ac_add_options --enable-stdcxx-compat
ac_add_options --host=%{_host}
ac_add_options --libdir="%{_libdir}"
ac_add_options --prefix="%{_prefix}"
ac_add_options --target=%{_target_platform}
ac_add_options --with-distribution-id=org.rosa
# Uncomment the following line if you wish to use Google's geolocaton API
# (needed for use with saved maps with Google Maps)
ac_add_options --with-google-location-service-api-keyfile=%{SOURCE11}
ac_add_options --with-google-safebrowsing-api-keyfile=%{SOURCE11}
# Uncomment the following line if you wish to use Mozilla Location Service
ac_add_options --with-mozilla-api-keyfile=%{SOURCE10}
ac_add_options --with-system-bz2
ac_add_options --with-system-jpeg
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-zlib
ac_add_options --with-unsigned-addon-scopes=app
ac_add_options --without-system-libvpx
#ac_add_options --enable-rust-debug
EOF
# force memory efficient linking and ets
%if 0%{?clang}
export LDFLAGS="%{ldflags} -Wl,--no-keep-memory"
%else
export LDFLAGS="%{ldflags} -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
%endif
export MOZ_SERVICES_SYNC="1"
export STRIP=/bin/true
./mach build
%install
# Make sure locale works for langpacks
cat > %{_builddir}/obj/dist/bin/browser/defaults/preferences/firefox-l10n.js << EOF
pref("general.useragent.locale", "chrome://global/locale/intl.properties");
EOF
make -C %{_builddir}/obj/browser/installer STRIP=/bin/true MOZ_PKG_FATAL_WARNINGS=0
# Copy files to buildroot
mkdir -p %{buildroot}%{mozillalibdir}
cp -rf %{_builddir}/obj/dist/firefox/* %{buildroot}%{mozillalibdir}
mkdir -p %{buildroot}%{_bindir}
ln -sf %{mozillalibdir}/firefox %{buildroot}%{_bindir}/firefox
pushd %{buildroot}%{_bindir}
ln -sf firefox mozilla-firefox
popd
mkdir -p %{buildroot}%{mozillalibdir}/defaults/preferences/
install -m 644 %{SOURCE9} %{buildroot}%{mozillalibdir}/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
for i in 16 22 24 32 48 256; do
# (cg) Not all icon sizes are installed with make install, so just redo it here.
install -m 644 browser/branding/official/default$i.png %{buildroot}%{mozillalibdir}/browser/chrome/icons/default/default$i.png
mkdir -p %{buildroot}%{_iconsdir}/hicolor/"$i"x"$i"/apps
ln -sf %{mozillalibdir}/browser/chrome/icons/default/default$i.png %{buildroot}%{_iconsdir}/hicolor/"$i"x"$i"/apps/%{name}.png ;
done
mkdir -p %{buildroot}{%{_liconsdir},%{_iconsdir},%{_miconsdir}}
ln -sf %{mozillalibdir}/browser/chrome/icons/default/default48.png %{buildroot}%{_liconsdir}/%{name}.png
ln -sf %{mozillalibdir}/browser/chrome/icons/default/default32.png %{buildroot}%{_iconsdir}/%{name}.png
ln -sf %{mozillalibdir}/browser/chrome/icons/default/default16.png %{buildroot}%{_miconsdir}/%{name}.png
# exclusions
rm -f %{buildroot}%{mozillalibdir}/README.txt
rm -f %{buildroot}%{mozillalibdir}/removed-files
rm -f %{buildroot}%{mozillalibdir}/precomplete
install -m 644 %{SOURCE7} %{buildroot}%{mozillalibdir}/firefox.cfg
cat << EOF >> %{buildroot}%{mozillalibdir}/defaults/pref/config-prefs.js
pref("general.config.filename", "firefox.cfg");
pref("general.config.obscure_value", 0); // use this to disable the byte-shift
EOF
# display icon for Firefox button
mkdir -p %{buildroot}%{mozillalibdir}/defaults/profile/chrome
cat << EOF > %{buildroot}%{mozillalibdir}/defaults/profile/chrome/userChrome.css
#appmenu-toolbar-button {
list-style-image: url("chrome://branding/content/icon16.png");
}
EOF
# use the system myspell dictionaries
%if %_use_syshunspell
rm -fr %{buildroot}%{mozillalibdir}/dictionaries
ln -s %{_datadir}/dict/mozilla/ %{buildroot}%{mozillalibdir}/dictionaries
%else
rm -fr %{buildroot}%{mozillalibdir}/dictionaries
mkdir -p %{buildroot}%{_datadir}/dict/mozilla/
tar xjf %{SOURCE2} -C %{buildroot}%{_datadir}/dict/mozilla/
ln -s %{_datadir}/dict/mozilla/ %{buildroot}%{mozillalibdir}/dictionaries
%endif
# (lm) touch and %%ghost bookmarks.html to a proper uninstall
touch %{buildroot}%{mozillalibdir}/defaults/profile/bookmarks.html
mkdir -p %{buildroot}%{_sys_macros_dir}
cat <<FIN >%{buildroot}%{_sys_macros_dir}/%{name}.macros
# Macros from %{name} package
%%firefox_major %{major}
%%firefox_epoch %{ff_epoch}
%%firefox_version %{major}
%%firefox_mozillapath %{mozillalibdir}
%%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
mkdir -p %{buildroot}%{_docdir}/%{name}
%pre
if [ -d %{mozillalibdir}/browser/dictionaries ]; then
rm -fr %{mozillalibdir}/browser/dictionaries
fi
%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 ../../../../share/mdk/bookmarks/mozilla/$bookmark %{mozillalibdir}/defaults/profile/bookmarks.html
fi