Build using clang

This commit is contained in:
Jan Horak 2021-01-15 12:59:23 +01:00
parent 3153ecddcd
commit d609ed6055

View File

@ -1,6 +1,7 @@
# Set for local builds only # Set for local builds only
%global disable_toolsets 0 %global disable_toolsets 0
%global build_with_clang 1
%ifarch i686 %ifarch i686
# no debug package for the i686 because oom on i686 with debuginfos # no debug package for the i686 because oom on i686 with debuginfos
%global debug_package %{nil} %global debug_package %{nil}
@ -380,6 +381,9 @@ BuildRequires: llvm-toolset-%{llvm_version}-llvm-devel
%if ! 0%{?use_bundled_yasm} %if ! 0%{?use_bundled_yasm}
BuildRequires: yasm BuildRequires: yasm
%endif %endif
%if %{build_with_clang}
BuildRequires: lld
%endif
%if 0%{?use_bundled_python_2} %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 # We don't wantfirefox to use CK_GCM_PARAMS_V3 in nss
MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -DNSS_PKCS11_3_0_STRICT" MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -DNSS_PKCS11_3_0_STRICT"
%if !%{build_with_clang}
%ifarch s390 %{arm} ppc aarch64 i686 x86_64 s390x %ifarch s390 %{arm} ppc aarch64 i686 x86_64 s390x
MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads" MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
%endif %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" MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--strip-debug"
echo "ac_add_options --enable-linker=gold" >> .mozconfig echo "ac_add_options --enable-linker=gold" >> .mozconfig
%endif %endif
%endif
%ifarch %{arm} i686 %ifarch %{arm} i686
export RUSTFLAGS="-Cdebuginfo=0" export RUSTFLAGS="-Cdebuginfo=0"
@ -1116,8 +1122,20 @@ export LDFLAGS=$MOZ_LINK_FLAGS
export PREFIX='%{_prefix}' export PREFIX='%{_prefix}'
export LIBDIR='%{_libdir}' 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 MOZ_SMP_FLAGS=-j1
# More than two build tasks can lead to OOM gcc crash. # More than two build tasks can lead to OOM gcc crash.