From afeb1c68387ea9d14b3638b5ad9fc8a1e86b7325 Mon Sep 17 00:00:00 2001 From: jchzhou Date: Fri, 29 Nov 2024 18:26:38 +0800 Subject: [PATCH] fix building w/ clang: only apply '-fno-ipa-icf' for gcc && disable LTO for clang + ld.bfd Signed-off-by: jchzhou (cherry picked from commit 8e01c8e676f7377dffa06999cd5771e3c68720d4) --- nodejs.spec | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/nodejs.spec b/nodejs.spec index 642f147..ff3bbd7 100644 --- a/nodejs.spec +++ b/nodejs.spec @@ -1,4 +1,4 @@ -%global baserelease 1 +%global baserelease 2 %{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} %global nodejs_epoch 1 %global nodejs_major 20 @@ -237,10 +237,15 @@ export CXXFLAGS='%{optflags} \ -O3 \ -fno-ipa-icf' -export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' ' ')" -export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')" +export CFLAGS="$(echo ${CFLAGS} | tr -s '[:space:]\\' ' ')" +export CXXFLAGS="$(echo ${CXXFLAGS} | tr -s '[:space:]\\' ' ')" export LDFLAGS="%{build_ldflags}" +%if "%toolchain" == "clang" +export CFLAGS="$(echo ${CFLAGS} | sed -e s/-fno-ipa-icf//g)" +export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e s/-fno-ipa-icf//g)" +%endif + %{__python3} configure.py --prefix=%{_prefix} \ --verbose \ --ninja \ @@ -250,12 +255,14 @@ export LDFLAGS="%{build_ldflags}" --shared-zlib \ --shared-brotli \ --shared-libuv \ - --enable-lto \ %{dtrace_configure} \ --with-intl=small-icu \ --with-icu-default-data-dir=%{icudatadir} \ --without-corepack \ - --openssl-use-def-ca-store + --openssl-use-def-ca-store \ +%if "%toolchain" != "clang" + --enable-lto +%endif %ninja_build -C out/Release @@ -402,6 +409,10 @@ NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/nod %{_pkgdocdir}/npm/docs %changelog +* Fri Nov 29 2024 jchzhou - 1:20.12.1-2 +- fix building w/ clang: only apply '-fno-ipa-icf' for gcc && disable LTO for clang + ld.bfd +- improve the handling of trilling whitespaces in C/CXXFLAGS + * Wed Sep 18 2024 yaoxin - 1:20.12.1-1 - Update to 20.12.1: * CVE-2024-27983 - Assertion failed in node::http2::Http2Session::~Http2Session() -- Gitee