a5e186dcff5804552883ee508a89711220a68660
[packages/firefox.git] / firefox.spec
1 # TODO:
2 # - consider --enable-libproxy
3 # - enable rust support
4 #
5 # Conditional build:
6 %bcond_with     tests           # enable tests (whatever they check)
7 %bcond_without  gtk3            # GTK+ 3.x instead of 2.x
8 %bcond_without  kerberos        # disable krb5 support
9 %bcond_without  official        # official Firefox branding
10 %bcond_without  pgo             # PGO-enabled build (requires working $DISPLAY == :100)
11 # - disabled shared_js - https://bugzilla.mozilla.org/show_bug.cgi?id=1039964
12 %bcond_with     shared_js       # shared libmozjs library [broken]
13 %bcond_with     system_icu      # build with system ICU (disabled due to crashes with system icu 58.2)
14
15 # On updating version, grab CVE links from:
16 # https://www.mozilla.org/security/known-vulnerabilities/firefox.html
17 # Release Notes:
18 # https://developer.mozilla.org/en-US/Firefox/Releases
19
20 # The actual sqlite version (see RHBZ#480989):
21 %define         sqlite_build_version %(pkg-config --silence-errors --modversion sqlite3 2>/dev/null || echo ERROR)
22
23 %define         nspr_ver        4.13.1
24 %define         nss_ver         3.28.1
25
26 Summary:        Firefox web browser
27 Summary(hu.UTF-8):      Firefox web böngésző
28 Summary(pl.UTF-8):      Firefox - przeglądarka WWW
29 Name:           firefox
30 Version:        53.0
31 Release:        3
32 License:        MPL v2.0
33 Group:          X11/Applications/Networking
34 Source0:        http://releases.mozilla.org/pub/mozilla.org/firefox/releases/%{version}/source/firefox-%{version}.source.tar.xz
35 # Source0-md5:  73175f850d4ff6068c6af674df20477c
36 Source3:        %{name}.desktop
37 Source4:        %{name}.sh
38 Source5:        vendor.js
39 Source6:        vendor-ac.js
40 Patch0:         idl-parser.patch
41 Patch1:         xulrunner-new-libxul.patch
42 Patch2:         xulrunner-paths.patch
43 Patch4:         %{name}-prefs.patch
44 Patch5:         %{name}-pld-bookmarks.patch
45 Patch6:         %{name}-no-subshell.patch
46 Patch7:         %{name}-middle_click_paste.patch
47 Patch8:         %{name}-system-virtualenv.patch
48 Patch9:         %{name}-Disable-Firefox-Health-Report.patch
49 Patch10:        freetype.patch
50 URL:            https://www.mozilla.org/firefox/
51 BuildRequires:  OpenGL-devel
52 BuildRequires:  alsa-lib-devel
53 BuildRequires:  automake
54 BuildRequires:  autoconf2_13
55 BuildRequires:  bzip2-devel
56 BuildRequires:  cairo-devel >= 1.10.2-5
57 BuildRequires:  dbus-glib-devel >= 0.60
58 BuildRequires:  fontconfig-devel >= 1:2.7.0
59 BuildRequires:  freetype-devel >= 1:2.1.8
60 BuildRequires:  gcc-c++ >= 6:4.4
61 BuildRequires:  glib2-devel >= 1:2.22
62 BuildRequires:  gstreamer-devel >= 1.0
63 BuildRequires:  gstreamer-plugins-base-devel >= 1.0
64 %{!?with_gtk3:BuildRequires:    gtk+2-devel >= 2:2.18.0}
65 %{?with_gtk3:BuildRequires:     gtk+3-devel >= 3.4.0}
66 %{?with_kerberos:BuildRequires: heimdal-devel >= 0.7.1}
67 BuildRequires:  hunspell-devel >= 1.6.1
68 BuildRequires:  libIDL-devel >= 0.8.0
69 # DECnet (dnprogs.spec), not dummy net (libdnet.spec)
70 #BuildRequires: libdnet-devel
71 BuildRequires:  libevent-devel >= 1.4.7
72 # standalone libffi 3.0.9 or gcc's from 4.5(?)+
73 BuildRequires:  libffi-devel >= 6:3.0.9
74 %{?with_system_icu:BuildRequires:       libicu-devel >= 58.1}
75 # requires libjpeg-turbo implementing at least libjpeg 6b API
76 BuildRequires:  libjpeg-devel >= 6b
77 BuildRequires:  libjpeg-turbo-devel
78 BuildRequires:  libpng(APNG)-devel >= 0.10
79 BuildRequires:  libpng-devel >= 2:1.6.25
80 BuildRequires:  libstdc++-devel >= 6:4.4
81 BuildRequires:  libvpx-devel >= 1.5.0
82 BuildRequires:  nspr-devel >= 1:%{nspr_ver}
83 BuildRequires:  nss-devel >= 1:%{nss_ver}
84 BuildRequires:  pango-devel >= 1:1.22.0
85 BuildRequires:  pixman-devel >= 0.19.2
86 BuildRequires:  perl-modules >= 5.004
87 BuildRequires:  pkgconfig
88 BuildRequires:  pkgconfig(libffi) >= 3.0.9
89 BuildRequires:  pulseaudio-devel
90 BuildRequires:  python-modules >= 1:2.5
91 %{?with_pgo:BuildRequires:      python-modules-sqlite}
92 BuildRequires:  python-simplejson
93 BuildRequires:  python-virtualenv >= 15
94 BuildRequires:  readline-devel
95 BuildRequires:  rpm >= 4.4.9-56
96 BuildRequires:  rpmbuild(macros) >= 1.601
97 BuildRequires:  sed >= 4.0
98 BuildRequires:  sqlite3-devel >= 3.17.0
99 BuildRequires:  startup-notification-devel >= 0.8
100 BuildRequires:  xorg-lib-libX11-devel
101 BuildRequires:  xorg-lib-libXScrnSaver-devel
102 BuildRequires:  xorg-lib-libXcomposite-devel
103 BuildRequires:  xorg-lib-libXdamage-devel
104 BuildRequires:  xorg-lib-libXext-devel
105 BuildRequires:  xorg-lib-libXfixes-devel
106 BuildRequires:  xorg-lib-libXinerama-devel
107 BuildRequires:  xorg-lib-libXt-devel
108 %{?with_pgo:BuildRequires:      xorg-xserver-Xvfb}
109 %ifarch %{x8664}
110 BuildRequires:  yasm >= 1.0.1
111 %endif
112 BuildRequires:  zip
113 BuildRequires:  zlib-devel >= 1.2.3
114 BuildConflicts: %{name}-devel < %{version}
115 Requires(post): mktemp >= 1.5-18
116 Requires:       browser-plugins >= 2.0
117 Requires:       cairo >= 1.10.2-5
118 Requires:       dbus-glib >= 0.60
119 Requires:       desktop-file-utils
120 Requires:       fontconfig-libs >= 1:2.7.0
121 Requires:       glib2 >= 1:2.22
122 %{!?with_gtk3:Requires: gtk+2 >= 2:2.18.0}
123 %{?with_gtk3:Requires:  gtk+3 >= 3.4.0}
124 Requires:       hicolor-icon-theme
125 Requires:       libjpeg-turbo
126 Requires:       libpng >= 2:1.6.25
127 Requires:       libpng(APNG) >= 0.10
128 Requires:       libvpx >= 1.5.0
129 Requires:       myspell-common
130 Requires:       nspr >= 1:%{nspr_ver}
131 Requires:       nss >= 1:%{nss_ver}
132 Requires:       pango >= 1:1.22.0
133 Requires:       sqlite3 >= %{sqlite_build_version}
134 Requires:       startup-notification >= 0.8
135 Provides:       xulrunner-libs = 2:%{version}-%{release}
136 Provides:       wwwbrowser
137 Obsoletes:      firefox-devel
138 Obsoletes:      firefox-libs
139 Obsoletes:      iceweasel
140 Obsoletes:      iceweasel-libs
141 Obsoletes:      mozilla-firebird
142 Obsoletes:      mozilla-firefox
143 Obsoletes:      mozilla-firefox-lang-en < 2.0.0.8-3
144 Obsoletes:      mozilla-firefox-libs
145 Obsoletes:      xulrunner
146 Obsoletes:      xulrunner-gnome
147 Obsoletes:      xulrunner-libs
148 Conflicts:      firefox-lang-resources < %{version}
149 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
150
151 %define         filterout_cpp           -D_FORTIFY_SOURCE=[0-9]+
152
153 # don't satisfy other packages
154 %define         _noautoprovfiles        %{_libdir}/%{name}
155
156 # and as we don't provide them, don't require either
157 %define         _noautoreq      libmozjs.so libxul.so
158
159 %description
160 Firefox is an open-source web browser, designed for standards
161 compliance, performance and portability.
162
163 %description -l hu.UTF-8
164 Firefox egy nyílt forrású webböngésző, hatékonyságra és
165 hordozhatóságra tervezve.
166
167 %description -l pl.UTF-8
168 Firefox jest przeglądarką WWW rozpowszechnianą zgodnie z ideami
169 ruchu otwartego oprogramowania oraz tworzoną z myślą o zgodności ze
170 standardami, wydajnością i przenośnością.
171
172 %prep
173 %setup -q
174
175 # avoid using included headers (-I. is before HUNSPELL_CFLAGS)
176 %{__rm} extensions/spellcheck/hunspell/src/{*.hxx,hunspell.h}
177 # hunspell needed for factory including mozHunspell.h
178 echo 'LOCAL_INCLUDES += $(MOZ_HUNSPELL_CFLAGS)' >> extensions/spellcheck/src/Makefile.in
179
180 %patch0 -p2
181 %patch1 -p1
182 %patch2 -p2
183 %patch4 -p1
184 %patch5 -p1
185 %patch6 -p2
186 %patch7 -p1
187 %patch8 -p2
188 %patch9 -p1
189 %patch10 -p2
190
191 %{__sed} -i -e '1s,/usr/bin/env python,%{__python},' xpcom/typelib/xpt/tools/xpt.py xpcom/idl-parser/xpidl/xpidl.py
192
193 %if %{with pgo}
194 %{__sed} -i -e 's@__BROWSER_PATH__@"../../dist/bin/firefox-bin"@' build/automation.py.in
195 %endif
196
197 %build
198 cp -p %{_datadir}/automake/config.* build/autoconf
199
200 cat << 'EOF' > .mozconfig
201 . $topsrcdir/browser/config/mozconfig
202
203 mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-%{_target_cpu}
204
205 # Options for 'configure' (same as command-line options).
206 ac_add_options --host=%{_target_platform}
207 ac_add_options --prefix=%{_prefix}
208 %if %{?debug:1}0
209 ac_add_options --disable-optimize
210 ac_add_options --enable-debug
211 ac_add_options --enable-debug-modules
212 ac_add_options --enable-debugger-info-modules
213 ac_add_options --enable-crash-on-assert
214 %else
215 ac_add_options --disable-debug
216 ac_add_options --enable-optimize="%{rpmcflags} -Os"
217 %endif
218 ac_add_options --disable-strip
219 ac_add_options --disable-install-strip
220 %if %{with tests}
221 ac_add_options --enable-tests
222 ac_add_options --enable-mochitest
223 %else
224 %if %{with pgo}
225 ac_add_options --enable-tests
226 %else
227 ac_add_options --disable-tests
228 %endif
229 %endif
230 ac_add_options --disable-crashreporter
231 ac_add_options --disable-gconf
232 ac_add_options --disable-gnomeui
233 ac_add_options --disable-necko-wifi
234 ac_add_options --disable-updater
235 ac_add_options --disable-rust
236 ac_add_options --enable-alsa
237 ac_add_options --enable-chrome-format=omni
238 ac_add_options --enable-default-toolkit=%{?with_gtk3:cairo-gtk3}%{!?with_gtk3:cairo-gtk2}
239 ac_add_options --enable-extensions=default
240 ac_add_options --enable-gio
241 ac_add_options --enable-readline
242 ac_add_options --enable-safe-browsing
243 %{?with_shared_js:ac_add_options --enable-shared-js}
244 ac_add_options --enable-startup-notification
245 ac_add_options --enable-system-cairo
246 ac_add_options --enable-system-ffi
247 ac_add_options --enable-system-hunspell
248 ac_add_options --enable-system-sqlite
249 ac_add_options --enable-url-classifier
250 %{?with_official:ac_add_options --enable-official-branding}
251 ac_add_options --with-default-mozilla-five-home=%{_libdir}/%{name}
252 ac_add_options --with-distribution-id=org.pld-linux
253 ac_add_options --with-pthreads
254 ac_add_options --with-system-bz2
255 ac_add_options --with%{!?with_system_icu:out}-system-icu
256 ac_add_options --with-system-jpeg
257 ac_add_options --with-system-libevent
258 ac_add_options --with-system-libvpx
259 ac_add_options --with-system-nspr
260 ac_add_options --with-system-nss
261 ac_add_options --with-system-png
262 ac_add_options --with-system-zlib
263 ac_add_options --with-x
264 EOF
265
266 %if %{with pgo}
267 D=$(( RANDOM % (200 - 100 + 1 ) + 5 ))
268 /usr/bin/Xvfb :${D} &
269 XVFB_PID=$!
270 [ -n "$XVFB_PID" ] || exit 1
271 export DISPLAY=:${D}
272 %{__make} -j1 -f client.mk profiledbuild \
273         AUTOCONF=/usr/bin/autoconf2_13 \
274         DESTDIR=obj-%{_target_cpu}/dist \
275         MOZ_MAKE_FLAGS="%{_smp_mflags}"
276 kill $XVFB_PID
277 %else
278 %{__make} -j1 -f client.mk build \
279         AUTOCONF=/usr/bin/autoconf2_13 \
280         MOZ_MAKE_FLAGS="%{_smp_mflags}"
281 %endif
282
283 %install
284 rm -rf $RPM_BUILD_ROOT
285 install -d \
286         $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_libdir}} \
287         $RPM_BUILD_ROOT%{_desktopdir} \
288         $RPM_BUILD_ROOT%{_datadir}/%{name}/browser \
289         $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/plugins \
290         $RPM_BUILD_ROOT%{_includedir}/%{name} \
291         $RPM_BUILD_ROOT%{_pkgconfigdir}
292
293 %browser_plugins_add_browser %{name} -p %{_libdir}/%{name}/browser/plugins
294
295 cd obj-%{_target_cpu}
296 %{__make} -C browser/installer stage-package \
297         DESTDIR=$RPM_BUILD_ROOT \
298         installdir=%{_libdir}/%{name} \
299         PKG_SKIP_STRIP=1
300
301 cp -aL dist/firefox/* $RPM_BUILD_ROOT%{_libdir}/%{name}/
302
303 # move arch independant ones to datadir
304 mv $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/chrome $RPM_BUILD_ROOT%{_datadir}/%{name}/browser/chrome
305 mv $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/extensions $RPM_BUILD_ROOT%{_datadir}/%{name}/browser/extensions
306 mv $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/icons $RPM_BUILD_ROOT%{_datadir}/%{name}/browser/icons
307 mv $RPM_BUILD_ROOT%{_libdir}/%{name}/defaults $RPM_BUILD_ROOT%{_datadir}/%{name}/browser/defaults
308 mv $RPM_BUILD_ROOT%{_datadir}/%{name}/browser/defaults/{pref,preferences}
309
310 ln -s ../../../share/%{name}/browser/chrome $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/chrome
311 ln -s ../../../share/%{name}/browser/defaults $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/defaults
312 ln -s ../../../share/%{name}/browser/extensions $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/extensions
313 ln -s ../../../share/%{name}/browser/icons $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/icons
314
315 %{__rm} -r $RPM_BUILD_ROOT%{_libdir}/%{name}/dictionaries
316 ln -s %{_datadir}/myspell $RPM_BUILD_ROOT%{_libdir}/%{name}/dictionaries
317
318 sed 's,@LIBDIR@,%{_libdir},' %{SOURCE4} > $RPM_BUILD_ROOT%{_bindir}/firefox
319 chmod 755 $RPM_BUILD_ROOT%{_bindir}/firefox
320
321 # install icons and desktop file
322 for i in 16 32 48 %{?with_official:22 24 256}; do
323         install -d $RPM_BUILD_ROOT%{_iconsdir}/hicolor/${i}x${i}/apps
324         cp -a ../browser/branding/%{!?with_official:un}official/default${i}.png \
325                 $RPM_BUILD_ROOT%{_iconsdir}/hicolor/${i}x${i}/apps/firefox.png
326 done
327
328 cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
329
330 # install our settings
331 %if "%{pld_release}" == "ac"
332 cp -a %{SOURCE6} $RPM_BUILD_ROOT%{_datadir}/%{name}/browser/defaults/preferences/vendor.js
333 %else
334 cp -a %{SOURCE5} $RPM_BUILD_ROOT%{_datadir}/%{name}/browser/defaults/preferences/vendor.js
335 %endif
336
337 cat << 'EOF' > $RPM_BUILD_ROOT%{_sbindir}/%{name}-chrome+xpcom-generate
338 #!/bin/sh
339 umask 022
340 rm -f %{_libdir}/%{name}/browser/components/{compreg,xpti}.dat
341
342 # it attempts to touch files in $HOME/.mozilla
343 # beware if you run this with sudo!!!
344 export HOME=$(mktemp -d)
345 # also TMPDIR could be pointing to sudo user's homedir
346 unset TMPDIR TMP || :
347
348 %{_libdir}/%{name}/firefox -register
349
350 rm -rf $HOME
351 EOF
352 chmod 755 $RPM_BUILD_ROOT%{_sbindir}/%{name}-chrome+xpcom-generate
353
354 %clean
355 rm -rf $RPM_BUILD_ROOT
356
357 %post
358 %{_sbindir}/%{name}-chrome+xpcom-generate
359 %update_browser_plugins
360 %update_icon_cache hicolor
361 %update_desktop_database
362
363 %postun
364 if [ "$1" = 0 ]; then
365         %update_browser_plugins
366         %update_icon_cache hicolor
367 fi
368
369 %files
370 %defattr(644,root,root,755)
371 %attr(755,root,root) %{_bindir}/%{name}
372 %attr(755,root,root) %{_sbindir}/%{name}-chrome+xpcom-generate
373
374 %{_desktopdir}/firefox.desktop
375 %{_iconsdir}/hicolor/*/apps/firefox.png
376
377 # browser plugins v2
378 %{_browserpluginsconfdir}/browsers.d/%{name}.*
379 %config(noreplace) %verify(not md5 mtime size) %{_browserpluginsconfdir}/blacklist.d/%{name}.*.blacklist
380
381 %dir %{_libdir}/%{name}/browser
382 %dir %{_libdir}/%{name}/browser/plugins
383 %dir %{_libdir}/%{name}/browser/features
384
385 %dir %{_datadir}/%{name}
386 %dir %{_datadir}/%{name}/browser
387 %dir %{_datadir}/%{name}/browser/extensions
388 %{_datadir}/%{name}/browser/chrome
389 %{_datadir}/%{name}/browser/defaults
390 %{_datadir}/%{name}/browser/icons
391
392 # symlinks
393 %{_libdir}/%{name}/browser/extensions
394 %{_libdir}/%{name}/browser/chrome
395 %{_libdir}/%{name}/browser/icons
396 %{_libdir}/%{name}/browser/defaults
397
398 %attr(755,root,root) %{_libdir}/%{name}/firefox
399 %attr(755,root,root) %{_libdir}/%{name}/firefox-bin
400 %attr(755,root,root) %{_libdir}/%{name}/run-mozilla.sh
401 %{_libdir}/%{name}/application.ini
402 %{_libdir}/%{name}/chrome.manifest
403 %{_libdir}/%{name}/browser/blocklist.xml
404 %{_libdir}/%{name}/browser/chrome.manifest
405 # the signature of the default theme
406 %{_datadir}/%{name}/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
407 %{_libdir}/%{name}/browser/omni.ja
408
409 %{_libdir}/%{name}/browser/features/aushelper@mozilla.org.xpi
410 %{_libdir}/%{name}/browser/features/e10srollout@mozilla.org.xpi
411 %{_libdir}/%{name}/browser/features/firefox@getpocket.com.xpi
412 %{_libdir}/%{name}/browser/features/webcompat@mozilla.org.xpi
413
414 %attr(755,root,root) %{_libdir}/%{name}/plugin-container
415 %{_libdir}/%{name}/dictionaries
416
417 %dir %{_libdir}/%{name}/fonts
418 %{_libdir}/%{name}/fonts/EmojiOneMozilla.ttf
419
420 %dir %{_libdir}/%{name}/gmp-clearkey
421 %dir %{_libdir}/%{name}/gmp-clearkey/0.1
422 %{_libdir}/%{name}/gmp-clearkey/0.1/manifest.json
423 %attr(755,root,root) %{_libdir}/%{name}/gmp-clearkey/0.1/libclearkey.so
424 %{!?with_system_icu:%{_libdir}/%{name}/icudt58l.dat}
425
426 %dir %{_libdir}/%{name}
427 %{_libdir}/%{name}/platform.ini
428 %{?with_shared_js:%attr(755,root,root) %{_libdir}/%{name}/libmozjs.so}
429 %attr(755,root,root) %{_libdir}/%{name}/liblgpllibs.so
430 %attr(755,root,root) %{_libdir}/%{name}/libxul.so
431 %attr(755,root,root) %{_libdir}/%{name}/libmozavcodec.so
432 %attr(755,root,root) %{_libdir}/%{name}/libmozavutil.so
433 %attr(755,root,root) %{_libdir}/%{name}/libmozsandbox.so
434 %{_libdir}/%{name}/dependentlibs.list
435 %{_libdir}/%{name}/omni.ja
436 %if %{with gtk3}
437 %dir %{_libdir}/%{name}/gtk2
438 %attr(755,root,root) %{_libdir}/%{name}/gtk2/libmozgtk.so
439 %attr(755,root,root) %{_libdir}/%{name}/libmozgtk.so
440 %endif
This page took 0.06388 seconds and 2 git commands to generate.