Clean up macros that allow building with clang

This adds the --with toolchain_clang option which can be passed to
fedpkg, mock, or rpmbuild to allow for building with clang.  It also
changes the conditional parts of the spec that are only used for
building with clang to check the value of the generic %toolchain macro
rather than a macro that is specific to thunderbird.
This commit is contained in:
Tom Stellard 2022-06-03 15:54:01 +00:00
parent eec1d9e941
commit 3cdd058597

View File

@ -19,7 +19,7 @@ ExcludeArch: armv7hl
%define system_ffi 1 %define system_ffi 1
%define build_langpacks 1 %define build_langpacks 1
%global build_with_clang 0 %bcond_with toolchain_clang
%global use_bundled_cbindgen 1 %global use_bundled_cbindgen 1
%global disable_elfhack 1 %global disable_elfhack 1
@ -89,6 +89,10 @@ ExcludeArch: s390x
%endif %endif
%endif %endif
%if %{with toolchain_clang}
%global toolchain clang
%endif
# Exclude private libraries from autogenerated provides and requires # Exclude private libraries from autogenerated provides and requires
%global __provides_exclude_from ^%{mozappdir} %global __provides_exclude_from ^%{mozappdir}
%global __requires_exclude ^(%%(find %{buildroot}%{mozappdir} -name '*.so' | xargs -n1 basename | sort -u | paste -s -d '|' -)) %global __requires_exclude ^(%%(find %{buildroot}%{mozappdir} -name '*.so' | xargs -n1 basename | sort -u | paste -s -d '|' -))
@ -96,7 +100,7 @@ ExcludeArch: s390x
Summary: Mozilla Thunderbird mail/newsgroup client Summary: Mozilla Thunderbird mail/newsgroup client
Name: thunderbird Name: thunderbird
Version: 91.11.0 Version: 91.11.0
Release: 1%{?dist} Release: 2%{?dist}
URL: http://www.mozilla.org/projects/thunderbird/ URL: http://www.mozilla.org/projects/thunderbird/
License: MPLv1.1 or GPLv2+ or LGPLv2+ License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/thunderbird/releases/%{version}%{?pre_version}/source/thunderbird-%{version}%{?pre_version}.source.tar.xz Source0: https://archive.mozilla.org/pub/thunderbird/releases/%{version}%{?pre_version}/source/thunderbird-%{version}%{?pre_version}.source.tar.xz
@ -178,7 +182,7 @@ BuildRequires: llvm
BuildRequires: llvm-devel BuildRequires: llvm-devel
BuildRequires: clang BuildRequires: clang
BuildRequires: clang-libs BuildRequires: clang-libs
%if 0%{?build_with_clang} %if "%toolchain" == "clang"
BuildRequires: lld BuildRequires: lld
%endif %endif
%if %{?system_ffi} %if %{?system_ffi}
@ -494,7 +498,7 @@ MOZ_OPT_FLAGS=$(echo "$MOZ_OPT_FLAGS" | %{__sed} -e 's/-g/-g0/')
export MOZ_DEBUG_FLAGS=" " export MOZ_DEBUG_FLAGS=" "
%endif %endif
%if !0%{?build_with_clang} %if "%toolchain" != "clang"
%ifarch s390 ppc aarch64 %{ix86} %ifarch s390 ppc aarch64 %{ix86}
MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads" MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
%endif %endif
@ -518,7 +522,7 @@ echo "export CFLAGS=\"$MOZ_OPT_FLAGS\"" >> .mozconfig
echo "export CXXFLAGS=\"$MOZ_OPT_FLAGS\"" >> .mozconfig echo "export CXXFLAGS=\"$MOZ_OPT_FLAGS\"" >> .mozconfig
echo "export LDFLAGS=\"$MOZ_LINK_FLAGS\"" >> .mozconfig echo "export LDFLAGS=\"$MOZ_LINK_FLAGS\"" >> .mozconfig
%if 0%{?build_with_clang} %if "%toolchain" == "clang"
echo "export LLVM_PROFDATA=\"llvm-profdata\"" >> .mozconfig echo "export LLVM_PROFDATA=\"llvm-profdata\"" >> .mozconfig
echo "export AR=\"llvm-ar\"" >> .mozconfig echo "export AR=\"llvm-ar\"" >> .mozconfig
echo "export NM=\"llvm-nm\"" >> .mozconfig echo "export NM=\"llvm-nm\"" >> .mozconfig
@ -742,6 +746,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#=============================================================================== #===============================================================================
%changelog %changelog
* Fri Jul 05 2022 Tom Stellard <tstellar@redhat.com> - 91.11.0-2
- Clean up macros that allow building with clang
* Wed Jun 29 2022 Eike Rathke <erack@redhat.com> - 91.11.0-1 * Wed Jun 29 2022 Eike Rathke <erack@redhat.com> - 91.11.0-1
- Update to 91.11.0 - Update to 91.11.0