Skip to content

Commit

Permalink
Update to node22
Browse files Browse the repository at this point in the history
  • Loading branch information
prikolium-cfx committed Oct 30, 2024
1 parent c288eb4 commit 8154950
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 69 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
clang clang-dev clang-libs llvm13-dev lld
libc-dev musl musl-dev musl-dbg gcc g++
- name: Apply patches
- name: Apply all patches
shell: bash
working-directory: ./node
run: |
git apply --reject --whitespace=fix ../patches/enable_rtti.patch
git apply --reject --whitespace=fix ../patches/internal_modules.patch
git apply --reject --whitespace=fix ../patches/rename_output.patch
git apply --reject --whitespace=fix ../patches/version_suffix.patch
for f in ../patches/*.patch; do
echo "Applying $f..."
git apply --reject --whitespace=fix "$f"
done
- name: Build project
if: runner.os != 'Windows'
Expand All @@ -46,7 +46,7 @@ jobs:
run: |
export CC="clang"
export CXX="clang++"
export CXXFLAGS="-g -mssse3 -std=c++17"
export CXXFLAGS="-g -mssse3 -std=c++20"
export LDFLAGS="-m64 -lstdc++ -Wl,--build-id -fuse-ld=lld"
./configure --shared
make -j4
Expand All @@ -59,7 +59,7 @@ jobs:
if: runner.os == 'Windows'
shell: bash
working-directory: ./node
run: ./vcbuild.bat release x64 dll no-cctest
run: ./vcbuild.bat release x64 dll no-cctest clang-cl

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -80,10 +80,10 @@ jobs:
uses: softprops/action-gh-release@v2
with:
files: |
${{ github.workspace }}/libnode-Windows-x64/libnode20.dll
${{ github.workspace }}/libnode-Windows-x64/libnode20.lib
${{ github.workspace }}/libnode-Windows-x64/libnode20.pdb
${{ github.workspace }}/libnode-Linux-x64/libnode20.so
${{ github.workspace }}/libnode-Windows-x64/libnode22.dll
${{ github.workspace }}/libnode-Windows-x64/libnode22.lib
${{ github.workspace }}/libnode-Windows-x64/libnode22.pdb
${{ github.workspace }}/libnode-Linux-x64/libnode22.so
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v5
Expand Down
9 changes: 9 additions & 0 deletions build-windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off
pushd node

for %%f in (../patches/*.patch) do (
echo Applying %%f...
git apply --reject --whitespace=fix "../patches/%%f"
)

vcbuild.bat release x64 dll no-cctest clang-cl nonpm
2 changes: 1 addition & 1 deletion node
Submodule node updated 14694 files
21 changes: 21 additions & 0 deletions patches/build_vs_2022.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git forkSrcPrefix/vcbuild.bat forkDstPrefix/vcbuild.bat
index 428577c5c3d1e9ab55285d7d985fc06ec0ac1dd4..562588ade19d7688a5fd260a38b9ecff10a537bb 100644
--- forkSrcPrefix/vcbuild.bat
+++ forkDstPrefix/vcbuild.bat
@@ -283,11 +283,11 @@ goto exit

@rem Visual Studio v17.10 has a bug that causes the build to fail.
@rem Check if the version is v17.10 and exit if it is.
-echo %VSCMD_VER% | findstr /b /c:"17.10" >nul
-if %errorlevel% neq 1 (
- echo Node.js doesn't compile with Visual Studio 17.10 Please use a different version.
- goto exit
-)
+@rem echo %VSCMD_VER% | findstr /b /c:"17.10" >nul
+@rem if %errorlevel% neq 1 (
+@rem echo Node.js doesn't compile with Visual Studio 17.10 Please use a different version.
+@rem goto exit
+@rem )

@rem check if the clang-cl build is requested
if not defined clang_cl goto clang-skip
22 changes: 11 additions & 11 deletions patches/enable_rtti.patch
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
diff --git a/common.gypi b/common.gypi
index efcd8da848..946952d720 100644
--- a/common.gypi
+++ b/common.gypi
@@ -439,7 +439,7 @@
diff --git forkSrcPrefix/common.gypi forkDstPrefix/common.gypi
index 32a298414b5392f0d083f573f129fdc6dac85cfd..4bfda1278552aaf3364b2c9612e205040eb9e464 100644
--- forkSrcPrefix/common.gypi
+++ forkDstPrefix/common.gypi
@@ -489,7 +489,7 @@
}],
[ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
- 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ],
+ 'cflags_cc': [ '-fno-exceptions' ],
+ 'cflags_cc': [ '-fno-exceptions', '-std=gnu++20' ],
'defines': [ '__STDC_FORMAT_MACROS' ],
'ldflags': [ '-rdynamic' ],
'target_conditions': [
diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi
index c768d7a0f1..c40752b4b6 100644
--- a/tools/v8_gypfiles/features.gypi
+++ b/tools/v8_gypfiles/features.gypi
@@ -318,7 +318,8 @@
diff --git forkSrcPrefix/tools/v8_gypfiles/features.gypi forkDstPrefix/tools/v8_gypfiles/features.gypi
index 6e21dac6d70ede1f6dbd6a525fb9f111d6c2eb96..bbe0a0b033f1c48119a5e73874b8d17df9e292a9 100644
--- forkSrcPrefix/tools/v8_gypfiles/features.gypi
+++ forkDstPrefix/tools/v8_gypfiles/features.gypi
@@ -328,7 +328,8 @@

# Enable advanced BigInt algorithms, costing about 10-30 KiB binary size
# depending on platform.
Expand Down
13 changes: 13 additions & 0 deletions patches/fix_icu_embedding.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git forkSrcPrefix/deps/icu-small/source/tools/toolutil/pkg_genc.cpp forkDstPrefix/deps/icu-small/source/tools/toolutil/pkg_genc.cpp
index 741a8a5228ca6808ea486e765e8165e229cc73fb..f5c621ab151850ad5010df3ebb42f425ec0068c2 100644
--- forkSrcPrefix/deps/icu-small/source/tools/toolutil/pkg_genc.cpp
+++ forkDstPrefix/deps/icu-small/source/tools/toolutil/pkg_genc.cpp
@@ -847,7 +847,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char
# if defined(_M_IX86)
*pCPU = IMAGE_FILE_MACHINE_I386;
# else
- *pCPU = IMAGE_FILE_MACHINE_UNKNOWN;
+ *pCPU = IMAGE_FILE_MACHINE_AMD64;
# endif
# if defined(_M_IA64) || defined(_M_AMD64) || defined (_M_ARM64)
*pBits = 64; // Doesn't seem to be used for anything interesting though?
10 changes: 5 additions & 5 deletions patches/internal_modules.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/lib/internal/bootstrap/realm.js b/lib/internal/bootstrap/realm.js
index 9cb6a8add7..6090473d7d 100644
--- a/lib/internal/bootstrap/realm.js
+++ b/lib/internal/bootstrap/realm.js
@@ -209,12 +209,12 @@ const getOwn = (target, property, receiver) => {
diff --git forkSrcPrefix/lib/internal/bootstrap/realm.js forkDstPrefix/lib/internal/bootstrap/realm.js
index c11f70dd6bf3298ac848ab5c1bf225bbc7250201..975bf1b35e3d8e534bface618e2895b739424fc6 100644
--- forkSrcPrefix/lib/internal/bootstrap/realm.js
+++ forkDstPrefix/lib/internal/bootstrap/realm.js
@@ -210,12 +210,12 @@ const getOwn = (target, property, receiver) => {

const publicBuiltinIds = builtinIds
.filter((id) =>
Expand Down
75 changes: 39 additions & 36 deletions patches/rename_output.patch
Original file line number Diff line number Diff line change
@@ -1,76 +1,79 @@
diff --git a/node.gyp b/node.gyp
index 4aac64089c..8fa6ab3e81 100644
--- a/node.gyp
+++ b/node.gyp
@@ -25,7 +25,7 @@
'node_v8_options%': '',
'node_enable_v8_vtunejit%': 'false',
'node_core_target_name%': 'node',
- 'node_lib_target_name%': 'libnode',
+ 'node_lib_target_name%': 'libnode20',
'node_intermediate_lib_type%': 'static_library',
'node_builtin_modules_path%': '',
'linked_module_files': [

diff --git a/tools/install.py b/tools/install.py
index 17b0947aac..3e49ce2d74 100755
--- a/tools/install.py
+++ b/tools/install.py
diff --git forkSrcPrefix/tools/install.py forkDstPrefix/tools/install.py
index bf54249b66c0d4e179deaae5a9fd55568e694fe0..ca1ee80b0400a8c5bbf14b44a6eaa6e8666a7a49 100755
--- forkSrcPrefix/tools/install.py
+++ forkDstPrefix/tools/install.py
@@ -151,31 +151,31 @@ def files(options, action):

if 'true' == options.variables.get('node_shared'):
if options.is_win:
- action(options, [os.path.join(options.build_dir, 'libnode.dll')], 'bin/libnode.dll')
- action(options, [os.path.join(options.build_dir, 'libnode.lib')], 'lib/libnode.lib')
+ action(options, [os.path.join(options.build_dir, 'libnode20.dll')], 'bin/libnode20.dll')
+ action(options, [os.path.join(options.build_dir, 'libnode20.lib')], 'lib/libnode20.lib')
+ action(options, [os.path.join(options.build_dir, 'libnode22.dll')], 'bin/libnode22.dll')
+ action(options, [os.path.join(options.build_dir, 'libnode22.lib')], 'lib/libnode22.lib')
elif sys.platform == 'zos':
# GYP will output to lib.target; see _InstallableTargetInstallPath
# function in tools/gyp/pylib/gyp/generator/make.py
output_prefix = os.path.join(options.build_dir, 'lib.target')

- output_lib = 'libnode.' + options.variables.get('shlib_suffix')
+ output_lib = 'libnode20.' + options.variables.get('shlib_suffix')
+ output_lib = 'libnode22.' + options.variables.get('shlib_suffix')
action(options, [os.path.join(output_prefix, output_lib)], os.path.join('lib', output_lib))

- # create libnode.x that references libnode.so (C++ addons compat)
+ # create libnode20.x that references libnode20.so (C++ addons compat)
+ # create libnode22.x that references libnode22.so (C++ addons compat)
os.system(os.path.dirname(os.path.realpath(__file__)) +
'/zos/modifysidedeck.sh ' +
abspath(options.install_path, 'lib', output_lib) + ' ' +
- abspath(options.install_path, 'lib/libnode.x') + ' libnode.so')
+ abspath(options.install_path, 'lib/libnode20.x') + ' libnode20.so')
+ abspath(options.install_path, 'lib/libnode22.x') + ' libnode22.so')

- # install libnode.version.so
- so_name = 'libnode.' + re.sub(r'\.x$', '.so', options.variables.get('shlib_suffix'))
+ # install libnode20.version.so
+ so_name = 'libnode20.' + re.sub(r'\.x$', '.so', options.variables.get('shlib_suffix'))
+ # install libnode22.version.so
+ so_name = 'libnode22.' + re.sub(r'\.x$', '.so', options.variables.get('shlib_suffix'))
action(options, [os.path.join(output_prefix, so_name)], options.variables.get('libdir') + '/' + so_name)

- # create symlink of libnode.so -> libnode.version.so (C++ addons compat)
- link_path = abspath(options.install_path, 'lib/libnode.so')
+ # create symlink of libnode20.so -> libnode20.version.so (C++ addons compat)
+ link_path = abspath(options.install_path, 'lib/libnode20.so')
+ # create symlink of libnode22.so -> libnode22.version.so (C++ addons compat)
+ link_path = abspath(options.install_path, 'lib/libnode22.so')
try_symlink(options, so_name, link_path)
else:
- output_lib = 'libnode.' + options.variables.get('shlib_suffix')
+ output_lib = 'libnode20.' + options.variables.get('shlib_suffix')
+ output_lib = 'libnode22.' + options.variables.get('shlib_suffix')
action(options, [os.path.join(options.build_dir, output_lib)],
os.path.join(options.variables.get('libdir'), output_lib))


diff --git a/vcbuild.bat b/vcbuild.bat
index 75f0850b01..3baa17461f 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -451,8 +451,8 @@ if errorlevel 1 echo Cannot copy nodevars.bat && goto package_error
diff --git forkSrcPrefix/node.gyp forkDstPrefix/node.gyp
index 46baef1db3eacec9592296b583d76e3ffcf4de59..8f61828079ec06c3624f6ec83273f5144dfa2221 100644
--- forkSrcPrefix/node.gyp
+++ forkDstPrefix/node.gyp
@@ -27,7 +27,7 @@
'node_v8_options%': '',
'node_enable_v8_vtunejit%': 'false',
'node_core_target_name%': 'node',
- 'node_lib_target_name%': 'libnode',
+ 'node_lib_target_name%': 'libnode22',
'node_intermediate_lib_type%': 'static_library',
'node_builtin_modules_path%': '',
'linked_module_files': [
diff --git forkSrcPrefix/vcbuild.bat forkDstPrefix/vcbuild.bat
index 428577c5c3d1e9ab55285d7d985fc06ec0ac1dd4..002b7e6558265557ed1c76bb94f9695f7603180d 100644
--- forkSrcPrefix/vcbuild.bat
+++ forkDstPrefix/vcbuild.bat
@@ -458,11 +458,11 @@ if errorlevel 1 echo Cannot copy nodevars.bat && goto package_error
copy /Y ..\tools\msvs\install_tools\*.* %TARGET_NAME%\ > nul
if errorlevel 1 echo Cannot copy install_tools scripts && goto package_error
if defined dll (
- copy /Y libnode.dll %TARGET_NAME%\ > nul
- if errorlevel 1 echo Cannot copy libnode.dll && goto package_error
+ copy /Y libnode20.dll %TARGET_NAME%\ > nul
+ if errorlevel 1 echo Cannot copy libnode20.dll && goto package_error
+ copy /Y libnode22.dll %TARGET_NAME%\ > nul
+ if errorlevel 1 echo Cannot copy libnode22.dll && goto package_error

- copy /Y libnode.lib %TARGET_NAME%\ > nul
- if errorlevel 1 echo Cannot copy libnode.lib && goto package_error
+ copy /Y libnode22.lib %TARGET_NAME%\ > nul
+ if errorlevel 1 echo Cannot copy libnode22.lib && goto package_error

mkdir %TARGET_NAME%\Release > nul
copy /Y node.def %TARGET_NAME%\Release\ > nul
10 changes: 5 additions & 5 deletions patches/version_suffix.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/configure.py b/configure.py
index 00c8513d68..0794bab18e 100755
--- a/configure.py
+++ b/configure.py
@@ -1428,7 +1428,7 @@ def configure_node(o):
diff --git forkSrcPrefix/configure.py forkDstPrefix/configure.py
index 9c6c0a56ccac6d29d1085bcdf40740b7a85c584c..18dfea6f76ef3383ff44c905f62863c56612c5fe 100755
--- forkSrcPrefix/configure.py
+++ forkDstPrefix/configure.py
@@ -1555,7 +1555,7 @@ def configure_node(o):
elif sys.platform.startswith('zos'):
shlib_suffix = '%s.x'
else:
Expand Down

0 comments on commit 8154950

Please sign in to comment.