From 6679bf8258e00d87a02cbad911bb7d9887550c00 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Thu, 19 Dec 2024 10:19:46 +0000 Subject: [PATCH] import CS nodejs-22.11.0-1.module_el9_5+1123+1f6cfb38 --- .gitignore | 5 +- .nodejs.metadata | 5 +- ...1-Disable-running-gyp-on-shared-deps.patch | 31 - .../0001-Remove-unused-OpenSSL-config.patch | 45 + ...ess-NPM-message-to-run-global-update.patch | 84 -- ...-deps-ncrypto-include-openssl-rand.h.patch | 25 + ...ICU-data-from-with-icu-default-data-.patch | 122 -- ...8n-prototype-pollution-vulnerability.patch | 13 - SOURCES/nodejs-tarball.sh | 117 +- SOURCES/nodejs.pc.in | 9 + SOURCES/nodejs_native.attr | 2 - SOURCES/npmrc | 1 + SOURCES/npmrc.builtin.in | 5 + SOURCES/v8.pc.in | 9 + SPECS/nodejs.spec | 1154 +++++++++-------- 15 files changed, 769 insertions(+), 858 deletions(-) delete mode 100644 SOURCES/0001-Disable-running-gyp-on-shared-deps.patch create mode 100644 SOURCES/0001-Remove-unused-OpenSSL-config.patch delete mode 100644 SOURCES/0002-Suppress-NPM-message-to-run-global-update.patch create mode 100644 SOURCES/0002-deps-ncrypto-include-openssl-rand.h.patch delete mode 100644 SOURCES/0003-build-auto-load-ICU-data-from-with-icu-default-data-.patch delete mode 100644 SOURCES/0004-CVE-2020-7774-nodejs-y18n-prototype-pollution-vulnerability.patch create mode 100644 SOURCES/nodejs.pc.in delete mode 100644 SOURCES/nodejs_native.attr create mode 100644 SOURCES/npmrc.builtin.in create mode 100644 SOURCES/v8.pc.in diff --git a/.gitignore b/.gitignore index eb6e49f..3c0bc00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -SOURCES/icu4c-64_2-src.tgz -SOURCES/node-v10.24.0-stripped.tar.gz +SOURCES/icu4c-75_1-data-bin-b.zip +SOURCES/icu4c-75_1-data-bin-l.zip +SOURCES/node-v22.11.0-stripped.tar.gz diff --git a/.nodejs.metadata b/.nodejs.metadata index fac6a06..9d330f2 100644 --- a/.nodejs.metadata +++ b/.nodejs.metadata @@ -1,2 +1,3 @@ -3127155ecf2b75ab4835f501b7478e39c07bb852 SOURCES/icu4c-64_2-src.tgz -be0e0b385a852c376f452b3d94727492e05407e4 SOURCES/node-v10.24.0-stripped.tar.gz +6c7291d88272d84fdadf1395166acd40dd12f623 SOURCES/icu4c-75_1-data-bin-b.zip +ef164aa671780d004e304b4c789b05450e912304 SOURCES/icu4c-75_1-data-bin-l.zip +17c2b64411adb2127c23324dfceaf52c076e1ab8 SOURCES/node-v22.11.0-stripped.tar.gz diff --git a/SOURCES/0001-Disable-running-gyp-on-shared-deps.patch b/SOURCES/0001-Disable-running-gyp-on-shared-deps.patch deleted file mode 100644 index 51d360f..0000000 --- a/SOURCES/0001-Disable-running-gyp-on-shared-deps.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 2cd4c12776af3da588231d3eb498e6451c30eae5 Mon Sep 17 00:00:00 2001 -From: Zuzana Svetlikova -Date: Thu, 27 Apr 2017 14:25:42 +0200 -Subject: [PATCH] Disable running gyp on shared deps - -Signed-off-by: rpm-build ---- - Makefile | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/Makefile b/Makefile -index 73feb4c..45bbceb 100644 ---- a/Makefile -+++ b/Makefile -@@ -123,10 +123,9 @@ with-code-cache: - test-code-cache: with-code-cache - $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) code-cache - --out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ -- deps/zlib/zlib.gyp deps/v8/gypfiles/toolchain.gypi \ -- deps/v8/gypfiles/features.gypi deps/v8/gypfiles/v8.gyp node.gyp \ -- config.gypi -+out/Makefile: common.gypi deps/http_parser/http_parser.gyp \ -+ deps/v8/gypfiles/toolchain.gypi deps/v8/gypfiles/features.gypi \ -+ deps/v8/gypfiles/v8.gyp node.gyp config.gypi - $(PYTHON) tools/gyp_node.py -f make - - config.gypi: configure configure.py --- -2.26.2 - diff --git a/SOURCES/0001-Remove-unused-OpenSSL-config.patch b/SOURCES/0001-Remove-unused-OpenSSL-config.patch new file mode 100644 index 0000000..f282c71 --- /dev/null +++ b/SOURCES/0001-Remove-unused-OpenSSL-config.patch @@ -0,0 +1,45 @@ +From 0aaaf4104a1f23f3de105ffdaffc282c4477bb0e Mon Sep 17 00:00:00 2001 +From: Stephen Gallagher +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 +--- + node.gyp | 17 ----------------- + 1 file changed, 17 deletions(-) + +diff --git a/node.gyp b/node.gyp +index dc4d77330a811d3448d84318c065a3447b159906..e1824d462ec876a66146092aab4dba3d085f4658 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -808,23 +808,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.44.0 + diff --git a/SOURCES/0002-Suppress-NPM-message-to-run-global-update.patch b/SOURCES/0002-Suppress-NPM-message-to-run-global-update.patch deleted file mode 100644 index e1b721f..0000000 --- a/SOURCES/0002-Suppress-NPM-message-to-run-global-update.patch +++ /dev/null @@ -1,84 +0,0 @@ -From e7afb2d6e2a6c8f9c9c32e12a10c3c5c4902a251 Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Tue, 1 May 2018 08:05:30 -0400 -Subject: [PATCH] Suppress NPM message to run global update - -Signed-off-by: Stephen Gallagher -Signed-off-by: rpm-build ---- - deps/npm/bin/npm-cli.js | 54 ----------------------------------------- - 1 file changed, 54 deletions(-) - -diff --git a/deps/npm/bin/npm-cli.js b/deps/npm/bin/npm-cli.js -index c0d9be0..0f0892e 100755 ---- a/deps/npm/bin/npm-cli.js -+++ b/deps/npm/bin/npm-cli.js -@@ -71,65 +71,11 @@ - npm.command = 'help' - } - -- var isGlobalNpmUpdate = conf.global && ['install', 'update'].includes(npm.command) && npm.argv.includes('npm') -- - // now actually fire up npm and run the command. - // this is how to use npm programmatically: - conf._exit = true - npm.load(conf, function (er) { - if (er) return errorHandler(er) -- if ( -- !isGlobalNpmUpdate && -- npm.config.get('update-notifier') && -- !unsupported.checkVersion(process.version).unsupported -- ) { -- const pkg = require('../package.json') -- let notifier = require('update-notifier')({pkg}) -- const isCI = require('ci-info').isCI -- if ( -- notifier.update && -- notifier.update.latest !== pkg.version && -- !isCI -- ) { -- const color = require('ansicolors') -- const useColor = npm.config.get('color') -- const useUnicode = npm.config.get('unicode') -- const old = notifier.update.current -- const latest = notifier.update.latest -- let type = notifier.update.type -- if (useColor) { -- switch (type) { -- case 'major': -- type = color.red(type) -- break -- case 'minor': -- type = color.yellow(type) -- break -- case 'patch': -- type = color.green(type) -- break -- } -- } -- const changelog = `https://github.com/npm/cli/releases/tag/v${latest}` -- notifier.notify({ -- message: `New ${type} version of ${pkg.name} available! ${ -- useColor ? color.red(old) : old -- } ${useUnicode ? '→' : '->'} ${ -- useColor ? color.green(latest) : latest -- }\n` + -- `${ -- useColor ? color.yellow('Changelog:') : 'Changelog:' -- } ${ -- useColor ? color.cyan(changelog) : changelog -- }\n` + -- `Run ${ -- useColor -- ? color.green(`npm install -g ${pkg.name}`) -- : `npm i -g ${pkg.name}` -- } to update!` -- }) -- } -- } - npm.commands[npm.command](npm.argv, function (err) { - // https://genius.com/Lin-manuel-miranda-your-obedient-servant-lyrics - if ( --- -2.26.2 - diff --git a/SOURCES/0002-deps-ncrypto-include-openssl-rand.h.patch b/SOURCES/0002-deps-ncrypto-include-openssl-rand.h.patch new file mode 100644 index 0000000..c6667fb --- /dev/null +++ b/SOURCES/0002-deps-ncrypto-include-openssl-rand.h.patch @@ -0,0 +1,25 @@ +From e79552fdbebb411b8a6f7bc323525f463c1ee7ad Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Wed, 30 Oct 2024 15:48:59 +0100 +Subject: [PATCH] deps(ncrypto): include + +Signed-off-by: rpm-build +--- + deps/ncrypto/ncrypto.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc +index 457bd2f..a38b4a2 100644 +--- a/deps/ncrypto/ncrypto.cc ++++ b/deps/ncrypto/ncrypto.cc +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + #include + #include + #if OPENSSL_VERSION_MAJOR >= 3 +-- +2.47.0 + diff --git a/SOURCES/0003-build-auto-load-ICU-data-from-with-icu-default-data-.patch b/SOURCES/0003-build-auto-load-ICU-data-from-with-icu-default-data-.patch deleted file mode 100644 index 14d39ae..0000000 --- a/SOURCES/0003-build-auto-load-ICU-data-from-with-icu-default-data-.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 0028cc74dac4dd24b8599ade85cb49fdafa9f559 Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Fri, 6 Dec 2019 16:40:25 -0500 -Subject: [PATCH] build: auto-load ICU data from --with-icu-default-data-dir - -When compiled with `--with-intl=small` and -`--with-icu-default-data-dir=PATH`, Node.js will use PATH as a -fallback location for the ICU data. - -We will first perform an access check using fopen(PATH, 'r') to -ensure that the file is readable. If it is, we'll set the -icu_data_directory and proceed. There's a slight overhead for the -fopen() check, but it should be barely measurable. - -This will be useful for Linux distribution packagers who want to -be able to ship a minimal node binary in a container image but -also be able to add on the full i18n support where needed. With -this patch, it becomes possible to ship the interpreter as -/usr/bin/node in one package for the distribution and to ship the -data files in another package (without a strict dependency -between the two). This means that users of the distribution will -not need to explicitly direct Node.js to locate the ICU data. It -also means that in environments where full internationalization is -not required, they do not need to carry the extra content (with -the associated storage costs). - -Refs: https://github.com/nodejs/node/issues/3460 - -Signed-off-by: Stephen Gallagher -Signed-off-by: rpm-build ---- - configure.py | 9 +++++++++ - node.gypi | 7 +++++++ - src/node.cc | 20 ++++++++++++++++++++ - 3 files changed, 36 insertions(+) - -diff --git a/configure.py b/configure.py -index 89f7bf5..d611a88 100755 ---- a/configure.py -+++ b/configure.py -@@ -433,6 +433,14 @@ intl_optgroup.add_option('--with-icu-source', - 'the icu4c source archive. ' - 'v%d.x or later recommended.' % icu_versions['minimum_icu']) - -+intl_optgroup.add_option('--with-icu-default-data-dir', -+ action='store', -+ dest='with_icu_default_data_dir', -+ help='Path to the icuXXdt{lb}.dat file. If unspecified, ICU data will ' -+ 'only be read if the NODE_ICU_DATA environment variable or the ' -+ '--icu-data-dir runtime argument is used. This option has effect ' -+ 'only when Node.js is built with --with-intl=small-icu.') -+ - parser.add_option('--with-ltcg', - action='store_true', - dest='with_ltcg', -@@ -1359,6 +1367,7 @@ def configure_intl(o): - locs.add('root') # must have root - o['variables']['icu_locales'] = string.join(locs,',') - # We will check a bit later if we can use the canned deps/icu-small -+ o['variables']['icu_default_data'] = options.with_icu_default_data_dir or '' - elif with_intl == 'full-icu': - # full ICU - o['variables']['v8_enable_i18n_support'] = 1 -diff --git a/node.gypi b/node.gypi -index 466a174..65b97d6 100644 ---- a/node.gypi -+++ b/node.gypi -@@ -113,6 +113,13 @@ - 'conditions': [ - [ 'icu_small=="true"', { - 'defines': [ 'NODE_HAVE_SMALL_ICU=1' ], -+ 'conditions': [ -+ [ 'icu_default_data!=""', { -+ 'defines': [ -+ 'NODE_ICU_DEFAULT_DATA_DIR="<(icu_default_data)"', -+ ], -+ }], -+ ], - }]], - }], - [ 'node_use_bundled_v8=="true" and \ -diff --git a/src/node.cc b/src/node.cc -index 7c01187..c9840e3 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -92,6 +92,7 @@ - - #if defined(NODE_HAVE_I18N_SUPPORT) - #include -+#include - #endif - - #if defined(LEAK_SANITIZER) -@@ -2643,6 +2644,25 @@ void Init(std::vector* argv, - // If the parameter isn't given, use the env variable. - if (per_process_opts->icu_data_dir.empty()) - SafeGetenv("NODE_ICU_DATA", &per_process_opts->icu_data_dir); -+ -+#ifdef NODE_ICU_DEFAULT_DATA_DIR -+ // If neither the CLI option nor the environment variable was specified, -+ // fall back to the configured default -+ if (per_process_opts->icu_data_dir.empty()) { -+ // Check whether the NODE_ICU_DEFAULT_DATA_DIR contains the right data -+ // file and can be read. -+ static const char full_path[] = -+ NODE_ICU_DEFAULT_DATA_DIR "/" U_ICUDATA_NAME ".dat"; -+ -+ FILE* f = fopen(full_path, "rb"); -+ -+ if (f != nullptr) { -+ fclose(f); -+ per_process_opts->icu_data_dir = NODE_ICU_DEFAULT_DATA_DIR; -+ } -+ } -+#endif // NODE_ICU_DEFAULT_DATA_DIR -+ - // Initialize ICU. - // If icu_data_dir is empty here, it will load the 'minimal' data. - if (!i18n::InitializeICUDirectory(per_process_opts->icu_data_dir)) { --- -2.26.2 - diff --git a/SOURCES/0004-CVE-2020-7774-nodejs-y18n-prototype-pollution-vulnerability.patch b/SOURCES/0004-CVE-2020-7774-nodejs-y18n-prototype-pollution-vulnerability.patch deleted file mode 100644 index 88a9d75..0000000 --- a/SOURCES/0004-CVE-2020-7774-nodejs-y18n-prototype-pollution-vulnerability.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/deps/npm/node_modules/y18n/index.js b/deps/npm/node_modules/y18n/index.js -index d720681628..727362aac0 100644 ---- a/deps/npm/node_modules/y18n/index.js -+++ b/deps/npm/node_modules/y18n/index.js -@@ -11,7 +11,7 @@ function Y18N (opts) { - this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true - - // internal stuff. -- this.cache = {} -+ this.cache = Object.create(null) - this.writeQueue = [] - } - diff --git a/SOURCES/nodejs-tarball.sh b/SOURCES/nodejs-tarball.sh index d333607..a908c63 100755 --- a/SOURCES/nodejs-tarball.sh +++ b/SOURCES/nodejs-tarball.sh @@ -119,69 +119,128 @@ tar -zxf node-v${version}.tar.gz rm -rf node-v${version}/deps/openssl tar -zcf node-v${version}-stripped.tar.gz node-v${version} -# Download the matching version of ICU -rm -f icu4c*-src.tgz icu.md5 -ICUMD5=$(cat node-v${version}/tools/icu/current_ver.dep |jq -r '.[0].md5') -wget $(cat node-v${version}/tools/icu/current_ver.dep |jq -r '.[0].url') -ICUTARBALL=$(ls -1 icu4c*-src.tgz) -echo "$ICUMD5 $ICUTARBALL" > icu.md5 -md5sum -c icu.md5 -rm -f icu.md5 SHASUMS256.txt +# Download the ICU binary data files +ICU_MAJOR=$(jq -r '.[0].url' node-v${version}/tools/icu/current_ver.dep | sed --expression='s/.*release-\([[:digit:]]\+\)-\([[:digit:]]\+\).*/\1/g') +ICU_MINOR=$(jq -r '.[0].url' node-v${version}/tools/icu/current_ver.dep | sed --expression='s/.*release-\([[:digit:]]\+\)-\([[:digit:]]\+\).*/\2/g') +rm -Rf icu4c-${ICU_MAJOR}_${ICU_MINOR}-data-bin-*.zip +wget $(grep Source3 nodejs.spec | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g") +wget $(grep Source4 nodejs.spec | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g") -rhpkg new-sources node-v${version}-stripped.tar.gz icu4c*-src.tgz +#fedpkg new-sources node-v${version}-stripped.tar.gz icu4c*-src.tgz rm -f node-v${version}.tar.gz set +e # Determine the bundled versions of the various packages +echo "Included software versions" +echo "-------------------------" +echo +echo "Node.js version" +echo "=========================" +echo "${version}" +echo echo "Bundled software versions" echo "-------------------------" echo -echo "libnode shared object version" +echo "libnode shared object version (nodejs_soversion)" echo "=========================" -grep "define NODE_MODULE_VERSION" node-v${version}/src/node_version.h +NODE_SOVERSION=$(grep -oP '(?<=#define NODE_MODULE_VERSION )\d+' node-v${version}/src/node_version.h) +echo "${NODE_SOVERSION}" echo echo "V8" echo "=========================" -grep "define V8_MAJOR_VERSION" node-v${version}/deps/v8/include/v8-version.h -grep "define V8_MINOR_VERSION" node-v${version}/deps/v8/include/v8-version.h -grep "define V8_BUILD_NUMBER" node-v${version}/deps/v8/include/v8-version.h -grep "define V8_PATCH_LEVEL" node-v${version}/deps/v8/include/v8-version.h +V8_MAJOR=$(grep -oP '(?<=#define V8_MAJOR_VERSION )\d+' node-v${version}/deps/v8/include/v8-version.h) +V8_MINOR=$(grep -oP '(?<=#define V8_MINOR_VERSION )\d+' node-v${version}/deps/v8/include/v8-version.h) +V8_BUILD=$(grep -oP '(?<=#define V8_BUILD_NUMBER )\d+' node-v${version}/deps/v8/include/v8-version.h) +V8_PATCH=$(grep -oP '(?<=#define V8_PATCH_LEVEL )\d+' node-v${version}/deps/v8/include/v8-version.h) +echo "${V8_MAJOR}.${V8_MINOR}.${V8_BUILD}.${V8_PATCH}" echo echo "c-ares" echo "=========================" -grep "define ARES_VERSION_MAJOR" node-v${version}/deps/cares/include/ares_version.h -grep "define ARES_VERSION_MINOR" node-v${version}/deps/cares/include/ares_version.h -grep "define ARES_VERSION_PATCH" node-v${version}/deps/cares/include/ares_version.h +C_ARES_VERSION=$(grep -oP '(?<=#define ARES_VERSION_STR ).*\"' node-v${version}/deps/cares/include/ares_version.h |sed -e 's/^"//' -e 's/"$//') +echo $C_ARES_VERSION echo -echo "http-parser" +echo "llhttp" echo "=========================" -grep "define HTTP_PARSER_VERSION_MAJOR" node-v${version}/deps/http_parser/http_parser.h -grep "define HTTP_PARSER_VERSION_MINOR" node-v${version}/deps/http_parser/http_parser.h -grep "define HTTP_PARSER_VERSION_PATCH" node-v${version}/deps/http_parser/http_parser.h +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) +LLHTTP_VERSION="${LLHTTP_MAJOR}.${LLHTTP_MINOR}.${LLHTTP_PATCH}" +echo $LLHTTP_VERSION echo echo "libuv" echo "=========================" -grep "define UV_VERSION_MAJOR" node-v${version}/deps/uv/include/uv/version.h -grep "define UV_VERSION_MINOR" node-v${version}/deps/uv/include/uv/version.h -grep "define UV_VERSION_PATCH" node-v${version}/deps/uv/include/uv/version.h +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) +LIBUV_VERSION="${UV_MAJOR}.${UV_MINOR}.${UV_PATCH}" +echo $LIBUV_VERSION echo echo "nghttp2" echo "=========================" -grep "define NGHTTP2_VERSION " node-v${version}/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h +NGHTTP2_VERSION=$(grep -oP '(?<=#define NGHTTP2_VERSION ).*\"' node-v${version}/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h |sed -e 's/^"//' -e 's/"$//') +echo $NGHTTP2_VERSION +echo +echo "nghttp3" +echo "=========================" +NGHTTP3_VERSION=$(grep -oP '(?<=#define NGHTTP3_VERSION ).*\"' node-v${version}/deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h |sed -e 's/^"//' -e 's/"$//') +echo $NGHTTP3_VERSION +echo +echo "ngtcp2" +echo "=========================" +NGTCP2_VERSION=$(grep -oP '(?<=#define NGTCP2_VERSION ).*\"' node-v${version}/deps/ngtcp2/ngtcp2/lib/includes/ngtcp2/version.h |sed -e 's/^"//' -e 's/"$//') +echo $NGTCP2_VERSION echo echo "ICU" echo "=========================" -grep "url" node-v${version}/tools/icu/current_ver.dep +ICU_MAJOR=$(jq -r '.[0].url' node-v${version}/tools/icu/current_ver.dep | sed --expression='s/.*release-\([[:digit:]]\+\)-\([[:digit:]]\+\).*/\1/g') +ICU_MINOR=$(jq -r '.[0].url' node-v${version}/tools/icu/current_ver.dep | sed --expression='s/.*release-\([[:digit:]]\+\)-\([[:digit:]]\+\).*/\2/g') +echo "${ICU_MAJOR}.${ICU_MINOR}" +echo +echo "simdutf" +echo "=========================" +SIMDUTF_VERSION=$(grep -oP '(?<=#define SIMDUTF_VERSION ).*\"' node-v${version}/deps/simdutf/simdutf.h |sed -e 's/^"//' -e 's/"$//') +echo $SIMDUTF_VERSION +echo +echo "ada" +echo "=========================" +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 "punycode" echo "=========================" -grep "'version'" node-v${version}/lib/punycode.js +PUNYCODE_VERSION=$(grep -oP "'version': '\K[^']+" ./node-v${version}/lib/punycode.js) +echo $PUNYCODE_VERSION echo echo "npm" echo "=========================" -grep "\"version\":" node-v${version}/deps/npm/package.json +NPM_VERSION=$(jq -r .version ./node-v${version}/deps/npm/package.json) +echo $NPM_VERSION +echo +echo "corepack" +echo "=========================" +COREPACK_VERSION=$(jq -r .version ./node-v${version}/deps/corepack/package.json) +echo $COREPACK_VERSION +echo +echo "uvwasi" +echo "=========================" +UVWASI_MAJOR=$(grep -oP '(?<=#define UVWASI_VERSION_MAJOR )\d+' node-v${version}/deps/uvwasi/include/uvwasi.h) +UVWASI_MINOR=$(grep -oP '(?<=#define UVWASI_VERSION_MINOR )\d+' node-v${version}/deps/uvwasi/include/uvwasi.h) +UVWASI_PATCH=$(grep -oP '(?<=#define UVWASI_VERSION_PATCH )\d+' node-v${version}/deps/uvwasi/include/uvwasi.h) +UVWASI_VERSION="${UVWASI_MAJOR}.${UVWASI_MINOR}.${UVWASI_PATCH}" +echo $UVWASI_VERSION +echo +echo "histogram_c" +echo "=========================" +HISTOGRAM_VERSION=$(grep -oP '(?<=#define HDR_HISTOGRAM_VERSION ).*\"' node-v${version}/deps/histogram/include/hdr/hdr_histogram_version.h|sed -e 's/^"//' -e 's/"$//') +echo $HISTOGRAM_VERSION +echo +echo "sqlite" +echo "=========================" +SQLITE_VERSION="$(grep -osP '(?<=#define SQLITE_VERSION ).*\"' node-v${version}/deps/sqlite/sqlite3.h |sed -e 's/^\s*"//' -e 's/"\s*$//')" +echo "${SQLITE_VERSION}" echo echo "Make sure these versions match what is in the RPM spec file" diff --git a/SOURCES/nodejs.pc.in b/SOURCES/nodejs.pc.in new file mode 100644 index 0000000..a699363 --- /dev/null +++ b/SOURCES/nodejs.pc.in @@ -0,0 +1,9 @@ +prefix=@PREFIX@ +includedir=@INCLUDEDIR@ +libdir=@LIBDIR@ + +Name: @PKGCONFNAME@ +Description: JavaScript Runtime +Version: @NODEJS_VERSION@ +Libs: -L${libdir} -lnodejs +Cflags: -I${includedir}/node diff --git a/SOURCES/nodejs_native.attr b/SOURCES/nodejs_native.attr deleted file mode 100644 index 0527af6..0000000 --- a/SOURCES/nodejs_native.attr +++ /dev/null @@ -1,2 +0,0 @@ -%__nodejs_native_requires %{_rpmconfigdir}/nodejs_native.req -%__nodejs_native_path ^/usr/lib.*/node_modules/.*\\.node$ diff --git a/SOURCES/npmrc b/SOURCES/npmrc index 10437ca..50be1d1 100644 --- a/SOURCES/npmrc +++ b/SOURCES/npmrc @@ -1 +1,2 @@ prefix=/usr/local +python=/usr/bin/python3 diff --git a/SOURCES/npmrc.builtin.in b/SOURCES/npmrc.builtin.in new file mode 100644 index 0000000..739a57d --- /dev/null +++ b/SOURCES/npmrc.builtin.in @@ -0,0 +1,5 @@ +# This is the distibution-level configuration file for npm. +# To configure NPM on a system level, use the globalconfig below (defaults to @SYSCONFDIR@/npmrc). +# vim:set filetype=dosini: + +globalconfig=@SYSCONFDIR@/npmrc diff --git a/SOURCES/v8.pc.in b/SOURCES/v8.pc.in new file mode 100644 index 0000000..6b63094 --- /dev/null +++ b/SOURCES/v8.pc.in @@ -0,0 +1,9 @@ +prefix=@PREFIX@ +includedir=@INCLUDEDIR@ +libdir=@LIBDIR@ + +Name: v8-@PKGCONFVERSION@ +Description: JavaScript Runtime +Version: @V8_VERSION@ +Libs: -L${libdir} -lv8 +Cflags: -I${includedir} diff --git a/SPECS/nodejs.spec b/SPECS/nodejs.spec index 7021757..2efa723 100644 --- a/SPECS/nodejs.spec +++ b/SPECS/nodejs.spec @@ -1,13 +1,46 @@ -%global with_debug 0 +# Determine if this should be the default version for this Fedora release +# The default version will own /usr/bin/node and friends +%global nodejs_pkg_major 22 -# PowerPC, s390x and aarch64 segfault during Debug builds -# https://github.com/nodejs/node/issues/20642 -%ifarch %{power64} s390x aarch64 -%global with_debug 0 +%global nodejs_default %{nodejs_pkg_major} + +%global nodejs_default_sitelib %{_prefix}/lib/node_modules +%global nodejs_private_sitelib %{nodejs_default_sitelib} + + +# Break circular dependencies +%bcond bootstrap 0 + +# 2024-05-21: Temporarily re-enable bundling to work around issues in Rawhide +%if %{with bootstrap} || 0%{?nodejs_pkg_major} == 22 +%bcond bundled_cjs_module_lexer 1 +%bcond bundled_undici 1 +%else +%bcond bundled_cjs_module_lexer 0 +%bcond bundled_undici 0 %endif -# bundle dependencies that are not available as Fedora modules -%bcond_with bootstrap +%if 0%{?rhel} && 0%{?rhel} < 10 +%bcond bundled_libuv 1 +%else +%bcond bundled_libuv 0 +%endif + +%if 0%{?rhel} && 0%{?rhel} < 8 +%bcond_without bundled_zlib +%else +%bcond_with bundled_zlib +%endif + +# System SQLite is too old in any RHEL <= 10 +%bcond_without bundled_sqlite + +# LTO is currently broken on Node.js builds +%define _lto_cflags %{nil} + +# Heavy-handed approach to avoiding issues with python +# bytecompiling files in the node_modules/ directory +%global __python %{python3} # == Master Relase == # This is used by both the nodejs package and the npm subpackage that @@ -23,79 +56,76 @@ # feature releases that are only supported for nine months, which is shorter # than a Fedora release lifecycle. %global nodejs_epoch 1 -%global nodejs_major 10 -%global nodejs_minor 24 +%global nodejs_major 22 +%global nodejs_minor 11 %global nodejs_patch 0 -%global nodejs_abi %{nodejs_major}.%{nodejs_minor} # nodejs_soversion - from NODE_MODULE_VERSION in src/node_version.h -%global nodejs_soversion 64 +%global nodejs_soversion 127 +%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}%{?dist} + +%global nodejs_datadir %{_datarootdir}/node-%{nodejs_pkg_major} -%global nodejs_datadir %{_datarootdir}/nodejs # == Bundled Dependency Versions == # v8 - from deps/v8/include/v8-version.h # Epoch is set to ensure clean upgrades from the old v8 package -%global v8_epoch 1 -%global v8_major 6 -%global v8_minor 8 -%global v8_build 275 -%global v8_patch 32 -# V8 presently breaks ABI at least every x.y release while never bumping SONAME -%global v8_abi %{v8_major}.%{v8_minor} +%global v8_epoch 3 +%global v8_major 12 +%global v8_minor 4 +%global v8_build 254 +%global v8_patch 21 %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 1.3.0.1-motley + # c-ares - from deps/cares/include/ares_version.h # https://github.com/nodejs/node/pull/9332 -%global c_ares_major 1 -%global c_ares_minor 15 -%global c_ares_patch 0 -%global c_ares_version %{c_ares_major}.%{c_ares_minor}.%{c_ares_patch} +%global c_ares_version 1.33.1 -# http-parser - from deps/http_parser/http_parser.h -%global http_parser_major 2 -%global http_parser_minor 9 -%global http_parser_patch 4 -%global http_parser_version %{http_parser_major}.%{http_parser_minor}.%{http_parser_patch} +# llhttp - from deps/llhttp/include/llhttp.h +%global llhttp_version 9.2.1 # libuv - from deps/uv/include/uv/version.h -%global libuv_major 1 -%global libuv_minor 34 -%global libuv_patch 2 -%global libuv_version %{libuv_major}.%{libuv_minor}.%{libuv_patch} +%global libuv_version 1.48.0 # nghttp2 - from deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h -%global nghttp2_major 1 -%global nghttp2_minor 41 -%global nghttp2_patch 0 -%global nghttp2_version %{nghttp2_major}.%{nghttp2_minor}.%{nghttp2_patch} +%global nghttp2_version 1.63.0 + +# nghttp3 - from deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h +%global nghttp3_version 0.7.0 + +# ngtcp2 from deps/ngtcp2/ngtcp2/lib/includes/ngtcp2/version.h +%global ngtcp2_version 1.3.0 # ICU - from tools/icu/current_ver.dep -%global icu_major 64 -%global icu_minor 2 +%global icu_major 75 +%global icu_minor 1 %global icu_version %{icu_major}.%{icu_minor} %global icudatadir %{nodejs_datadir}/icudata -%{!?little_endian: %global little_endian %(%{__python3} -c "import sys;print (0 if sys.byteorder=='big' else 1)")} +%{!?little_endian: %global little_endian %(%{python3} -c "import sys;print (0 if sys.byteorder=='big' else 1)")} # " this line just fixes syntax highlighting for vim that is confused by the above and continues literal +# simdutf from deps/simdutf/simdutf.h +%global simdutf_version 5.5.0 + +# OpenSSL minimum version +%global openssl11_minimum 1:1.1.1 +%global openssl30_minimum 1:3.0.2 # 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_major 2 -%global punycode_minor 1 -%global punycode_patch 0 -%global punycode_version %{punycode_major}.%{punycode_minor}.%{punycode_patch} +%global punycode_version 2.1.0 # npm - from deps/npm/package.json %global npm_epoch 1 -%global npm_major 6 -%global npm_minor 14 -%global npm_patch 11 -%global npm_version %{npm_major}.%{npm_minor}.%{npm_patch} +%global npm_version 10.9.0 # 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 @@ -103,19 +133,25 @@ # base npm version number is increasing. %global npm_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release} -# brotli - from deps/brotli/c/common/version.h -# v10.x doesn't have --shared-brotli configure option, so we have to bundle it -%global brotli_major 1 -%global brotli_minor 0 -%global brotli_patch 7 -%global brotli_version %{brotli_major}.%{brotli_minor}.%{brotli_patch} +%global npm_envr %{npm_epoch}:%{npm_version}-%{npm_release} + +# uvwasi - from deps/uvwasi/include/uvwasi.h +%global uvwasi_version 0.0.21 + +# histogram_c - assumed from timestamps +%global histogram_version 0.11.8 + +# sqlite - from deps/sqlite/sqlite3.h +%global sqlite_version 3.46.1 + Name: nodejs Epoch: %{nodejs_epoch} Version: %{nodejs_version} Release: %{nodejs_release}%{?dist} Summary: JavaScript runtime -License: MIT and ASL 2.0 and ISC and BSD +# see bundled_licenses.py, which helps identify licenses in bundled NPM modules +License: Apache-2.0 AND Artistic-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BlueOak-1.0.0 AND CC-BY-3.0 AND CC0-1.0 AND ISC AND MIT Group: Development/Languages URL: http://nodejs.org/ @@ -123,74 +159,121 @@ ExclusiveArch: %{nodejs_arches} # nodejs bundles openssl, but we use the system version in Fedora # because openssl contains prohibited code, we remove openssl completely from -# the tarball, using the script in Source100 +# the tarball, using the script in Source200 Source0: node-v%{nodejs_version}-stripped.tar.gz Source1: npmrc Source2: btest402.js -Source3: https://github.com/unicode-org/icu/releases/download/release-%{icu_major}-%{icu_minor}/icu4c-%{icu_major}_%{icu_minor}-src.tgz -Source100: %{name}-tarball.sh +# The binary data that icu-small can use to get icu-full capability +Source3: https://github.com/unicode-org/icu/releases/download/release-%{icu_major}-%{icu_minor}/icu4c-%{icu_major}_%{icu_minor}-data-bin-b.zip +Source4: https://github.com/unicode-org/icu/releases/download/release-%{icu_major}-%{icu_minor}/icu4c-%{icu_major}_%{icu_minor}-data-bin-l.zip +Source200: nodejs-tarball.sh +Source201: npmrc.builtin.in +Source202: nodejs.pc.in +Source203: v8.pc.in -# The native module Requires generator remains in the nodejs SRPM, so it knows -# the nodejs and v8 versions. The remainder has migrated to the -# nodejs-packaging SRPM. -Source7: nodejs_native.attr +Patch: 0001-Remove-unused-OpenSSL-config.patch +Patch: 0002-deps-ncrypto-include-openssl-rand.h.patch -# Disable running gyp on bundled deps we don't use -Patch1: 0001-Disable-running-gyp-on-shared-deps.patch - -# Suppress the message from npm to run `npm -g update npm` -# This does bad things on an RPM-managed npm. -Patch2: 0002-Suppress-NPM-message-to-run-global-update.patch - -# Upstream patch to enable auto-detection of full ICU data -# https://github.com/nodejs/node/pull/30825 -Patch3: 0003-build-auto-load-ICU-data-from-with-icu-default-data-.patch - -# CVE-2020-7774 -Patch4: 0004-CVE-2020-7774-nodejs-y18n-prototype-pollution-vulnerability.patch +%global pkgname nodejs BuildRequires: make -BuildRequires: python2-devel -BuildRequires: python3-devel +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-jinja2 +%if 0%{?rhel} && 0%{?rhel} < 9 +BuildRequires: python-unversioned-command +%endif +%if %{with bundled_zlib} +Provides: bundled(zlib) = %{zlib_version} +%else BuildRequires: zlib-devel -BuildRequires: gcc >= 6.3.0 -BuildRequires: gcc-c++ >= 6.3.0 +%endif +BuildRequires: brotli-devel +%if 0%{?rhel} && 0%{?rhel} < 8 +BuildRequires: devtoolset-11-gcc +BuildRequires: devtoolset-11-gcc-c++ +%else +BuildRequires: gcc >= 8.3.0 +BuildRequires: gcc-c++ >= 8.3.0 +%endif + +BuildRequires: pkgconf +BuildRequires: jq + # needed to generate bundled provides for npm dependencies # https://src.fedoraproject.org/rpms/nodejs/pull-request/2 # https://pagure.io/nodejs-packaging/pull-request/10 BuildRequires: nodejs-packaging + BuildRequires: chrpath BuildRequires: libatomic +BuildRequires: ninja-build +BuildRequires: unzip -%if %{with bootstrap} -Provides: bundled(http-parser) = %{http_parser_version} -Provides: bundled(libuv) = %{libuv_version} -Provides: bundled(nghttp2) = %{nghttp2_version} -%else -BuildRequires: systemtap-sdt-devel -BuildRequires: libuv-devel >= 1:%{libuv_version} -Requires: libuv >= 1:%{libuv_version} -BuildRequires: libnghttp2-devel >= %{nghttp2_version} -Requires: libnghttp2 >= %{nghttp2_version} -BuildRequires: http-parser-devel >= %{http_parser_version} -Requires: http-parser >= %{http_parser_version} + +%if 0%{?nodejs_default} +Provides: nodejs = %{nodejs_envr} %endif -BuildRequires: openssl-devel +%if %{with bundled_libuv} +Provides: bundled(libuv) = %{libuv_version} +%else +BuildRequires: libuv-devel >= 1:%{libuv_version} +Requires: libuv >= 1:%{libuv_version} +%endif + +# Node.js frequently bumps this faster than Fedora can follow, +# so we will bundle it. +Provides: bundled(nghttp2) = %{nghttp2_version} +Provides: bundled(nghttp3) = %{nghttp3_version} +Provides: bundled(ngtcp2) = %{ngtcp2_version} + +# Temporarily bundle llhttp because the upstream doesn't +# provide releases for it. +Provides: bundled(llhttp) = %{llhttp_version} + + +%if 0%{?rhel} && 0%{?rhel} < 8 +BuildRequires: openssl11-devel >= %{openssl11_minimum} +Requires: openssl11 >= %{openssl11_minimum} +%global ssl_configure --shared-openssl --shared-openssl-includes=%{_includedir}/openssl11 --shared-openssl-libpath=%{_libdir}/openssl11 +%else + +%if 0%{?fedora} >= 36 +BuildRequires: openssl >= %{openssl30_minimum} +BuildRequires: openssl-devel >= %{openssl30_minimum} +%global openssl_fips_configure --openssl-is-fips +%else +Requires: openssl >= %{openssl11_minimum} +BuildRequires: openssl-devel >= %{openssl11_minimum} +%global openssl_fips_configure %{nil} +%endif + +%global ssl_configure --shared-openssl --openssl-conf-name=openssl_conf %{openssl_fips_configure} +%endif + + +# dtrace is not supported on Node.js 19+ +%global dtrace_configure %{nil} + # we need the system certificate store Requires: ca-certificates -# Pull in the full-icu data by default -Recommends: nodejs-full-i18n%{?_isa} = %{nodejs_epoch}:%{version}-%{release} +Requires: %{pkgname}-libs%{?_isa} = %{nodejs_envr} + +%if 0%{?fedora} || 0%{?rhel} >= 8 +# Pull in the docs and full-icu data by default +Recommends: %{pkgname}-docs = %{nodejs_envr} +Recommends: %{pkgname}-full-i18n%{?_isa} = %{nodejs_envr} +Recommends: %{pkgname}-npm >= %{npm_envr} +%endif # we need ABI virtual provides where SONAMEs aren't enough/not present so deps # break when binary compatibility is broken Provides: nodejs(abi) = %{nodejs_abi} Provides: nodejs(abi%{nodejs_major}) = %{nodejs_abi} -Provides: nodejs(v8-abi) = %{v8_abi} -Provides: nodejs(v8-abi%{v8_major}) = %{v8_abi} # this corresponds to the "engine" requirement in package.json Provides: nodejs(engine) = %{nodejs_version} @@ -229,87 +312,171 @@ Provides: bundled(v8) = %{v8_version} # an ABI-break, so we'll use the bundled copy. Provides: bundled(icu) = %{icu_version} -# Make sure we keep NPM up to date when we update Node.js -%if 0%{?rhel} -# EPEL doesn't support Recommends, so make it strict -Requires: npm = %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist} +# Upstream added new dependencies, but so far they are not available in Fedora +# or there's no option to built it as a shared dependency, so we bundle them +Provides: bundled(uvwasi) = %{uvwasi_version} +Provides: bundled(histogram) = %{histogram_version} +Provides: bundled(simdutf) = %{simdutf_version} + +# Upstream has added a new URL parser that has no option to build as a shared +# library (19.7.0+) +Provides: bundled(ada) = 2.8.0 + + +# undici and cjs-module-lexer ship with pre-built WASM binaries. +%if %{with bundled_cjs_module_lexer} +Provides: bundled(nodejs-cjs-module-lexer) = 1.2.2 %else -Recommends: npm = %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist} +BuildRequires: nodejs-cjs-module-lexer +Requires: nodejs-cjs-module-lexer %endif -# Provide bundled brotli until we can build it with system package -Provides: bundled(brotli) = %{brotli_version} +%if %{with bundled_undici} +Provides: bundled(nodejs-undici) = 6.19.2 +%else +BuildRequires: nodejs-undici +Requires: nodejs-undici +%endif + +%if %{with bundled_sqlite} +Provides: bundled(sqlite) = %{sqlite_version} +%else +BuildRequires: pkgconfig(sqlite3) >= 3.45 +%endif + + %description -Node.js is a platform built on Chrome's JavaScript runtime -for easily building fast, scalable network applications. -Node.js uses an event-driven, non-blocking I/O model that -makes it lightweight and efficient, perfect for data-intensive -real-time applications that run across distributed devices. +Node.js is a platform built on Chrome's JavaScript runtime \ +for easily building fast, scalable network applications. \ +Node.js uses an event-driven, non-blocking I/O model that \ +makes it lightweight and efficient, perfect for data-intensive \ +real-time applications that run across distributed devices.} - -%package devel +%package -n %{pkgname}-devel Summary: JavaScript runtime - development headers Group: Development/Languages -Requires: %{name}%{?_isa} = %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} +Requires: %{pkgname}%{?_isa} = %{nodejs_envr} +Requires: %{pkgname}-libs%{?_isa} = %{nodejs_envr} Requires: openssl-devel%{?_isa} +%if !%{with bundled_zlib} Requires: zlib-devel%{?_isa} +%endif +Requires: brotli-devel%{?_isa} Requires: nodejs-packaging -%if %{with bootstrap} -# deps are bundled -%else -Requires: http-parser-devel%{?_isa} +%if %{without bundled_libuv} Requires: libuv-devel%{?_isa} %endif -%description devel +%if 0%{?nodejs_default} +Provides: nodejs-devel = %{nodejs_envr} +%endif + +Provides: nodejs-devel-pkg = %{nodejs_envr} +Conflicts: nodejs-devel-pkg + + +%description -n %{pkgname}-devel Development headers for the Node.js JavaScript runtime. -%package full-i18n -Summary: Non-English locale data for Node.js -Requires: %{name}%{?_isa} = %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} +%package -n %{pkgname}-libs +Summary: Node.js and v8 libraries -%description full-i18n +# Compatibility for obsolete v8 package +%if 0%{?__isa_bits} == 64 +Provides: libv8.so.%{v8_major}()(64bit) = %{v8_epoch}:%{v8_version} +Provides: libv8_libbase.so.%{v8_major}()(64bit) = %{v8_epoch}:%{v8_version} +Provides: libv8_libplatform.so.%{v8_major}()(64bit) = %{v8_epoch}:%{v8_version} +%else +# 32-bits +Provides: libv8.so.%{v8_major} = %{v8_epoch}:%{v8_version} +Provides: libv8_libbase.so.%{v8_major} = %{v8_epoch}:%{v8_version} +Provides: libv8_libplatform.so.%{v8_major} = %{v8_epoch}:%{v8_version} +%endif + +Provides: v8 = %{v8_epoch}:%{v8_version}-%{nodejs_release} +Provides: v8%{?_isa} = %{v8_epoch}:%{v8_version}-%{nodejs_release} +Obsoletes: v8 < 1:6.7.17-10 + +Provides: nodejs-libs = %{nodejs_envr} + +%description -n %{pkgname}-libs +Libraries to support Node.js and provide stable v8 interfaces. + + +%package -n %{pkgname}-full-i18n +Summary: Non-English locale data for Node.js +Requires: %{pkgname}%{?_isa} = %{nodejs_envr} + + + +%description -n %{pkgname}-full-i18n Optional data files to provide full-icu support for Node.js. Remove this package to save space if non-English locales are not needed. +%package -n v8-%{v8_major}.%{v8_minor}-devel +Summary: v8 - development headers +Epoch: %{v8_epoch} +Version: %{v8_version} +Release: %{v8_release}%{?dist} +Requires: %{pkgname}-devel%{?_isa} = %{nodejs_envr} +Requires: %{pkgname}-libs%{?_isa} = %{nodejs_envr} +Provides: v8-devel = %{v8_epoch}:%{v8_version}-%{v8_release} + +Conflicts: v8-devel +Conflicts: v8-314-devel + + +%description -n v8-%{v8_major}.%{v8_minor}-devel +Development headers for the v8 runtime. + + %package -n npm Summary: Node.js Package Manager Epoch: %{npm_epoch} Version: %{npm_version} Release: %{npm_release}%{?dist} -# We used to ship npm separately, but it is so tightly integrated with Node.js -# (and expected to be present on all Node.js systems) that we ship it bundled -# now. -Obsoletes: npm < 0:3.5.4-6 -Provides: npm = %{npm_epoch}:%{npm_version} -Requires: nodejs = %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} +# If we're using the companion NPM build, make sure to keep it in lock-step +# with the Node version. +Requires: %{pkgname} = %{nodejs_envr} +%if 0%{?fedora} || 0%{?rhel} >= 8 +Recommends: %{pkgname}-docs = %{nodejs_envr} +%endif # Do not add epoch to the virtual NPM provides or it will break # the automatic dependency-generation script. Provides: npm(npm) = %{npm_version} + +%if 0%{?nodejs_default} +# Satisfy dependency requests for "npm" +Provides: npm = %{npm_envr} + +# Obsolete the old 'npm' package +Obsoletes: npm < 1:9 + +%endif + + %description -n npm npm is a package manager for node.js. You can use it to install and publish your node programs. It manages dependencies and does other cool stuff. -%package docs +%package -n %{pkgname}-docs Summary: Node.js API documentation Group: Documentation BuildArch: noarch +Requires(meta): %{pkgname} = %{nodejs_envr} -# We don't require that the main package be installed to -# use the docs, but if it is installed, make sure the -# version always matches -Conflicts: %{name} > %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} -Conflicts: %{name} < %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} +Provides: nodejs-docs = %{nodejs_envr} -%description docs + +%description -n %{pkgname}-docs The API documentation for the Node.js JavaScript runtime. @@ -317,135 +484,174 @@ 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 !%{with bundled_zlib} rm -rf deps/zlib +%endif + +rm -rf deps/brotli +rm -rf deps/v8/third_party/jinja2 +rm -rf tools/inspector_protocol/jinja2 + +%if %{without bundled_cjs_module_lexer} +rm -rf deps/cjs-module-lexer +%endif + +%if %{without bundled_undici} +rm -rf deps/undici +%endif + +%if %{without bundled_sqlite} +rm -rf deps/sqlite +%endif + +# Replace any instances of unversioned python with python3 +pfiles=( $(grep -rl python) ) +%py3_shebang_fix ${pfiles[@]} -# Replace any instances of unversioned python' with python2 -pathfix.py -i %{__python2} -pn $(find -type f ! -name "*.js") -find . -type f -exec sed -i "s~/usr\/bin\/env python~/usr/bin/python2~" {} \; -find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python2~" {} \; -sed -i "s~python~python2~" $(find . -type f | grep "gyp$") -sed -i "s~usr\/bin\/python2~usr\/bin\/python3~" ./deps/v8/tools/gen-inlining-tests.py -sed -i "s~usr\/bin\/python.*$~usr\/bin\/python2~" ./deps/v8/tools/mb/mb_unittest.py -find . -type f -exec sed -i "s~python -c~python2 -c~" {} \; -sed -i "s~which('python')~which('python2')~" configure %build -%ifarch s390 s390x %{arm} %ix86 +# Activate DevToolset 11 on EPEL 7 +%if 0%{?rhel} && 0%{?rhel} < 8 +. /opt/rh/devtoolset-11/enable +%endif + +# When compiled on armv7hl this package generates an out of range +# reference to the literal pool. This is most likely a GCC issue. +%ifarch armv7hl +%define _lto_cflags %{nil} +%endif + # Decrease debuginfo verbosity to reduce memory consumption during final # library linking %global optflags %(echo %{optflags} | sed 's/-g /-g1 /') -%endif -export RHEL_ALLOW_PYTHON2_FOR_BUILD=1 export CC='%{__cc}' export CXX='%{__cxx}' +export NODE_GYP_FORCE_PYTHON=%{python3} # build with debugging symbols and add defines from libuv (#892601) -# Node's v8 breaks with GCC 6 because of incorrect usage of methods on -# NULL objects. We need to pass -fno-delete-null-pointer-checks -export CFLAGS='%{optflags} \ - -D_LARGEFILE_SOURCE \ - -D_FILE_OFFSET_BITS=64 \ - -DZLIB_CONST \ - -fno-delete-null-pointer-checks' -export CXXFLAGS='%{optflags} \ - -D_LARGEFILE_SOURCE \ - -D_FILE_OFFSET_BITS=64 \ - -DZLIB_CONST \ - -fno-delete-null-pointer-checks' - -# Explicit new lines in C(XX)FLAGS can break naive build scripts -export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' ' ')" -export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')" - +# 2022-07-14: There's a bug in either torque or gcc that causes a +# segmentation fault on ppc64le and s390x if compiled with -O2. Things +# run fine on -O1 and -O3, so we'll just go with -O3 (like upstream) +# while this gets sorted out. +extra_cflags=( + -D_LARGEFILE_SOURCE + -D_FILE_OFFSET_BITS=64 + -DOPENSSL_NO_ENGINE # https://issues.redhat.com/browse/RHEL-33743 + -DZLIB_CONST + -O3 + -fno-ipa-icf +) +export CFLAGS="%{optflags} ${extra_cflags[*]}" CXXFLAGS="%{optflags} ${extra_cflags[*]}" export LDFLAGS="%{build_ldflags}" -%if %{with bootstrap} -./configure --prefix=%{_prefix} \ - --shared-openssl \ - --shared-zlib \ - --without-dtrace \ - --with-intl=small-icu \ - --openssl-use-def-ca-store -%else -./configure --prefix=%{_prefix} \ - --shared-openssl \ - --shared-zlib \ - --shared-libuv \ - --shared-http-parser \ - --shared-nghttp2 \ - --with-dtrace \ +# Fake up the unversioned python executable because gyp calls it from the PATH +mkdir .bin +cwd=$(pwd) +ln -srf /usr/bin/python3 ./.bin/python +export PATH="${cwd}/.bin:$PATH" + +%{python3} configure.py \ + --verbose \ + --ninja \ + --enable-lto \ + --prefix=%{_prefix} \ + --shared \ + --libdir=%{_lib} \ + %{ssl_configure} \ + %{dtrace_configure} \ + %{!?with_bundled_zlib:--shared-zlib} \ + %{!?with_bundled_cjs_module_lexer:--shared-builtin-cjs_module_lexer/lexer-path %{nodejs_private_sitelib}/cjs-module-lexer/lexer.js} \ + %{!?with_bundled_cjs_module_lexer:--shared-builtin-cjs_module_lexer/dist/lexer-path %{nodejs_private_sitelib}/cjs-module-lexer/dist/lexer.js} \ + %{!?with_bundled_undici:--shared-builtin-undici/undici-path %{nodejs_private_sitelib}/undici/loader.js} \ + --shared-brotli \ + %{!?with_bundled_libuv:--shared-libuv} \ + %{!?with_bundled_sqlite:--shared-sqlite} \ --with-intl=small-icu \ --with-icu-default-data-dir=%{icudatadir} \ + --without-corepack \ --openssl-use-def-ca-store -%endif -%if %{?with_debug} == 1 -# Setting BUILDTYPE=Debug builds both release and debug binaries -make BUILDTYPE=Debug %{?_smp_mflags} -%else -make BUILDTYPE=Release %{?_smp_mflags} -%endif - -# Extract the ICU data and convert it to the appropriate endianness -pushd deps/ -tar xfz %SOURCE3 - -pushd icu/source - -mkdir -p converted -%if 0%{?little_endian} -# The little endian data file is included in the ICU sources -install -Dpm0644 data/in/icudt%{icu_major}l.dat converted/ - -%else -# For the time being, we need to build ICU and use the included `icupkg` tool -# to convert the little endian data file into a big-endian one. -# At some point in the future, ICU releases will start including both data -# files and we should switch to those. -mkdir -p data/out/tmp - -%configure -%make_build - -icu_root=$(pwd) -LD_LIBRARY_PATH=./lib ./bin/icupkg -tb data/in/icudt%{icu_major}l.dat \ - converted/icudt%{icu_major}b.dat -%endif - -popd # icu/source -popd # deps +%ninja_build -C out/Release %install -export RHEL_ALLOW_PYTHON2_FOR_BUILD=1 -rm -rf %{buildroot} +# The ninja build does not put the shared library in the expected location, so +# we will move it. +mv out/Release/lib/libnode.so.%{nodejs_soversion} out/Release/ +%if 0%{?nodejs_major} >= 20 +./tools/install.py install --dest-dir %{buildroot} --prefix %{_prefix} +%else ./tools/install.py install %{buildroot} %{_prefix} +%endif + + + + # Set the binary permissions properly chmod 0755 %{buildroot}/%{_bindir}/node chrpath --delete %{buildroot}%{_bindir}/node -%if %{?with_debug} == 1 -# Install the debug binary and set its permissions -install -Dpm0755 out/Debug/node %{buildroot}/%{_bindir}/node_g +# Rename the node binary +mv %{buildroot}%{_bindir}/node %{buildroot}%{_bindir}/node-%{nodejs_pkg_major} + +# Move the npm binary to npm-NODEJS_MAJOR +rm -f %{buildroot}%{_bindir}/npm + +# Set the hashbang to use the matching Node.js interpreter +sed --in-place --regexp-extended \ + 's;^#!/usr/bin/env node($|\ |\t)+;#!/usr/bin/node-%{nodejs_pkg_major};g' \ + %{buildroot}%{nodejs_private_sitelib}/npm/bin/npm-cli.js + +ln -srf %{buildroot}%{nodejs_private_sitelib}/npm/bin/npm-cli.js \ + %{buildroot}%{_bindir}/npm-%{nodejs_pkg_major} + +# Move the npx binary to npx-NODEJS_MAJOR +rm -f %{buildroot}%{_bindir}/npx + +# Set the hashbang to use the matching Node.js interpreter +sed --in-place --regexp-extended \ + 's;^#!/usr/bin/env node($|\ |\t)+;#!/usr/bin/node-%{nodejs_pkg_major};g' \ + %{buildroot}%{nodejs_private_sitelib}/npm/bin/npx-cli.js + +ln -srf %{buildroot}%{nodejs_private_sitelib}/npm/bin/npx-cli.js \ + %{buildroot}%{_bindir}/npx-%{nodejs_pkg_major} + +# Add the symlinks back for the default version +%if 0%{?nodejs_default} +ln -srf %{buildroot}%{_bindir}/node-%{nodejs_pkg_major} \ + %{buildroot}%{_bindir}/node + +ln -srf %{buildroot}%{_bindir}/npm-%{nodejs_pkg_major} \ + %{buildroot}%{_bindir}/npm + +ln -srf %{buildroot}%{_bindir}/npx-%{nodejs_pkg_major} \ + %{buildroot}%{_bindir}/npx %endif -# own the sitelib directory -mkdir -p %{buildroot}%{_prefix}/lib/node_modules +# Install library symlink +ln -srf %{buildroot}%{_libdir}/libnode.so.%{nodejs_soversion} \ + %{buildroot}%{_libdir}/libnode.so -# ensure Requires are added to every native module that match the Provides from -# the nodejs build in the buildroot -install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr -cat << EOF > %{buildroot}%{_rpmconfigdir}/nodejs_native.req -#!/bin/sh -echo 'nodejs(abi%{nodejs_major}) >= %nodejs_abi' -echo 'nodejs(v8-abi%{v8_major}) >= %v8_abi' -EOF -chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req +# Install v8 compatibility symlinks +for header in %{buildroot}%{_includedir}/node/libplatform %{buildroot}%{_includedir}/node/v8*.h; do + header=$(basename ${header}) + ln -sf ./node/${header} %{buildroot}%{_includedir}/${header} +done +ln -s ./node/cppgc %{buildroot}%{_includedir}/cppgc + +for soname in libv8 libv8_libbase libv8_libplatform; do + ln -srf %{buildroot}%{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major}.%{v8_minor} + ln -srf %{buildroot}%{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so + + %if 0%{?nodejs_default} + ln -srf %{buildroot}%{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major} + %endif +done # install documentation mkdir -p %{buildroot}%{_pkgdocdir}/html @@ -453,24 +659,54 @@ cp -pr doc/* %{buildroot}%{_pkgdocdir}/html rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1 # node-gyp needs common.gypi too -mkdir -p %{buildroot}%{_datadir}/node -cp -p common.gypi %{buildroot}%{_datadir}/node +mkdir -p %{buildroot}%{nodejs_datadir} +cp -p common.gypi %{buildroot}%{nodejs_datadir} + +# The config.gypi file is platform-dependent, so rename it to not conflict +mv %{buildroot}%{_includedir}/node/config.gypi \ + %{buildroot}%{_includedir}/node/config-%{_arch}.gypi # Install the GDB init tool into the documentation directory mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit -# install NPM docs to mandir -mkdir -p %{buildroot}%{_mandir} \ +mkdir -p %{buildroot}%{_mandir}/nodejs-%{nodejs_pkg_major}/man1 \ + %{buildroot}%{_mandir}/nodejs-%{nodejs_pkg_major}/man5 \ + %{buildroot}%{_mandir}/nodejs-%{nodejs_pkg_major}/man7 \ + %{buildroot}%{nodejs_default_sitelib}/npm/man \ + %{buildroot}%{nodejs_private_sitelib}/npm/man \ %{buildroot}%{_pkgdocdir}/npm -cp -pr deps/npm/man/* %{buildroot}%{_mandir}/ -rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man -ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man +# install manpage docs to mandir +cp -pr deps/npm/man/* \ + %{buildroot}%{_mandir}/nodejs-%{nodejs_pkg_major}/ +rm -rf %{buildroot}%{nodejs_private_sitelib}/npm/man +ln -srf %{buildroot}%{_mandir}/nodejs-%{nodejs_pkg_major} \ + %{buildroot}%{nodejs_private_sitelib}/npm/man -# Install Gatsby HTML documentation to %{_pkgdocdir} +%if 0%{?nodejs_default} +for i in 1 5 7; do + mkdir -p %{buildroot}%{_mandir}/man${i} + for manpage in %{buildroot}%{nodejs_private_sitelib}/npm/man/man$i/*; do + basename=$(basename ${manpage}) + ln -srf %{buildroot}%{nodejs_private_sitelib}/npm/man/man${i}/${basename} \ + %{buildroot}%{_mandir}/man${i}/${basename} + done +done +%endif + +# Install the node interpreter manpage +mv %{buildroot}%{_mandir}/man1/node.1 \ + %{buildroot}%{_mandir}/nodejs-%{nodejs_pkg_major}/man1/ + +%if 0%{?nodejs_default} +ln -srf %{buildroot}%{_mandir}/nodejs-%{nodejs_pkg_major}/man1/node.1 \ + %{buildroot}%{_mandir}/man1/ +%endif + +# Install Gatsby HTML documentation to %%{_pkgdocdir} cp -pr deps/npm/docs %{buildroot}%{_pkgdocdir}/npm/ -rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/docs -ln -sf %{_pkgdocdir}/npm %{buildroot}%{_prefix}/lib/node_modules/npm/docs +rm -rf %{buildroot}%{nodejs_private_sitelib}/npm/docs +ln -srf %{buildroot}%{_pkgdocdir}/npm %{buildroot}%{nodejs_private_sitelib}/npm/docs # Node tries to install some python files into a documentation directory # (and not the proper one). Remove them for now until we figure out what to @@ -481,47 +717,74 @@ rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py \ # Some NPM bundled deps are executable but should not be. This causes # unnecessary automatic dependencies to be added. Make them not executable. # Skip the npm bin directory or the npm binary will not work. -find %{buildroot}%{_prefix}/lib/node_modules/npm \ - -not -path "%{buildroot}%{_prefix}/lib/node_modules/npm/bin/*" \ +find %{buildroot}%{nodejs_private_sitelib}/npm \ + -not -path "%{buildroot}%{nodejs_private_sitelib}/npm/bin/*" \ -executable -type f \ -exec chmod -x {} \; # The above command is a little overzealous. Add a few permissions back. -chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp -chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js +chmod 0755 %{buildroot}%{nodejs_private_sitelib}/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp +chmod 0755 %{buildroot}%{nodejs_private_sitelib}/npm/node_modules/node-gyp/bin/node-gyp.js + +# Set the hashbang to use the matching Node.js interpreter +sed --in-place --regexp-extended \ + 's;^#!/usr/bin/env node($|\ |\t)+;#!/usr/bin/node-%{nodejs_pkg_major};g' \ + %{buildroot}%{nodejs_private_sitelib}/npm/node_modules/node-gyp/bin/node-gyp.js + +# Drop the NPM builtin configuration in place +sed -e 's#@SYSCONFDIR@#%{_sysconfdir}#g' \ + %{SOURCE201} > %{buildroot}%{nodejs_private_sitelib}/npm/npmrc # Drop the NPM default configuration in place +%if 0%{?nodejs_default} mkdir -p %{buildroot}%{_sysconfdir} cp %{SOURCE1} %{buildroot}%{_sysconfdir}/npmrc - -# NPM upstream expects it to be in /usr/etc/npmrc, so we'll put a symlink here -# This is done in the interests of keeping /usr read-only. -mkdir -p %{buildroot}%{_prefix}/etc -ln -s %{_sysconfdir}/npmrc %{buildroot}%{_prefix}/etc/npmrc +%endif # Install the full-icu data files -install -Dpm0644 -t %{buildroot}%{icudatadir} deps/icu/source/converted/* +mkdir -p %{buildroot}%{icudatadir} +%if 0%{?little_endian} +unzip -d %{buildroot}%{icudatadir} %{SOURCE4} icudt%{icu_major}l.dat +%else +unzip -d %{buildroot}%{icudatadir} %{SOURCE3} icudt%{icu_major}b.dat +%endif + +# Add pkg-config files +mkdir -p %{buildroot}%{_libdir}/pkgconfig +sed -e 's#@PREFIX@#%{_prefix}#g' \ + -e 's#@INCLUDEDIR@#%{_includedir}#g' \ + -e 's#@LIBDIR@#%{_libdir}#g' \ + -e 's#@PKGCONFNAME@#nodejs-%{nodejs_pkg_major}#g' \ + -e 's#@NODEJS_VERSION@#%{nodejs_version}#g' \ + %{SOURCE202} > %{buildroot}%{_libdir}/pkgconfig/nodejs-%{nodejs_pkg_major}.pc + +sed -e 's#@PREFIX@#%{_prefix}#g' \ + -e 's#@INCLUDEDIR@#%{_includedir}#g' \ + -e 's#@LIBDIR@#%{_libdir}#g' \ + -e 's#@PKGCONFVERSION@#v8-%{v8_major}.%{v8_minor}#g' \ + -e 's#@V8_VERSION@#%{v8_version}#g' \ + %{SOURCE203} > %{buildroot}%{_libdir}/pkgconfig/v8-%{v8_major}.%{v8_minor}.pc %check # Fail the build if the versions don't match -%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')" -%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')" -%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node-%{nodejs_pkg_major} -e "require('assert').equal(process.versions.node, '%{nodejs_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node-%{nodejs_pkg_major} -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node-%{nodejs_pkg_major} -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')" # Ensure we have punycode and that the version matches -%{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node-%{nodejs_pkg_major} -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')" # Ensure we have npm and that the version matches -NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}%{_bindir}/node-%{nodejs_pkg_major} %{buildroot}%{_bindir}/npm-%{nodejs_pkg_major} version --json |jq -e '.npm == "%{npm_version}"' # Make sure i18n support is working -NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules %{buildroot}/%{_bindir}/node --icu-data-dir=%{buildroot}%{icudatadir} %{SOURCE2} +NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{nodejs_private_sitelib}/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node-%{nodejs_pkg_major} --icu-data-dir=%{buildroot}%{icudatadir} %{SOURCE2} -%pretrans -n npm -p +%if 0%{?rhel} && 0%{?rhel} < 8 +%pretrans %{pkgname}-npm -p -- Remove all of the symlinks from the bundled npm node_modules directory --- This scriptlet can be removed in Fedora 31 base_path = "%{_prefix}/lib/node_modules/npm/node_modules/" d_st = posix.stat(base_path) if d_st then @@ -533,10 +796,11 @@ if d_st then end end end +%endif --- Replace the npm man directory with a symlink --- Drop this scriptlet when F31 is EOL -path = "%{_prefix}/lib/node_modules/npm/man" +# This can be removed once F37 is EOL +%pretrans -n %{pkgname} -p +path = "/usr/lib/node_modules" st = posix.stat(path) if st and st.type == "directory" then status = os.rename(path, path .. ".rpmmoved") @@ -551,344 +815,88 @@ if st and st.type == "directory" then end -%files +%files -n %{pkgname} +%doc CHANGELOG.md onboarding.md GOVERNANCE.md README.md + +%if 0%{?nodejs_default} %{_bindir}/node -%dir %{_prefix}/lib/node_modules -%dir %{_datadir}/node -%dir %{_datadir}/systemtap -%dir %{_datadir}/systemtap/tapset -%{_datadir}/systemtap/tapset/node.stp - -%if %{with bootstrap} -# no dtrace -%else -%dir %{_usr}/lib/dtrace -%{_usr}/lib/dtrace/node.d -%endif - -%{_rpmconfigdir}/fileattrs/nodejs_native.attr -%{_rpmconfigdir}/nodejs_native.req -%license LICENSE -%doc AUTHORS CHANGELOG.md COLLABORATOR_GUIDE.md GOVERNANCE.md README.md +%{_bindir}/node-%{nodejs_major} %doc %{_mandir}/man1/node.1* +%{nodejs_default_sitelib} -%files devel -%if %{?with_debug} == 1 -%{_bindir}/node_g %endif + +%dir %{nodejs_private_sitelib} + +%doc %{_mandir}/nodejs-%{nodejs_pkg_major}/man1/node.1* + + +%files -n %{pkgname}-devel %{_includedir}/node -%{_datadir}/node/common.gypi +%{_libdir}/libnode.so +%{nodejs_datadir}/common.gypi %{_pkgdocdir}/gdbinit +%{_libdir}/pkgconfig/nodejs-%{nodejs_pkg_major}.pc -%files full-i18n +%files -n %{pkgname}-full-i18n %dir %{icudatadir} %{icudatadir}/icudt%{icu_major}*.dat +%files -n %{pkgname}-libs +%license LICENSE +%{_libdir}/libnode.so.%{nodejs_soversion} +%{_libdir}/libv8.so.%{v8_major}.%{v8_minor} +%{_libdir}/libv8_libbase.so.%{v8_major}.%{v8_minor} +%{_libdir}/libv8_libplatform.so.%{v8_major}.%{v8_minor} +%dir %{nodejs_datadir}/ +%if 0%{?nodejs_default} +%{_libdir}/libv8.so.%{v8_major} +%{_libdir}/libv8_libbase.so.%{v8_major} +%{_libdir}/libv8_libplatform.so.%{v8_major} +%endif + +%files -n v8-%{v8_major}.%{v8_minor}-devel +%{_includedir}/libplatform +%{_includedir}/v8*.h +%{_includedir}/cppgc +%{_libdir}/libv8.so +%{_libdir}/libv8_libbase.so +%{_libdir}/libv8_libplatform.so +%{_libdir}/pkgconfig/v8-%{v8_major}.%{v8_minor}.pc + + %files -n npm +%if 0%{?nodejs_default} %{_bindir}/npm %{_bindir}/npx -%{_prefix}/lib/node_modules/npm %config(noreplace) %{_sysconfdir}/npmrc -%{_prefix}/etc/npmrc %ghost %{_sysconfdir}/npmignore -%doc %{_mandir}/man1/npm*.1* -%doc %{_mandir}/man1/npx.1* -%doc %{_mandir}/man5/folders.5* -%doc %{_mandir}/man5/install.5* -%doc %{_mandir}/man5/npmrc.5* -%doc %{_mandir}/man5/package-json.5* -%doc %{_mandir}/man5/package-lock-json.5* -%doc %{_mandir}/man5/package-locks.5* -%doc %{_mandir}/man5/shrinkwrap-json.5* -%doc %{_mandir}/man7/config.7* -%doc %{_mandir}/man7/developers.7* -%doc %{_mandir}/man7/disputes.7* -%doc %{_mandir}/man7/orgs.7* -%doc %{_mandir}/man7/registry.7* -%doc %{_mandir}/man7/removal.7* -%doc %{_mandir}/man7/scope.7* -%doc %{_mandir}/man7/scripts.7* -%doc %{_mandir}/man7/semver.7* + +%doc %{_mandir}/man*/ +%exclude %doc %{_mandir}/man1/node.1* +%endif + +%{_bindir}/npm-%{nodejs_pkg_major} +%{_bindir}/npx-%{nodejs_pkg_major} +%{nodejs_private_sitelib}/npm + +%doc %{_mandir}/nodejs-%{nodejs_pkg_major}/ +%exclude %doc %{_mandir}/nodejs-%{nodejs_pkg_major}/man1/node.1* -%files docs +%files -n %{pkgname}-docs +%doc doc %dir %{_pkgdocdir} %{_pkgdocdir}/html %{_pkgdocdir}/npm/docs %changelog -* Wed Feb 24 2021 Zuzana Svetlikova - 1:10.24.0-1 -- Resolves: RHBZ#1932373, RHBZ#1932426 -- Resolves CVE-2021-22883 and CVE-2021-22884 -- remove -debug-nghttp2 flag (1930775) -- remove ini patch merged upstream - -* Mon Jan 18 2021 Zuzana Svetlikova - 1:10.23.1-1 -- January Security release -- https://nodejs.org/en/blog/vulnerability/january-2021-security-releases/ -- Rebase to 10.23.1 -- Resolves: RHBZ#1916461, RHBZ#1914789 -- Resolves: RHBZ#1914783, RHBZ#1916462, RHBZ#1916395, RHBZ#1916459 -- Resolves: RHBZ#1916691, RHBZ#1916689, RHBZ#1916388 -- Remove dot-prop patch, as it is fixed by npm rebase - -* Tue Sep 22 2020 Jan Staněk - 1:10.22.1-1 -- Security rebase to 10.22.1 - -* Wed Jun 17 2020 Zuzana Svetlikova - 1:10.21.0-3 -- Resolves: RHBZ#1845307 -- Remove brotli-devel requires from nodejs-devel - -* Tue Jun 16 2020 Zuzana Svetlikova - 1:10.21.0-2 -- Resolves: RHBZ#1845307 -- Turn off debug builds - -* Mon Jun 15 2020 Zuzana Svetlikova - 1:10.21.0-1 -- Security update to 10.21.0 -- Resolves: RHBZ#1845307 -- Fixes CVE-2020-11080, CVE-2020-8174, CVE-2020-10531 -- Bundle brotli, because --shared-brotli configure option is missing -- Add i18n subpackage - -* Wed Mar 18 2020 Zuzana Svetlikova - 1:10.19.0-2 -- Resolves: RHBZ#1811499 - -* Mon Feb 10 2020 Jan Staněk - 1:10.19.0-1 -- Rebase to 10.19.0 to fix CVE-2019-15604 to CVE-2019-15606 - -* Tue Sep 10 2019 Jan Staněk - 1:10.16.3-1 -- Rebase to 10.16.3 to fix CVE-2019-9511 to CVE-2019-9518 - -* Thu Mar 14 2019 Zuzana Svetlikova - 1:10.14.1-2 -- move nodejs-packaging BR out of conditional - -* Tue Dec 11 2018 Zuzana Svetlikova - 1:10.14.1-1 -- Resolves: RHBZ#1644207 -- fixes node-gyp permissions -- rebase - -* Thu Oct 11 2018 Jan Staněk - 1:10.11.0-2 -- BuildRequire nodejs-packaging for proper npm dependency generation -- Resolves: rhbz#1615947 - -* Mon Oct 08 2018 Jan Staněk - 1:10.11.0-1 -- Rebase to 10.11.0 -- Import changes from fedora -- Resolves: rhbz#1621766 - -* Mon Jul 30 2018 Zuzana Svetlikova - 1:10.7.0-5 -- Import sources from fedora -- Allow using python2 at %%build and %%install -- turn off debug for aarch64 - -* Fri Jul 20 2018 Stephen Gallagher - 1:10.7.0-4 -- Fix npm upgrade scriptlet -- Fix unexpected trailing .1 in npm release field - -* Fri Jul 20 2018 Stephen Gallagher - 1:10.7.0-3 -- Restore annotations to binaries -- Fix unexpected trailing .1 in release field - -* Thu Jul 19 2018 Stephen Gallagher - 1:10.7.0-2 -- Update to 10.7.0 -- https://nodejs.org/en/blog/release/v10.7.0/ -- https://nodejs.org/en/blog/release/v10.6.0/ - -* Fri Jul 13 2018 Fedora Release Engineering - 1:10.5.0-1.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Thu Jun 21 2018 Stephen Gallagher - 1:10.5.0-1 -- Update to 10.5.0 -- https://nodejs.org/en/blog/release/v10.5.0/ - -* Thu Jun 14 2018 Stephen Gallagher - 1:10.4.1-1 -- Update to 10.4.1 to address security issues -- https://nodejs.org/en/blog/release/v10.4.1/ -- Resolves: rhbz#1590801 -- Resolves: rhbz#1591014 -- Resolves: rhbz#1591019 - -* Thu Jun 07 2018 Stephen Gallagher - 1:10.4.0-1 -- Update to 10.4.0 -- https://nodejs.org/en/blog/release/v10.4.0/ - -* Wed May 30 2018 Stephen Gallagher - 1:10.3.0-1 -- Update to 10.3.0 -- Update npm to 6.1.0 -- https://nodejs.org/en/blog/release/v10.3.0/ - -* Tue May 29 2018 Stephen Gallagher - 1:10.2.1-2 -- Fix up bare 'python' to be python2 -- Drop redundant entry in docs section - -* Fri May 25 2018 Stephen Gallagher - 1:10.2.1-1 -- Update to 10.2.1 -- https://nodejs.org/en/blog/release/v10.2.1/ - -* Wed May 23 2018 Stephen Gallagher - 1:10.2.0-1 -- Update to 10.2.0 -- https://nodejs.org/en/blog/release/v10.2.0/ - -* Thu May 10 2018 Stephen Gallagher - 1:10.1.0-3 -- Fix incorrect rpm macro - -* Thu May 10 2018 Stephen Gallagher - 1:10.1.0-2 -- Include upstream v8 fix for ppc64[le] -- Disable debug build on ppc64[le] and s390x - -* Wed May 09 2018 Stephen Gallagher - 1:10.1.0-1 -- Update to 10.1.0 -- https://nodejs.org/en/blog/release/v10.1.0/ -- Reenable node_g binary - -* Thu Apr 26 2018 Stephen Gallagher - 1:10.0.0-1 -- Update to 10.0.0 -- https://nodejs.org/en/blog/release/v10.0.0/ -- Drop workaround patch -- Temporarily drop node_g binary due to - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85587 - -* Fri Apr 13 2018 Rafael dos Santos - 1:9.11.1-2 -- Use standard Fedora linker flags (bug #1543859) - -* Thu Apr 05 2018 Stephen Gallagher - 1:9.11.1-1 -- Update to 9.11.1 -- https://nodejs.org/en/blog/release/v9.11.0/ -- https://nodejs.org/en/blog/release/v9.11.1/ - -* Wed Mar 28 2018 Stephen Gallagher - 1:9.10.0-1 -- Update to 9.10.0 -- https://nodejs.org/en/blog/release/v9.10.0/ - -* Wed Mar 21 2018 Stephen Gallagher - 1:9.9.0-1 -- Update to 9.9.0 -- https://nodejs.org/en/blog/release/v9.9.0/ - -* Thu Mar 08 2018 Stephen Gallagher - 1:9.8.0-1 -- Update to 9.8.0 -- https://nodejs.org/en/blog/release/v9.8.0/ - -* Thu Mar 01 2018 Stephen Gallagher - 1:9.7.0-1 -- Update to 9.7.0 -- https://nodejs.org/en/blog/release/v9.7.0/ -- Work around F28 build issue - -* Sun Feb 25 2018 Stephen Gallagher - 1:9.6.1-1 -- Update to 9.6.1 -- https://nodejs.org/en/blog/release/v9.6.1/ -- https://nodejs.org/en/blog/release/v9.6.0/ - -* Mon Feb 05 2018 Stephen Gallagher - 1:9.5.0-1 -- Package Node.js 9.5.0 - -* Thu Jan 11 2018 Stephen Gallagher - 1:8.9.4-2 -- Fix incorrect Requires: - -* Thu Jan 11 2018 Stephen Gallagher - 1:8.9.4-1 -- Update to 8.9.4 -- https://nodejs.org/en/blog/release/v8.9.4/ -- Switch to system copy of nghttp2 - -* Fri Dec 08 2017 Stephen Gallagher - 1:8.9.3-2 -- Update to 8.9.3 -- https://nodejs.org/en/blog/release/v8.9.3/ -- https://nodejs.org/en/blog/release/v8.9.2/ - -* Thu Nov 30 2017 Pete Walter - 1:8.9.1-2 -- Rebuild for ICU 60.1 - -* Thu Nov 09 2017 Zuzana Svetlikova - 1:8.9.1-1 -- Update to 8.9.1 - -* Tue Oct 31 2017 Stephen Gallagher - 1:8.9.0-1 -- Update to 8.9.0 -- Drop upstreamed patch - -* Thu Oct 26 2017 Stephen Gallagher - 1:8.8.1-1 -- Update to 8.8.1 to fix a regression - -* Wed Oct 25 2017 Zuzana Svetlikova - 1:8.8.0-1 -- Security update to 8.8.0 -- https://nodejs.org/en/blog/release/v8.8.0/ - -* Sun Oct 15 2017 Zuzana Svetlikova - 1:8.7.0-1 -- Update to 8.7.0 -- https://nodejs.org/en/blog/release/v8.7.0/ - -* Fri Oct 06 2017 Zuzana Svetlikova - 1:8.6.0-2 -- Use bcond macro instead of bootstrap conditional - -* Wed Sep 27 2017 Zuzana Svetlikova - 1:8.6.0-1 -- Fix nghttp2 version -- Update to 8.6.0 -- https://nodejs.org/en/blog/release/v8.6.0/ - -* Wed Sep 20 2017 Zuzana Svetlikova - 1:8.5.0-3 -- Build with bootstrap + bundle libuv for modularity -- backport patch for aarch64 debug build - -* Wed Sep 13 2017 Stephen Gallagher - 1:8.5.0-2 -- Disable debug builds on aarch64 due to https://github.com/nodejs/node/issues/15395 - -* Tue Sep 12 2017 Stephen Gallagher - 1:8.5.0-1 -- Update to v8.5.0 -- https://nodejs.org/en/blog/release/v8.5.0/ - -* Thu Sep 07 2017 Zuzana Svetlikova - 1:8.4.0-2 -- Refactor openssl BR - -* Wed Aug 16 2017 Zuzana Svetlikova - 1:8.4.0-1 -- Update to v8.4.0 -- https://nodejs.org/en/blog/release/v8.4.0/ -- http2 is now supported, add bundled nghttp2 -- remove openssl 1.0.1 patches, we won't be using them in fedora - -* Thu Aug 10 2017 Zuzana Svetlikova - 1:8.3.0-1 -- Update to v8.3.0 -- https://nodejs.org/en/blog/release/v8.3.0/ -- update V8 to 6.0 -- update minimal gcc and g++ requirements to 4.9.4 - -* Wed Aug 09 2017 Tom Hughes - 1:8.2.1-2 -- Bump release to fix broken dependencies - -* Thu Aug 03 2017 Fedora Release Engineering - 1:8.2.1-1.2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - -* Wed Jul 26 2017 Fedora Release Engineering - 1:8.2.1-1.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Fri Jul 21 2017 Stephen Gallagher - 1:8.2.1-1 -- Update to v8.2.1 -- https://nodejs.org/en/blog/release/v8.2.1/ - -* Thu Jul 20 2017 Stephen Gallagher - 1:8.2.0-1 -- Update to v8.2.0 -- https://nodejs.org/en/blog/release/v8.2.0/ -- Update npm to 5.3.0 -- Adds npx command - -* Tue Jul 18 2017 Igor Gnatenko - 1:8.1.4-3 -- s/BuildRequires/Requires/ for http-parser-devel%%{?_isa} - -* Mon Jul 17 2017 Zuzana Svetlikova - 1:8.1.4-2 -- Rename python-devel to python2-devel -- own %%{_pkgdocdir}/npm - -* Tue Jul 11 2017 Stephen Gallagher - 1:8.1.4-1 -- Update to v8.1.4 -- https://nodejs.org/en/blog/release/v8.1.4/ -- Drop upstreamed c-ares patch - -* Thu Jun 29 2017 Zuzana Svetlikova - 1:8.1.3-1 -- Update to v8.1.3 -- https://nodejs.org/en/blog/release/v8.1.3/ - -* Wed Jun 28 2017 Zuzana Svetlikova - 1:8.1.2-1 -- Update to v8.1.2 -- remove GCC 7 patch, as it is now fixed in node >= 6.12 +* Mon Nov 04 2024 Jan Staněk - 1:22.11.0-1 +- Update to version 22.11.0 +* Thu Aug 15 2024 Filip Janus - 22.4.1-4 +- Initial import of nodeJS 22