Merge pull request #13636 from nornagon/gn-release

build: [gn] release build
This commit is contained in:
John Kleinschmidt 2018-07-12 10:45:21 -04:00 committed by GitHub
commit e922b1733b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 123 additions and 55 deletions

View file

@ -217,7 +217,8 @@ static_library("electron_lib") {
"//components/printing/common",
"//components/security_state/content",
"//components/viz/service",
"//content/public/browser",
"//content/public/app:both",
"//content/public/child",
"//device/geolocation",
"//gin",
"//net:net_resources",
@ -240,6 +241,14 @@ static_library("electron_lib") {
"brightray",
"build/node",
]
include_dirs = [
"chromium_src",
".",
"$target_gen_dir",
# TODO(nornagon): replace usage of SchemeRegistry by an actually exported
# API of blink, then delete this include dir.
"//third_party/WebKit/Source",
]
if (enable_desktop_capturer) {
deps += [ "//third_party/webrtc/modules/desktop_capture" ]
}
@ -274,20 +283,15 @@ static_library("electron_lib") {
defines = [
# Disable warnings for g_settings_list_schemas.
"GLIB_DISABLE_DEPRECATION_WARNINGS",
# Import V8 symbols from shared library (node.dll / libnode.so)
"USING_V8_SHARED",
"USING_V8_PLATFORM_SHARED",
"USING_V8_BASE_SHARED",
]
include_dirs = [
"chromium_src",
".",
"$target_gen_dir",
# TODO(nornagon): replace usage of SchemeRegistry by an actually exported
# API of blink, then delete this include dir.
"//third_party/WebKit/Source",
]
if (is_component_build) {
defines += [
# Import V8 symbols from shared library (node.dll / libnode.so)
"USING_V8_SHARED",
"USING_V8_PLATFORM_SHARED",
"USING_V8_BASE_SHARED",
]
}
if (is_linux || is_win) {
deps += [ "//third_party/breakpad:client" ]
include_dirs += [
@ -433,14 +437,16 @@ if (is_mac) {
]
}
bundle_data("electron_framework_libraries") {
public_deps = [ "build/node" ]
sources = [
"$root_out_dir/libnode.dylib"
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}"
]
if (is_component_build) {
bundle_data("electron_framework_libraries") {
public_deps = [ "build/node" ]
sources = [
"$root_out_dir/libnode.dylib"
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}"
]
}
}
bundle_data("electron_crashpad_helper") {
@ -465,13 +471,15 @@ if (is_mac) {
deps = [
"//base",
"//base:i18n",
":electron_framework_libraries",
":electron_framework_resources",
":electron_xibs",
]
if (!is_mas_build) {
deps += [ ":electron_crashpad_helper" ]
}
if (is_component_build) {
deps += [ ":electron_framework_libraries" ]
}
info_plist = "atom/common/resources/mac/Info.plist"
extra_substitutions = [
"ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",

2
DEPS
View file

@ -2,7 +2,7 @@ vars = {
'chromium_version':
'66.0.3359.181',
'libchromiumcontent_revision':
'0628cd925e513bfd873524621a91834b366899f1',
'a55a9ce536db60702630c4b9d94dcb2145fc3b24',
'node_version':
'v10.2.0-35-g4879332def',

View file

@ -9,7 +9,9 @@
// Include common headers for using node APIs.
#ifdef NODE_SHARED_MODE
#define BUILDING_NODE_EXTENSION
#endif
// The following define makes sure that we do not include the macros
// again. But we still need the tracing functions, so declaring them.

View file

@ -13,7 +13,6 @@ action("configure_node") {
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" + ssl_libname_suffix,
@ -29,6 +28,9 @@ action("configure_node") {
"--config-out-dir=" + rebase_path(target_gen_dir),
"--no-run-gyp",
]
if (is_component_build) {
args += [ "--shared" ]
}
outputs = [
"$target_gen_dir/config.gypi",
]
@ -75,6 +77,7 @@ action("gyp_node") {
"-D", "llvm_dir=" + rebase_path("//third_party/llvm-build/Release+Asserts"),
"-D", "libcxx_dir=" + rebase_path("//buildtools/third_party/libc++"),
"-D", "libcxxabi_dir=" + rebase_path("//buildtools/third_party/libc++abi"),
"-D", "is_component_build=$is_component_build",
"-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),
@ -93,16 +96,53 @@ action("build_node") {
script = "//electron/build/run-ninja.py"
args = [
"-C", rebase_path(target_out_dir, root_build_dir) + "/$node_configuration",
"node_lib"
"node_lib",
"libuv", "nghttp2", "cares", "http_parser", "zlib"
]
if (is_mac) {
outputs = [ "$target_out_dir/$node_configuration/libnode.dylib" ]
if (is_component_build) {
outputs = [ "$target_out_dir/$node_configuration/libnode.dylib" ]
} else {
outputs = [
"$target_out_dir/$node_configuration/libnode.a",
"$target_out_dir/$node_configuration/libcares.a",
"$target_out_dir/$node_configuration/libhttp_parser.a",
"$target_out_dir/$node_configuration/libnghttp2.a",
"$target_out_dir/$node_configuration/libuv.a",
"$target_out_dir/$node_configuration/libzlib.a",
]
}
}
if (is_linux) {
outputs = [ "$target_out_dir/$node_configuration/lib/libnode.so" ]
if (is_component_build) {
outputs = [ "$target_out_dir/$node_configuration/lib/libnode.so" ]
} else {
outputs = [
"$target_out_dir/$node_configuration/obj/third_party/electron_node/libnode.a",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/uv/libuv.a",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/nghttp2/libnghttp2.a",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/cares/libcares.a",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/http_parser/libhttp_parser.a",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/zlib/libzlib.a",
]
}
}
if (is_win) {
outputs = [ "$target_out_dir/$node_configuration/node.dll.lib", "$target_out_dir/$node_configuration/node.dll" ]
if (is_component_build) {
outputs = [
"$target_out_dir/$node_configuration/node.dll.lib",
"$target_out_dir/$node_configuration/node.dll",
]
} else {
outputs = [
"$target_out_dir/$node_configuration/obj/third_party/electron_node/node.lib",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/uv/libuv.lib",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/nghttp2/nghttp2.lib",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/cares/cares.lib",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/http_parser/http_parser.lib",
"$target_out_dir/$node_configuration/obj/third_party/electron_node/deps/zlib/zlib.lib",
]
}
}
}
@ -120,17 +160,25 @@ config("node_config") {
"//third_party/electron_node/deps/uv/include",
"//third_party/electron_node/deps/cares/include",
]
libs = [ node_libs[0] ]
if (is_win && is_component_build) {
# Windows builds need both the .dll and the .dll.lib copied, but only the
# .dll.lib goes in the `libs` list.
libs = [ node_libs[0] ]
} else {
libs = node_libs
}
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",
]
if (is_component_build) {
defines += [ "NODE_SHARED_MODE" ]
}
}
group("node") {

View file

@ -5,6 +5,8 @@
'v8_enable_inspector': 1,
'shlib_suffix': '<(shlib_suffix_gn)',
'is_component_build%': 'false',
},
'conditions': [
['OS=="linux"', {
@ -57,32 +59,40 @@
],
'conditions': [
['OS=="win"', {
'libraries': [
'-lv8.dll',
'-lv8_libbase.dll',
'-lv8_libplatform.dll',
'-licuuc.dll',
'-ldbghelp',
'conditions': [
['is_component_build=="true"', {
'libraries': [
'-lv8.dll',
'-lv8_libbase.dll',
'-lv8_libplatform.dll',
'-licuuc.dll',
'-ldbghelp',
],
'msvs_settings': {
# Change location of some hard-coded paths.
'VCLinkerTool': {
'AdditionalOptions!': [
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\zlib<(STATIC_LIB_SUFFIX)',
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\libuv<(STATIC_LIB_SUFFIX)',
],
'AdditionalOptions': [
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\obj\\third_party\\electron_node\\deps\\zlib\\zlib<(STATIC_LIB_SUFFIX)',
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\obj\\third_party\\electron_node\\deps\\uv\\libuv<(STATIC_LIB_SUFFIX)',
],
},
},
}]
],
'msvs_settings': {
# Change location of some hard-coded paths.
'VCLinkerTool': {
'AdditionalOptions!': [
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\zlib<(STATIC_LIB_SUFFIX)',
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\libuv<(STATIC_LIB_SUFFIX)',
],
'AdditionalOptions': [
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\obj\\third_party\\electron_node\\deps\\zlib\\zlib<(STATIC_LIB_SUFFIX)',
'/WHOLEARCHIVE:<(PRODUCT_DIR)\\obj\\third_party\\electron_node\\deps\\uv\\libuv<(STATIC_LIB_SUFFIX)',
],
},
},
}, {
'libraries': [
'-lv8',
'-lv8_libbase',
'-lv8_libplatform',
'-licuuc',
'conditions': [
['is_component_build=="true"', {
'libraries': [
'-lv8',
'-lv8_libbase',
'-lv8_libplatform',
'-licuuc',
]
}]
]
}]
]