Update to 12.18.4

This commit is contained in:
lingsheng 2020-11-19 10:05:26 +08:00
parent 90d88afb41
commit 6956179850
10 changed files with 139 additions and 282 deletions

View File

@ -1,30 +1,25 @@
From 7a6257be1d0276ff22d2d92ea89c5bca6c633802 Mon Sep 17 00:00:00 2001 From 0da4decd64a9cbfcf75b2697c722cd6fc82a164d Mon Sep 17 00:00:00 2001
From: Zuzana Svetlikova <zsvetlik@redhat.com> From: Zuzana Svetlikova <zsvetlik@redhat.com>
Date: Thu, 27 Apr 2017 14:25:42 +0200 Date: Fri, 17 Apr 2020 12:59:44 +0200
Subject: [PATCH 1/3] Disable running gyp on shared deps Subject: [PATCH] 0001
--- ---
Makefile | 7 +++---- Makefile | 2 +-
1 file changed, 3 insertions(+), 4 deletions(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile diff --git a/Makefile b/Makefile
index 316410e3f81e39cdddecf91d5b717c884a9c51b3..62c8ebb5b95a68e44d4c2ab3beee70d63c3175c7 100644 index 88166da2a8..f0637b6c78 100644
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -123,10 +123,9 @@ with-code-cache: @@ -141,7 +141,7 @@ test-code-cache: with-code-cache
test-code-cache: with-code-cache echo "'test-code-cache' target is a noop"
$(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 \ out/Makefile: config.gypi common.gypi node.gyp \
- deps/zlib/zlib.gyp deps/v8/gypfiles/toolchain.gypi \ - deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp \
- deps/v8/gypfiles/features.gypi deps/v8/gypfiles/v8.gyp node.gyp \ + deps/http_parser/http_parser.gyp \
- config.gypi tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
+out/Makefile: common.gypi deps/http_parser/http_parser.gyp \ tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.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 $(PYTHON) tools/gyp_node.py -f make
config.gypi: configure configure.py
-- --
2.24.1 2.25.2

View File

@ -1,7 +1,7 @@
From 8828c8fdc98f310a718a65ebc47d8a163e41b0cb Mon Sep 17 00:00:00 2001 From 11512edeb046b64be4daca76f061a3a918251ee0 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com> From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Tue, 19 Mar 2019 23:22:40 -0400 Date: Tue, 19 Mar 2019 23:22:40 -0400
Subject: [PATCH 2/3] Install both binaries and use libdir. Subject: [PATCH 2/2] Install both binaries and use libdir.
This allows us to build with a shared library for other users while This allows us to build with a shared library for other users while
still providing the normal executable. still providing the normal executable.
@ -13,10 +13,10 @@ Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
2 files changed, 20 insertions(+), 16 deletions(-) 2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/configure.py b/configure.py diff --git a/configure.py b/configure.py
index 22861a10eeac54cae69fc1be4b9aef7ed5106a35..48389fbdcb57cbf8d9c11d4921c65f34a1937cc7 100755 index 6537a62d3954d83927c698db3fb80c9fc05faba7..b9a894bec9e5fd954004bcb423822ca984066dc5 100755
--- a/configure.py --- a/configure.py
+++ b/configure.py +++ b/configure.py
@@ -552,6 +552,12 @@ parser.add_option('--shared', @@ -571,6 +571,12 @@ parser.add_option('--shared',
help='compile shared library for embedding node in another project. ' + help='compile shared library for embedding node in another project. ' +
'(This mode is not officially supported for regular applications)') '(This mode is not officially supported for regular applications)')
@ -29,19 +29,19 @@ index 22861a10eeac54cae69fc1be4b9aef7ed5106a35..48389fbdcb57cbf8d9c11d4921c65f34
parser.add_option('--without-v8-platform', parser.add_option('--without-v8-platform',
action='store_true', action='store_true',
dest='without_v8_platform', dest='without_v8_platform',
@@ -1095,6 +1101,7 @@ def configure_node(o): @@ -1105,6 +1111,7 @@ def configure_node(o):
if options.code_cache_path: o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
o['variables']['node_code_cache_path'] = options.code_cache_path
o['variables']['node_shared'] = b(options.shared) o['variables']['node_shared'] = b(options.shared)
+ o['variables']['libdir'] = options.libdir + o['variables']['libdir'] = options.libdir
node_module_version = getmoduleversion.get_version() node_module_version = getmoduleversion.get_version()
if sys.platform == 'darwin': if options.dest_os == 'android':
diff --git a/tools/install.py b/tools/install.py diff --git a/tools/install.py b/tools/install.py
index 028c32ecbbdf9625238dfcc2baef66df9408b539..bf443c4d15a3b3ebf1e10a5dd802e9c5999691e5 100755 index 655802980a6ea94d1d4ca1dc63c8c8e905fbb83a..fe4723bf15012c8aacacb0393dc8294c049b0503 100755
--- a/tools/install.py --- a/tools/install.py
+++ b/tools/install.py +++ b/tools/install.py
@@ -117,26 +117,23 @@ def subdir_files(path, dest, action): @@ -121,26 +121,23 @@ def subdir_files(path, dest, action):
def files(action): def files(action):
is_windows = sys.platform == 'win32' is_windows = sys.platform == 'win32'

View File

@ -0,0 +1,25 @@
From 7fddd1453f365e54b46f6564d5c168ed13e758db Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Wed, 18 Nov 2020 14:58:37 +0800
Subject: [PATCH] Modify openEuler aarch64 v8_os_page_size to 64
---
deps/v8/src/flags/flag-definitions.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/deps/v8/src/flags/flag-definitions.h b/deps/v8/src/flags/flag-definitions.h
index c7c07e6d..38a035e2 100644
--- a/deps/v8/src/flags/flag-definitions.h
+++ b/deps/v8/src/flags/flag-definitions.h
@@ -917,7 +917,7 @@ DEFINE_BOOL(memory_reducer_for_small_heaps, true,
"use memory reducer for small heaps")
DEFINE_INT(heap_growing_percent, 0,
"specifies heap growing factor as (1 + heap_growing_percent/100)")
-DEFINE_INT(v8_os_page_size, 0, "override OS page size (in KBytes)")
+DEFINE_INT(v8_os_page_size, 64, "override OS page size (in KBytes)")
DEFINE_BOOL(always_compact, false, "Perform compaction on every full GC")
DEFINE_BOOL(never_compact, false,
"Never perform compaction on full GC - testing only")
--
2.23.0

View File

@ -1,122 +0,0 @@
From 9ca4d4aeccf50e6c036e5536ef070a09c1776817 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Fri, 6 Dec 2019 16:40:25 -0500
Subject: [PATCH 3/3] 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 <sgallagh@redhat.com>
---
configure.py | 9 +++++++++
node.gypi | 7 +++++++
src/node.cc | 20 ++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/configure.py b/configure.py
index 48389fbdcb57cbf8d9c11d4921c65f34a1937cc7..063e8748b954a7fed4fe084399e61371c061edab 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',
@@ -1360,6 +1368,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 466a1746811cfac1a8ce4ef604ef1152c6229ff1..65b97d6466a14f4343a948a5fc36f8a2580badfb 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 7c0118758dfd9449283b900209b2ba8df7ddd129..c9840e3e367ca47176a17a7940a1e08eb1f56f78 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -92,6 +92,7 @@
#if defined(NODE_HAVE_I18N_SUPPORT)
#include <unicode/uvernum.h>
+#include <unicode/utypes.h>
#endif
#if defined(LEAK_SANITIZER)
@@ -2643,6 +2644,25 @@ void Init(std::vector<std::string>* 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.24.1

View File

@ -1,79 +0,0 @@
From 4cb8fa4aa5dea72bc66ea950e3fc193385bb7175 Mon Sep 17 00:00:00 2001
From: gaozhekang <gaozhekang@huawei.com>
Date: Wed, 4 Nov 2020 11:12:53 +0800
Subject: [PATCH] src: avoid OOB read in URL parser
This is not a big concern, because right now, all (non-test) inputs
to the parser are `'\0'`-terminated, but we should be future-proof
here and not perform these OOB reads.
---
src/node_url.cc | 6 +++---
test/cctest/test_url.cc | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/node_url.cc b/src/node_url.cc
index 7bfcde5..41492b1 100644
--- a/src/node_url.cc
+++ b/src/node_url.cc
@@ -1487,7 +1487,7 @@ void URL::Parse(const char* input,
state = kSpecialRelativeOrAuthority;
} else if (special) {
state = kSpecialAuthoritySlashes;
- } else if (p[1] == '/') {
+ } else if (p + 1 < end && p[1] == '/') {
state = kPathOrAuthority;
p++;
} else {
@@ -1547,7 +1547,7 @@ void URL::Parse(const char* input,
}
break;
case kSpecialRelativeOrAuthority:
- if (ch == '/' && p[1] == '/') {
+ if (ch == '/' && p + 1 < end && p[1] == '/') {
state = kSpecialAuthorityIgnoreSlashes;
p++;
} else {
@@ -1695,7 +1695,7 @@ void URL::Parse(const char* input,
break;
case kSpecialAuthoritySlashes:
state = kSpecialAuthorityIgnoreSlashes;
- if (ch == '/' && p[1] == '/') {
+ if (ch == '/' && p + 1 < end && p[1] == '/') {
p++;
} else {
continue;
diff --git a/test/cctest/test_url.cc b/test/cctest/test_url.cc
index ddef534..810cbc2 100644
--- a/test/cctest/test_url.cc
+++ b/test/cctest/test_url.cc
@@ -80,6 +80,26 @@ TEST_F(URLTest, Base3) {
EXPECT_EQ(simple.path(), "/baz");
}
+TEST_F(URLTest, TruncatedAfterProtocol) {
+ char input[2] = { 'q', ':' };
+ URL simple(input, sizeof(input));
+
+ EXPECT_FALSE(simple.flags() & URL_FLAGS_FAILED);
+ EXPECT_EQ(simple.protocol(), "q:");
+ EXPECT_EQ(simple.host(), "");
+ EXPECT_EQ(simple.path(), "/");
+}
+
+TEST_F(URLTest, TruncatedAfterProtocol2) {
+ char input[6] = { 'h', 't', 't', 'p', ':', '/' };
+ URL simple(input, sizeof(input));
+
+ EXPECT_TRUE(simple.flags() & URL_FLAGS_FAILED);
+ EXPECT_EQ(simple.protocol(), "http:");
+ EXPECT_EQ(simple.host(), "");
+ EXPECT_EQ(simple.path(), "");
+}
+
TEST_F(URLTest, ToFilePath) {
#define T(url, path) EXPECT_EQ(path, URL(url).ToFilePath())
T("http://example.org/foo/bar", "");
--
2.23.0

View File

@ -1,44 +1,50 @@
%bcond_with bootstrap %bcond_with bootstrap
%global baserelease 3 %global baserelease 1
%{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} %{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
%global nodejs_epoch 1 %global nodejs_epoch 1
%global nodejs_major 10 %global nodejs_major 12
%global nodejs_minor 21 %global nodejs_minor 18
%global nodejs_patch 0 %global nodejs_patch 4
%global nodejs_abi %{nodejs_major}.%{nodejs_minor} %global nodejs_abi %{nodejs_major}.%{nodejs_minor}
%global nodejs_soversion 64 %global nodejs_soversion 72
%global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch} %global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}
%global nodejs_release %{baserelease} %global nodejs_release %{baserelease}
%global nodejs_datadir %{_datarootdir}/nodejs %global nodejs_datadir %{_datarootdir}/nodejs
%global v8_epoch 1 %global v8_epoch 2
%global v8_major 6 %global v8_major 7
%global v8_minor 8 %global v8_minor 8
%global v8_build 275 %global v8_build 279
%global v8_patch 32 %global v8_patch 23
%global v8_abi %{v8_major}.%{v8_minor} %global v8_abi %{v8_major}.%{v8_minor}
%global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch} %global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch}
%global v8_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release} %global v8_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release}
%global c_ares_major 1 %global c_ares_major 1
%global c_ares_minor 15 %global c_ares_minor 16
%global c_ares_patch 0 %global c_ares_patch 0
%global c_ares_version %{c_ares_major}.%{c_ares_minor}.%{c_ares_patch} %global c_ares_version %{c_ares_major}.%{c_ares_minor}.%{c_ares_patch}
%global http_parser_major 2 %global http_parser_major 2
%global http_parser_minor 9 %global http_parser_minor 9
%global http_parser_patch 3 %global http_parser_patch 3
%global http_parser_version %{http_parser_major}.%{http_parser_minor}.%{http_parser_patch} %global http_parser_version %{http_parser_major}.%{http_parser_minor}.%{http_parser_patch}
%global llhttp_major 2
%global llhttp_minor 1
%global llhttp_patch 2
%global llhttp_version %{llhttp_major}.%{llhttp_minor}.%{llhttp_patch}
%global libuv_major 1 %global libuv_major 1
%global libuv_minor 34 %global libuv_minor 38
%global libuv_patch 2 %global libuv_patch 0
%global libuv_version %{libuv_major}.%{libuv_minor}.%{libuv_patch} %global libuv_version %{libuv_major}.%{libuv_minor}.%{libuv_patch}
%global nghttp2_major 1 %global nghttp2_major 1
%global nghttp2_minor 41 %global nghttp2_minor 41
%global nghttp2_patch 0 %global nghttp2_patch 0
%global nghttp2_version %{nghttp2_major}.%{nghttp2_minor}.%{nghttp2_patch} %global nghttp2_version %{nghttp2_major}.%{nghttp2_minor}.%{nghttp2_patch}
%global icu_major 64 %global icu_major 67
%global icu_minor 2 %global icu_minor 1
%global icu_version %{icu_major}.%{icu_minor} %global icu_version %{icu_major}.%{icu_minor}
%global icudatadir %{nodejs_datadir}/icudata %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
%global openssl_minimum 1:1.1.1
%global punycode_major 2 %global punycode_major 2
%global punycode_minor 1 %global punycode_minor 1
%global punycode_patch 0 %global punycode_patch 0
@ -46,18 +52,22 @@
%global npm_epoch 1 %global npm_epoch 1
%global npm_major 6 %global npm_major 6
%global npm_minor 14 %global npm_minor 14
%global npm_patch 4 %global npm_patch 6
%global npm_version %{npm_major}.%{npm_minor}.%{npm_patch} %global npm_version %{npm_major}.%{npm_minor}.%{npm_patch}
%global uvwasi_major 0
%global uvwasi_minor 0
%global uvwasi_patch 9
%global uvwasi_version %{uvwasi_major}.%{uvwasi_minor}.%{uvwasi_patch}
%global histogram_major 0
%global histogram_minor 9
%global histogram_patch 7
%global histogram_version %{histogram_major}.%{histogram_minor}.%{histogram_patch}
%global npm_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release} %global npm_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release}
%global brotli_major 1
%global brotli_minor 0
%global brotli_patch 7
%global brotli_version %{brotli_major}.%{brotli_minor}.%{brotli_patch}
Name: nodejs Name: nodejs
Epoch: %{nodejs_epoch} Epoch: %{nodejs_epoch}
Version: %{nodejs_version} Version: %{nodejs_version}
Release: %{nodejs_release} Release: %{nodejs_release}%{?dist}
Summary: JavaScript runtime Summary: JavaScript runtime
License: MIT and ASL 2.0 and ISC and BSD License: MIT and ASL 2.0 and ISC and BSD
Group: Development/Languages Group: Development/Languages
@ -69,13 +79,20 @@ Source2: btest402.js
Source3: https://github.com/unicode-org/icu/releases/download/release-%{icu_major}-%{icu_minor}/icu4c-%{icu_major}_%{icu_minor}-src.tgz Source3: https://github.com/unicode-org/icu/releases/download/release-%{icu_major}-%{icu_minor}/icu4c-%{icu_major}_%{icu_minor}-src.tgz
Source7: nodejs_native.attr Source7: nodejs_native.attr
Patch1: 0001-Disable-running-gyp-on-shared-deps.patch Patch0001: 0001-Disable-running-gyp-on-shared-deps.patch
Patch2: 0002-Install-both-binaries-and-use-libdir.patch Patch0002: 0002-Install-both-binaries-and-use-libdir.patch
Patch3: 0003-build-auto-load-ICU-data-from-with-icu-default-data-.patch %ifarch aarch64
Patch4: 0004-src-avoid-OOB-read-in-URL-parser.patch Patch0003: 0003-Modify-openEuler-aarch64-v8_os_page_size-to-64.patch
%endif
BuildRequires: python2-devel python3-devel zlib-devel gcc >= 6.3.0 BuildRequires: python3-devel
BuildRequires: gcc-c++ >= 6.3.0 nodejs-packaging chrpath libatomic BuildRequires: zlib-devel
BuildRequires: brotli-devel
BuildRequires: gcc >= 6.3.0
BuildRequires: gcc-c++ >= 6.3.0
BuildRequires: nodejs-packaging
BuildRequires: chrpath
BuildRequires: libatomic
%if %{with bootstrap} %if %{with bootstrap}
Provides: bundled(http-parser) = %{http_parser_version} Provides: bundled(http-parser) = %{http_parser_version}
@ -87,11 +104,12 @@ BuildRequires: libuv-devel >= 1:%{libuv_version}
Requires: libuv >= 1:%{libuv_version} Requires: libuv >= 1:%{libuv_version}
BuildRequires: libnghttp2-devel >= %{nghttp2_version} BuildRequires: libnghttp2-devel >= %{nghttp2_version}
Requires: libnghttp2 >= %{nghttp2_version} Requires: libnghttp2 >= %{nghttp2_version}
BuildRequires: http-parser-devel >= %{http_parser_version} Provides: bundled(http-parser) = %{http_parser_version}
Requires: http-parser >= %{http_parser_version} Provides: bundled(llhttp) = %{llhttp_version}
%endif %endif
BuildRequires: openssl-devel BuildRequires: openssl-devel >= %{openssl_minimum}
Requires: openssl >= %{openssl_minimum}
Requires: ca-certificates Requires: ca-certificates
Requires: nodejs-libs%{?_isa} = %{nodejs_epoch}:%{version}-%{release} Requires: nodejs-libs%{?_isa} = %{nodejs_epoch}:%{version}-%{release}
Recommends: nodejs-full-i18n%{?_isa} = %{nodejs_epoch}:%{version}-%{release} Recommends: nodejs-full-i18n%{?_isa} = %{nodejs_epoch}:%{version}-%{release}
@ -106,9 +124,10 @@ Provides: npm(punycode) = %{punycode_version}
Provides: bundled(c-ares) = %{c_ares_version} Provides: bundled(c-ares) = %{c_ares_version}
Provides: bundled(v8) = %{v8_version} Provides: bundled(v8) = %{v8_version}
Provides: bundled(icu) = %{icu_version} Provides: bundled(icu) = %{icu_version}
Provides: bundled(uvwasi) = %{uvwasi_version}
Provides: bundled(histogram) = %{histogram_version}
Requires: (nodejs-packaging if rpm-build) Requires: (nodejs-packaging if rpm-build)
Recommends: npm >= %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist} Recommends: npm >= %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist}
Provides: bundled(brotli) = %{brotli_version}
%description %description
Node.js is a platform built on Chrome's JavaScript runtime Node.js is a platform built on Chrome's JavaScript runtime
@ -128,7 +147,6 @@ Requires: nodejs-packaging
%if %{with bootstrap} %if %{with bootstrap}
%else %else
Requires: http-parser-devel%{?_isa}
Requires: libuv-devel%{?_isa} Requires: libuv-devel%{?_isa}
%endif %endif
@ -203,15 +221,15 @@ The API documentation for the Node.js JavaScript runtime.
%prep %prep
%autosetup -p1 -n node-v%{nodejs_version} %autosetup -p1 -n node-v%{nodejs_version}
rm -rf deps/zlib rm -rf deps/zlib
rm -rf deps/brotli
rm -rf deps/openssl rm -rf deps/openssl
pathfix.py -i %{__python2} -pn $(find -type f ! -name "*.js") pathfix.py -i %{__python3} -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\/env python~/usr/bin/python3~" {} \;
find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python2~" {} \; find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python3~" {} \;
sed -i "s~python~python2~" $(find . -type f | grep "gyp$") sed -i "s~python~python3~" $(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\/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 sed -i "s~usr\/bin\/python.*$~usr\/bin\/python3~" ./deps/v8/tools/mb/mb_unittest.py
find . -type f -exec sed -i "s~python -c~python2 -c~" {} \; find . -type f -exec sed -i "s~python -c~python3 -c~" {} \;
sed -i "s~which('python')~which('python2')~" configure
%build %build
%define _lto_cflags %{nil} %define _lto_cflags %{nil}
@ -238,23 +256,24 @@ export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')"
export LDFLAGS="%{build_ldflags}" export LDFLAGS="%{build_ldflags}"
%if %{with bootstrap} %if %{with bootstrap}
./configure --prefix=%{_prefix} \ %{__python3} configure.py --prefix=%{_prefix} \
--shared \ --shared \
--libdir=%{_lib} \ --libdir=%{_lib} \
--shared-openssl \ --shared-openssl \
--shared-zlib \ --shared-zlib \
--shared-brotli \
--without-dtrace \ --without-dtrace \
--with-intl=small-icu \ --with-intl=small-icu \
--debug-nghttp2 \ --debug-nghttp2 \
--openssl-use-def-ca-store --openssl-use-def-ca-store
%else %else
./configure --prefix=%{_prefix} \ %{__python3} configure.py --prefix=%{_prefix} \
--shared \ --shared \
--libdir=%{_lib} \ --libdir=%{_lib} \
--shared-openssl \ --shared-openssl \
--shared-zlib \ --shared-zlib \
--shared-brotli \
--shared-libuv \ --shared-libuv \
--shared-http-parser \
--shared-nghttp2 \ --shared-nghttp2 \
--with-dtrace \ --with-dtrace \
--with-intl=small-icu \ --with-intl=small-icu \
@ -264,8 +283,10 @@ export LDFLAGS="%{build_ldflags}"
%endif %endif
make BUILDTYPE=Release %{?_smp_mflags} make BUILDTYPE=Release %{?_smp_mflags}
pushd deps/ pushd deps/
tar xfz %SOURCE3 tar xfz %SOURCE3
pushd icu/source pushd icu/source
mkdir -p converted mkdir -p converted
%if 0%{?little_endian} %if 0%{?little_endian}
@ -279,15 +300,18 @@ LD_LIBRARY_PATH=./lib ./bin/icupkg -tb data/in/icudt%{icu_major}l.dat \
converted/icudt%{icu_major}b.dat converted/icudt%{icu_major}b.dat
%endif %endif
popd # icu/source popd
popd # deps popd
%install %install
rm -rf %{buildroot} rm -rf %{buildroot}
./tools/install.py install %{buildroot} %{_prefix} ./tools/install.py install %{buildroot} %{_prefix}
chmod 0755 %{buildroot}/%{_bindir}/node chmod 0755 %{buildroot}/%{_bindir}/node
chrpath --delete %{buildroot}%{_bindir}/node chrpath --delete %{buildroot}%{_bindir}/node
ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/libnode.so ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/libnode.so
for header in %{buildroot}%{_includedir}/node/libplatform %{buildroot}%{_includedir}/node/v8*.h; do for header in %{buildroot}%{_includedir}/node/libplatform %{buildroot}%{_includedir}/node/v8*.h; do
header=$(basename ${header}) header=$(basename ${header})
ln -s %{_includedir}/node/${header} %{buildroot}%{_includedir}/${header} ln -s %{_includedir}/node/${header} %{buildroot}%{_includedir}/${header}
@ -296,7 +320,9 @@ for soname in libv8 libv8_libbase libv8_libplatform; do
ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so
ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major} ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major}
done done
mkdir -p %{buildroot}%{_prefix}/lib/node_modules mkdir -p %{buildroot}%{_prefix}/lib/node_modules
install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr
cat << EOF > %{buildroot}%{_rpmconfigdir}/nodejs_native.req cat << EOF > %{buildroot}%{_rpmconfigdir}/nodejs_native.req
#!/bin/sh #!/bin/sh
@ -304,49 +330,56 @@ echo 'nodejs(abi%{nodejs_major}) >= %nodejs_abi'
echo 'nodejs(v8-abi%{v8_major}) >= %v8_abi' echo 'nodejs(v8-abi%{v8_major}) >= %v8_abi'
EOF EOF
chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req
mkdir -p %{buildroot}%{_pkgdocdir}/html mkdir -p %{buildroot}%{_pkgdocdir}/html
cp -pr doc/* %{buildroot}%{_pkgdocdir}/html cp -pr doc/* %{buildroot}%{_pkgdocdir}/html
rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1 rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1
mkdir -p %{buildroot}%{_datadir}/node mkdir -p %{buildroot}%{_datadir}/node
cp -p common.gypi %{buildroot}%{_datadir}/node cp -p common.gypi %{buildroot}%{_datadir}/node
mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit
mkdir -p %{buildroot}%{_mandir} \ mkdir -p %{buildroot}%{_mandir} \
%{buildroot}%{_pkgdocdir}/npm %{buildroot}%{_pkgdocdir}/npm
cp -pr deps/npm/man/* %{buildroot}%{_mandir}/ cp -pr deps/npm/man/* %{buildroot}%{_mandir}/
rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man
ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man
cp -pr deps/npm/docs %{buildroot}%{_pkgdocdir}/npm/ cp -pr deps/npm/docs %{buildroot}%{_pkgdocdir}/npm/
rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/docs rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/docs
ln -sf %{_pkgdocdir}/npm %{buildroot}%{_prefix}/lib/node_modules/npm/docs ln -sf %{_pkgdocdir}/npm %{buildroot}%{_prefix}/lib/node_modules/npm/docs
rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py \ rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py \
%{buildroot}/%{_defaultdocdir}/node/lldbinit %{buildroot}/%{_defaultdocdir}/node/lldbinit
find %{buildroot}%{_prefix}/lib/node_modules/npm \ find %{buildroot}%{_prefix}/lib/node_modules/npm \
-not -path "%{buildroot}%{_prefix}/lib/node_modules/npm/bin/*" \ -not -path "%{buildroot}%{_prefix}/lib/node_modules/npm/bin/*" \
-executable -type f \ -executable -type f \
-exec chmod -x {} \; -exec chmod -x {} \;
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/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}%{_prefix}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
mkdir -p %{buildroot}%{_sysconfdir} mkdir -p %{buildroot}%{_sysconfdir}
cp %{SOURCE1} %{buildroot}%{_sysconfdir}/npmrc cp %{SOURCE1} %{buildroot}%{_sysconfdir}/npmrc
mkdir -p %{buildroot}%{_prefix}/etc mkdir -p %{buildroot}%{_prefix}/etc
ln -s %{_sysconfdir}/npmrc %{buildroot}%{_prefix}/etc/npmrc ln -s %{_sysconfdir}/npmrc %{buildroot}%{_prefix}/etc/npmrc
install -Dpm0644 -t %{buildroot}%{icudatadir} deps/icu/source/converted/* install -Dpm0644 -t %{buildroot}%{icudatadir} deps/icu/source/converted/*
%check %check
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')" LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')"
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')" LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')"
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')" LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')"
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')" LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')"
NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')" NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')"
NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node --icu-data-dir=%{buildroot}%{icudatadir} %{SOURCE2} NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node --icu-data-dir=%{buildroot}%{icudatadir} %{SOURCE2}
%pretrans -n npm -p <lua> %pretrans -n npm -p <lua>
-- Replace the npm man directory with a symlink
-- Drop this scriptlet when F31 is EOL
path = "%{_prefix}/lib/node_modules/npm/man" path = "%{_prefix}/lib/node_modules/npm/man"
st = posix.stat(path) st = posix.stat(path)
if st and st.type == "directory" then if st and st.type == "directory" then
@ -362,8 +395,6 @@ if st and st.type == "directory" then
end end
%pretrans -n v8-devel -p <lua> %pretrans -n v8-devel -p <lua>
-- Replace the v8 libplatform include directory with a symlink
-- Drop this scriptlet when F30 is EOL
path = "%{_includedir}/libplatform" path = "%{_includedir}/libplatform"
st = posix.stat(path) st = posix.stat(path)
if st and st.type == "directory" then if st and st.type == "directory" then
@ -394,7 +425,7 @@ end
%{_rpmconfigdir}/fileattrs/nodejs_native.attr %{_rpmconfigdir}/fileattrs/nodejs_native.attr
%{_rpmconfigdir}/nodejs_native.req %{_rpmconfigdir}/nodejs_native.req
%doc AUTHORS CHANGELOG.md COLLABORATOR_GUIDE.md GOVERNANCE.md README.md %doc AUTHORS CHANGELOG.md onboarding.md GOVERNANCE.md README.md
%doc %{_mandir}/man1/node.1* %doc %{_mandir}/man1/node.1*
%files devel %files devel
@ -454,8 +485,10 @@ end
%{_pkgdocdir}/html %{_pkgdocdir}/html
%{_pkgdocdir}/npm/docs %{_pkgdocdir}/npm/docs
%changelog %changelog
* Wed Nov 18 2020 lingsheng <lingsheng@huawei.com> - 1:12.18.4-1
- Update to 12.18.4
* Tue Nov 17 2020 lingsheng <lingsheng@huawei.com> - 1:10.21.0-3 * Tue Nov 17 2020 lingsheng <lingsheng@huawei.com> - 1:10.21.0-3
- Fix nodejs release version - Fix nodejs release version

4
nodejs.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: nodejs/node
tag_prefix: "^v"
separator: "."

1
npmrc
View File

@ -1 +1,2 @@
prefix=/usr/local prefix=/usr/local
python=/usr/bin/python3