From d609ed6055cfc07f23efb2f79d047e313858ab7a Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Fri, 15 Jan 2021 12:59:23 +0100 Subject: [PATCH] Build using clang --- firefox.spec | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index a2b75a1..b2222f3 100644 --- a/firefox.spec +++ b/firefox.spec @@ -1,6 +1,7 @@ # Set for local builds only %global disable_toolsets 0 +%global build_with_clang 1 %ifarch i686 # no debug package for the i686 because oom on i686 with debuginfos %global debug_package %{nil} @@ -380,6 +381,9 @@ BuildRequires: llvm-toolset-%{llvm_version}-llvm-devel %if ! 0%{?use_bundled_yasm} BuildRequires: yasm %endif +%if %{build_with_clang} +BuildRequires: lld +%endif %if 0%{?use_bundled_python_2} @@ -1099,6 +1103,7 @@ export MOZ_DEBUG_FLAGS=" " # We don't wantfirefox to use CK_GCM_PARAMS_V3 in nss MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -DNSS_PKCS11_3_0_STRICT" +%if !%{build_with_clang} %ifarch s390 %{arm} ppc aarch64 i686 x86_64 s390x MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads" %endif @@ -1106,6 +1111,7 @@ MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads" MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--strip-debug" echo "ac_add_options --enable-linker=gold" >> .mozconfig %endif +%endif %ifarch %{arm} i686 export RUSTFLAGS="-Cdebuginfo=0" @@ -1116,8 +1122,20 @@ export LDFLAGS=$MOZ_LINK_FLAGS export PREFIX='%{_prefix}' export LIBDIR='%{_libdir}' -export CC=gcc -export CXX=g++ + +%if %{build_with_clang} +echo "export LLVM_PROFDATA=\"llvm-profdata\"" >> .mozconfig +echo "export AR=\"llvm-ar\"" >> .mozconfig +echo "export NM=\"llvm-nm\"" >> .mozconfig +echo "export RANLIB=\"llvm-ranlib\"" >> .mozconfig +echo "ac_add_options --enable-linker=lld" >> .mozconfig +%else +echo "export CC=gcc" >> .mozconfig +echo "export CXX=g++" >> .mozconfig +echo "export AR=\"gcc-ar\"" >> .mozconfig +echo "export NM=\"gcc-nm\"" >> .mozconfig +echo "export RANLIB=\"gcc-ranlib\"" >> .mozconfig +%endif MOZ_SMP_FLAGS=-j1 # More than two build tasks can lead to OOM gcc crash.