firefox-esr68/firefox.spec
2018-06-27 17:12:41 +03:00

361 lines
12 KiB
RPMSpec

#
# 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 61.0
%define ff_epoch 0
%define relurl 0
%define rel_url 6b51784853e47e091d213d421a19cb623af718f0
# (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
Summary: Next generation web browser
Name: firefox
Version: %{major}
Epoch: %{ff_epoch}
Release: 1
License: MPLv1+
Group: Networking/WWW
Url: http://www.mozilla.com/firefox/
%if %{relurl}
Source0: https://hg.mozilla.org/releases/mozilla-release/archive/%{rel_url}.tar.bz2?/mozilla-release-%{rel_url}.tar.bz2
%else
Source0: https://archive.mozilla.org/pub/firefox/releases/%{realver}/source/%{name}-%{realver}.source.tar.xz
%endif
Source4: %{name}.desktop
Source7: firefox.cfg
Source9: kde.js
# 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
Patch37: firefox-50.1-fix-glibc-check.patch
# Fedora specific patches
# Unable to install addons from https pages
Patch215: firefox-enable-addons.patch
Patch219: rhbz-1173156.patch
Patch300: firefox-56.0-build-error.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
BuildRequires: lld
BuildRequires: libatomic-devel
BuildRequires: pkgconfig(xinerama)
BuildRequires: pkgconfig(xscrnsaver)
BuildRequires: jpeg-devel
BuildRequires: zlib-devel
BuildRequires: glib2-devel
BuildRequires: pkgconfig(python3)
BuildRequires: pkgconfig(libIDL-2.0)
BuildRequires: makedepend
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
%{_bindir}/%{name}
%{_bindir}/mozilla-firefox
%{_iconsdir}/hicolor/*/apps/*.png
%{_miconsdir}/%{name}.png
%{_iconsdir}/%{name}.png
%{_liconsdir}/%{name}.png
%{_datadir}/applications/*.desktop
%{_libdir}/%{name}-%{major}*
%dir %{_libdir}/mozilla
%dir %{_libdir}/mozilla/extensions
%dir %{pluginsdir}
%dir %{_libdir}/mozilla/extensions/%{firefox_appid}
%dir %{_datadir}/mozilla/extensions/%{firefox_appid}
#---------------------------------------------------------------------
%package devel
Summary: Development files for %{name}
Group: Development/Other
%description devel
Files and macros mainly for building Firefox extensions.
%files devel
%{_sys_macros_dir}/%{name}.macros
#---------------------------------------------------------------------
%prep
%if %{relurl}
%setup -qn mozilla-release-%{rel_url}
%else
%setup -q
%endif
## KDE INTEGRATION
%patch11 -p1 -b .kdepatch
%patch12 -p1 -b .kdemoz
#%%patch13 -p1 -b .kdebackground
%patch35 -p1
%patch37 -p1
# Fedora patches
%patch215 -p1 -b .addons
%patch219 -p2 -b .rhbz-1173156
%patch300 -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
%build
%if 0%{?clang}
export CC=clang
export CXX=clang++
export LINKER=ld.lld
%else
CFLAGS="$CFLAGS -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object"
CXXFLAGS="$CFLAGS -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object"
export CFLAGS
export CXXFLAGS
%endif
export MOZCONFIG=`pwd`/mozconfig
cat << EOF > $MOZCONFIG
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZ_MAKE_FLAGS="%{_smp_mflags}"
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj
ac_add_options --host=%{_host}
ac_add_options --target=%{_target_platform}
ac_add_options --enable-release
ac_add_options --prefix="%{_prefix}"
ac_add_options --libdir="%{_libdir}"
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-zlib
ac_add_options --with-system-jpeg
ac_add_options --with-pthreads
ac_add_options --without-system-libvpx
ac_add_options --with-system-bz2
ac_add_options --disable-updater
ac_add_options --disable-tests
%if %{toolkit_gtk3}
ac_add_options --enable-default-toolkit=cairo-gtk3
%else
ac_add_options --enable-default-toolkit=cairo-gtk2
%endif
ac_add_options --enable-official-branding
ac_add_options --disable-system-sqlite
ac_add_options --enable-startup-notification
ac_add_options --with-distribution-id=org.rosa
ac_add_options --disable-crashreporter
ac_add_options --disable-debug
#ac_add_options --enable-rust-debug
EOF
perl -p -i -e 's|\-0|\-9|g' config/make-jars.pl
export LDFLAGS="%{ldflags}"
./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
rm -fr %{buildroot}%{mozillalibdir}/dictionaries
ln -s %{_datadir}/dict/mozilla/ %{buildroot}%{mozillalibdir}/dictionaries
# (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