build: [gn] use platform-appropriate shlib_suffix when building node
This commit is contained in:
parent
99ecbfbd3b
commit
d4cf3cee22
2 changed files with 17 additions and 6 deletions
|
@ -48,6 +48,19 @@ action("gyp_node") {
|
|||
"$target_out_dir/$node_configuration/build.ninja",
|
||||
]
|
||||
|
||||
# By default, node will build a dylib called something like
|
||||
# libnode.$node_module_version.dylib, which is inconvenient for our
|
||||
# purposes (since it makes the library's name unpredictable). This forces
|
||||
# it to drop the module_version from the filename and just produce
|
||||
# `libnode.dylib`.
|
||||
if (is_mac) {
|
||||
shlib_suffix = "dylib"
|
||||
} else if (is_win) {
|
||||
shlib_suffix = "dll"
|
||||
} else if (is_linux) {
|
||||
shlib_suffix = "so"
|
||||
}
|
||||
|
||||
args = [
|
||||
"-I", rebase_path("$target_gen_dir/config.gypi", root_build_dir),
|
||||
"-I", rebase_path("node_override.gypi", root_build_dir),
|
||||
|
@ -56,6 +69,9 @@ action("gyp_node") {
|
|||
"-D", "target_arch=$target_cpu",
|
||||
"-D", "host_arch=$host_cpu",
|
||||
"-D", "config_gypi=" + rebase_path("$target_gen_dir/config.gypi"),
|
||||
# This has _gn suffixed otherwise it gets overridden by a shlib_suffix
|
||||
# that's set in node's gyp files. Don't ask me 🤷
|
||||
"-D", "shlib_suffix_gn=" + shlib_suffix,
|
||||
"-Goutput_dir=./$target_out_dir", # bizarrely, gyp generates from the build root instead of from cwd
|
||||
"-fninja",
|
||||
rebase_path("//third_party/electron_node/node.gyp", root_build_dir),
|
||||
|
|
|
@ -4,12 +4,7 @@
|
|||
# that we're building v8 with icu, so force it on.
|
||||
'v8_enable_inspector': 1,
|
||||
|
||||
# By default, node will build a dylib called something like
|
||||
# libnode.$node_module_version.dylib, which is inconvenient for our
|
||||
# purposes (since it makes the library's name unpredictable). This forces
|
||||
# it to drop the module_version from the filename and just produce
|
||||
# `libnode.dylib`.
|
||||
'shlib_suffix': 'dylib',
|
||||
'shlib_suffix': '<(shlib_suffix_gn)',
|
||||
},
|
||||
'target_defaults': {
|
||||
'target_conditions': [
|
||||
|
|
Loading…
Reference in a new issue