conditional BR for clang
[packages/thunderbird.git] / thunderbird.spec
CommitLineData
c4ddd260 1# TODO:
283702b9 2# - build with system mozldap
210a9feb 3# - fix startup crash "TypeError: a is null"
c4ddd260 4#
44be9ed4 5# Conditional builds
8b3db612 6%bcond_with tests # enable tests (whatever they check)
210a9feb 7%bcond_without gtk3 # GTK+ 3.x instead of 2.x
44be9ed4 8%bcond_without ldap # disable e-mail address lookups in LDAP directories
e820c55e 9%bcond_without lightning # disable Sunbird/Lightning calendar
506cce80 10%bcond_without official # official Thunderbird branding
765a3a27 11%bcond_with crashreporter # report crashes to crash-stats.mozilla.com
a97d3356
JR
12# - disabled shared_js - https://bugzilla.mozilla.org/show_bug.cgi?id=1039964
13%bcond_with shared_js # shared libmozjs library [broken]
99b97bc4 14%bcond_with system_icu # build with system ICU (disabled due to crashes with system icu 58.2)
293b5895 15%bcond_without clang # build using Clang/LLVM
88149483 16
f4114a7f 17%if 0%{?_enable_debug_packages} != 1
765a3a27
ER
18%undefine crashreporter
19%endif
20
8b3db612 21%define nspr_ver 4.13.1
5b7bcd89 22%define nss_ver 3.28.5
44be9ed4 23
7d981f69
ER
24# The actual sqlite version (see RHBZ#480989):
25%define sqlite_build_version %(pkg-config --silence-errors --modversion sqlite3 2>/dev/null || echo ERROR)
7d981f69 26
cae5b55b
JR
27Summary: Thunderbird - email client
28Summary(pl.UTF-8): Thunderbird - klient poczty
29Name: thunderbird
962f00cb 30Version: 52.3.0
1e1b81a7 31Release: 1
3366507a 32License: MPL v2.0
2d289b25 33Group: X11/Applications/Mail
cae5b55b 34Source0: http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/%{version}/source/%{name}-%{version}.source.tar.xz
962f00cb 35# Source0-md5: 5841ee1a70423b9385110c82b78bef47
dd12359d
JR
36Source1: %{name}.desktop
37Source2: %{name}.sh
38Patch0: prefs.patch
39Patch1: no-subshell.patch
40Patch2: enable-addons.patch
210a9feb 41Patch3: mozilla-1245783.patch
cae5b55b 42URL: http://www.mozilla.org/projects/thunderbird/
51a3b6db 43BuildRequires: alsa-lib-devel
ea3df35f 44BuildRequires: autoconf2_13 >= 2.13
51a3b6db 45BuildRequires: bzip2-devel
e820c55e 46BuildRequires: cairo-devel >= 1.10
a22a585b 47%{?with_clang:BuildRequires: clang}
e820c55e 48BuildRequires: dbus-glib-devel >= 0.60
5b7bcd89 49BuildRequires: fontconfig-devel >= 2.7.0
44be9ed4 50BuildRequires: freetype-devel >= 1:2.1.8
ea3df35f 51BuildRequires: glib2-devel >= 1:2.22
99b97bc4
JR
52%{!?with_gtk3:BuildRequires: gtk+2-devel >= 2:2.18.0}
53%{?with_gtk3:BuildRequires: gtk+3-devel >= 3.4.0}
5e9bb798 54BuildRequires: hunspell-devel
5b9c8e4c 55BuildRequires: libatomic-devel
d0b96b40 56BuildRequires: libevent-devel
5b7bcd89 57BuildRequires: libffi-devel > 3.0.9
99b97bc4 58%{?with_system_icu:BuildRequires: libicu-devel >= 58.1}
51a3b6db 59BuildRequires: libiw-devel
e82da7a1 60# requires libjpeg-turbo implementing at least libjpeg 6b API
44be9ed4 61BuildRequires: libjpeg-devel >= 6b
e82da7a1 62BuildRequires: libjpeg-turbo-devel
ea3df35f 63BuildRequires: libpng-devel >= 2:1.6.25
44be9ed4 64BuildRequires: libstdc++-devel
5b7bcd89 65BuildRequires: libvpx-devel >= 1.5.0
d0b96b40 66BuildRequires: mozldap-devel
f4114a7f
ER
67BuildRequires: nspr-devel >= 1:%{nspr_ver}
68BuildRequires: nss-devel >= 1:%{nss_ver}
62096d2c 69BuildRequires: pango-devel >= 1:1.22.0
e820c55e 70BuildRequires: perl-base >= 1:5.6
5b7bcd89 71BuildRequires: pixman-devel >= 0.19.2
1c62cadb 72BuildRequires: pkgconfig
ea3df35f 73BuildRequires: python >= 1:2.7
cae5b55b 74BuildRequires: python-virtualenv
44be9ed4 75BuildRequires: sed >= 4.0
5b7bcd89 76BuildRequires: sqlite3-devel >= 3.17.0
1c62cadb 77BuildRequires: startup-notification-devel >= 0.8
ffb12c8e 78BuildRequires: virtualenv
ea3df35f
JB
79BuildRequires: xorg-lib-libX11-devel
80BuildRequires: xorg-lib-libXcomposite-devel
81BuildRequires: xorg-lib-libXdamage-devel
44be9ed4 82BuildRequires: xorg-lib-libXext-devel
ea3df35f 83BuildRequires: xorg-lib-libXfixes-devel
44be9ed4 84BuildRequires: xorg-lib-libXt-devel
ea3df35f
JB
85%ifarch %{ix86} %{x8664}
86BuildRequires: yasm >= 1.0.1
87%endif
1c62cadb 88BuildRequires: zip
ea3df35f
JB
89BuildRequires: zlib-devel >= 1.2.3
90Requires(post): mktemp >= 1.5-18
91Requires: dbus-glib >= 0.60
92Requires: glib2 >= 1:2.22
99b97bc4
JR
93%{!?with_gtk3:Requires: gtk+2 >= 2:2.18.0}
94%{?with_gtk3:Requires: gtk+3 >= 3.4.0}
ea3df35f 95Requires: libpng >= 2:1.6.25
5b7bcd89 96Requires: libvpx >= 1.5.0
44be9ed4 97Requires: myspell-common
f4114a7f
ER
98Requires: nspr >= 1:%{nspr_ver}
99Requires: nss >= 1:%{nss_ver}
62096d2c 100Requires: pango >= 1:1.22.0
4b6bc367 101Requires: sqlite3 >= %{sqlite_build_version}
ea3df35f 102Requires: startup-notification >= 0.8
e82da7a1 103Requires: libjpeg-turbo
99b97bc4 104Obsoletes: icedove
44be9ed4 105Obsoletes: mozilla-thunderbird
106Obsoletes: mozilla-thunderbird-dictionary-en-US
cae5b55b 107Conflicts: thunderbird-lang-resources < %{version}
44be9ed4 108BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
109
9e366f18
AM
110%define filterout_cpp -D_FORTIFY_SOURCE=[0-9]+
111
e9df532c
JR
112%if %{with clang}
113%define filterout -fvar-tracking-assignments
114%endif
115
cae5b55b 116# firefox/thunderbird/seamonkey provide their own versions
44be9ed4 117%define _noautoprovfiles %{_libdir}/%{name}/components
99b97bc4 118
fb7d4f06 119# we don't want these to satisfy packages depending on xulrunner
6f32f966 120%define _noautoprov libmozalloc.so libmozjs.so libxul.so
44be9ed4 121# and as we don't provide them, don't require either
6f32f966 122%define _noautoreq libmozalloc.so libmozjs.so libxul.so
44be9ed4 123
7a5e9406 124%define topdir %{_builddir}/thunderbird-%{version}
9e7875fc
ER
125%define objdir %{topdir}/obj-%{_target_cpu}
126
44be9ed4 127%description
cae5b55b 128Thunderbird is an open-source, fast and portable email client.
44be9ed4 129
130%description -l pl.UTF-8
cae5b55b 131Thunderbird jest mającym otwarte źródła, szybkim i przenośnym klientem
6b327de6 132poczty.
44be9ed4 133
6578c165 134%package addon-lightning
cae5b55b
JR
135Summary: An integrated calendar for Thunderbird
136Summary(pl.UTF-8): Zintegrowany kalendarz dla Thunderbird
6578c165 137License: MPL 1.1 or GPL v2+ or LGPL v2.1+
138Group: Applications/Networking
139Requires: %{name} = %{version}-%{release}
99b97bc4 140Obsoletes: icedove-addon-lightning
6578c165 141
142%description addon-lightning
cae5b55b 143Lightning is an calendar extension to Thunderbird email client.
6578c165 144
145%description addon-lightning -l pl.UTF-8
cae5b55b 146Lightning to rozszerzenie do klienta poczty Thunderbird dodające
6578c165 147funkcjonalność kalendarza.
148
44be9ed4 149%prep
cae5b55b 150%setup -q
dd12359d
JR
151%patch0 -p1
152%patch1 -p1
f53f9bcd 153%patch2 -p1
dd12359d 154%patch3 -p1
d0b96b40 155
44be9ed4 156%build
fbac75ca 157cat << EOF > .mozconfig
9e7875fc 158mk_add_options MOZ_OBJDIR=%{objdir}
cb0e4412 159
19f2dc46
JR
160%if %{with clang}
161export CC="clang"
162export CXX="clang++"
163%else
164export CC="%{__cc}"
165export CXX="%{__cxx}"
166%endif
167export CFLAGS="%{rpmcflags} -D_FILE_OFFSET_BITS=64"
168export CXXFLAGS="%{rpmcxxflags} -D_FILE_OFFSET_BITS=64"
169
765a3a27
ER
170%if %{with crashreporter}
171export MOZ_DEBUG_SYMBOLS=1
172%endif
173
59c5a0e8 174# Options for 'configure' (same as command-line options).
44be9ed4 175ac_add_options --prefix=%{_prefix}
44be9ed4 176%if %{?debug:1}0
59c5a0e8 177ac_add_options --disable-optimize
44be9ed4 178ac_add_options --enable-debug
179ac_add_options --enable-debug-modules
59c5a0e8
SP
180ac_add_options --enable-debugger-info-modules
181ac_add_options --enable-crash-on-assert
44be9ed4 182%else
183ac_add_options --disable-debug
59c5a0e8 184ac_add_options --enable-optimize="%{rpmcflags} -Os"
44be9ed4 185%endif
88149483 186ac_add_options --disable-strip
210a9feb 187ac_add_options --disable-install-strip
44be9ed4 188%if %{with tests}
189ac_add_options --enable-tests
210a9feb 190ac_add_options --enable-mochitest
44be9ed4 191%else
192ac_add_options --disable-tests
193%endif
3366507a
JB
194%if %{with lightning}
195ac_add_options --enable-calendar
44be9ed4 196%else
3366507a 197ac_add_options --disable-calendar
44be9ed4 198%endif
765a3a27
ER
199%if %{with crashreporter}
200ac_add_options --enable-crashreporter
201%else
59c5a0e8 202ac_add_options --disable-crashreporter
765a3a27 203%endif
99b97bc4 204#ac_add_options --disable-elf-hack
8b3db612 205ac_add_options --disable-gconf
3366507a 206ac_add_options --disable-gnomeui
8b3db612 207ac_add_options --disable-necko-wifi
88149483 208ac_add_options --disable-updater
8b3db612 209ac_add_options --enable-alsa
3366507a 210ac_add_options --enable-application=mail
ea3df35f 211ac_add_options --enable-chrome-format=omni
3366507a
JB
212ac_add_options --enable-default-toolkit=%{?with_gtk3:cairo-gtk3}%{!?with_gtk3:cairo-gtk2}
213ac_add_options --enable-gio
214%if %{with ldap}
215ac_add_options --enable-ldap
3366507a
JB
216%else
217ac_add_options --disable-ldap
218%endif
ea3df35f
JB
219%{?with_official:ac_add_options --enable-official-branding}
220ac_add_options --enable-readline
a97d3356 221%{?with_shared_js:ac_add_options --enable-shared-js}
88149483 222ac_add_options --enable-startup-notification
44be9ed4 223ac_add_options --enable-system-cairo
210a9feb 224ac_add_options --enable-system-ffi
5e9bb798 225ac_add_options --enable-system-hunspell
7d981f69 226ac_add_options --enable-system-sqlite
210a9feb 227ac_add_options --enable-url-classifier
3366507a
JB
228ac_add_options --with-default-mozilla-five-home=%{_libdir}/%{name}
229ac_add_options --with-distribution-id=org.pld-linux
88149483
ER
230ac_add_options --with-pthreads
231ac_add_options --with-system-bz2
99b97bc4 232ac_add_options --with%{!?with_system_icu:out}-system-icu
44be9ed4 233ac_add_options --with-system-jpeg
d0b96b40
JR
234ac_add_options --with-system-libevent
235ac_add_options --with-system-libvpx
44be9ed4 236ac_add_options --with-system-nspr
237ac_add_options --with-system-nss
238ac_add_options --with-system-png
239ac_add_options --with-system-zlib
210a9feb 240ac_add_options --with-x
44be9ed4 241EOF
242
d0b96b40 243mkdir -p %{objdir}/config
7a5e9406 244ln -sf %{topdir}/mozilla/config/*.mk %{objdir}/config
d0b96b40 245
90e998ba 246%{__make} -j1 -f client.mk build \
210a9feb
JR
247 AUTOCONF=/usr/bin/autoconf2_13 \
248 MOZ_MAKE_FLAGS="%{_smp_mflags}"
44be9ed4 249
765a3a27
ER
250%if %{with crashreporter}
251# create debuginfo for crash-stats.mozilla.com
252%{__make} -j1 -C obj-%{_target_cpu} buildsymbols
253%endif
254
44be9ed4 255%install
256rm -rf $RPM_BUILD_ROOT
99b97bc4 257install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir}/%{name}/plugins,%{_datadir}/%{name},%{_pixmapsdir},%{_desktopdir}}
44be9ed4 258
9e7875fc 259cd %{objdir}
ecf04393 260%{__make} -C mail/installer stage-package \
44be9ed4 261 DESTDIR=$RPM_BUILD_ROOT \
d0b96b40 262 installdir=%{_libdir}/%{name} \
44be9ed4 263 PKG_SKIP_STRIP=1
264
cae5b55b 265cp -a dist/thunderbird/* $RPM_BUILD_ROOT%{_libdir}/%{name}/
d0b96b40 266
9b40a2c3 267# Enable crash reporter for Thunderbird application
765a3a27
ER
268%if %{with crashreporter}
269%{__sed} -i -e 's/\[Crash Reporter\]/[Crash Reporter]\nEnabled=1/' $RPM_BUILD_ROOT%{_libdir}/%{name}/application.ini
270
271# Add debuginfo for crash-stats.mozilla.com
51a3b6db 272install -d $RPM_BUILD_ROOT%{_exec_prefix}/lib/debug%{_libdir}/%{name}
3a30e2d7 273cp -a dist/%{name}-%{version}.en-US.linux-*.crashreporter-symbols.zip $RPM_BUILD_ROOT%{_prefix}/lib/debug%{_libdir}/%{name}
765a3a27
ER
274%endif
275
99b97bc4
JR
276%{__sed} -e 's,@LIBDIR@,%{_libdir},' %{SOURCE2} > $RPM_BUILD_ROOT%{_bindir}/%{name}
277cp -p dist/thunderbird/chrome/icons/default/default48.png $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
78c9ef4f 278cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
c6ec3c1c 279
99b97bc4
JR
280# use system dict
281%{__rm} -rv $RPM_BUILD_ROOT%{_libdir}/%{name}/dictionaries
44be9ed4 282ln -s %{_datadir}/myspell $RPM_BUILD_ROOT%{_libdir}/%{name}/dictionaries
99b97bc4 283ln -s %{_datadir}/myspell $RPM_BUILD_ROOT%{_libdir}/%{name}/hyphenation
e6bc19b3 284
99b97bc4
JR
285# move arch independant ones to datadir
286mv $RPM_BUILD_ROOT%{_libdir}/%{name}/chrome $RPM_BUILD_ROOT%{_datadir}/%{name}/chrome
287mv $RPM_BUILD_ROOT%{_libdir}/%{name}/defaults $RPM_BUILD_ROOT%{_datadir}/%{name}/defaults
288mv $RPM_BUILD_ROOT%{_libdir}/%{name}/isp $RPM_BUILD_ROOT%{_datadir}/%{name}/isp
289ln -s ../../share/%{name}/chrome $RPM_BUILD_ROOT%{_libdir}/%{name}/chrome
290ln -s ../../share/%{name}/defaults $RPM_BUILD_ROOT%{_libdir}/%{name}/defaults
291ln -s ../../share/%{name}/isp $RPM_BUILD_ROOT%{_libdir}/%{name}/isp
52fc61e6 292
283702b9 293# mozldap
d0b96b40
JR
294%{__sed} -i '/lib\(ldap\|ldif\|prldap\)60.so/d' $RPM_BUILD_ROOT%{_libdir}/%{name}/dependentlibs.list
295%{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/lib{ldap,ldif,prldap}60.so
283702b9 296
99b97bc4
JR
297# remove unecessary stuff
298%{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/removed-files
299
44be9ed4 300%clean
301rm -rf $RPM_BUILD_ROOT
302
303%pretrans
304if [ -d %{_libdir}/%{name}/dictionaries ] && [ ! -L %{_libdir}/%{name}/dictionaries ]; then
305 mv -v %{_libdir}/%{name}/dictionaries{,.rpmsave}
306fi
99b97bc4 307for d in chrome defaults icons isp modules res; do
44be9ed4 308 if [ -d %{_libdir}/%{name}/$d ] && [ ! -L %{_libdir}/%{name}/$d ]; then
309 install -d %{_datadir}/%{name}
310 mv %{_libdir}/%{name}/$d %{_datadir}/%{name}/$d
311 fi
312done
313exit 0
314
e8f4ba81 315%post
99b97bc4
JR
316%update_desktop_database_post
317# make temporary HOME, as it attempts to touch files in $HOME/.mozilla
318# dangerous if you run this with sudo with keep_env += HOME
319# also TMPDIR could be pointing to sudo user's homedir so we reset that too.
320export HOME=$(mktemp -d)
321unset TMPDIR TMP || :
322umask 022
323%{_libdir}/%{name}/thunderbird -register
324rm -rf $HOME
325
326%postun
327%update_desktop_database_postun
e8f4ba81 328
44be9ed4 329%files
330%defattr(644,root,root,755)
99b97bc4 331%attr(755,root,root) %{_bindir}/%{name}
44be9ed4 332%dir %{_libdir}/%{name}
99b97bc4
JR
333%dir %{_libdir}/%{name}/plugins
334
335%if %{with gtk3}
336%dir %{_libdir}/%{name}/gtk2
337%attr(755,root,root) %{_libdir}/%{name}/gtk2/libmozgtk.so
338%attr(755,root,root) %{_libdir}/%{name}/libmozgtk.so
339%endif
340%attr(755,root,root) %{_libdir}/%{name}/liblgpllibs.so
341%{?with_shared_js:%attr(755,root,root) %{_libdir}/%{name}/libmozjs.so}
210a9feb 342%attr(755,root,root) %{_libdir}/%{name}/libmozsandbox.so
99b97bc4 343%attr(755,root,root) %{_libdir}/%{name}/libxul.so
73d54cb2
JB
344%attr(755,root,root) %{_libdir}/%{name}/*.sh
345%attr(755,root,root) %{_libdir}/%{name}/*-bin
99b97bc4 346%attr(755,root,root) %{_libdir}/%{name}/plugin-container
cae5b55b 347%attr(755,root,root) %{_libdir}/%{name}/thunderbird
99b97bc4
JR
348
349%{_libdir}/%{name}/application.ini
350%{_libdir}/%{name}/blocklist.xml
a367af64 351%{_libdir}/%{name}/dependentlibs.list
99b97bc4 352%{_libdir}/%{name}/omni.ja
73d54cb2 353%{_libdir}/%{name}/platform.ini
210a9feb
JR
354%{!?with_system_icu:%{_libdir}/%{name}/icudt58l.dat}
355
356%dir %{_libdir}/%{name}/fonts
357%{_libdir}/%{name}/fonts/EmojiOneMozilla.ttf
44be9ed4 358
765a3a27
ER
359%if %{with crashreporter}
360%attr(755,root,root) %{_libdir}/%{name}/crashreporter
361%{_libdir}/%{name}/crashreporter.ini
362%{_libdir}/%{name}/Throbber-small.gif
363%endif
364
44be9ed4 365%dir %{_libdir}/%{name}/extensions
99b97bc4
JR
366%{_libdir}/%{name}/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
367
368%dir %{_libdir}/%{name}/distribution
369%dir %{_libdir}/%{name}/distribution/extensions
370
371# symlinks
372%{_libdir}/%{name}/chrome
373%{_libdir}/%{name}/defaults
374%{_libdir}/%{name}/dictionaries
375%{_libdir}/%{name}/hyphenation
376%{_libdir}/%{name}/isp
6578c165 377
99b97bc4
JR
378%{_pixmapsdir}/*.png
379%{_desktopdir}/*.desktop
52fc61e6 380
99b97bc4
JR
381%dir %{_datadir}/%{name}
382%{_datadir}/%{name}/chrome
383%{_datadir}/%{name}/defaults
384%{_datadir}/%{name}/isp
d0b96b40 385
6578c165 386%if %{with lightning}
387%files addon-lightning
388%defattr(644,root,root,755)
3a30e2d7
JR
389%dir %{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}
390%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/app.ini
391%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/chrome.jar
392%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/chrome.manifest
393%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/defaults
394%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/install.rdf
395%dir %{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/components
3a30e2d7
JR
396%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/components/*.js
397%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/components/*manifest
398%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/components/*.xpt
399%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/modules
400%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/calendar-js
401%dir %{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/timezones
402%{_libdir}/%{name}/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/timezones/zones.json
6578c165 403%endif
This page took 0.326562 seconds and 4 git commands to generate.