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

update node to 18.19.0 #47

Merged
merged 5 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
11 changes: 5 additions & 6 deletions Dockerfile.centos6 → Dockerfile.centos7
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
FROM centos:6

# add centos6 vault based repos
COPY centos6-repos/* /etc/yum.repos.d/
FROM centos:7

# use node 10 as it's guaranteed to run on CentOS6
RUN yum install -y centos-release-scl && \
yum install -y devtoolset-7 rh-python36 wget patch && \
yum-config-manager --enable rhel-server-rhscl-7-rpms && \
yum install -y devtoolset-8 python36 wget patch && \
wget -q https://nodejs.org/dist/v10.23.0/node-v10.23.0-linux-x64.tar.gz && \
tar -xf node-v10.23.0-linux-x64.tar.gz && \
rm node-v10.23.0-linux-x64.tar.gz && \
ln -s /node-v10.23.0-linux-x64/bin/node /bin/node && \
ln -s /node-v10.23.0-linux-x64/bin/npm /bin/npm

# before building using this container you need to enable the right slc toolchain ie
# source /opt/rh/devtoolset-7/enable && source /opt/rh/rh-python36/enable
# scl enable devtoolset-8 '<your-build-command-here>'
# or 'source /opt/rh/devtoolset-8/enable'

10 changes: 5 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ jobs:
linux_arm64:
imageName: 'ubuntu-20.04'
arch: 'linux/arm64'
node: '18.15.0'
node: '18.19.0'

linux_amd64:
imageName: 'ubuntu-20.04'
arch: 'linux/amd64'
node: '18.15.0'
node: '18.19.0'
ptrcompress: false

linux_amd64_ptrc:
imageName: 'ubuntu-20.04'
arch: 'linux/amd64'
node: '18.15.0'
node: '18.19.0'
ptrcompress: true

windows_2019:
imageName: 'windows-2019'
node: '18.15.0'
node: '18.19.0'
ptrcompress: false
windows_2019_ptrc:
imageName: 'windows-2019'
node: '18.15.0'
node: '18.19.0'
ptrcompress: true

# mac:
Expand Down
2 changes: 1 addition & 1 deletion build-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ fi
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx use js2bin-builder
docker buildx build -t "cribl/js2bin-builder:latest-nonx64" --platform linux/arm64/v8 --push -f Dockerfile.centos7.arm64 .
docker build -t "cribl/js2bin-builder:latest" -f Dockerfile.centos6 .
docker build -t "cribl/js2bin-builder:latest" -f Dockerfile.centos7 .
docker push "cribl/js2bin-builder:latest"
40 changes: 0 additions & 40 deletions centos6-repos/CentOS-Base.repo

This file was deleted.

33 changes: 0 additions & 33 deletions centos6-repos/CentOS-SCLo-scl-rh.repo

This file was deleted.

33 changes: 0 additions & 33 deletions centos6-repos/CentOS-SCLo-scl.repo

This file was deleted.

29 changes: 0 additions & 29 deletions centos6-repos/epel.repo

This file was deleted.

12 changes: 2 additions & 10 deletions src/NodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,9 @@ class NodeJsBuilder {
join(this.patchDir, 'push_registers_asm.cc.patch'));
}

async patchBugs() {
await patchFile(
this.nodePath('src', 'crypto', 'crypto_tls.cc'),
join(this.patchDir, 'crypto_tls.cc.patch')
);
}

async applyPatches() {
await this.patchThirdPartyMain();
await this.patchNodeCompileIssues();
await this.patchBugs();
}

printDiskUsage() {
Expand All @@ -245,7 +237,7 @@ class NodeJsBuilder {
'-v', `${process.cwd()}:/js2bin/`,
'-t', containerTag,
'/bin/bash', '-c',
`source /opt/rh/devtoolset-7/enable && source /opt/rh/rh-python36/enable && cd /js2bin && npm install && ./js2bin.js --ci --node=${this.version} --size=${this.placeHolderSizeMB}MB`
`source /opt/rh/devtoolset-8/enable && source /opt/rh/rh-python36/enable && cd /js2bin && npm install && ./js2bin.js --ci --node=${this.version} --size=${this.placeHolderSizeMB}MB`
]
);
}
Expand All @@ -272,7 +264,7 @@ class NodeJsBuilder {
const mod1 = path.join('lib', '_third_party_main.js');
const mod2 = path.join('lib', '_js2bin_app_main.js');
const makeArgs = isWindows ? ['x64', 'noetw', 'no-cctest', 'link-module', mod1, 'link-module', mod2] : [`-j${os.cpus().length}`];
const configArgs = ['--link-module', mod1, '--link-module', mod2];
const configArgs = [];
if(ptrCompression) {
if(isWindows) makeArgs.push('v8_ptr_compress');
else configArgs.push('--experimental-enable-pointer-compression');
Expand Down
17 changes: 17 additions & 0 deletions src/patch/18.19.0/node.cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- src/node.cc 2023-05-26 13:05:24.458396341 -0500
+++ src/node.cc 2023-05-26 13:06:12.179824998 -0500
@@ -312,6 +312,14 @@
return env->RunSnapshotDeserializeMain();
}

+ // To allow people to extend Node in different ways, this hook allows
+ // one to drop a file lib/_third_party_main.js into the build
+ // directory which will be executed instead of Node's normal loading.
+ if (env->builtin_loader()->Exists("_third_party_main")) {
+ return StartExecution(env, "internal/main/run_third_party_main");
+ }
+
+
if (env->worker_context() != nullptr) {
return StartExecution(env, "internal/main/worker_thread");
}
13 changes: 13 additions & 0 deletions src/patch/18.19.0/node.gyp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
disable building of cctest as it (a) it fails to build due to align_alloc and (b) it is just a waste of time

--- node.gyp 2023-01-13 00:09:28.917464091 -0800
+++ node.gyp 2023-01-13 00:09:21.165486651 -0800
@@ -1128,7 +1128,7 @@
}, # fuzz_env
{
'target_name': 'cctest',
- 'type': 'executable',
+ 'type': 'none',

'dependencies': [
'<(node_lib_target_name)',
39 changes: 39 additions & 0 deletions src/patch/18.19.0/node_credentials.cc.patch
ckulkarni-cribl marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From bd1a7be7eef7d3d9aa3aab7af0cb5efc6a980dd5 Mon Sep 17 00:00:00 2001
Reverts: https://github.com/nodejs/node/commit/bd1a7be7eef7d3d9aa3aab7af0cb5efc6a980dd5
avoids missing sys/auxv.h in centos6

--- a/src/node_credentials.cc
+++ b/src/node_credentials.cc
@@ -13,7 +13,13 @@
#endif
#ifdef __linux__
#include <linux/capability.h>
-#include <sys/auxv.h>
+#include <elf.h>
+#ifdef __LP64__
+#define Elf_auxv_t Elf64_auxv_t
+#else
+#define Elf_auxv_t Elf32_auxv_t
+#endif // __LP64__
+extern char** environ;
#include <sys/syscall.h>
#endif // __linux__

@@ -38,8 +44,15 @@
// and returns the correct value, e.g. even in static
// initialization code in other files.
#ifdef __linux__
- static const bool value = getauxval(AT_SECURE);
- return value;
+ char** envp = environ;
+ while (*envp++ != nullptr) {}
+ Elf_auxv_t* auxv = reinterpret_cast<Elf_auxv_t*>(envp);
+ for (; auxv->a_type != AT_NULL; auxv++) {
+ if (auxv->a_type == AT_SECURE) {
+ return auxv->a_un.a_val;
+ }
+ }
+ return false;
#else
return false;
#endif
17 changes: 17 additions & 0 deletions src/patch/18.19.0/run_third_party_main.js.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- /dev/null 2022-08-18 11:11:24.665352687 -0500
+++ lib/internal/main/run_third_party_main.js 2022-08-26 13:55:53.482283827 -0500
@@ -0,0 +1,14 @@
+'use strict';
+
+const {
+ prepareMainThreadExecution,
+ markBootstrapComplete
+} = require('internal/process/pre_execution');
+
+prepareMainThreadExecution();
+markBootstrapComplete();
+
+// Legacy _third_party_main.js support
+process.nextTick(() => {
+ require('_third_party_main');
+});