electron/build/node/BUILD.gn

114 lines
3 KiB
Text
Raw Normal View History

2018-05-15 16:31:13 +00:00
action("configure_node") {
script = "//third_party/electron_node/configure"
args = [
"--enable-static",
"--release-urlbase=https://atom.io/download/electron",
"--shared",
"--shared-openssl",
"--shared-openssl-includes=" + rebase_path("//third_party/boringssl/src/include"),
"--shared-openssl-libname=boringssl",
"--shared-openssl-libpath=" + rebase_path(root_out_dir),
2018-05-15 16:31:13 +00:00
"--without-npm",
"--without-bundled-v8",
"--without-dtrace",
"--without-etw",
"--without-perfctr",
"--without-v8-platform",
"--without-intl",
"--prefix=",
"--config-out-dir=" + rebase_path(target_gen_dir),
"--no-run-gyp",
]
outputs = [
"$target_gen_dir/config.gypi",
]
}
2018-05-03 22:44:29 +00:00
action("gyp_node") {
script = "//tools/gyp/gyp_main.py"
2018-05-15 16:31:13 +00:00
deps = [ ":configure_node" ]
2018-05-03 22:44:29 +00:00
inputs = [
"//third_party/electron_node/common.gypi",
"//third_party/electron_node/node.gyp",
"//third_party/electron_node/node.gypi",
2018-05-15 16:31:13 +00:00
"$target_gen_dir/config.gypi",
"node_override.gypi",
2018-05-03 22:44:29 +00:00
]
outputs = [
"$target_out_dir/Release/build.ninja",
2018-05-03 22:44:29 +00:00
]
2018-05-16 19:51:11 +00:00
# TODO(jeremy): should shlib_suffix be set inside node.gypi?
if (is_mac) {
shlib_suffix = "dylib"
} else if (is_linux) {
shlib_suffix = "so"
}
2018-05-03 22:44:29 +00:00
args = [
2018-05-15 16:31:13 +00:00
"-I", rebase_path("$target_gen_dir/config.gypi", root_build_dir),
"-I", rebase_path("node_override.gypi", root_build_dir),
"-I", rebase_path("//third_party/electron_node/common.gypi", root_build_dir),
2018-05-03 22:44:29 +00:00
"-D", "component=shared_library",
2018-05-15 16:31:13 +00:00
"-D", "target_arch=$target_cpu",
"-D", "host_arch=$host_cpu",
"-D", "config_gypi=" + rebase_path("$target_gen_dir/config.gypi"),
2018-05-03 22:44:29 +00:00
"-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),
]
}
action("build_node") {
deps = [
"//third_party/boringssl",
2018-05-03 22:44:29 +00:00
"//third_party/icu",
"//v8",
"//v8:v8_libbase",
"//v8:v8_libplatform",
":gyp_node",
]
script = "//electron/build/run-ninja.py"
args = [
"-C", rebase_path(target_out_dir, root_build_dir) + "/Release",
2018-05-03 22:44:29 +00:00
"node_lib"
]
2018-05-16 19:51:11 +00:00
if (is_mac) {
outputs = [ "$target_out_dir/Release/libnode.dylib" ]
}
if (is_linux) {
outputs = [ "$target_out_dir/Release/lib/libnode.so" ]
}
2018-05-03 22:44:29 +00:00
}
2018-05-16 19:51:11 +00:00
node_libs = get_target_outputs(":build_node")
2018-05-03 22:44:29 +00:00
copy("copy_node") {
deps = [ ":build_node" ]
2018-05-16 19:51:11 +00:00
sources = node_libs
2018-05-03 22:44:29 +00:00
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
config("node_config") {
include_dirs = [
"//third_party/electron_node/src",
"//third_party/electron_node/deps/uv/include",
"//third_party/electron_node/deps/cares/include",
]
2018-05-16 19:51:11 +00:00
libs = node_libs
2018-05-03 22:44:29 +00:00
cflags_cc = [
"-Wno-deprecated-declarations",
]
defines = [
# We need to access internal implementations of Node.
"NODE_WANT_INTERNALS=1",
"NODE_SHARED_MODE",
"HAVE_OPENSSL=1",
"HAVE_INSPECTOR=1",
]
}
group("node") {
public_configs = [ ":node_config" ]
public_deps = [ ":copy_node" ]
}