Import SRPM from Fedora Rawhide

Related: RHEL-101566
This commit is contained in:
Jan Staněk 2025-07-22 14:36:42 +02:00
parent 4d4c41a6b4
commit 6043c067e7
No known key found for this signature in database
GPG Key ID: 2972F2037B243B6D
15 changed files with 4277 additions and 0 deletions

4
.gitignore vendored
View File

@ -0,0 +1,4 @@
/icu4c-77_1-data-bin-b.zip
/icu4c-77_1-data-bin-l.zip
/node-v24.4.1-stripped.tar.gz
/packaging-scripts.tar.gz

View File

@ -0,0 +1,46 @@
From e93d9b5fdcd8e5744de629461c03a07de2252f8f Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
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 <sgallagh@redhat.com>
Signed-off-by: rpm-build <rpm-build>
---
node.gyp | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/node.gyp b/node.gyp
index 1147495..da6ea50 100644
--- a/node.gyp
+++ b/node.gyp
@@ -822,23 +822,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.47.0

View File

@ -0,0 +1,265 @@
From 4208b7849eeee5c2aa76d692e2624bd80422057d Mon Sep 17 00:00:00 2001
From: John Platts <john_platts@hotmail.com>
Date: Fri, 17 Jan 2025 12:16:49 -0600
Subject: [PATCH] v8(highway): Fix for GCC 15 compiler error on PPC8/PPC9/PPC10
Signed-off-by: rpm-build <rpm-build>
---
.../highway/src/hwy/ops/ppc_vsx-inl.h | 167 +++++++++++-------
1 file changed, 103 insertions(+), 64 deletions(-)
diff --git a/deps/v8/third_party/highway/src/hwy/ops/ppc_vsx-inl.h b/deps/v8/third_party/highway/src/hwy/ops/ppc_vsx-inl.h
index d216c54..73e736e 100644
--- a/deps/v8/third_party/highway/src/hwy/ops/ppc_vsx-inl.h
+++ b/deps/v8/third_party/highway/src/hwy/ops/ppc_vsx-inl.h
@@ -3701,16 +3701,73 @@ static HWY_INLINE V VsxF2INormalizeSrcVals(V v) {
#endif
}
+template <class VF32>
+static HWY_INLINE HWY_MAYBE_UNUSED VFromD<Repartition<int64_t, DFromV<VF32>>>
+VsxXvcvspsxds(VF32 vf32) {
+ using VI64 = VFromD<Repartition<int64_t, DFromV<VF32>>>;
+#if (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1500) || \
+ HWY_HAS_BUILTIN(__builtin_vsx_xvcvspsxds)
+ // Use __builtin_vsx_xvcvspsxds if it is available (which is the case with
+ // GCC 4.8 through GCC 14 or Clang 13 or later on PPC8/PPC9/PPC10)
+ return VI64{__builtin_vsx_xvcvspsxds(vf32.raw)};
+#elif HWY_COMPILER_GCC_ACTUAL >= 1500 && HWY_IS_LITTLE_ENDIAN
+ // On little-endian PPC8/PPC9/PPC10 with GCC 15 or later, use the F32->I64
+ // vec_signedo intrinsic as the __builtin_vsx_xvcvspsxds intrinsic has been
+ // removed from GCC in GCC 15
+ return VI64{vec_signedo(vf32.raw)};
+#elif HWY_COMPILER_GCC_ACTUAL >= 1500 && HWY_IS_BIG_ENDIAN
+ // On big-endian PPC8/PPC9/PPC10 with GCC 15 or later, use the F32->I64
+ // vec_signede intrinsic as the __builtin_vsx_xvcvspsxds intrinsic has been
+ // removed from GCC in GCC 15
+ return VI64{vec_signede(vf32.raw)};
+#else
+ // Inline assembly fallback for older versions of Clang that do not have the
+ // __builtin_vsx_xvcvspsxds intrinsic
+ __vector signed long long raw_result;
+ __asm__("xvcvspsxds %x0, %x1" : "=wa"(raw_result) : "wa"(vf32.raw) :);
+ return VI64{raw_result};
+#endif
+}
+
+template <class VF32>
+static HWY_INLINE HWY_MAYBE_UNUSED VFromD<Repartition<uint64_t, DFromV<VF32>>>
+VsxXvcvspuxds(VF32 vf32) {
+ using VU64 = VFromD<Repartition<uint64_t, DFromV<VF32>>>;
+#if (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1500) || \
+ HWY_HAS_BUILTIN(__builtin_vsx_xvcvspuxds)
+ // Use __builtin_vsx_xvcvspuxds if it is available (which is the case with
+ // GCC 4.8 through GCC 14 or Clang 13 or later on PPC8/PPC9/PPC10)
+ return VU64{reinterpret_cast<__vector unsigned long long>(
+ __builtin_vsx_xvcvspuxds(vf32.raw))};
+#elif HWY_COMPILER_GCC_ACTUAL >= 1500 && HWY_IS_LITTLE_ENDIAN
+ // On little-endian PPC8/PPC9/PPC10 with GCC 15 or later, use the F32->U64
+ // vec_unsignedo intrinsic as the __builtin_vsx_xvcvspuxds intrinsic has been
+ // removed from GCC in GCC 15
+ return VU64{vec_unsignedo(vf32.raw)};
+#elif HWY_COMPILER_GCC_ACTUAL >= 1500 && HWY_IS_BIG_ENDIAN
+ // On big-endian PPC8/PPC9/PPC10 with GCC 15 or later, use the F32->U64
+ // vec_unsignedo intrinsic as the __builtin_vsx_xvcvspuxds intrinsic has been
+ // removed from GCC in GCC 15
+ return VU64{vec_unsignede(vf32.raw)};
+#else
+ // Inline assembly fallback for older versions of Clang that do not have the
+ // __builtin_vsx_xvcvspuxds intrinsic
+ __vector unsigned long long raw_result;
+ __asm__("xvcvspuxds %x0, %x1" : "=wa"(raw_result) : "wa"(vf32.raw) :);
+ return VU64{raw_result};
+#endif
+}
+
} // namespace detail
#endif // !HWY_S390X_HAVE_Z14
template <class D, HWY_IF_I64_D(D)>
HWY_API VFromD<D> PromoteTo(D di64, VFromD<Rebind<float, D>> v) {
-#if !HWY_S390X_HAVE_Z14 && \
- (HWY_COMPILER_GCC_ACTUAL || HWY_HAS_BUILTIN(__builtin_vsx_xvcvspsxds))
- const __vector float raw_v =
- detail::VsxF2INormalizeSrcVals(InterleaveLower(v, v)).raw;
- return VFromD<decltype(di64)>{__builtin_vsx_xvcvspsxds(raw_v)};
+#if !HWY_S390X_HAVE_Z14
+ const Repartition<float, decltype(di64)> dt_f32;
+ const auto vt_f32 = ResizeBitCast(dt_f32, v);
+ return detail::VsxXvcvspsxds(
+ detail::VsxF2INormalizeSrcVals(InterleaveLower(vt_f32, vt_f32)));
#else
const RebindToFloat<decltype(di64)> df64;
return ConvertTo(di64, PromoteTo(df64, v));
@@ -3719,12 +3776,11 @@ HWY_API VFromD<D> PromoteTo(D di64, VFromD<Rebind<float, D>> v) {
template <class D, HWY_IF_U64_D(D)>
HWY_API VFromD<D> PromoteTo(D du64, VFromD<Rebind<float, D>> v) {
-#if !HWY_S390X_HAVE_Z14 && \
- (HWY_COMPILER_GCC_ACTUAL || HWY_HAS_BUILTIN(__builtin_vsx_xvcvspuxds))
- const __vector float raw_v =
- detail::VsxF2INormalizeSrcVals(InterleaveLower(v, v)).raw;
- return VFromD<decltype(du64)>{reinterpret_cast<__vector unsigned long long>(
- __builtin_vsx_xvcvspuxds(raw_v))};
+#if !HWY_S390X_HAVE_Z14
+ const Repartition<float, decltype(du64)> dt_f32;
+ const auto vt_f32 = ResizeBitCast(dt_f32, v);
+ return detail::VsxXvcvspuxds(
+ detail::VsxF2INormalizeSrcVals(InterleaveLower(vt_f32, vt_f32)));
#else
const RebindToFloat<decltype(du64)> df64;
return ConvertTo(du64, PromoteTo(df64, v));
@@ -3829,12 +3885,10 @@ HWY_API VFromD<D> PromoteUpperTo(D df64, Vec128<uint32_t> v) {
template <class D, HWY_IF_V_SIZE_D(D, 16), HWY_IF_I64_D(D)>
HWY_API VFromD<D> PromoteUpperTo(D di64, Vec128<float> v) {
-#if !HWY_S390X_HAVE_Z14 && \
- (HWY_COMPILER_GCC_ACTUAL || HWY_HAS_BUILTIN(__builtin_vsx_xvcvspsxds))
- const __vector float raw_v =
- detail::VsxF2INormalizeSrcVals(InterleaveUpper(Full128<float>(), v, v))
- .raw;
- return VFromD<decltype(di64)>{__builtin_vsx_xvcvspsxds(raw_v)};
+#if !HWY_S390X_HAVE_Z14
+ (void)di64;
+ return detail::VsxXvcvspsxds(
+ detail::VsxF2INormalizeSrcVals(InterleaveUpper(Full128<float>(), v, v)));
#else
const RebindToFloat<decltype(di64)> df64;
return ConvertTo(di64, PromoteUpperTo(df64, v));
@@ -3843,13 +3897,10 @@ HWY_API VFromD<D> PromoteUpperTo(D di64, Vec128<float> v) {
template <class D, HWY_IF_V_SIZE_D(D, 16), HWY_IF_U64_D(D)>
HWY_API VFromD<D> PromoteUpperTo(D du64, Vec128<float> v) {
-#if !HWY_S390X_HAVE_Z14 && \
- (HWY_COMPILER_GCC_ACTUAL || HWY_HAS_BUILTIN(__builtin_vsx_xvcvspuxds))
- const __vector float raw_v =
- detail::VsxF2INormalizeSrcVals(InterleaveUpper(Full128<float>(), v, v))
- .raw;
- return VFromD<decltype(du64)>{reinterpret_cast<__vector unsigned long long>(
- __builtin_vsx_xvcvspuxds(raw_v))};
+#if !HWY_S390X_HAVE_Z14
+ (void)du64;
+ return detail::VsxXvcvspuxds(
+ detail::VsxF2INormalizeSrcVals(InterleaveUpper(Full128<float>(), v, v)));
#else
const RebindToFloat<decltype(du64)> df64;
return ConvertTo(du64, PromoteUpperTo(df64, v));
@@ -3937,20 +3988,18 @@ HWY_INLINE VFromD<D> PromoteEvenTo(hwy::SignedTag /*to_type_tag*/,
hwy::SizeTag<8> /*to_lane_size_tag*/,
hwy::FloatTag /*from_type_tag*/, D d_to,
V v) {
-#if !HWY_S390X_HAVE_Z14 && \
- (HWY_COMPILER_GCC_ACTUAL || HWY_HAS_BUILTIN(__builtin_vsx_xvcvspsxds))
+#if !HWY_S390X_HAVE_Z14
(void)d_to;
const auto normalized_v = detail::VsxF2INormalizeSrcVals(v);
#if HWY_IS_LITTLE_ENDIAN
- // __builtin_vsx_xvcvspsxds expects the source values to be in the odd lanes
- // on little-endian PPC, and the vec_sld operation below will shift the even
+ // VsxXvcvspsxds expects the source values to be in the odd lanes on
+ // little-endian PPC, and the Shuffle2103 operation below will shift the even
// lanes of normalized_v into the odd lanes.
- return VFromD<D>{
- __builtin_vsx_xvcvspsxds(vec_sld(normalized_v.raw, normalized_v.raw, 4))};
+ return VsxXvcvspsxds(Shuffle2103(normalized_v));
#else
- // __builtin_vsx_xvcvspsxds expects the source values to be in the even lanes
- // on big-endian PPC.
- return VFromD<D>{__builtin_vsx_xvcvspsxds(normalized_v.raw)};
+ // VsxXvcvspsxds expects the source values to be in the even lanes on
+ // big-endian PPC.
+ return VsxXvcvspsxds(normalized_v);
#endif
#else
const RebindToFloat<decltype(d_to)> df64;
@@ -3965,22 +4014,18 @@ HWY_INLINE VFromD<D> PromoteEvenTo(hwy::UnsignedTag /*to_type_tag*/,
hwy::SizeTag<8> /*to_lane_size_tag*/,
hwy::FloatTag /*from_type_tag*/, D d_to,
V v) {
-#if !HWY_S390X_HAVE_Z14 && \
- (HWY_COMPILER_GCC_ACTUAL || HWY_HAS_BUILTIN(__builtin_vsx_xvcvspuxds))
+#if !HWY_S390X_HAVE_Z14
(void)d_to;
const auto normalized_v = detail::VsxF2INormalizeSrcVals(v);
#if HWY_IS_LITTLE_ENDIAN
- // __builtin_vsx_xvcvspuxds expects the source values to be in the odd lanes
- // on little-endian PPC, and the vec_sld operation below will shift the even
- // lanes of normalized_v into the odd lanes.
- return VFromD<D>{
- reinterpret_cast<__vector unsigned long long>(__builtin_vsx_xvcvspuxds(
- vec_sld(normalized_v.raw, normalized_v.raw, 4)))};
+ // VsxXvcvspuxds expects the source values to be in the odd lanes
+ // on little-endian PPC, and the Shuffle2103 operation below will shift the
+ // even lanes of normalized_v into the odd lanes.
+ return VsxXvcvspuxds(Shuffle2103(normalized_v));
#else
- // __builtin_vsx_xvcvspuxds expects the source values to be in the even lanes
+ // VsxXvcvspuxds expects the source values to be in the even lanes
// on big-endian PPC.
- return VFromD<D>{reinterpret_cast<__vector unsigned long long>(
- __builtin_vsx_xvcvspuxds(normalized_v.raw))};
+ return VsxXvcvspuxds(normalized_v);
#endif
#else
const RebindToFloat<decltype(d_to)> df64;
@@ -4022,20 +4067,18 @@ HWY_INLINE VFromD<D> PromoteOddTo(hwy::SignedTag /*to_type_tag*/,
hwy::SizeTag<8> /*to_lane_size_tag*/,
hwy::FloatTag /*from_type_tag*/, D d_to,
V v) {
-#if !HWY_S390X_HAVE_Z14 && \
- (HWY_COMPILER_GCC_ACTUAL || HWY_HAS_BUILTIN(__builtin_vsx_xvcvspsxds))
+#if !HWY_S390X_HAVE_Z14
(void)d_to;
const auto normalized_v = detail::VsxF2INormalizeSrcVals(v);
#if HWY_IS_LITTLE_ENDIAN
- // __builtin_vsx_xvcvspsxds expects the source values to be in the odd lanes
+ // VsxXvcvspsxds expects the source values to be in the odd lanes
// on little-endian PPC
- return VFromD<D>{__builtin_vsx_xvcvspsxds(normalized_v.raw)};
+ return VsxXvcvspsxds(normalized_v);
#else
- // __builtin_vsx_xvcvspsxds expects the source values to be in the even lanes
- // on big-endian PPC, and the vec_sld operation below will shift the odd lanes
- // of normalized_v into the even lanes.
- return VFromD<D>{
- __builtin_vsx_xvcvspsxds(vec_sld(normalized_v.raw, normalized_v.raw, 4))};
+ // VsxXvcvspsxds expects the source values to be in the even lanes
+ // on big-endian PPC, and the Shuffle0321 operation below will shift the odd
+ // lanes of normalized_v into the even lanes.
+ return VsxXvcvspsxds(Shuffle0321(normalized_v));
#endif
#else
const RebindToFloat<decltype(d_to)> df64;
@@ -4050,22 +4093,18 @@ HWY_INLINE VFromD<D> PromoteOddTo(hwy::UnsignedTag /*to_type_tag*/,
hwy::SizeTag<8> /*to_lane_size_tag*/,
hwy::FloatTag /*from_type_tag*/, D d_to,
V v) {
-#if !HWY_S390X_HAVE_Z14 && \
- (HWY_COMPILER_GCC_ACTUAL || HWY_HAS_BUILTIN(__builtin_vsx_xvcvspuxds))
+#if !HWY_S390X_HAVE_Z14
(void)d_to;
const auto normalized_v = detail::VsxF2INormalizeSrcVals(v);
#if HWY_IS_LITTLE_ENDIAN
- // __builtin_vsx_xvcvspuxds expects the source values to be in the odd lanes
+ // VsxXvcvspuxds expects the source values to be in the odd lanes
// on little-endian PPC
- return VFromD<D>{reinterpret_cast<__vector unsigned long long>(
- __builtin_vsx_xvcvspuxds(normalized_v.raw))};
+ return VsxXvcvspuxds(normalized_v);
#else
- // __builtin_vsx_xvcvspuxds expects the source values to be in the even lanes
- // on big-endian PPC, and the vec_sld operation below will shift the odd lanes
- // of normalized_v into the even lanes.
- return VFromD<D>{
- reinterpret_cast<__vector unsigned long long>(__builtin_vsx_xvcvspuxds(
- vec_sld(normalized_v.raw, normalized_v.raw, 4)))};
+ // VsxXvcvspuxds expects the source values to be in the even lanes
+ // on big-endian PPC, and the Shuffle0321 operation below will shift the odd
+ // lanes of normalized_v into the even lanes.
+ return VsxXvcvspuxds(Shuffle0321(normalized_v));
#endif
#else
const RebindToFloat<decltype(d_to)> df64;
--
2.50.0

55
Makefile Normal file
View File

@ -0,0 +1,55 @@
# This is a packager-level Makefile, used for task related to the RPM updates.
# === Paths
# Directory of current Makefile; assumed to be the same as the .spec file.
MAKEDIR := $(dir $(lastword ${MAKEFILE_LIST}))
SPECFILE ?= $(wildcard ${MAKEDIR}nodejs*.spec)
# === Tools
GIT := git
RPM := rpm -D '_sourcedir ${MAKEDIR}'
RPKG ?= fedpkg
SPECTOOL := rpmdev-spectool --define '_sourcedir ${MAKEDIR}'
TAR := tar
# === Variables potentially overwritten from environment
# Version we want to update to.
TARGET_VERSION ?= $(error No target version specified for update!)
# === File lists
# Source files that are not stored directly in git
SOURCES := $(shell ${SPECTOOL} --list-files --source 0,1,2,100 ${SPECFILE}|sed -E 's/^Source[[:digit:]]*: //'|xargs basename -a)
# Packaging support files
PACKAGING := Makefile packaging/make-nodejs-tarball.sh packaging/fill-versions.sh
# === Control targets / actions ===
.PHONY: update clean
# Update the package to TARGET_VERSION
update: ${SPECFILE} packaging/fill-versions.sh
sed -Ei '/^%nodejs_define_version\s+node\>/s|:[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+-|:${TARGET_VERSION}-|' '${SPECFILE}'
${MAKE} node-v${TARGET_VERSION}-stripped.tar.gz
packaging/fill-versions.sh '${SPECFILE}' node-v${TARGET_VERSION}-stripped.tar.gz
${GIT} add '${SPECFILE}'
${MAKE} sources
# Remove all downloaded and/or created files
clean:
$(RM) -r node-v*-stripped.tar.gz node-v*/ # main archive and it's expanded contents
$(RM) icu4c-*-data-bin-?.zip # ICU database
$(RM) packaging-scripts.tar.gz # packaging tarball
# === Recipes for concrete files ===
# Upload new sources to lookaside cache
sources: ${SOURCES}
${RPKG} new-sources $^
node-v%-stripped.tar.gz: packaging/make-nodejs-tarball.sh
$< $*
icu4c-%-data-bin-b.zip icu4c-%-data-bin-l.zip &: ${SPECFILE}
${SPECTOOL} --get-files --source 1,2 $<
packaging-scripts.tar.gz: ${PACKAGING}
${TAR} -czf $@ $^

151
i18n-btest402.js Normal file
View File

@ -0,0 +1,151 @@
// Copyright (C) 2014 IBM Corporation and Others. All Rights Reserved.
// This file is part of the Node.JS ICU enablement work
// https://github.com/joyent/node/pull/7719
// and is under the same license.
//
// This is a very, very, very basic test of es402
//
// URL: https://github.com/srl295/btest402
// Author: Steven R. Loomis <srl@icu-project.org>
//
// for a complete test, see http://test262.ecmascript.org
//
// Usage: node btest402.js
try {
console.log("You have console.log.");
} catch(e) {
// this works on d8
console = { log: print };
console.log("Now you have console.log.");
}
function runbtest() {
var summary = {};
try {
var i = Intl;
summary.haveIntl = true;
console.log("+ Congrats, you have the Intl object.");
} catch(e) {
console.log("You don't have the Intl object: " + e);
}
if(summary.haveIntl) {
var locs = [ "en", "mt", "ja","tlh"];
var d = new Date(196400000);
for ( var n=0; n<locs.length; n++ ) {
var loc = locs[n];
var lsummary = summary[loc] = {};
console.log(loc+":");
var sl=null;
try {
sl = Intl.DateTimeFormat.supportedLocalesOf([loc]);
if( sl.length > 0 ) {
lsummary.haveSlo = true;
}
} catch (e) {
console.log("SLO err: " + e);
}
var dstr = "ERR";
try {
lsummary.dstr = d.toLocaleString(loc,{month: "long",day:"numeric",weekday:"long",year:"numeric"});
console.log(" date: (supported:"+sl+") " + lsummary.dstr);
} catch (e) {
console.log(" Date Format err: " + e);
}
try {
new Intl.v8BreakIterator();
console.log(" Intl.v8BreakIterator:" +
Intl.v8BreakIterator.supportedLocalesOf(loc) + " Supported, first()==" +
new Intl.v8BreakIterator(loc).first() );
lsummary.brkOk = true;
} catch ( e) {
console.log(" Intl.v8BreakIterator error (NOT part of EcmaScript402): " + e);
}
console.log();
}
}
// print summary
console.log();
console.log("--------- Analysis ---------");
stxt = "";
if( summary.haveIntl ) {
console.log("* You have the 'Intl' object. Congratulations! You have the possibility of being EcmaScript 402 compliant.");
stxt += "Have Intl, ";
if ( !summary.en.haveSlo ) {
stxt += "Date:no EN, ";
console.log("* English isn't a supported language by the date formatter. Perhaps the data isn't installed properly?");
}
if ( !summary.tlh.haveSlo ) {
stxt += "Date:no 'tlh', ";
console.log("* Klingon isn't a supported language by the date formatter. It is without honor!");
}
// now, what is it actually saying
if( summary.en.dstr.indexOf("1970") == -1) {
stxt += "Date:bad 'en', ";
console.log("* the English date format text looks bad to me. Doesn't even have the year.");
} else {
if( summary.en.dstr.indexOf("Jan") == -1) {
stxt += "Date:bad 'en', ";
console.log("* The English date format text looks bad to me. Doesn't have the right month.");
}
}
if( summary.mt.dstr == summary.en.dstr ) {
stxt += "Date:'mt'=='en', ";
console.log("* The English and Maltese look the same to me. Probably a 'small' build.");
} else if( summary.mt.dstr.indexOf("1970") == -1) {
stxt += "Date:bad 'mt', ";
console.log("* the Maltese date format text looks bad to me. Doesn't even have the year. (This data is missing from the Chromium ICU build)");
} else {
if( summary.mt.dstr.indexOf("Jann") == -1) {
stxt += "Date:bad 'mt', ";
console.log("* The Maltese date format text looks bad to me. Doesn't have the right month. (This data is missing from the Chromium ICU build)");
}
}
if ( !summary.ja.haveSlo ) {
stxt += "Date:no 'ja', ";
console.log("* Japanese isn't a supported language by the date formatter. Could be a 'small' build.");
} else {
if( summary.ja.dstr.indexOf("1970") == -1) {
stxt += "Date:bad 'ja', ";
console.log("* the Japanese date format text looks bad to me. Doesn't even have the year.");
} else {
if( summary.ja.dstr.indexOf("日") == -1) {
stxt += "Date:bad 'ja', ";
console.log("* The Japanese date format text looks bad to me.");
}
}
}
if ( summary.en.brkOk ) {
stxt += "FYI: v8Brk:have 'en', ";
console.log("* You have Intl.v8BreakIterator support. (Note: not part of ES402.)");
}
} else {
console.log("* You don't have the 'Intl' object. You aren't EcmaScript 402 compliant.");
stxt += " NO Intl. ";
}
// 1-liner.
console.log();
console.log("----------------");
console.log( "SUMMARY:" + stxt );
}
var dorun = true;
try {
if(btest402_noautorun) {
dorun = false;
}
} catch(e) {}
if(dorun) {
console.log("Running btest..");
runbtest();
}

9
nodejs.pc.in Normal file
View File

@ -0,0 +1,9 @@
prefix=@PREFIX@
includedir=@INCLUDEDIR@
libdir=@LIBDIR@
Name: @PKGCONFNAME@
Description: JavaScript Runtime
Version: @NODEJS_VERSION@
Libs: -L${libdir} -lnode
Cflags: -I${includedir}/node

119
nodejs.srpm.macros Normal file
View File

@ -0,0 +1,119 @@
# ============================================================================
# Vendored dependencies management
# --- Version macros definition
# Parse and normalize version string into several macros.
# By default, stores the whole string in `%<name>_evr` macro,
# then automatically strips any epoch and/or release parts
# (specified in the standard "E:V-R" format)
# and defines `%<name>_epoch`, `%<name>_version`, and `%<name>_release` macros.
#
# With the `-p` option, the version is additionally split into
# `%<name>_version_major`, `%<name>_version_minor`, and `%<name>_version_patch` macros.
#
# Any would-be empty macro will evaluate to `%{nil}`.
#
# Options:
# -p : Also define the partial macros.
#
# Arguments:
# 1: Name of the dependency. Any `-' will be replaced by `_' in the macro names.
# 2: The EVR string to parse.
%nodejs_define_version(p) %{lua:
local component <const> = arg[1] or error("No name provided!")
local evr <const> = arg[2] or error("No version string provided!")
local name <const> = component:gsub("-", "_") -- macro-safe name
macros[name .. "_evr"] = evr
local _, epoch_end, epoch <const> = evr:find("^(%d+):")
macros[name .. "_epoch"] = epoch
local release_start, _, release <const> = evr:find("%-([^-]+)$")
macros[name .. "_release"] = release
local version_start, version_end = 0, -1
if epoch_end then version_start = epoch_end + 1 end
if release_start then version_end = release_start -1 end
local version <const> = evr:sub(version_start, version_end)
macros[name .. "_version"] = version
if opt.p then
local parts = {}; for p in version:gmatch("[^.]+") do table.insert(parts, p) end
macros[name .. "_version_major"] = parts[1]
macros[name .. "_version_minor"] = parts[2]
macros[name .. "_version_patch"] = parts[3]
end
}
# --- Declare vendored dependency
# Emits bcond-controlled RPM tags for a (potentially) vendored dependency.
#
# By default, it emits `Provides: bundled(<name>) = <version>` for given arguments.
# If de-vendoring option is provided, also defines a bcond that controls whether to de-vendor or not.
# The default is to de-vendor when possible unless a global bcond (`all_deps_bundled`) is set.
#
# Options:
# -a : Autoversion try using `<name>_version` macro if the version argument is empty.
# -n[npmname,...] : Also provide the respective npm module name when vendoring.
# -p[pkgname,...] : Use pkgconfig to BuildRequire de-vendored dependency.
# -r[rpmname,...] : Also explicitly declare run time requirement.
# -s[rpmname,...] : BuildRequire de-vendored dependency by RPM name.
#
# All above options accept optional parameter overriding the component name in respective tag.
# If needed, multiple values can be requested by separating them with a comma.
#
# When a name is used in a macro context (for example, in the -a option),
# the same name-mangling as for nodejs_define_version is used;
# no need to adjust it by hand.
#
# Arguments:
# 1: Name of the vendored component. Should be appropriate for `Provides: bundled(<name>)` tag.
# 2: Version of the vendored component. Ignored if de-vendored.
%nodejs_declare_bundled(an::p::r::s::) %{lua:
local component <const> = arg[1] or error("Vendored component was not named!")
local version <const> = arg[2] or (opt.a and macros[component:gsub("-", "_") .. "_version"]) or error("Missing component version!")
local mapvalues <const> = function(fn, tbl)
local output = {}; for _, val in ipairs(tbl) do table.insert(output, fn(val)) end; return output
end
local splitnames <const> = function(input)
local output = {}; for m in input:gmatch("[^,]+") do table.insert(output, m) end; return output
end
local nl <const> = string.char(10); -- \n does not work in rpmlua
local possible_to_devendor <const> = opt.p or opt.s
local should_devendor <const> = possible_to_devendor and macros.with{"all_deps_bundled"} == "0"
local bcond_name <const> = "bundled_" .. component:gsub("-", "_")
macros.bcond{bcond_name, should_devendor and "0" or "1"}
if macros.with{bcond_name} == "1" then
local provides = {string.format("bundled(%s) = %s", component, version)}
if opt.n then
local names = {component}; if opt.n ~= "" then names = splitnames(opt.n) end
for _, name in ipairs(names) do
table.insert(provides, string.format("npm(%s) = %s", name, version))
end
end
return "Provides: " .. table.concat(provides, ", ")
end
local buildrequire, require = nil, nil
if opt.p then
local format <const> = function(n) return string.format("pkgconfig(%s)", n) end
local names = {component}; if opt.p ~= "" then names = splitnames(opt.p) end
buildrequire = "BuildRequires: " .. table.concat(mapvalues(format, names), ", ")
elseif opt.s then
local names = {component}; if opt.s ~= "" then names = splitnames(opt.s) end
buildrequire = "BuildRequires: " .. table.concat(names, ", ")
end
if opt.r then
local names = {component}; if opt.r ~= "" then names = splitnames(opt.r) end
require = "Requires: " .. table.concat(names, ", ")
end
return table.concat({buildrequire, require}, nl)
}

583
nodejs24.spec Normal file
View File

@ -0,0 +1,583 @@
# This should be moved to rpm-redhat-config or similar as soon as feasible
# NOTE: %%SOURCE macros are not yet defined, so explicit path is needed
%{load:%{_sourcedir}/nodejs.srpm.macros}
# === Versions of any software shipped in the main nodejs tarball
%nodejs_define_version node 1:24.4.1-%{autorelease} -p
# The following ones are generated via script;
# expect anything between the markers to be overwritten on any update.
# BEGIN automatic-version-macros # DO NOT REMOVE THIS LINE!
# Version from node-v24.4.1/src/node_version.h
%global node_soversion 137
# Version from node-v24.4.1/deps/ada/ada.h
%nodejs_define_version ada 3.2.4
# Version from node-v24.4.1/deps/brotli/c/common/version.h
%nodejs_define_version brotli 1.1.0
# Version from node-v24.4.1/deps/cares/include/ares_version.h
%nodejs_define_version c_ares 1.34.5
# Version from node-v24.4.1/deps/histogram/include/hdr/hdr_histogram_version.h
%nodejs_define_version histogram 0.11.8
# Version from node-v24.4.1/tools/icu/current_ver.dep
%nodejs_define_version icu 77.1 -p
# Version from node-v24.4.1/deps/uv/include/uv/version.h
%nodejs_define_version libuv 1.51.0
# Version from node-v24.4.1/deps/llhttp/include/llhttp.h
%nodejs_define_version llhttp 9.3.0
# Version from node-v24.4.1/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
%nodejs_define_version nghttp2 1.66.0
# Version from node-v24.4.1/deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h
%nodejs_define_version nghttp3 1.6.0
# Version from node-v24.4.1/deps/ngtcp2/ngtcp2/lib/includes/ngtcp2/version.h
%nodejs_define_version ngtcp2 1.11.0
# Version from node-v24.4.1/deps/cjs-module-lexer/src/package.json
%nodejs_define_version nodejs-cjs-module-lexer 2.1.0
# Version from node-v24.4.1/lib/punycode.js
%nodejs_define_version nodejs-punycode 2.1.0
# Version from node-v24.4.1/deps/undici/src/package.json
%nodejs_define_version nodejs-undici 7.11.0
# Version from node-v24.4.1/deps/npm/package.json
%nodejs_define_version npm 1:11.4.2
# Version from node-v24.4.1/deps/sqlite/sqlite3.h
%nodejs_define_version sqlite 3.50.2
# Version from node-v24.4.1/deps/uvwasi/include/uvwasi.h
%nodejs_define_version uvwasi 0.0.21
# Version from node-v24.4.1/deps/v8/include/v8-version.h
%nodejs_define_version v8 3:13.6.233.10 -p
# Version from node-v24.4.1/deps/zlib/zlib.h
%nodejs_define_version zlib 1.3.1
# END automatic-version-macros # DO NOT REMOVE THIS LINE!
# Special release for sub-packages with their own version string.
# The complex release string ensures that the subpackage release is always increasing,
# even in the event that the main package version changes
# while the sub-package version stays the same.
%global nodejs_subpackage_release %{node_epoch}.%{node_version}.%{node_release}
# === Conditional build global options
# Use all vendored dependencies when bootstrapping
%bcond all_deps_bundled %{with bootstrap}
# === Distro-wide build configuration adjustments ===
# v8 cannot be built with LTO enabled;
# the rest of the build should be LTO enabled via the configure script
%global _lto_cflags %{nil}
# === Additional definitions ===
# Architecture-dependent suffix for requiring/providing .so names
%if 0%{?__isa_bits} == 64
%global _so_arch_suffix ()(64bit)
%endif
# place for data files
%global nodejs_datadir %{_datarootdir}/node-%{node_version_major}
# place for (npm) packages used by multiple streams and/or that are stream-agnostic (do not care)
%global nodejs_common_sitelib %{_prefix}/lib/node_modules
# place for (npm) packages specific to this stream
%global nodejs_private_sitelib %{_prefix}/lib/node_modules_%{node_version_major}
Name: nodejs%{node_version_major}
Epoch: %{node_epoch}
Version: %{node_version}
Release: %{node_release}
Summary: JavaScript runtime
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
URL: https://nodejs.org
ExclusiveArch: %{nodejs_arches}
# v8 does not build on i686 any more
ExcludeArch: %{ix86}
# SPEC tools additiona macros, dependency generators, and utilities
BuildRequires: chrpath
BuildRequires: git-core
BuildRequires: jq
BuildRequires: nodejs-packaging
# Build system and supporting tools
BuildRequires: gcc >= 10.0, gcc-c++ >= 10.0, pkgconf, ninja-build
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: %{py3_dist setuptools jinja2}
# Additional libraries, either system or vendored ones
BuildRequires: pkgconfig(openssl) >= 3.0.2
%nodejs_declare_bundled -a ada
%nodejs_declare_bundled -a brotli -plibbrotlidec,libbrotlienc
%nodejs_declare_bundled -a c-ares -plibcares
%nodejs_declare_bundled -a histogram
%nodejs_declare_bundled -a icu
%nodejs_declare_bundled -a libuv -p
%nodejs_declare_bundled -a llhttp
%nodejs_declare_bundled -a nghttp2
%nodejs_declare_bundled -a nghttp3
%nodejs_declare_bundled -a ngtcp2
%nodejs_declare_bundled -a nodejs-cjs-module-lexer
%nodejs_declare_bundled -a nodejs-punycode -npunycode
%nodejs_declare_bundled -a nodejs-undici
%nodejs_declare_bundled -a sqlite -psqlite3
%nodejs_declare_bundled -a uvwasi
%nodejs_declare_bundled -a v8
%nodejs_declare_bundled -a zlib -p
# Run-time dependencies of the main package
Requires: ca-certificates
# Required and/or recommended sub-packages
Requires: %{name}-libs%{?_isa} = %{node_evr}
Recommends: %{name}-docs = %{node_evr}
Recommends: %{name}-full-i18n%{?_isa} = %{node_evr}
Recommends: %{name}-npm >= %{npm_epoch}:%{npm_version}-%{nodejs_subpackage_release}
# Virtual provides
Provides: nodejs(abi) = %{node_soversion}, nodejs(abi%{node_version_major}) = %{node_soversion}
Provides: nodejs(engine) = %{node_version}
# Main source tarball; see packaging/make-nodejs-tarball.sh on how it is created
Source: node-v%{node_version}-stripped.tar.gz
# Sources 001-099: reserved for additional sources to be installed
# - Full ICU database data
Source001: https://github.com/unicode-org/icu/releases/download/release-%{icu_version_major}-%{icu_version_minor}/icu4c-%{icu_version_major}_%{icu_version_minor}-data-bin-b.zip
Source002: https://github.com/unicode-org/icu/releases/download/release-%{icu_version_major}-%{icu_version_minor}/icu4c-%{icu_version_major}_%{icu_version_minor}-data-bin-l.zip
# - Downstream/distribution configuration files
Source003: nodejs.pc.in
Source004: v8.pc.in
Source005: npmrc.in
# - Check section tests
Source010: test-runner.sh
Source011: test-should-pass.txt
Source020: i18n-btest402.js
# Source 100+: Packaging support files that won't be installed
# - Packaging supports scripts and Makefile, used to semi-automate RPM updates. See the Makefile in the tarball on how this is created.
Source100: packaging-scripts.tar.gz
# - Additional SRPM macros
Source101: nodejs.srpm.macros
%patchlist
0001-Remove-unused-OpenSSL-config.patch
0005-v8-highway-Fix-for-GCC-15-compiler-error-on-PPC8-PPC.patch
%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.
%package devel
Summary: JavaScript runtime development headers
Requires: nodejs%{node_version_major}%{?_isa} = %{node_evr}
Requires: nodejs%{node_version_major}-libs%{?_isa} = %{node_evr}
Requires: nodejs-packaging
Requires: openssl-devel%{?_isa}
%{!?with_bundled_brotli:Requires: brotli-devel%{?_isa}}
%{!?with_bundled_libuv:Requires: libuv-devel%{?_isa}}
%{!?with_bundled_zlib:Requires: zlib-devel%{?_isa}}
# Note: -devel sub-packages of the various streams conflict with each other,
# as the headers cannot be easily namespaced (would break at lease node-gyp search path).
# Hence the Provides: in place of metapackage.
Provides: nodejs-devel = %{node_evr}
%description devel
Development headers for the Node.js JavaScript runtime.
%package -n v8-%{v8_version_major}.%{v8_version_minor}-devel
Summary: v8 development headers
Epoch: %{v8_epoch}
Version: %{v8_version}
Release: %{nodejs_subpackage_release}
Requires: nodejs%{node_version_major}-devel%{?_isa} = %{node_evr}
Requires: nodejs%{node_version_major}-libs%{?_isa} = %{node_evr}
Provides: v8-devel = %{v8_epoch}:%{v8_version}-%{nodejs_subpackage_release}
Obsoletes: v8-devel <= 2:10.2.154, v8-314-devel <= 2:3.14
%description -n v8-%{v8_version_major}.%{v8_version_minor}-devel
Development headers for the v8 runtime.
%package libs
Summary: Node.js and v8 libraries
# v8 used to be a separate package; keep providing it virtually
Provides: v8 = %{v8_epoch}:%{v8_version}-%{nodejs_subpackage_release}
Provides: v8%{?_isa} = %{v8_epoch}:%{v8_version}-%{nodejs_subpackage_release}
Obsoletes: v8 < 1:6.7.17-10
Provides: libv8.so.%{v8_version_major}%{?_so_arch_suffix} = %{v8_epoch}:%{v8_version}
Provides: libv8_libbase.so.%{v8_version_major}%{?_so_arch_suffix} = %{v8_epoch}:%{v8_version}
Provides: libv8_libplatform.so.%{v8_version_major}%{?_so_arch_suffix} = %{v8_epoch}:%{v8_version}
%description libs
Libraries to support Node.js and provide stable v8 interfaces.
%package full-i18n
Summary: Non-English locale data for Node.js
Requires: nodejs%{node_version_major}%{?_isa} = %{node_evr}
%description 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 docs
Summary: Node.js API documentation
BuildArch: noarch
Requires(meta): nodejs%{node_version_major} = %{node_evr}
%description docs
The API documentation for the Node.js JavaScript runtime.
%package npm
Summary: Node.js Package Manager
Epoch: %{npm_epoch}
Version: %{npm_version}
Release: %{nodejs_subpackage_release}
BuildArch: noarch
Requires: nodejs%{node_version_major} = %{node_evr}
Recommends: nodejs%{node_version_major}-docs = %{node_evr}
Provides: npm(npm) = %{npm_version}
%description 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.
%prep
%autosetup -n node-v%{node_version} -S git_am
# clean the archive of the de-vendored dependencies, ensuring they are not used
readonly -a devendored_paths=(
deps/v8/third_party/jinja2 tools/inspector_protocol/jinja2
%{?!with_bundled_brotli:deps/brotli}
%{?!with_bundled_c_ares:deps/cares}
%{?!with_bundled_libuv:deps/uv}
%{?!with_bundled_nodejs_cjs_module_lexer:deps/cjs-module-lexer}
%{?!with_bundled_nodejs_undici:deps/undici}
%{?!with_bundled_sqlite:deps/sqlite}
%{?!with_bundled_zlib:deps/zlib}
)
rm -rf "${devendored_paths[@]}"
# use system python throughout the whole sources
readonly -a potential_python_scripts=(
$(grep --recursive --files-with-matches --max-count=1 python)
)
%py3_shebang_fix "${potential_python_scripts[@]}"
%build
# additional build flags
readonly -a extra_cflags=(
# Decrease debuginfo verbosity; otherwise,
# the linker will run out of memory when linking v8
-g1
# For i686 compatibility, build with defines from libuv (rhbz#892601)
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
# Do not use OpenSSL Engine API (RHEL-33743)
-DOPENSSL_NO_ENGINE
# 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.
-O3
# v8 segfaults when Identical Code Folding is enabled
# - https://github.com/nodejs/node/issues/47865
-fno-ipa-icf
)
# configuration flags
readonly -a configure_flags=(
# Basic build options
--verbose --ninja
# Use FHS and build separate libnode.so
--prefix=%{_prefix} --shared --libdir=%{_lib}
# Use system OpenSSL
--shared-openssl
--openssl-is-fips
--openssl-conf-name=openssl_conf
--openssl-use-def-ca-store
# Link with system libraries where appropriate
%{?!with_bundled_brotli:--shared-brotli}
%{?!with_bundled_c_ares:--shared-cares}
%{?!with_bundled_libuv:--shared-libuv}
%{?!with_bundled_sqlite:--shared-sqlite}
%{?!with_bundled_zlib:--shared-zlib}
%if %{without bundled_nodejs_cjs_module_lexer}
--shared-builtin-cjs_module_lexer/lexer-path=%{nodejs_common_sitelib}/cjs-module-lexer/lexer.js
--shared-builtin-cjs_module_lexer/dist/lexer-path=%{nodejs_common_sitelib}/cjs-module-lexer/dist/lexer.js
%endif
%if %{without bundled_nodejs_undici}
--shared-builtin-undici/undici-path=%{nodejs_common_sitelib}/undici/loader.js
%endif
# Enable LTO where possible
--enable-lto
# Compile with small icu, extendable via full-i18n subpackage
--with-intl=small-icu --with-icu-default-data-dir=%{nodejs_datadir}/icudata
# Do not ship corepack
--without-corepack
# Use local headers for native addons when available
--use-prefix-to-find-headers
)
export CFLAGS="${CFLAGS} ${extra_cflags[*]}" CXXFLAGS="${CXXFLAGS} ${extra_cflags[*]}"
%python3 configure.py "${configure_flags[@]}"
%ninja_build -C out/Release
%install
# Fill in values in configuration file templates
# usage: mkconfig [additional sed options] <template.in >config_file
mkconfig() {
local -ra replace_opts=(
-e 's;@INCLUDEDIR@;%{_includedir};g'
-e 's;@LIBDIR@;%{_libdir};g'
-e 's;@NODEJS_VERSION@;%{node_version};g'
-e 's;@PREFIX@;%{_prefix};g'
-e 's;@PYTHON3@;%{python3};g'
-e 's;@SYSCONFDIR@;%{_sysconfdir};g'
-e 's;@V8_VERSION@;%{v8_version};g'
)
sed --regexp-extended "${replace_opts[@]}" "$@"
}
# === Base installation
%{python3} tools/install.py install --dest-dir="${RPM_BUILD_ROOT}" --prefix="%{_prefix}"
# Correct the main binary permissions and remove RPATH
chmod 0755 "${RPM_BUILD_ROOT}%{_bindir}/node"
chrpath --delete "${RPM_BUILD_ROOT}%{_bindir}/node"
# Provide library symlinks
pushd "${RPM_BUILD_ROOT}%{_libdir}"
# - devel symlink for libnode.so
ln -srf libnode.so.%{node_soversion} libnode.so
# - compatibility symlinks for libv8
for soname in libv8{,_libbase,_libplatform}; do
ln -srf libnode.so.%{node_soversion} "${soname}.so.%{v8_version_major}.%{v8_version_minor}"
ln -srf libnode.so.%{node_soversion} "${soname}.so"
done
popd # from ${RPM_BUILD_ROOT}%%{_libdir}
# Massage includedir
pushd "${RPM_BUILD_ROOT}%{_includedir}"
# - provide compatibility symlinks for libv8
for header in node/libplatform node/v8*.h node/cppgc; do
ln -srf "${header}" "$(basename "${header}")"
done
# - config.gypi is platform-dependent and would conflict between arches
mv node/config.gypi node/config-%{_arch}.gypi
popd # ${RPM_BUILD_ROOT}%%{_includedir}
# Install node-gyp configuration files
install -p -Dt "${RPM_BUILD_ROOT}%{nodejs_datadir}" common.gypi
# Create pkg-config files
readonly PKGCONFDIR="${RPM_BUILD_ROOT}%{_libdir}/pkgconfig"
mkdir -p "${PKGCONFDIR}"
mkconfig -e 's;@PKGCONFNAME@;nodejs-%{node_version_major};g' \
<%{SOURCE3} >"${PKGCONFDIR}/nodejs-%{node_version_major}.pc"
mkconfig -e 's;@PKGCONFNAME@;v8-%{v8_version_major}.%{v8_version_minor};g' \
<%{SOURCE4} >"${PKGCONFDIR}/v8-%{v8_version_major}.%{v8_version_minor}.pc"
# Install documentation
mkdir -p "${RPM_BUILD_ROOT}%{_pkgdocdir}/html"
cp -pr doc/* "${RPM_BUILD_ROOT}%{_pkgdocdir}/html"
rm -f "${RPM_BUILD_ROOT}%{_pkgdocdir}/html/node.1"
# Some debugger support files from v8 are provided as documentation from upstream;
# move them to the correct directory (according to us).
pushd "${RPM_BUILD_ROOT}%{_defaultdocdir}"
mv -t "${RPM_BUILD_ROOT}%{_pkgdocdir}" node/gdbinit node/lldb_commands.py
popd # from ${RPM_BUILD_ROOT}%%{_defaultdocdir}
# === Full ICU data installation
# Unzip the data themselves, and make the appropriate documentation available for %%doc
if test "$(%{python3} -Ic 'import sys; print(sys.byteorder)')" = "little"; then
readonly icu_source='%{SOURCE2}' icu_data_file='icudt%{icu_version_major}l.dat'
else
readonly icu_source='%{SOURCE1}' icu_data_file='icudt%{icu_version_major}b.dat'
fi
readonly icu_data_dir="${RPM_BUILD_ROOT}%{nodejs_datadir}/icudata"
readonly icu_doc_dir="full-icu"
unzip -od "${icu_data_dir}" "${icu_source}" "${icu_data_file}"
unzip -od "${icu_doc_dir}" "${icu_source}" -x "${icu_data_file}"
# === NPM installation and tweaks
# Correct permissions in provided scripts
# - There are executable scripts for Windows PowerShell; RPM would try to pull it as a dependency
# - Not all executable bits should be removed; the -not -path lines are the ones that will be kept untouched
declare NPM_DIR="${RPM_BUILD_ROOT}%{nodejs_common_sitelib}/npm"
find "${NPM_DIR}" \
-not -path "${NPM_DIR}/bin/*" \
-not -path "${NPM_DIR}/node_modules/node-gyp/bin/node-gyp.js" \
-not -path "${NPM_DIR}/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp" \
-type f -executable \
-execdir chmod -x '{}' +
# Remove (empty) project-specific .npmrc from npm itself,
# to avoid confusion with the distro-wide configuration below
rm -f "${NPM_DIR}/.npmrc"
# Create distribution-wide configuration file
mkconfig <%{SOURCE5} >"${NPM_DIR}/npmrc"
# Install HTML documentation to %%_pkgdocdir
mkdir -p "${RPM_BUILD_ROOT}%{_pkgdocdir}/npm/"
cp -prt "${RPM_BUILD_ROOT}%{_pkgdocdir}/npm/" deps/npm/docs
# - replace the docs in $NPM_DIR with symlink to the doc dir
rm -rf "${NPM_DIR}/docs"
ln -srf "${RPM_BUILD_ROOT}%{_pkgdocdir}/npm/docs" "${NPM_DIR}/docs"
# Install man pages to %%_mandir
mkdir -p "${RPM_BUILD_ROOT}%{_mandir}"
cp -prt "${RPM_BUILD_ROOT}%{_mandir}" deps/npm/man/*
# replace man pages in $NPM_DIR with symlinks to the man dir
rm -rf "${NPM_DIR}/man"
ln -srf "${RPM_BUILD_ROOT}%{_mandir}" "${NPM_DIR}/man"
# === Adjustments to avoid conflict between parallel streams
# Note: some of the actions here make some of the previous ones redundant
# (for example, replacing a symlink made few lines above).
# This is by design; it should allow us to drop this entire section if we want
# to approach the problem in a different way
# (for example, backporting the changes to modular packages in EL9).
# Rename the main binary
readonly NODE_BIN='%{_bindir}/node-%{node_version_major}'
mv "${RPM_BUILD_ROOT}%{_bindir}/node" "${RPM_BUILD_ROOT}%{_bindir}/node-%{node_version_major}"
# Make the sitelib into a private one; but keep providing (empty) common one
mv "${RPM_BUILD_ROOT}%{nodejs_common_sitelib}" "${RPM_BUILD_ROOT}%{nodejs_private_sitelib}"
# 2025-05-20 FIXME: Turning a symlink into a directory needs to be coordinated across all the active streams.
# In order to not block this new packaging approach on the WASM unbundling effort,
# do not provide the common sitelib for now.
#mkdir "${RPM_BUILD_ROOT}%%{nodejs_common_sitelib}"
declare NPM_DIR="${RPM_BUILD_ROOT}%{nodejs_private_sitelib}/npm"
# Adjust npm scripts to use the renamed interpreter
readonly SHEBANG_ERE='^#!/usr/bin/(env\s+)?node\b'
readonly SHEBANG_FIX='#!%{_bindir}/node-%{node_version_major}'
readonly -a npm_bin_dirs=("${NPM_DIR}/bin" "${NPM_DIR}/node_modules/node-gyp/bin")
find "${npm_bin_dirs[@]}" -type f \
| xargs grep --extended-regexp --files-with-matches "${SHEBANG_ERE}" \
| xargs sed --regexp-extended --in-place "s;${SHEBANG_ERE};${SHEBANG_FIX};"
# Replace npm %%{_bindir} symlinks with properly versioned ones
# usage: relink_bin <basename> <source>
relink_bin() {
local -r basename="${1?No link basename provided!}"
local -r source="${2?No link source provided!}"
ln -srf "${source}" "${RPM_BUILD_ROOT}%{_bindir}/${basename}-%{node_version_major}"
rm -f "${RPM_BUILD_ROOT}%{_bindir}/${basename}"
}
relink_bin npm "${NPM_DIR}/bin/npm-cli.js"
relink_bin npx "${NPM_DIR}/bin/npx-cli.js"
# Move manpages to versioned directories
readonly VERSIONED_MANDIR="${RPM_BUILD_ROOT}%{nodejs_datadir}/man"
mkdir -p "${VERSIONED_MANDIR}"
mv -t "${VERSIONED_MANDIR}" "${RPM_BUILD_ROOT}%{_mandir}"/man?
# - compress the man-pages manually so that rpm will (re-)create valid symlinks
# FIXME: This should probably be replaced with ading /usr/share/node-*/man dir to /usr/lib/rpm/brp-compress
readonly COMPRESS=${COMPRESS:-gzip -9 -n}
find "${VERSIONED_MANDIR}" -type f -name '*.[123456789]' -execdir ${COMPRESS} '{}' +
# update npm man symlink
ln -srfn "${VERSIONED_MANDIR}" "${NPM_DIR}/man"
# - create symlinks for the versioned binaries
mkdir -p "${RPM_BUILD_ROOT}%{_mandir}/man1"
ln -srf "${VERSIONED_MANDIR}/man1/node.1.gz" "${RPM_BUILD_ROOT}%{_mandir}/man1/node-%{node_version_major}.1.gz"
ln -srf "${VERSIONED_MANDIR}/man1/npm.1.gz" "${RPM_BUILD_ROOT}%{_mandir}/man1/npm-%{node_version_major}.1.gz"
ln -srf "${VERSIONED_MANDIR}/man1/npx.1.gz" "${RPM_BUILD_ROOT}%{_mandir}/man1/npx-%{node_version_major}.1.gz"
%check
# === Common test environment
export LD_LIBRARY_PATH="${RPM_BUILD_ROOT}%{_libdir}:${LD_LIBRARY_PATH}"
# "aliases" to the just-build binaries
node() {
"${RPM_BUILD_ROOT}%{_bindir}/node-%{node_version_major}" \
--icu-data-dir="${RPM_BUILD_ROOT}%{nodejs_datadir}/icudata" \
"$@"
}
npm() {
node "${RPM_BUILD_ROOT}%{_bindir}/npm-%{node_version_major}" "$@"
}
# === Sanity check for important versions
node -e 'require("assert").equal(process.versions.node, "%{node_version}")'
node -e 'require("assert").equal(process.versions.v8.replace(/-node\.\d+$/, ""), "%{v8_version}")'
node -e 'require("assert").equal(process.versions.ares.replace(/-DEV$/, ""), "%{c_ares_version}")'
node --no-deprecation -e 'require("assert").equal(require("punycode").version, "%{nodejs_punycode_version}")'
npm version --json | jq --exit-status '.npm == "%{npm_version}"'
# === Custom and/or devendored parts sanity checks
# - full i18n support is available
node '%{SOURCE20}'
# - npm update notifier is disabled
npm config list --json | jq --exit-status '.["update-notifier"] == false'
# === Upstream test suite
bash '%{SOURCE10}' "${RPM_BUILD_ROOT}%{_bindir}/node-%{node_version_major}" test/ '%{SOURCE11}'
%files
%doc README.md CHANGELOG.md GOVERNANCE.md onboarding.md
%license LICENSE
%dir %{nodejs_datadir}/
%dir %{nodejs_datadir}/man/
%dir %{nodejs_datadir}/man/man1/
#%%dir %%{nodejs_common_sitelib}/
%dir %{nodejs_private_sitelib}/
%{_bindir}/node-%{node_version_major}
%{nodejs_datadir}/man/man1/node.1*
%{_mandir}/man1/node-%{node_version_major}.1*
%files libs
%license LICENSE
%{_libdir}/libnode.so.%{node_soversion}
%{_libdir}/libv8.so.%{v8_version_major}.%{v8_version_minor}
%{_libdir}/libv8_libbase.so.%{v8_version_major}.%{v8_version_minor}
%{_libdir}/libv8_libplatform.so.%{v8_version_major}.%{v8_version_minor}
%files devel
%license LICENSE
%dir %{nodejs_datadir}/
%{_includedir}/node/
%{_libdir}/libnode.so
%{_libdir}/pkgconfig/nodejs-%{node_version_major}.pc
%{_pkgdocdir}/gdbinit
%{_pkgdocdir}/lldb_commands.py
%{nodejs_datadir}/common.gypi
%files -n v8-%{v8_version_major}.%{v8_version_minor}-devel
%license LICENSE
%{_includedir}/cppgc
%{_includedir}/libplatform
%{_includedir}/v8*.h
%{_libdir}/libv8.so
%{_libdir}/libv8_libbase.so
%{_libdir}/libv8_libplatform.so
%{_libdir}/pkgconfig/v8-%{v8_version_major}.%{v8_version_minor}.pc
%files full-i18n
%doc full-icu/icu4c-%{icu_version_major}_%{icu_version_minor}-data-bin-?-README.md
%license full-icu/LICENSE
%dir %{nodejs_datadir}/
%{nodejs_datadir}/icudata/
%files npm
%doc deps/npm/README.md
%license deps/npm/LICENSE
%dir %{nodejs_datadir}/
%dir %{nodejs_private_sitelib}/
%{_bindir}/npm-%{node_version_major}
%{_bindir}/npx-%{node_version_major}
%{_mandir}/man1/npm-%{node_version_major}.1*
%{_mandir}/man1/npx-%{node_version_major}.1*
%{nodejs_datadir}/man
%{nodejs_private_sitelib}/npm/
%exclude %{nodejs_datadir}/man/man1/node*.1*
%files docs
%doc doc/README.md
%license LICENSE
%dir %{_pkgdocdir}
%{_pkgdocdir}/html/
%{_pkgdocdir}/npm/
%changelog
%autochangelog

7
npmrc.in Normal file
View File

@ -0,0 +1,7 @@
# This is the distribution-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
prefix=/usr/local
update-notifier=false

178
packaging/fill-versions.sh Executable file
View File

@ -0,0 +1,178 @@
#!/bin/bash
set -e
usage() {
echo "$(basename "$0")" '<SPEC>' '<TARBALL>'
echo Fill versions between BEGIN/END automatic-version-macros in the spec file.
}
# Format version information in unified style
# usage: format_version <component> <source file> <version> [macro options…]
format_version() {
local -r component="${1?No component named!}" && shift
local -r srcpath="${1?No version source specified!}" && shift
local -r version="${1?No version specified}" && shift
printf '# Version from %s\n' "${srcpath}"
printf '%%nodejs_define_version %s %s%s%s\n' "${component}" "${version}" "${*:+ }" "${*}"
}
# Find concrete path to the requested file within unpacked source tree.
# usage: find_source_path <path_tail>
find_source_path() {
local -r path_tail="${1?No source path specified!}"
# currently just verify that the expected path exists
if test -r node-v*/"${path_tail}"
then
printf '%s\n' "${_}"
else
printf >&2 'Path does not exist: %s\n' "${_}"
return 1
fi
}
# "Meta"-extraction function.
# Finds the actual source file, extracts the version as specified,
# and outputs properly formatted macro on stdout.
# usage: find_version <component> <source_path> <macro_opts> <extractor_fn> [extractor_fn_opts]…
# arguments:
# component: name of the vendored component
# source_path: path to the version information source, relative to the root of the extracted tree
# macro_opts: options for %nodejs_define_version macro; use empty string ('') if none shall be used
# extractor_fn: name of the function responsible for extraction of the version string.
# expected signature: extractor_fn <source_path> [options]…
# extractor_fn_opts: additional options to pass to extractor_fn after source_path
find_version() {
local -r component="${1?No component specified!}" && shift
local -r srcpath="${1?No version source path specified!}" && shift
local -r macro_opts="${1?No %nodejs_define_version macro options specified!}" && shift
local -r extract_fn="${1?No extraction function specified!}" && shift
local full_source_path version_string
full_source_path="$(find_source_path "${srcpath}")"
version_string="$("${extract_fn}" "${full_source_path}" "$@")"
format_version "${component}" "${full_source_path}" "${version_string}" "${macro_opts}"
}
# The extraction functions (extractor_fn above) follows. Add to them as necessary.
# Extract version string from a C #define directive.
# If provided more than one define name, it is assumed these define the version components,
# and they will all be concatenated with a dot.
# usage: version_from_c_define <header> <define_name>…
version_from_c_define() {
local -r path="${1?No C header provided!}" && shift
while test "$#" -gt 0; do
local name="${1}"; shift
# grab either a single numeric component (\d+)
# or a single quoted string (".*?")
# after a #define <name> statement
local regexp="(?<=#define ${name})\s+(\d+|\".*?\")"
grep --only-matching --perl-regexp "${regexp}" "${path}" \
| sed -E 's|^[[:space:]"]*||;s|"$||' \
| if test "$#" -gt 0 # not the last part
then tr '\n' '.' # turn line end into separator dot
else cat # leave as is
fi
done
}
# Extract version from package.json or similar file
# usage: version_from_json <path> [jq_filter]
# jq_filter defaults to .version
version_from_json() {
local -r path="${1?No JSON path provided!}" && shift
local -r filter="${1-.version}" && shift
jq --raw-output "${filter}" "${path}"
}
# There always is a special case. Don't be afraid to use one-off extractor functions.
parse_isu_version() {
local -r path="${1?No ICU metadata JSON path provided!}"
version_from_json "${path}" '.[0].url' \
| sed -E 's/.*release-([[:digit:]]+)-([[:digit:]]+).*/\1.\2/g'
}
parse_punycode_version() {
local -r path="${1?No punycode.js path provided!}"
# Fragile, but I could come up with nothing better yet.
grep --only-matching --perl-regexp \
"(?<='version': )'\d+\.\d+\.\d+'" "${path}" \
| tr -d "'"
}
parse_npm_version() {
# NPM was originally a separate package using epoch; we need to keep it
local -r NPM_EPOCH=1
local -r path="${1?No path to npm package.json provided!}"
printf '%d:' "${NPM_EPOCH}" && version_from_json "${path}"
}
parse_v8_version() {
# v8 was originally a separate package using epoch; we need to keep it
local -r V8_EPOCH=3
local -r path="${1?No path to v8 version header provided!}"
printf '%d:' "${V8_EPOCH}" && version_from_c_define "${path}" \
V8_{MAJOR,MINOR}_VERSION V8_BUILD_NUMBER V8_PATCH_LEVEL
}
# Main script
# ===========
readonly SPEC="$1" TARBALL="$2"
if test -z "${SPEC}"; then echo 'Missing SPEC path!' >&2; usage >&2; exit 1; fi
if test -z "${TARBALL}"; then echo 'Missing TARBALL path!' >&2; usage >&2; exit 1; fi
readonly NEW_SPEC="${SPEC}.new"
# Start with a clean source tree
rm -rf node-v*/ && tar -xzf "${TARBALL}"
# Redirect standard output to working copy of the current spec file
exec 3>&1 1>"${NEW_SPEC}"
# Copy SPEC file up to the BEGIN marker
sed -E '/^#\s*BEGIN automatic-version-macros/q' "${SPEC}"
# Output libnode.so soname version
soversion_source="$(find_source_path src/node_version.h)"
printf '# Version from %s\n' "${soversion_source}"
printf '%%global node_soversion %s\n' "$(version_from_c_define "${soversion_source}" NODE_MODULE_VERSION)"
echo
# Output all the dependency versions. Try to keep them in alphabetical order
find_version ada deps/ada/ada.h '' version_from_c_define ADA_VERSION
find_version brotli deps/brotli/c/common/version.h '' version_from_c_define BROTLI_VERSION_{MAJOR,MINOR,PATCH}
find_version c_ares deps/cares/include/ares_version.h '' version_from_c_define ARES_VERSION_STR
find_version histogram deps/histogram/include/hdr/hdr_histogram_version.h '' version_from_c_define HDR_HISTOGRAM_VERSION
find_version icu tools/icu/current_ver.dep -p parse_isu_version
find_version libuv deps/uv/include/uv/version.h '' version_from_c_define UV_VERSION_{MAJOR,MINOR,PATCH}
find_version llhttp deps/llhttp/include/llhttp.h '' version_from_c_define LLHTTP_VERSION_{MAJOR,MINOR,PATCH}
find_version nghttp2 deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h '' version_from_c_define NGHTTP2_VERSION
find_version nghttp3 deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h '' version_from_c_define NGHTTP3_VERSION
find_version ngtcp2 deps/ngtcp2/ngtcp2/lib/includes/ngtcp2/version.h '' version_from_c_define NGTCP2_VERSION
find_version nodejs-cjs-module-lexer deps/cjs-module-lexer/src/package.json '' version_from_json
find_version nodejs-punycode lib/punycode.js '' parse_punycode_version
find_version nodejs-undici deps/undici/src/package.json '' version_from_json
find_version npm deps/npm/package.json '' parse_npm_version
find_version sqlite deps/sqlite/sqlite3.h '' version_from_c_define SQLITE_VERSION
find_version uvwasi deps/uvwasi/include/uvwasi.h '' version_from_c_define UVWASI_VERSION_{MAJOR,MINOR,PATCH}
find_version v8 deps/v8/include/v8-version.h -p parse_v8_version
find_version zlib deps/zlib/zlib.h '' version_from_c_define ZLIB_VERSION
# Copy rest of the spec file from the END marker till the end
sed -nE '/^#\s*END automatic-version-macros/,$p' "${SPEC}"
# Restore standard output
exec 1>&3 3>&-
# Replace the old spec with the updated one
mv "${NEW_SPEC}" "${SPEC}"

View File

@ -0,0 +1,37 @@
#!/bin/bash
# deps: coreutils curl tar
set -e
# Print usage
usage() {
printf '%s <VERSION>\n' "$(basename "$0")"
printf '%s\n' "Create a NodeJS tarball for given VERSION stripped of parts we cannot ship."
}
# Log a message
log() {
printf '## %s\n' "$*"
}
# Tweak default cURL flags
curl() {
command curl --progress-bar "$@"
}
readonly VERSION="$1"; if test -z "$VERSION"; then
printf '%s\n\n' "No VERSION specified!"
usage >&2
exit 1
fi
readonly BASENAME="node-v${VERSION}"
readonly BASEURL="https://nodejs.org/dist/v${VERSION}"
log >&2 Downloading and verifying "${BASENAME}.tar.gz"
curl --remote-name "${BASEURL}/${BASENAME}.tar.gz"
curl --silent "${BASEURL}/SHASUMS256.txt" | sha256sum --check --ignore-missing
log >&2 Repackaging the sources into "${BASENAME}-stripped.tar.gz"
tar -xzf "${BASENAME}.tar.gz" && rm -f "${BASENAME}.tar.gz"
rm -rf "${BASENAME}/deps/openssl"
tar -czf "${BASENAME}-stripped.tar.gz" "${BASENAME}"

4
sources Normal file
View File

@ -0,0 +1,4 @@
SHA512 (icu4c-77_1-data-bin-b.zip) = 93b4c8228a059546e7c3e337f1f837db255c0046c15f50a31a7bd20daf361174edab05b01faaac1dd4f515ca3c1f1d7fb0f61e4177eb5631833ad1450e252c4e
SHA512 (icu4c-77_1-data-bin-l.zip) = 3de15bb5925956b8e51dc6724c2114a1009ec471a2241b09ae09127f1760f44d02cc29cfbeed6cbaac6ee880553ac8395c61c6043c00ddba3277233e19e6490e
SHA512 (node-v24.4.1-stripped.tar.gz) = 9da4e8f8b5c87d2ab7b826109dc18910b2c42fbc43058251b5488be1d34625896944a54800d995175aba698010a537eb60b22ec546edcfc53295343ad395fed8
SHA512 (packaging-scripts.tar.gz) = 5123c6fa3eb89e37a300914184eee10268568efc662a1c5b107900438b35e43c4222c4a31cf02b9d605c693f7e652420fdaf7209e41ba666ff428c3c0d340b7b

61
test-runner.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
NODE_BIN="$1"
PARENT_TEST_FOLDER="$2"
TEST_LIST_FILE="$3"
# At most 10 min per test
TIMEOUT_DURATION=600
# Exit code
FINAL_RESULT=0
ARCH=$(uname -m)
echo "Started test run:"
# Run the list of test
while IFS= read -r test_line; do
# ignore commented lines
if [[ "$test_line" =~ ^# ]]; then
continue
fi
# If test has specified ARCH which it should be skipped
# Extract it
TEST_PATH=$(echo "$test_line" | awk '{print $1}')
IGNORE_ARCHES=$(echo "$test_line" |\
awk '{for (i=2; i<=NF; i++) printf "%s ", $i; print ""}')
# Skip test for specified ARCH
for ARCH_IGNORE in $IGNORE_ARCHES; do
if [[ "$ARCH_IGNORE" == "$ARCH" ]]; then
echo "Skipping test, current arch is in ignore: $TEST_PATH ($ARCH_IGNORE)"
continue 2
fi
done
# Construct test path
TEST_SCRIPT="$PARENT_TEST_FOLDER/$TEST_PATH"
if [ ! -f "$TEST_SCRIPT" ]; then
echo "Test script not found: $TEST_SCRIPT"
continue
fi
TEST_OUTPUT=$(timeout "$TIMEOUT_DURATION" "$NODE_BIN" "$TEST_SCRIPT" 2>&1)
TEST_RESULT=$?
# Handle test result
if [ $TEST_RESULT -ne 0 ]; then
FINAL_RESULT=1
if [ $TEST_RESULT -eq 124 ]; then
echo "Test timed out: $TEST_SCRIPT"
else
echo "Test failed: $TEST_SCRIPT"
fi
echo "Test failure message:"
echo "$TEST_OUTPUT"
fi
done < "$TEST_LIST_FILE"
if [ $FINAL_RESULT -eq 0 ]; then
echo "All tests succesfully passed."
fi
exit $FINAL_RESULT

2749
test-should-pass.txt Normal file

File diff suppressed because it is too large Load Diff

9
v8.pc.in Normal file
View File

@ -0,0 +1,9 @@
prefix=@PREFIX@
includedir=@INCLUDEDIR@
libdir=@LIBDIR@
Name: @PKGCONFNAME@
Description: JavaScript Runtime
Version: @V8_VERSION@
Libs: -L${libdir} -lv8
Cflags: -I${includedir}