Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: node 20.14.0 #37

Merged
merged 23 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
linux-x64:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
fail-fast: false
Expand Down
32 changes: 18 additions & 14 deletions Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
FROM oraclelinux:7 AS build
FROM oraclelinux:8 AS build

USER root:root
WORKDIR /root/pkg-fetch/

RUN yum install -y oracle-softwarecollection-release-el7
# Install required tools and enable the necessary repositories
RUN dnf install -y oracle-epel-release-el8 oraclelinux-developer-release-el8

RUN yum-config-manager --enable ol7_latest ol7_optional_latest software_collections
RUN yum upgrade -y
# Enable the developer repo for devtoolset and python36
RUN dnf config-manager --enable ol8_UEKR6 ol8_addons ol8_developer ol8_developer_EPEL

RUN yum install -y \
devtoolset-10 glibc-headers kernel-headers \
# Upgrade all packages
RUN dnf upgrade -y

# Install the necessary development tools and packages
RUN dnf install -y \
gcc-toolset-10 glibc-headers kernel-headers \
make patch python2 \
rh-python36-python
python3

RUN curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -
RUN yum install -y nodejs
# Install Node.js 20 and yarn
RUN curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
RUN dnf install -y nodejs
RUN npm install -g yarn

COPY . ./
Expand All @@ -23,10 +29,8 @@ ARG PKG_FETCH_OPTION_n

RUN yarn install --ignore-engines

RUN scl enable devtoolset-10 rh-python36 \
" \
yarn start --node-range $PKG_FETCH_OPTION_n --output dist \
"
RUN source /opt/rh/gcc-toolset-10/enable && \
yarn start --node-range $PKG_FETCH_OPTION_n --output dist

FROM scratch
COPY --from=build /root/pkg-fetch/dist /
COPY --from=build /root/pkg-fetch/dist /
20 changes: 11 additions & 9 deletions Dockerfile.linuxcross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:bionic AS build
FROM ubuntu:focal AS build

USER root:root
WORKDIR /root/pkg-fetch/
Expand All @@ -7,26 +7,28 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y curl software-properties-common ca-certificates gnupg

# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
# Install Node.js 20
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs

RUN apt-get install -y binutils g++-8 git make patch python3 python3-distutils
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update && \
apt-get install -y binutils g++-10 git make patch python3 python3-distutils

ARG TARGET_TOOLCHAIN_ARCH

RUN [ `uname -m` = ${TARGET_TOOLCHAIN_ARCH} ] || \
apt-get install -y binutils-${TARGET_TOOLCHAIN_ARCH}-linux-gnu g++-8-${TARGET_TOOLCHAIN_ARCH}-linux-gnu
apt-get install -y binutils-${TARGET_TOOLCHAIN_ARCH}-linux-gnu g++-10-${TARGET_TOOLCHAIN_ARCH}-linux-gnu

ENV CC=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-gcc-8
ENV CXX=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-g++-8
ENV CC=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-gcc-10
ENV CXX=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-g++-10
ENV AR=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-ar
ENV NM=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-nm
ENV RANLIB=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-ranlib
ENV READELF=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-readelf
ENV STRIP=${TARGET_TOOLCHAIN_ARCH}-linux-gnu-strip
ENV CC_host=gcc-8
ENV CXX_host=g++-8
ENV CC_host=gcc-10
ENV CXX_host=g++-10
ENV AR_host=ar
ENV NM_host=nm
ENV RANLIB_host=ranlib
Expand Down
15 changes: 0 additions & 15 deletions patches/node.v18.20.2.cpp.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ index 82916748fd..59575698b5 100755
o['variables']['arm_fpu'] = options.arm_fpu or 'neon'

if options.node_snapshot_main is not None:
diff --git node/deps/cares/config/linux/ares_config.h node/deps/cares/config/linux/ares_config.h
index 3cb135a35c..131ad80f2a 100644
--- node/deps/cares/config/linux/ares_config.h
+++ node/deps/cares/config/linux/ares_config.h
@@ -329,7 +329,9 @@
#define HAVE_SYS_PARAM_H 1

/* Define to 1 if you have the <sys/random.h> header file. */
-#define HAVE_SYS_RANDOM_H 1
+/* Fixes https://github.com/yao-pkg/pkg-fetch/pull/35#issuecomment-2165554043 */
+// #define HAVE_SYS_RANDOM_H 1
+#undef HAVE_SYS_RANDOM_H

/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
index 3d59c73f7c..00b2de4524 100644
--- node/deps/v8/include/v8-initialization.h
Expand Down
66 changes: 27 additions & 39 deletions patches/node.v20.11.1.cpp.patch → patches/node.v20.14.0.cpp.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git node/common.gypi node/common.gypi
index db09a8a33d..6b2053467d 100644
index 0af8af37c6..604a28c3cf 100644
--- node/common.gypi
+++ node/common.gypi
@@ -182,7 +182,7 @@
@@ -183,7 +183,7 @@
'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
}],
['llvm_version=="0.0"', {
Expand All @@ -11,18 +11,6 @@ index db09a8a33d..6b2053467d 100644
}, {
'lto': ' -flto ', # Clang
}],
diff --git node/configure.py node/configure.py
index 84b016cd85..3b31b09f04 100755
--- node/configure.py
+++ node/configure.py
@@ -1275,7 +1275,6 @@ def configure_node(o):

# Enable branch protection for arm64
if target_arch == 'arm64':
- o['cflags']+=['-msign-return-address=all']
o['variables']['arm_fpu'] = options.arm_fpu or 'neon'

if options.node_snapshot_main is not None:
diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
index d3e35d6ec5..6e9bbe3849 100644
--- node/deps/v8/include/v8-initialization.h
Expand All @@ -39,7 +27,7 @@ index d3e35d6ec5..6e9bbe3849 100644
static const char* GetVersion();

diff --git node/deps/v8/src/api/api.cc node/deps/v8/src/api/api.cc
index a91dfc271c..a4cd4eeb31 100644
index a06394e6c1..154b7a82a8 100644
--- node/deps/v8/src/api/api.cc
+++ node/deps/v8/src/api/api.cc
@@ -806,6 +806,28 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
Expand Down Expand Up @@ -164,7 +152,7 @@ index c83e8e4581..8cb451e147 100644
uint32_t max_payload_length = this->size_ - kHeaderSize;
if (payload_length > max_payload_length) {
diff --git node/lib/child_process.js node/lib/child_process.js
index 449013906e..3a85e4a541 100644
index c09fca5125..ebf8b443f8 100644
--- node/lib/child_process.js
+++ node/lib/child_process.js
@@ -169,7 +169,7 @@ function fork(modulePath, args = [], options) {
Expand Down Expand Up @@ -232,10 +220,10 @@ index 0000000000..a697294fdf
+ }());
+}());
diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
index b077ee386b..b4271b5951 100644
index 7bbd59e163..1a4acdb11b 100644
--- node/lib/internal/modules/cjs/loader.js
+++ node/lib/internal/modules/cjs/loader.js
@@ -95,7 +95,7 @@ const { containsModuleSyntax } = internalBinding('contextify');
@@ -102,7 +102,7 @@ const {
const assert = require('internal/assert');
const fs = require('fs');
const path = require('path');
Expand All @@ -258,10 +246,10 @@ index 88c079d10d..a7eaca0574 100644
const permission = require('internal/process/permission');
const { kEmptyObject } = require('internal/util');
diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
index cffffc28d3..679b9c3939 100644
index 16e291484b..9c998f3409 100644
--- node/lib/internal/process/pre_execution.js
+++ node/lib/internal/process/pre_execution.js
@@ -52,7 +52,11 @@ const {
@@ -50,7 +50,11 @@ const {
},
} = require('internal/v8/startup_snapshot');

Expand All @@ -273,7 +261,7 @@ index cffffc28d3..679b9c3939 100644
return prepareExecution({
expandArgv1,
initializeModules,
@@ -231,7 +235,8 @@ function patchProcessObject(expandArgv1) {
@@ -242,7 +246,8 @@ function patchProcessObject(expandArgv1) {
// If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
// the entry point.
if (expandArgv1 && process.argv[1] &&
Expand All @@ -283,7 +271,7 @@ index cffffc28d3..679b9c3939 100644
// Expand process.argv[1] into a full path.
const path = require('path');
try {
@@ -747,6 +752,7 @@ function loadPreloadModules() {
@@ -722,6 +727,7 @@ function loadPreloadModules() {
// For user code, we preload modules if `-r` is passed
const preloadModules = getOptionValue('--require');
if (preloadModules && preloadModules.length > 0) {
Expand All @@ -292,18 +280,18 @@ index cffffc28d3..679b9c3939 100644
Module: {
_preloadModules,
diff --git node/lib/vm.js node/lib/vm.js
index 44861be46d..9775ef58b7 100644
index 34814c430d..db1f4779b6 100644
--- node/lib/vm.js
+++ node/lib/vm.js
@@ -80,6 +80,7 @@ class Script extends ContextifyScript {
@@ -97,6 +97,7 @@ class Script extends ContextifyScript {
produceCachedData = false,
importModuleDynamically,
[kParsingContext]: parsingContext,
+ sourceless = false,
} = options;

validateString(filename, 'options.filename');
@@ -103,7 +104,8 @@ class Script extends ContextifyScript {
@@ -120,7 +121,8 @@ class Script extends ContextifyScript {
cachedData,
produceCachedData,
parsingContext,
Expand All @@ -314,10 +302,10 @@ index 44861be46d..9775ef58b7 100644
throw e; /* node-do-not-add-exception-line */
}
diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
index de372400fd..2538afa37d 100644
index 63c8ae14ab..0007b5adcd 100644
--- node/src/inspector_agent.cc
+++ node/src/inspector_agent.cc
@@ -707,8 +707,6 @@ bool Agent::Start(const std::string& path,
@@ -717,8 +717,6 @@ bool Agent::Start(const std::string& path,
StartIoThreadAsyncCallback));
uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
start_io_thread_async.data = this;
Expand All @@ -327,10 +315,10 @@ index de372400fd..2538afa37d 100644
parent_env_->AddCleanupHook([](void* data) {
Environment* env = static_cast<Environment*>(data);
diff --git node/src/node.cc node/src/node.cc
index 524f80ee69..419cb95c4c 100644
index 3e4f1b5d73..754138b5b2 100644
--- node/src/node.cc
+++ node/src/node.cc
@@ -322,6 +322,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
@@ -367,6 +367,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
return env->RunSnapshotDeserializeMain();
}

Expand All @@ -339,7 +327,7 @@ index 524f80ee69..419cb95c4c 100644
if (env->worker_context() != nullptr) {
return StartExecution(env, "internal/main/worker_thread");
}
@@ -543,14 +545,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
@@ -588,14 +590,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
}

if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
Expand All @@ -355,18 +343,18 @@ index 524f80ee69..419cb95c4c 100644
}

diff --git node/src/node_contextify.cc node/src/node_contextify.cc
index a68f6bb686..eab5eb9b8b 100644
index ca8575e9a2..c41a935453 100644
--- node/src/node_contextify.cc
+++ node/src/node_contextify.cc
@@ -75,6 +75,7 @@ using v8::String;
@@ -76,6 +76,7 @@ using v8::String;
using v8::Symbol;
using v8::Uint32;
using v8::UnboundScript;
+using v8::V8;
using v8::Value;
using v8::WeakCallbackInfo;

@@ -798,13 +799,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -789,13 +790,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
Local<ArrayBufferView> cached_data_buf;
bool produce_cached_data = false;
Local<Context> parsing_context = context;
Expand All @@ -383,7 +371,7 @@ index a68f6bb686..eab5eb9b8b 100644
CHECK(args[2]->IsNumber());
line_offset = args[2].As<Int32>()->Value();
CHECK(args[3]->IsNumber());
@@ -825,6 +827,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -816,6 +818,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
}
CHECK(args[7]->IsSymbol());
id_symbol = args[7].As<Symbol>();
Expand All @@ -394,7 +382,7 @@ index a68f6bb686..eab5eb9b8b 100644
}

ContextifyScript* contextify_script =
@@ -873,6 +879,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -864,6 +870,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
Context::Scope scope(parsing_context);

Expand All @@ -405,7 +393,7 @@ index a68f6bb686..eab5eb9b8b 100644
MaybeLocal<UnboundScript> maybe_v8_script =
ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);

@@ -887,6 +897,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -878,6 +888,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
return;
}

Expand All @@ -417,7 +405,7 @@ index a68f6bb686..eab5eb9b8b 100644
contextify_script->script_.Reset(isolate, v8_script);
contextify_script->script_.SetWeak();
contextify_script->object()->SetInternalFieldForNodeCore(kUnboundScriptSlot,
@@ -920,6 +935,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -911,6 +926,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
.IsNothing())
return;

Expand Down Expand Up @@ -539,10 +527,10 @@ index f66099a557..4048f6bd93 100644
+ return adjacent(c, nargv);
+}
diff --git node/src/node_options.cc node/src/node_options.cc
index 5da6918af8..56c793ba96 100644
index 937ce44696..0319bbcfbf 100644
--- node/src/node_options.cc
+++ node/src/node_options.cc
@@ -302,6 +302,7 @@ void Parse(
@@ -305,6 +305,7 @@ void Parse(
// TODO(addaleax): Make that unnecessary.

DebugOptionsParser::DebugOptionsParser() {
Expand Down
2 changes: 1 addition & 1 deletion patches/patches.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"v20.11.1": ["node.v20.11.1.cpp.patch"],
"v20.14.0": ["node.v20.14.0.cpp.patch"],
"v18.20.2": ["node.v18.20.2.cpp.patch"],
"v16.20.2": ["node.v16.20.2.cpp.patch"],
"v14.21.3": ["node.v14.21.3.cpp.patch"],
Expand Down