%ifarch %{ix86} %define _build_id_links none %endif %define upstream_version %{version} # The tarball is pretty inconsistent with directory structure. # Sometimes there is a top level directory. That goes here. # # IMPORTANT: If there is no top level directory, this should be # set to the cwd, ie: '.' %define release_dir %{name}-%{version} %define title Mozilla Thunderbird # # Compiler Choices # %define _smp_ncpus_max 8 # Use CCache for speedup compiling (only for developing) %define use_ccache 0 %{?_with_ccache: %global use_ccache 1} %{?_without_ccache: %global use_ccache 0} # Enable O3 Optimization %define use_opt_o3 0 %{?_with_opt_o3: %global use_opt_o3 1} %{?_without_opt_o3: %global use_opt_o3 0} # Use GTK3 toolkit %define use_toolkit_gtk3 1 %{?_with_gtk3: %global use_toolkit_gtk3 1} %{?_without_gtk3: %global use_toolkit_gtk3 0} %define oname thunderbird %define tb_appid \{3550f703-e582-4d05-9a08-453d09bdfdc6\} %define tbdir %{_libdir}/%{name} %define tbextdir %{_libdir}/mozilla/extensions/%{tb_appid} %global langpackdir %{tbdir}/distribution/extensions #(doktor5000) this is where the actual build happens to keep compiled objects out-of-tree # see https://bugzilla.mozilla.org/show_bug.cgi?id=1106883#c4 for context information %define objdir objdir # fallback using absolute path - should be used with .mozconfig # see https://bugzilla.mozilla.org/show_bug.cgi?id=1106883#c4 for context information #define objdir objdir-tb %%{_builddir}/%%{name}-%%{version}/%%{release_dir}/%%{objdir} %global __provides_exclude libgtkembedmoz.so|libxpcom.so %global __requires_exclude libgtkembedmoz.so|libxpcom.so|libxul.so %global build_with_clang 0 %ifarch %{ix86} %{arm} %global build_with_clang 1 %endif %global debug_build 0 %global use_bundled_cbindgen 1 %global hardened_build 1 %global system_ffi 1 %global system_libevent 1 %global system_libvpx 1 %global system_webp 1 %global system_pixman 1 %global disable_elfhack 1 %global system_libicu 0 # Conditional Building Options # # #{with system_cairo}: use system cairo graphics library optionally # (default for now is to use the in-tree cairo library, which for thunderbird # 45.4.0 is stuck at 1.9.5. Compiling with system cairo instead of the # in-tree one seems to produce an executable which is subject to sporadic # crashes. Note that this affects also the PDF engine used by Thunderbird # to print documents, which in the case of the system-cairo will be newer. # %bcond_with system_cairo %ifarch %{ix86} %{arm} %global debug_package %{nil} %endif # Minimal required versions %if %{?system_libvpx} %global libvpx_version 1.10.0 %endif %if %{?system_webp} %global libwebp_version 1.1.0 %endif # 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) # this one as well (#59759) %define nss_libname %mklibname nss 3 %define nss_version %(pkg-config --modversion nss &>/dev/null && pkg-config --modversion nss 2>/dev/null || echo 0) Name: thunderbird Epoch: 0 Version: 115.10.1 Release: %mkrel 1 Summary: Full-featured email, RSS, and newsgroup client License: MPL Group: Networking/Mail URL: https://www.mozilla.org/thunderbird/organizations/ Source0: https://releases.mozilla.org/pub/thunderbird/releases/%{upstream_version}/source/thunderbird-%{upstream_version}.source.tar.xz Source1: cbindgen-vendor.tar.xz Source12: mozilla-thunderbird-mageia-default-prefs.js # To generate cbindgen-vendor.tar.xz Source100: gen_cbindgen-vendor.sh Source303: thunderbird.desktop # All patches P0 please # Mageia patches (patch100+) Patch3: thunderbird-60.0-run-mozilla.patch Patch5: thunderbird-68.0-appname.patch # Patch by Martin Whitaker to fix building i586 with rust Patch7: force-i586-host.patch # (martinw) don't check for cmov support when running on older CPUs Patch8: bypass-cmov-assert-on-i586.patch # Fedora patches Patch109: mozilla-build-arm.patch Patch126: build-icu-big-endian.patch # Fedora specific patches Patch418: mozilla-1512162.patch Patch103: rhbz-1219542-s390-build.patch Patch231: webrtc-nss-fix.patch # gcc 12 build fix patches Patch419: firefox-gcc-build.patch Patch422: 0001-GLIBCXX-fix-for-GCC-12.patch Patch423: build-rnp.patch Patch301: CVE-2023-44488-libvpx.patch # PPC fix Patch304: mozilla-1245783.patch Patch305: build-big-endian.patch Patch307: build-disable-elfhack.patch # Upstream patches Patch402: mozilla-526293.patch # Bundled expat backported patches Patch501: expat-CVE-2022-25235.patch Patch502: expat-CVE-2022-25236.patch Patch503: expat-CVE-2022-25315.patch # Mageia patches # Teach botan about armv7hl Patch1001: botan-armv7hl.patch Patch1002: build-arm-libopus.patch Patch1005: mga-fix-double_t-conflicting-declaration.patch BuildRequires: autoconf2.1 %if %{with system_cairo} BuildRequires: pkgconfig(cairo) >= 1.10 %endif Requires: %{mklibname sqlite3_ 0} >= %{sqlite3_version} BuildRequires: pkgconfig(sqlite3) >= 3.34.1 Requires: %{nss_libname} >= 2:%{nss_version} BuildRequires: yasm BuildRequires: pkgconfig(gl) %if %{use_toolkit_gtk3} BuildRequires: pkgconfig(gtk+-3.0) >= 3.4.0 %endif BuildRequires: pkgconfig(gtk+-2.0) >= 2.18.0 BuildRequires: gzip BuildRequires: pkgconfig(python2) BuildRequires: python-virtualenv BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libpng) >= 1.6.34 BuildRequires: pkgconfig(nspr) >= 4.32 BuildRequires: nss-static-devel >= 2:3.69 BuildRequires: unzip BuildRequires: zip BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(libIDL-2.0) BuildRequires: pkgconfig(freetype2) %if %{system_libicu} BuildRequires: icu-devel %endif BuildRequires: pkgconfig(xft) BuildRequires: pkgconfig(libpulse) BuildRequires: pkgconfig(xt) BuildRequires: pkgconfig(hunspell) >= 1.6.2 BuildRequires: pkgconfig(dbus-glib-1) >= 0.60 Requires(post): mktemp Requires(post): rpm-helper Requires(postun): rpm-helper # Integrates thunderbird with xdg-utils. Requires: xdg-utils # Thunderbird 3 requires alsa BuildRequires: pkgconfig(alsa) BuildRequires: pkgconfig(gstreamer-1.0) BuildRequires: pkgconfig(gstreamer-allocators-1.0) # pango-devel is bring in also by gtk+2-devel but not with minimal requirement BuildRequires: pkgconfig(pango) >= 1.22.0 %if %{?system_ffi} BuildRequires: pkgconfig(libffi) %endif BuildRequires: pkgconfig(libnotify) BuildRequires: pkgconfig(libstartup-notification-1.0) >= 0.8 BuildRequires: libiw-devel %if %{?system_libevent} BuildRequires: pkgconfig(libevent) >= 1.4.7 %endif %if %{?system_pixman} BuildRequires: pixman-devel %endif %if %{?system_libvpx} BuildRequires: pkgconfig(vpx) >= %{libvpx_version} %endif %if %{?system_webp} BuildRequires: pkgconfig(libwebp) >= %{libwebp_version} BuildRequires: pkgconfig(libwebpdemux) >= %{libwebp_version} %endif BuildRequires: python-setuptools BuildRequires: pkgconfig(gconf-2.0) BuildRequires: java-headless BuildRequires: rootcerts BuildRequires: doxygen BuildRequires: glibc-static-devel BuildRequires: wget BuildRequires: cdrkit-genisoimage BuildRequires: ffmpeg-devel BuildRequires: pkgconfig(theora) BuildRequires: pkgconfig(xscrnsaver) BuildRequires: cargo BuildRequires: rust BuildRequires: clang BuildRequires: clang-devel BuildRequires: llvm-devel %if 0%{?build_with_clang} BuildRequires: lld %ifarch %{ix86} BuildRequires: libatomic-devel %endif %endif BuildRequires: nodejs BuildRequires: nasm Requires: %{_lib}notify4 Requires: %{_lib}otr5 Requires: gstreamer1.0-libav # 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: thunderbird-l10n Recommends: %{_lib}canberra0 Recommends: %{_lib}cups2 Recommends: thunderbird-compose Obsoletes: mozilla-thunderbird < %{epoch}:%{version}-%{release} Provides: mozilla-thunderbird = %{epoch}:%{version}-%{release} Obsoletes: thunderbird-lightning < 1:3.3-7 Obsoletes: thunderbird-lightning < 0:69 Obsoletes: thunderbird-enigmail < 0:79 %description %{title} is a full-featured email, RSS and newsgroup client that makes emailing safer, faster and easier than ever before. %prep %setup -q -c -n %{name}-%{version} #=================== # Thunderbird itself %setup -q -T -D -n %{name}-%{version}/%{release_dir} # Build patches %patch -P3 -p0 %patch -P5 -p0 %patch -P7 -p0 %patch -P8 -p1 %patch -P109 -p2 -b .arm %ifarch s390 %patch -P103 -p1 -b .rhbz-1219542-s390-build %endif %patch -P304 -p1 -b .1245783 # Patch for big endian platforms only %if 0%{?big_endian} %patch -P126 -p1 -b .icu %patch -P305 -p1 -b .big-endian %endif %patch -P418 -p1 -b .mozbz-1512162 %if 0%{?disable_elfhack} %patch -P307 -p1 -b .elfhack %endif %patch -P231 -p1 -b .webrtc-nss-fix %patch -P402 -p1 -b .526293 %patch -P419 -p1 -b .gcc %patch -P422 -p1 -b .0001-GLIBCXX-fix-for-GCC-12 %patch -P423 -p1 -b .build-rnp %patch -P501 -p1 -b .expat-CVE-2022-25235 %patch -P502 -p1 -b .expat-CVE-2022-25236 %patch -P503 -p1 -b .expat-CVE-2022-25315 pushd media/libvpx/libvpx %patch -P301 -p1 -b .CVE-2023-44488-libvpx popd %patch -P1001 -p1 -b .botan-armv7hl %patch -P1002 -p1 -b .build-arm-libopus %patch -P1005 -p1 -b .fix-double_t # (ns80) to get rid of errors like this: # *** ERROR: .rs has shebang which doesn't start with '/' ([allow(dead_code)]) for i in $(find . -type f -name '*.rs' -executable); do if [ -n "$(head -n 1 $i | grep '^#\!')" ]; then chmod a-x $i fi done %build %if 0%{?use_bundled_cbindgen} mkdir -p my_rust_vendor cd my_rust_vendor %{__tar} xf %{SOURCE1} cd - mkdir -p .cargo cat > .cargo/config < $MOZCONFIG << EOF mk_add_options AUTOCONF=autoconf-2.13 mk_add_options MOZILLA_OFFICIAL=1 mk_add_options BUILD_OFFICIAL=1 mk_add_options MOZ_MAKE_FLAGS="-j%{_smp_ncpus_max}" # fallback using absolute path - should be used with define for absolute path for objdir # see https://bugzilla.mozilla.org/show_bug.cgi?id=1106883#c4 for context information #mk_add_options MOZ_OBJDIR=%%{_builddir}/%%{name}-%%{version}/%%{release_dir}/%%{objdir} # -Werror=format-security causes build failures when -Wno-format is explicitly given # for some sources ac_add_options --host=%{_host} ac_add_options --target=%{_target_platform} ac_add_options --prefix="%{_prefix}" ac_add_options --libdir="%{_libdir}" ac_add_options --includedir="%{_includedir}" ac_add_options --datadir="%{_datadir}" ac_add_options --enable-application=comm/mail ac_add_options --with-system-nspr ac_add_options --with-system-nss ac_add_options --with-system-zlib %if %{system_libicu} ac_add_options --with-system-icu %else ac_add_options --without-system-icu %endif ac_add_options --with-system-png ac_add_options --with-system-bz2 %if %{with system_cairo} ac_add_options --enable-system-cairo %endif ac_add_options --disable-tests ac_add_options --disable-updater ac_add_options --disable-crashreporter %if %{use_toolkit_gtk3} ac_add_options --enable-default-toolkit=cairo-gtk3 %else ac_add_options --enable-default-toolkit=cairo-gtk2 %endif %if %{?system_ffi} ac_add_options --enable-system-ffi %endif ac_add_options --disable-strip ac_add_options --disable-install-strip %ifnarch %{ix86} x86_64 ac_add_options --disable-jemalloc %endif %if %{?debug_build} ac_add_options --enable-debug ac_add_options --disable-optimize %else %define optimize_flags "none" %ifnarch s390 s390x aarch64 %define optimize_flags "-g -O2" %endif %ifarch %{ix86} %define optimize_flags "-g0 -O2" %endif %ifarch armv7hl %define optimize_flags "-g0 -O2 -fno-schedule-insns" %endif %if %{optimize_flags} != "none" ac_add_options --enable-optimize=%{?optimize_flags} %else ac_add_options --enable-optimize %endif ac_add_options --disable-debug %endif %ifnarch %{ix86} x86_64 ac_add_options --disable-webrtc %endif %ifarch armv7hl ac_add_options --with-arch=armv7-a ac_add_options --with-float-abi=hard ac_add_options --with-fpu=vfpv3-d16 %endif %ifarch armv7hnl ac_add_options --with-arch=armv7-a ac_add_options --with-float-abi=hard ac_add_options --with-fpu=neon ac_add_options --disable-yarr-jit %endif %ifarch armv5tel ac_add_options --with-arch=armv5te ac_add_options --with-float-abi=soft ac_add_options --disable-yarr-jit %endif %if %{?system_libevent} ac_add_options --with-system-libevent %endif ac_add_options --enable-official-branding ac_add_options --with-distribution-id=org.mageia ac_add_options --enable-release ac_add_options --update-channel=release ac_add_options --without-wasm-sandboxed-libraries # %if %{use_ccache} ac_add_options --with-cache=%{_bindir}/ccache %endif %ifarch %{ix86} x86_64 ac_add_options --disable-elf-hack %endif %ifarch i586 # Rust seems to default to i686 otherwise ac_add_options --host=i586-mageia-linux-gnu ac_add_options --target=i586-mageia-linux-gnu %endif %if 0%{?build_with_clang} ac_add_options --enable-linker=lld %else %ifarch %{arm} %{ix86} ac_add_options --enable-linker=gold %endif %endif %if %{?system_pixman} ac_add_options --enable-system-pixman %endif %if %{?system_libvpx} ac_add_options --with-system-libvpx %else ac_add_options --without-system-libvpx %endif %if %{?system_webp} ac_add_options --with-system-webp %else ac_add_options --without-system-webp %endif ac_add_options --enable-necko-wifi ac_add_options --enable-chrome-format=omni ac_add_options --enable-pulseaudio ac_add_options --enable-av1 ac_add_options --allow-addon-sideload ac_add_options --enable-js-shell ac_add_options --with-unsigned-addon-scopes=app,system # Same as https://bugzilla.redhat.com/show_bug.cgi?id=2239046 for Firefox: # Clang 17 upstream's detection fails, tell it where to look. ac_add_options --with-libclang-path=`llvm-config --libdir` EOF export MOZ_REQUIRE_SIGNING= # recommended way to build - also used by upstream buildsystem # see https://bugzilla.mozilla.org/show_bug.cgi?id=1106883#c4 for context information export STRIP=/bin/true export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system MOZ_OBJDIR=%{objdir} ./mach build %install cd %{objdir} %make_install cd .. rm -rf %buildroot%tbdir/dictionaries ln -s %{_datadir}/hunspell %buildroot%tbdir/dictionaries # install icons for s in 16 22 24 32 48 64 128 256; do %{__mkdir_p} %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps %{__cp} -p comm/mail/branding/%{name}/default${s}.png \ %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/thunderbird.png done # desktop file %{__install} -p -D %{SOURCE303} %{buildroot}/%{_datadir}/applications/%{name}.desktop #used for matching system locale on startup %{__cat} %{SOURCE12} | %{__perl} -p -e 's,THUNDERBIRD_RPM_VR,%{version}-%{release},g;' \ -e 's,THUNDERBIRD_VENDOR_COMMENT,%{product_release},g;' \ > %{buildroot}%{tbdir}/defaults/pref/all-mageia.js #=============================================================================== #exclude devel files %{__rm} -rf %{buildroot}%{_libdir}/%{oname}-devel-%{version} #=============================================================================== %files # (doktor5000) explicit %%attrs are not applicable to symlinks, remove them %{_bindir}/thunderbird %attr(644,root,root) %{_datadir}/applications/*.desktop %{tbdir} # other icons %{_iconsdir}/hicolor/*/apps/%{name}.png