De-bundle c-ares, libuv

- we waited for c-ares for about 4 months, so added conditional flag in case it falls behind in future again, same for libuv
This commit is contained in:
Andrei Radchenko 2026-04-24 10:59:22 +02:00
parent fda37c709c
commit c532e13764

View File

@ -28,6 +28,12 @@
%bcond_with bundled_zlib
%endif
# 2026-05-05: Currently libuv up to date, but if it no longer the case - switch to 1
%bcond bundled_libuv 0
# 2026-05-05: Currently c-ares up to date, but if it no longer the case - switch to 1
%bcond bundled_cares 0
%bcond bundled_sqlite %{with bootstrap}
# LTO is currently broken on Node.js builds
@ -212,6 +218,11 @@ BuildRequires: jq
# https://pagure.io/nodejs-packaging/pull-request/10
BuildRequires: nodejs-packaging
%if %{with bundled_cares}
Provides: bundled(c-ares) = %{c_ares_version}
%else
BuildRequires: c-ares-devel >= %{c_ares_version}
%endif
BuildRequires: chrpath
BuildRequires: libatomic
BuildRequires: ninja-build
@ -241,7 +252,7 @@ Provides: nodejs%{nodejs_pkg_major}%{?1:-%{1}} = %{nodejs_envr}\
%define unversioned_obsoletes_of_nodejsXX_if_default() %{nil}
%endif
%if %{with bundled}
%if %{with bundled_libuv}
Provides: bundled(libuv) = %{libuv_version}
%else
BuildRequires: libuv-devel >= 1:%{libuv_version}
@ -320,11 +331,6 @@ Conflicts: node <= 0.3.2-12
Provides: nodejs-punycode = %{punycode_version}
Provides: npm(punycode) = %{punycode_version}
# Node.js has forked c-ares from upstream in an incompatible way, so we need
# to carry the bundled version internally.
# See https://github.com/nodejs/node/commit/766d063e0578c0f7758c3a965c971763f43fec85
Provides: bundled(c-ares) = %{c_ares_version}
# Node.js is closely tied to the version of v8 that is used with it. It makes
# sense to use the bundled version because upstream consistently breaks ABI
# even in point releases. Node.js upstream has now removed the ability to build
@ -397,7 +403,7 @@ Requires: zlib-devel%{?_isa}
Requires: brotli-devel%{?_isa}
Requires: nodejs-packaging
%if %{without bundled}
%if %{without bundled_libuv}
Requires: libuv-devel%{?_isa}
%endif
@ -526,6 +532,14 @@ The API documentation for the Node.js JavaScript runtime.
%autosetup -p1 -n node-v%{nodejs_version}
# remove bundled dependencies that we aren't building
%if %{without bundled_libuv}
rm -rf deps/uv
%endif
%if %{without bundled_cares}
rm -rf deps/cares
%endif
%if !%{with bundled_zlib}
rm -rf deps/zlib
%endif
@ -610,7 +624,8 @@ export PATH="${cwd}/.bin:$PATH"
%{!?with_bundled_undici:--shared-builtin-undici/undici-path %{nodejs_private_sitelib}/undici/loader.js} \
%{!?with_bundled_sqlite:--shared-sqlite} \
--shared-brotli \
--shared-libuv \
%{!?with_bundled_cares:--shared-cares} \
%{!?with_bundled_libuv:--shared-libuv} \
--with-intl=small-icu \
--with-icu-default-data-dir=%{icudatadir} \
--without-corepack \