From cb6423f10f5eef741f3b18d5cbbacfc235a0bad8 Mon Sep 17 00:00:00 2001 From: Cheng Date: Mon, 6 Jan 2025 11:12:34 +0900 Subject: [PATCH] Update to Node 20.18.1 --- build.mjs | 21 +++++++++++---------- common.gypi | 7 ++++--- node | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/build.mjs b/build.mjs index d26ae59..08340fa 100755 --- a/build.mjs +++ b/build.mjs @@ -92,17 +92,23 @@ if (process.platform == 'darwin') { const SDKROOT = sdks.stdout.match(/-sdk (macosx\d+\.\d+)/)[1] config.xcode_settings = {SDKROOT} } +// Copy fields from config.gypi of node. +const configGypiPath = fs.readFileSync(path.join(__dirname, 'node', 'config.gypi')).toString() +const configGypi = JSON.parse(configGypiPath.split('\n').slice(1).join('\n').replace(/'/g, '"')) +for (const key of ['clang', 'node_builtin_shareable_builtins']) { + config.variables[key] = configGypi.variables[key] +} // Read node_library_files from config.gypi. -config.variables.node_library_files = readNodeConfigFiles('node_library_files').map(l => 'node/' + l) -config.variables.node_builtin_shareable_builtins = readNodeConfigFiles('node_builtin_shareable_builtins') -fs.writeFileSync(path.join(__dirname, 'config.gypi'), JSON.stringify(config, null, ' ')) +config.variables.node_library_files = configGypi.variables.node_library_files.map(l => 'node/' + l) +fs.writeFileSync(`${__dirname}/config.gypi`, JSON.stringify(config, null, ' ')) await $`${python} node/tools/gyp/gyp_main.py yode.gyp --no-parallel -f ninja -Dbuild_type=${buildType} -Iconfig.gypi -Icommon.gypi --depth .` // Build. -process.env.PATH = `${path.join('deps', 'ninja')}${path.delimiter}${process.env.PATH}` +const ninja = process.platform == 'win32' ? 'deps/ninja/ninja.exe' + : 'deps/ninja/ninja' const jobs = argv.j ?? os.cpus().length -await $`ninja -j ${jobs} -C out/${buildType} yode` +await $`${ninja} -j ${jobs} -C out/${buildType} yode` if (process.platform == 'linux') await $`strip out/${buildType}/yode` @@ -123,8 +129,3 @@ zip.addFile('node/LICENSE', 'LICENSE') zip.addFile(`out/${buildType}/${filename}`, filename) zip.outputStream.pipe(fs.createWriteStream(`out/${buildType}/${distname}`)) zip.end() - -function readNodeConfigFiles(key) { - const config_gypi = fs.readFileSync(path.join(__dirname, 'node', 'config.gypi')).toString() - return JSON.parse(config_gypi.split('\n').slice(1).join('\n').replace(/'/g, '"')).variables[key] -} diff --git a/common.gypi b/common.gypi index 898e692..d263a9b 100644 --- a/common.gypi +++ b/common.gypi @@ -51,6 +51,7 @@ 'node_with_ltcg': 'false', 'node_report': 'false', 'node_use_node_code_cache': 'false', + 'node_write_snapshot_as_array_literals': 'false', 'uv_library': 'static_library', 'uv_parent_path': 'node/deps/uv', 'uv_use_dtrace': 'false', @@ -73,15 +74,15 @@ 'v8_random_seed': 0, 'v8_trace_maps': 0, 'v8_use_siphash': 1, - 'icu_data_file': 'icudt73l.dat', - 'icu_data_in': '../../deps/icu-tmp/icudt73l.dat', + 'icu_data_file': 'icudt75l.dat', + 'icu_data_in': '../../deps/icu-tmp/icudt75l.dat', 'icu_default_data': '', 'icu_endianness': 'l', 'icu_gyp_path': 'node/tools/icu/icu-generic.gyp', 'icu_locales': 'en,root', 'icu_path': '../../deps/icu-small', 'icu_small': 'true', - 'icu_ver_major': '73', + 'icu_ver_major': '75', }, 'target_defaults': { 'includes': [ diff --git a/node b/node index 53926c7..6372b05 160000 --- a/node +++ b/node @@ -1 +1 @@ -Subproject commit 53926c7677cdfe25b874f79112f32e6f9e9770e9 +Subproject commit 6372b0551929196e3d7dca615fa4a680932a0326