Skip to content

Commit

Permalink
Update to Node 20.18.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Jan 6, 2025
1 parent 9059b2c commit cb6423f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
21 changes: 11 additions & 10 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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]
}
7 changes: 4 additions & 3 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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': [
Expand Down
2 changes: 1 addition & 1 deletion node
Submodule node updated 8886 files

0 comments on commit cb6423f

Please sign in to comment.