From b77028c1094a6d43bd2a4af427e6016ff9b3e0c8 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 1 Mar 2023 13:12:07 -0500 Subject: [PATCH] template: Re-sync from nodejs20 Signed-off-by: Stephen Gallagher --- 0001-Remove-unused-OpenSSL-config.patch | 68 +++++++++++ nodejs-sources.sh | 109 +++++++++-------- nodejs18.spec | 66 +++++----- packaging/{nodejs.spec.in => nodejs.spec.j2} | 122 ++++++++++--------- 4 files changed, 221 insertions(+), 144 deletions(-) create mode 100644 0001-Remove-unused-OpenSSL-config.patch rename packaging/{nodejs.spec.in => nodejs.spec.j2} (92%) diff --git a/0001-Remove-unused-OpenSSL-config.patch b/0001-Remove-unused-OpenSSL-config.patch new file mode 100644 index 0000000..3ce5dd2 --- /dev/null +++ b/0001-Remove-unused-OpenSSL-config.patch @@ -0,0 +1,68 @@ +From 07410a91b031a99636830c5bf825d243f1fa9bfd Mon Sep 17 00:00:00 2001 +From: Zuzana Svetlikova +Date: Fri, 17 Apr 2020 12:59:44 +0200 +Subject: [PATCH] Remove unused OpenSSL config + +The build process will try to create these config files, even when +using the system OpenSSL and will thus fail since we strip this path +from the tarball. + +Signed-off-by: Stephen Gallagher +--- + Makefile | 4 ++-- + node.gyp | 17 ----------------- + 2 files changed, 2 insertions(+), 19 deletions(-) + +diff --git a/Makefile b/Makefile +index 94013466239e9c43ddce5cebc7a8d0a4dc56db4f..8577570c95d20dcf8d3dfe5d9fe82c1f67b2d70a 100644 +--- a/Makefile ++++ b/Makefile +@@ -169,7 +169,7 @@ with-code-cache test-code-cache: + $(warning '$@' target is a noop) + + out/Makefile: config.gypi common.gypi node.gyp \ +- deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \ ++ deps/llhttp/llhttp.gyp \ + deps/simdutf/simdutf.gyp \ + tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \ + tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp +@@ -1550,7 +1550,7 @@ CONFLICT_RE=^>>>>>>> [[:xdigit:]]+|^<<<<<<< [[:alpha:]]+ + + # Related CI job: node-test-linter + lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs lint-yaml-build lint-yaml +- @if ! ( grep -IEqrs "$(CONFLICT_RE)" --exclude="error-message.js" --exclude="merge-conflict.json" benchmark deps doc lib src test tools ) \ ++ @if ! ( grep -IEqrs "$(CONFLICT_RE)" --exclude="error-message.js" benchmark deps doc lib src test tools ) \ + && ! ( $(FIND) . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \ + exit 0 ; \ + else \ +diff --git a/node.gyp b/node.gyp +index cec24aed034362530cfbe833f4f52098f3fbaf2e..13af00f40d006fa75bfc5f656b505d29abf5038e 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -429,23 +429,6 @@ + ], + }, + ], +- }, { +- 'variables': { +- 'opensslconfig_internal': '<(obj_dir)/deps/openssl/openssl.cnf', +- 'opensslconfig': './deps/openssl/nodejs-openssl.cnf', +- }, +- 'actions': [ +- { +- 'action_name': 'reset_openssl_cnf', +- 'inputs': [ '<(opensslconfig)', ], +- 'outputs': [ '<(opensslconfig_internal)', ], +- 'action': [ +- '<(python)', 'tools/copyfile.py', +- '<(opensslconfig)', +- '<(opensslconfig_internal)', +- ], +- }, +- ], + }], + ], + }, # node_core_target_name +-- +2.39.2 + diff --git a/nodejs-sources.sh b/nodejs-sources.sh index e83ef8f..41eb299 100755 --- a/nodejs-sources.sh +++ b/nodejs-sources.sh @@ -137,6 +137,10 @@ fi FEDORA_DEFAULT_RELEASE_LOW=$((NODE_PKG_MAJOR + 19)) FEDORA_DEFAULT_RELEASE_HIGH=$((NODE_PKG_MAJOR + 20)) +if [[ $((NODE_PKG_MAJOR)) -eq 20 ]] + then RHEL_DEFAULT_RELEASE=" || 0%{?rhel} == 10" +fi + rm -rf node-v${version}.tar.gz \ node-v${version}-stripped.tar.gz \ node-v${version}/ \ @@ -190,22 +194,8 @@ ICU_MINOR=$(jq -r '.[0].url' node-v${version}/tools/icu/current_ver.dep | sed -- # Download the ICU binary data files rm -Rf icu4c-${ICU_MAJOR}_${ICU_MINOR}-data-bin-*.zip -wget $(grep Source3 packaging/nodejs.spec.in | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g") -wget $(grep Source4 packaging/nodejs.spec.in | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g") - -if [ $_arg_push = 'on' ]; then - push_flag='' -else - push_flag='--offline' -fi - -fedpkg new-sources ${push_flag} \ - node-v${version}-stripped.tar.gz \ - icu4c-${ICU_MAJOR}_${ICU_MINOR}-data-bin-*.zip \ - cjs-module-lexer-${LEXER_VERSION}-stripped.tar.gz \ - wasi-sdk-${LEXER_WASI_MAJOR}.${LEXER_WASI_MINOR}-linux.tar.gz \ - undici-${UNDICI_VERSION}-stripped.tar.gz \ - wasi-sdk-${UNDICI_WASI_MAJOR}.${UNDICI_WASI_MINOR}-linux.tar.gz +wget $(grep Source3 packaging/nodejs.spec.j2 | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g") +wget $(grep Source4 packaging/nodejs.spec.j2 | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g") rm -f node-v${version}.tar.gz @@ -242,14 +232,16 @@ echo "=========================" LLHTTP_MAJOR=$(grep -oP '(?<=#define LLHTTP_VERSION_MAJOR )\d+' node-v${version}/deps/llhttp/include/llhttp.h) LLHTTP_MINOR=$(grep -oP '(?<=#define LLHTTP_VERSION_MINOR )\d+' node-v${version}/deps/llhttp/include/llhttp.h) LLHTTP_PATCH=$(grep -oP '(?<=#define LLHTTP_VERSION_PATCH )\d+' node-v${version}/deps/llhttp/include/llhttp.h) -echo "${LLHTTP_MAJOR}.${LLHTTP_MINOR}.${LLHTTP_PATCH}" +LLHTTP_VERSION="${LLHTTP_MAJOR}.${LLHTTP_MINOR}.${LLHTTP_PATCH}" +echo $LLHTTP_VERSION echo echo "libuv" echo "=========================" UV_MAJOR=$(grep -oP '(?<=#define UV_VERSION_MAJOR )\d+' node-v${version}/deps/uv/include/uv/version.h) UV_MINOR=$(grep -oP '(?<=#define UV_VERSION_MINOR )\d+' node-v${version}/deps/uv/include/uv/version.h) UV_PATCH=$(grep -oP '(?<=#define UV_VERSION_PATCH )\d+' node-v${version}/deps/uv/include/uv/version.h) -echo ${UV_MAJOR}.${UV_MINOR}.${UV_PATCH} +LIBUV_VERSION="${UV_MAJOR}.${UV_MINOR}.${UV_PATCH}" +echo $UV_VERSION echo echo "nghttp2" echo "=========================" @@ -295,41 +287,62 @@ echo "WASI-SDK: ${UNDICI_WASI_MAJOR}.${UNDICI_WASI_MINOR}" echo echo "ada" echo "=========================" -ADA_VERSION=$(grep -oP '(?<=#define ADA_VERSION ).*\"' node-v${version}/deps/ada/ada.h |sed -e 's/^"//' -e 's/"$//') +ADA_VERSION=$(grep -osP '(?<=#define ADA_VERSION ).*\"' node-v${version}/deps/ada/ada.h |sed -e 's/^"//' -e 's/"$//') +ADA_VERSION=${ADA_VERSION:-0} echo "${ADA_VERSION}" echo echo "Applying versions to spec template" -sed -e "s/@NODE_PKG_MAJOR@/${NODE_PKG_MAJOR}/g" \ - -e "s/@NODE_MAJOR@/${NODE_MAJOR}/g" \ - -e "s/@NODE_MINOR@/${NODE_MINOR}/g" \ - -e "s/@NODE_PATCH@/${NODE_PATCH}/g" \ - -e "s/@FEDORA_DEFAULT_RELEASE_LOW@/${FEDORA_DEFAULT_RELEASE_LOW}/g" \ - -e "s/@FEDORA_DEFAULT_RELEASE_HIGH@/${FEDORA_DEFAULT_RELEASE_HIGH}/g" \ - -e "s/@NODE_SOVERSION@/${NODE_SOVERSION}/g" \ - -e "s/@V8_MAJOR@/${V8_MAJOR}/g" \ - -e "s/@V8_MINOR@/${V8_MINOR}/g" \ - -e "s/@V8_BUILD@/${V8_BUILD}/g" \ - -e "s/@V8_PATCH@/${V8_PATCH}/g" \ - -e "s/@C_ARES_VERSION@/${C_ARES_VERSION}/g" \ - -e "s/@LLHTTP_VERSION@/${LLHTTP_MAJOR}.${LLHTTP_MINOR}.${LLHTTP_PATCH}/g" \ - -e "s/@LIBUV_VERSION@/${UV_MAJOR}.${UV_MINOR}.${UV_PATCH}/g" \ - -e "s/@NGHTTP2_VERSION@/${NGHTTP2_VERSION}/g" \ - -e "s/@ICU_MAJOR@/${ICU_MAJOR}/g" \ - -e "s/@ICU_MINOR@/${ICU_MINOR}/g" \ - -e "s/@PUNYCODE_VERSION@/${PUNYCODE_VERSION}/g" \ - -e "s/@UVWASI_VERSION@/${UVWASI_VERSION}/g" \ - -e "s/@NPM_VERSION@/${NPM_VERSION}/g" \ - -e "s/@ZLIB_VERSION@/${ZLIB_VERSION}/g" \ - -e "s/@LEXER_VERSION@/${LEXER_VERSION}/g" \ - -e "s/@LEXER_WASI_MAJOR@/${LEXER_WASI_MAJOR}/g" \ - -e "s/@LEXER_WASI_MINOR@/${LEXER_WASI_MINOR}/g" \ - -e "s/@UNDICI_VERSION@/${UNDICI_VERSION}/g" \ - -e "s/@UNDICI_WASI_MAJOR@/${UNDICI_WASI_MAJOR}/g" \ - -e "s/@UNDICI_WASI_MINOR@/${UNDICI_WASI_MINOR}/g" \ - -e "s/@ADA_VERSION@/${ADA_VERSION}/g" \ - ${SCRIPT_DIR}/packaging/nodejs.spec.in \ +# Get the list of patches we need to add to the specfile +readarray -t patchlist < <(git ls-files |grep '^[0-9]\{4\}-.*\.patch') +json_patchlist=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${patchlist[@]}") + +IFS='' read -r -d '' template_json < ${SCRIPT_DIR}/nodejs${NODE_PKG_MAJOR}.spec +if [ $_arg_push = 'on' ]; then + fedpkg new-sources node-v${version}-stripped.tar.gz \ + icu4c-${ICU_MAJOR}_${ICU_MINOR}-data-bin-*.zip \ + cjs-module-lexer-${LEXER_VERSION}-stripped.tar.gz \ + wasi-sdk-${LEXER_WASI_MAJOR}.${LEXER_WASI_MINOR}-linux.tar.gz \ + undici-${UNDICI_VERSION}-stripped.tar.gz \ + wasi-sdk-${UNDICI_WASI_MAJOR}.${UNDICI_WASI_MINOR}-linux.tar.gz +fi + rm -rf node-v${version} # ] <-- needed because of Argbash diff --git a/nodejs18.spec b/nodejs18.spec index f39ddd6..b3d92dd 100644 --- a/nodejs18.spec +++ b/nodejs18.spec @@ -1,21 +1,3 @@ -# The following macros control the usage of dependencies bundled from upstream. -# -# When to use what: -# - Regular (presumably non-modular) build: use neither (the default in Fedora) -# - Early bootstrapping build that is not intended to be shipped: -# use --with=bootstrap; this will bundle deps and add `~bootstrap` release suffix -# - Build with some dependencies not avalaible in necessary versions (i.e. module build): -# use --with=bundled; will bundle deps, but do not add the suffix -# -# create bootstrapping build with bundled deps and extra release suffix -%bcond_with bootstrap -# bundle dependencies that are not available in Fedora modules -%if %{with bootstrap} -%bcond_without bundled -%else -%bcond_with bundled -%endif - %if 0%{?rhel} && 0%{?rhel} < 8 %bcond_without bundled_zlib %else @@ -46,9 +28,9 @@ %global nodejs_major 18 %global nodejs_minor 14 %global nodejs_patch 2 -%global nodejs_abi %{nodejs_major}.%{nodejs_minor} # nodejs_soversion - from NODE_MODULE_VERSION in src/node_version.h %global nodejs_soversion 108 +%global nodejs_abi %{nodejs_soversion} %global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch} %global nodejs_release %{baserelease} %global nodejs_envr %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release} @@ -57,9 +39,10 @@ # Determine if this should be the default version for this Fedora release # The default version will own /usr/bin/node and friends -%if 0%{?fedora} == 37 || 0%{?fedora} == 38 || 0%{?rhel} == 10 +%if 0%{?fedora} == 37 || 0%{?fedora} == 38 %global nodejs_default %{nodejs_major} %endif + %global nodejs_private_sitelib %{nodejs_sitelib}_%{nodejs_major} @@ -121,8 +104,6 @@ %global npm_envr %{npm_epoch}:%{npm_version}-%{npm_release} -%global npm_obsoletes 1:8.19.2-1.18.12.1.3 - # uvwasi - from deps/uvwasi/include/uvwasi.h %global uvwasi_version 0.0.14 @@ -130,7 +111,7 @@ %global histogram_version 0.9.7 -Name: nodejs%{nodejs_major} +Name: nodejs18 Epoch: %{nodejs_epoch} Version: %{nodejs_version} Release: %{nodejs_release} @@ -161,12 +142,14 @@ Source102: wasi-sdk-11.0-linux.tar.gz Source111: undici-5.20.0-stripped.tar.gz Source112: wasi-sdk-14.0-linux.tar.gz +Patch: 0001-Remove-unused-OpenSSL-config.patch + %if 0%{?nodejs_default} %global pkgname nodejs %package -n %{pkgname} Summary: JavaScript runtime %else -%global pkgname nodejs%{nodejs_major} +%global pkgname nodejs18 %endif BuildRequires: make @@ -200,9 +183,11 @@ BuildRequires: nodejs-packaging BuildRequires: chrpath BuildRequires: libatomic BuildRequires: ninja-build -BuildRequires: systemtap-sdt-devel BuildRequires: unzip +BuildRequires: systemtap-sdt-devel + + Provides: nodejs = %{nodejs_envr} %if %{with bundled} @@ -240,6 +225,14 @@ BuildRequires: openssl-devel >= %{openssl11_minimum} %global ssl_configure --shared-openssl %{openssl_fips_configure} %endif +%if 0%{?nodejs_default} +%global dtrace_configure --with-dtrace +%else +# dtrace is only installed for the default version +%global dtrace_configure %{nil} +%endif + + # we need the system certificate store Requires: ca-certificates @@ -300,6 +293,7 @@ Provides: bundled(uvwasi) = %{uvwasi_version} Provides: bundled(histogram) = %{histogram_version} + %description Node.js is a platform built on Chrome's JavaScript runtime \ for easily building fast, scalable network applications. \ @@ -414,8 +408,10 @@ Provides: npm(npm) = %{npm_version} # Satisfy dependency requests for "npm" Provides: npm = %{npm_envr} +%if 0%{?nodejs_default} # Obsolete the old 'npm' package -Obsoletes: npm < %{npm_obsoletes} +Obsoletes: npm < 1:9 +%endif %description -n %{pkgname}-npm @@ -521,10 +517,10 @@ export PATH="${cwd}/.bin:$PATH" --shared \ --libdir=%{_lib} \ %{ssl_configure} \ + %{dtrace_configure} \ %{!?with_bundled_zlib:--shared-zlib} \ --shared-brotli \ - %{!?with_bundled:--shared-libuv} \ - %{?with_bundled:--without-dtrace}%{!?with_bundled:--with-dtrace} \ + --shared-libuv \ --with-intl=small-icu \ --with-icu-default-data-dir=%{icudatadir} \ --without-corepack \ @@ -548,6 +544,8 @@ mv %{buildroot}%{nodejs_sitelib} \ %if 0%{?nodejs_default} ln -srf %{buildroot}%{nodejs_private_sitelib} \ %{buildroot}%{nodejs_sitelib} +%else +rm -f %{buildroot}%{_datadir}/systemtap/tapset/node.stp %endif @@ -597,12 +595,6 @@ for soname in libv8 libv8_libbase libv8_libplatform; do ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major} done -# Remove tracing for non-default versions -%if ! 0%{?nodejs_default} -rm -rf %{buildroot}%{_usr}/lib/dtrace \ - %{buildroot}%{_datadir}/systemtap/tapset/node.stp -%endif - # install documentation mkdir -p %{buildroot}%{_pkgdocdir}/html cp -pr doc/* %{buildroot}%{_pkgdocdir}/html @@ -752,14 +744,14 @@ end %if 0%{?nodejs_default} %{_bindir}/node %doc %{_mandir}/man1/node.1* +%{nodejs_sitelib} + %dir %{_datadir}/systemtap %dir %{_datadir}/systemtap/tapset -%{nodejs_sitelib} %{_datadir}/systemtap/tapset/node.stp -%if %{without bundled} %dir %{_usr}/lib/dtrace %{_usr}/lib/dtrace/node.d -%endif + %endif %{_bindir}/node-%{nodejs_major} diff --git a/packaging/nodejs.spec.in b/packaging/nodejs.spec.j2 similarity index 92% rename from packaging/nodejs.spec.in rename to packaging/nodejs.spec.j2 index d84c0e4..0ca55d8 100644 --- a/packaging/nodejs.spec.in +++ b/packaging/nodejs.spec.j2 @@ -1,21 +1,3 @@ -# The following macros control the usage of dependencies bundled from upstream. -# -# When to use what: -# - Regular (presumably non-modular) build: use neither (the default in Fedora) -# - Early bootstrapping build that is not intended to be shipped: -# use --with=bootstrap; this will bundle deps and add `~bootstrap` release suffix -# - Build with some dependencies not avalaible in necessary versions (i.e. module build): -# use --with=bundled; will bundle deps, but do not add the suffix -# -# create bootstrapping build with bundled deps and extra release suffix -%bcond_with bootstrap -# bundle dependencies that are not available in Fedora modules -%if %{with bootstrap} -%bcond_without bundled -%else -%bcond_with bundled -%endif - %if 0%{?rhel} && 0%{?rhel} < 8 %bcond_without bundled_zlib %else @@ -43,12 +25,12 @@ # feature releases that are only supported for nine months, which is shorter # than a Fedora release lifecycle. %global nodejs_epoch 1 -%global nodejs_major @NODE_MAJOR@ -%global nodejs_minor @NODE_MINOR@ -%global nodejs_patch @NODE_PATCH@ -%global nodejs_abi %{nodejs_major}.%{nodejs_minor} +%global nodejs_major {{ NODE_MAJOR }} +%global nodejs_minor {{ NODE_MINOR }} +%global nodejs_patch {{ NODE_PATCH }} # nodejs_soversion - from NODE_MODULE_VERSION in src/node_version.h -%global nodejs_soversion @NODE_SOVERSION@ +%global nodejs_soversion {{ NODE_SOVERSION }} +%global nodejs_abi %{nodejs_soversion} %global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch} %global nodejs_release %{baserelease} %global nodejs_envr %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release} @@ -57,9 +39,10 @@ # Determine if this should be the default version for this Fedora release # The default version will own /usr/bin/node and friends -%if 0%{?fedora} == 37 || 0%{?fedora} == 38 || 0%{?rhel} == 10 +%if 0%{?fedora} == {{ FEDORA_DEFAULT_RELEASE_LOW }} || 0%{?fedora} == {{ FEDORA_DEFAULT_RELEASE_HIGH }}{{ RHEL_DEFAULT_RELEASE }} %global nodejs_default %{nodejs_major} %endif + %global nodejs_private_sitelib %{nodejs_sitelib}_%{nodejs_major} @@ -67,32 +50,32 @@ # v8 - from deps/v8/include/v8-version.h # Epoch is set to ensure clean upgrades from the old v8 package %global v8_epoch 3 -%global v8_major @V8_MAJOR@ -%global v8_minor @V8_MINOR@ -%global v8_build @V8_BUILD@ -%global v8_patch @V8_PATCH@ +%global v8_major {{ V8_MAJOR }} +%global v8_minor {{ V8_MINOR }} +%global v8_build {{ V8_BUILD }} +%global v8_patch {{ V8_PATCH }} %global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch} %global v8_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release} # zlib - from deps/zlib/zlib.h -%global zlib_version @ZLIB_VERSION@ +%global zlib_version {{ ZLIB_VERSION }} # c-ares - from deps/cares/include/ares_version.h # https://github.com/nodejs/node/pull/9332 -%global c_ares_version @C_ARES_VERSION@ +%global c_ares_version {{ C_ARES_VERSION }} # llhttp - from deps/llhttp/include/llhttp.h -%global llhttp_version @LLHTTP_VERSION@ +%global llhttp_version {{ LLHTTP_VERSION }} # libuv - from deps/uv/include/uv/version.h -%global libuv_version @LIBUV_VERSION@ +%global libuv_version {{ LIBUV_VERSION }} # nghttp2 - from deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h -%global nghttp2_version @NGHTTP2_VERSION@ +%global nghttp2_version {{ NGHTTP2_VERSION }} # ICU - from tools/icu/current_ver.dep -%global icu_major @ICU_MAJOR@ -%global icu_minor @ICU_MINOR@ +%global icu_major {{ ICU_MAJOR }} +%global icu_minor {{ ICU_MINOR }} %global icu_version %{icu_major}.%{icu_minor} %global icudatadir %{nodejs_datadir}/icudata @@ -107,11 +90,11 @@ # punycode - from lib/punycode.js # Note: this was merged into the mainline since 0.6.x # Note: this will be unmerged in an upcoming major release -%global punycode_version @PUNYCODE_VERSION@ +%global punycode_version {{ PUNYCODE_VERSION }} # npm - from deps/npm/package.json %global npm_epoch 1 -%global npm_version @NPM_VERSION@ +%global npm_version {{ NPM_VERSION }} # In order to avoid needing to keep incrementing the release version for the # main package forever, we will just construct one for npm that is guaranteed @@ -121,16 +104,14 @@ %global npm_envr %{npm_epoch}:%{npm_version}-%{npm_release} -%global npm_obsoletes 1:8.19.2-1.18.12.1.3 - # uvwasi - from deps/uvwasi/include/uvwasi.h -%global uvwasi_version @UVWASI_VERSION@ +%global uvwasi_version {{ UVWASI_VERSION }} # histogram_c - assumed from timestamps %global histogram_version 0.9.7 -Name: nodejs%{nodejs_major} +Name: nodejs{{ NODE_PKG_MAJOR }} Epoch: %{nodejs_epoch} Version: %{nodejs_version} Release: %{nodejs_release} @@ -156,17 +137,21 @@ Source100: nodejs-sources.sh # Note: These sources would also include pre-compiled WASM blobs… so they are adjusted not to. # Recipes for creating these blobs are included in the sources. # These are generated by nodejs-sources.sh -Source101: cjs-module-lexer-@LEXER_VERSION@-stripped.tar.gz -Source102: wasi-sdk-@LEXER_WASI_MAJOR@.@LEXER_WASI_MINOR@-linux.tar.gz -Source111: undici-@UNDICI_VERSION@-stripped.tar.gz -Source112: wasi-sdk-@UNDICI_WASI_MAJOR@.@UNDICI_WASI_MINOR@-linux.tar.gz +Source101: cjs-module-lexer-{{ LEXER_VERSION }}-stripped.tar.gz +Source102: wasi-sdk-{{ LEXER_WASI_MAJOR }}.{{ LEXER_WASI_MINOR }}-linux.tar.gz +Source111: undici-{{ UNDICI_VERSION }}-stripped.tar.gz +Source112: wasi-sdk-{{ UNDICI_WASI_MAJOR }}.{{ UNDICI_WASI_MINOR }}-linux.tar.gz +{% for patch in PATCHES -%} +Patch: {{ patch }} +{% endfor -%} +{# #} %if 0%{?nodejs_default} %global pkgname nodejs %package -n %{pkgname} Summary: JavaScript runtime %else -%global pkgname nodejs%{nodejs_major} +%global pkgname nodejs{{ NODE_PKG_MAJOR }} %endif BuildRequires: make @@ -200,9 +185,12 @@ BuildRequires: nodejs-packaging BuildRequires: chrpath BuildRequires: libatomic BuildRequires: ninja-build -BuildRequires: systemtap-sdt-devel BuildRequires: unzip +{% if NODE_MAJOR < 19 -%} +BuildRequires: systemtap-sdt-devel +{% endif %} + Provides: nodejs = %{nodejs_envr} %if %{with bundled} @@ -240,6 +228,18 @@ BuildRequires: openssl-devel >= %{openssl11_minimum} %global ssl_configure --shared-openssl %{openssl_fips_configure} %endif +{% if NODE_MAJOR < 19 -%} +%if 0%{?nodejs_default} +%global dtrace_configure --with-dtrace +%else +# dtrace is only installed for the default version +%global dtrace_configure %{nil} +%endif +{% else %} +# dtrace is not supported on Node.js 19+ +%global dtrace_configure %{nil} +{% endif %} + # we need the system certificate store Requires: ca-certificates @@ -299,6 +299,11 @@ Provides: bundled(icu) = %{icu_version} Provides: bundled(uvwasi) = %{uvwasi_version} Provides: bundled(histogram) = %{histogram_version} +{% if ADA_VERSION -%} +# Upstream has added a new URL parser that has no option to build as a shared +# library (19.7.0+) +Provides: bundled(ada) = {{ ADA_VERSION }} +{% endif %} %description Node.js is a platform built on Chrome's JavaScript runtime \ @@ -414,8 +419,10 @@ Provides: npm(npm) = %{npm_version} # Satisfy dependency requests for "npm" Provides: npm = %{npm_envr} +%if 0%{?nodejs_default} # Obsolete the old 'npm' package -Obsoletes: npm < %{npm_obsoletes} +Obsoletes: npm < 1:9 +%endif %description -n %{pkgname}-npm @@ -521,10 +528,10 @@ export PATH="${cwd}/.bin:$PATH" --shared \ --libdir=%{_lib} \ %{ssl_configure} \ + %{dtrace_configure} \ %{!?with_bundled_zlib:--shared-zlib} \ --shared-brotli \ - %{!?with_bundled:--shared-libuv} \ - %{?with_bundled:--without-dtrace}%{!?with_bundled:--with-dtrace} \ + --shared-libuv \ --with-intl=small-icu \ --with-icu-default-data-dir=%{icudatadir} \ --without-corepack \ @@ -548,6 +555,8 @@ mv %{buildroot}%{nodejs_sitelib} \ %if 0%{?nodejs_default} ln -srf %{buildroot}%{nodejs_private_sitelib} \ %{buildroot}%{nodejs_sitelib} +%else +rm -f %{buildroot}%{_datadir}/systemtap/tapset/node.stp %endif @@ -597,12 +606,6 @@ for soname in libv8 libv8_libbase libv8_libplatform; do ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major} done -# Remove tracing for non-default versions -%if ! 0%{?nodejs_default} -rm -rf %{buildroot}%{_usr}/lib/dtrace \ - %{buildroot}%{_datadir}/systemtap/tapset/node.stp -%endif - # install documentation mkdir -p %{buildroot}%{_pkgdocdir}/html cp -pr doc/* %{buildroot}%{_pkgdocdir}/html @@ -752,14 +755,15 @@ end %if 0%{?nodejs_default} %{_bindir}/node %doc %{_mandir}/man1/node.1* +%{nodejs_sitelib} + +{% if NODE_MAJOR < 19 -%} %dir %{_datadir}/systemtap %dir %{_datadir}/systemtap/tapset -%{nodejs_sitelib} %{_datadir}/systemtap/tapset/node.stp -%if %{without bundled} %dir %{_usr}/lib/dtrace %{_usr}/lib/dtrace/node.d -%endif +{% endif %} %endif %{_bindir}/node-%{nodejs_major}