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/printing/common",
"//components/security_state/content", "//components/security_state/content",
"//components/viz/service", "//components/viz/service",
"//content/public/browser", "//content/public/app:both",
"//content/public/child",
"//device/geolocation", "//device/geolocation",
"//gin", "//gin",
"//net:net_resources", "//net:net_resources",
@ -240,6 +241,14 @@ static_library("electron_lib") {
"brightray", "brightray",
"build/node", "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) { if (enable_desktop_capturer) {
deps += [ "//third_party/webrtc/modules/desktop_capture" ] deps += [ "//third_party/webrtc/modules/desktop_capture" ]
} }
@ -274,20 +283,15 @@ static_library("electron_lib") {
defines = [ defines = [
# Disable warnings for g_settings_list_schemas. # Disable warnings for g_settings_list_schemas.
"GLIB_DISABLE_DEPRECATION_WARNINGS", "GLIB_DISABLE_DEPRECATION_WARNINGS",
]
if (is_component_build) {
defines += [
# Import V8 symbols from shared library (node.dll / libnode.so) # Import V8 symbols from shared library (node.dll / libnode.so)
"USING_V8_SHARED", "USING_V8_SHARED",
"USING_V8_PLATFORM_SHARED", "USING_V8_PLATFORM_SHARED",
"USING_V8_BASE_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_linux || is_win) { if (is_linux || is_win) {
deps += [ "//third_party/breakpad:client" ] deps += [ "//third_party/breakpad:client" ]
include_dirs += [ include_dirs += [
@ -433,6 +437,7 @@ if (is_mac) {
] ]
} }
if (is_component_build) {
bundle_data("electron_framework_libraries") { bundle_data("electron_framework_libraries") {
public_deps = [ "build/node" ] public_deps = [ "build/node" ]
sources = [ sources = [
@ -442,6 +447,7 @@ if (is_mac) {
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}" "{{bundle_contents_dir}}/Libraries/{{source_file_part}}"
] ]
} }
}
bundle_data("electron_crashpad_helper") { bundle_data("electron_crashpad_helper") {
sources = [ sources = [
@ -465,13 +471,15 @@ if (is_mac) {
deps = [ deps = [
"//base", "//base",
"//base:i18n", "//base:i18n",
":electron_framework_libraries",
":electron_framework_resources", ":electron_framework_resources",
":electron_xibs", ":electron_xibs",
] ]
if (!is_mas_build) { if (!is_mas_build) {
deps += [ ":electron_crashpad_helper" ] deps += [ ":electron_crashpad_helper" ]
} }
if (is_component_build) {
deps += [ ":electron_framework_libraries" ]
}
info_plist = "atom/common/resources/mac/Info.plist" info_plist = "atom/common/resources/mac/Info.plist"
extra_substitutions = [ extra_substitutions = [
"ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework", "ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",

2
DEPS
View file

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

View file

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

View file

@ -13,7 +13,6 @@ action("configure_node") {
args = [ args = [
"--enable-static", "--enable-static",
"--release-urlbase=https://atom.io/download/electron", "--release-urlbase=https://atom.io/download/electron",
"--shared",
"--shared-openssl", "--shared-openssl",
"--shared-openssl-includes=" + rebase_path("//third_party/boringssl/src/include"), "--shared-openssl-includes=" + rebase_path("//third_party/boringssl/src/include"),
"--shared-openssl-libname=boringssl" + ssl_libname_suffix, "--shared-openssl-libname=boringssl" + ssl_libname_suffix,
@ -29,6 +28,9 @@ action("configure_node") {
"--config-out-dir=" + rebase_path(target_gen_dir), "--config-out-dir=" + rebase_path(target_gen_dir),
"--no-run-gyp", "--no-run-gyp",
] ]
if (is_component_build) {
args += [ "--shared" ]
}
outputs = [ outputs = [
"$target_gen_dir/config.gypi", "$target_gen_dir/config.gypi",
] ]
@ -75,6 +77,7 @@ action("gyp_node") {
"-D", "llvm_dir=" + rebase_path("//third_party/llvm-build/Release+Asserts"), "-D", "llvm_dir=" + rebase_path("//third_party/llvm-build/Release+Asserts"),
"-D", "libcxx_dir=" + rebase_path("//buildtools/third_party/libc++"), "-D", "libcxx_dir=" + rebase_path("//buildtools/third_party/libc++"),
"-D", "libcxxabi_dir=" + rebase_path("//buildtools/third_party/libc++abi"), "-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 "-Goutput_dir=./$target_out_dir", # bizarrely, gyp generates from the build root instead of from cwd
"-fninja", "-fninja",
rebase_path("//third_party/electron_node/node.gyp", root_build_dir), rebase_path("//third_party/electron_node/node.gyp", root_build_dir),
@ -93,16 +96,53 @@ action("build_node") {
script = "//electron/build/run-ninja.py" script = "//electron/build/run-ninja.py"
args = [ args = [
"-C", rebase_path(target_out_dir, root_build_dir) + "/$node_configuration", "-C", rebase_path(target_out_dir, root_build_dir) + "/$node_configuration",
"node_lib" "node_lib",
"libuv", "nghttp2", "cares", "http_parser", "zlib"
] ]
if (is_mac) { if (is_mac) {
if (is_component_build) {
outputs = [ "$target_out_dir/$node_configuration/libnode.dylib" ] 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) { if (is_linux) {
if (is_component_build) {
outputs = [ "$target_out_dir/$node_configuration/lib/libnode.so" ] 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) { 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/uv/include",
"//third_party/electron_node/deps/cares/include", "//third_party/electron_node/deps/cares/include",
] ]
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] ] libs = [ node_libs[0] ]
} else {
libs = node_libs
}
cflags_cc = [ cflags_cc = [
"-Wno-deprecated-declarations", "-Wno-deprecated-declarations",
] ]
defines = [ defines = [
# We need to access internal implementations of Node. # We need to access internal implementations of Node.
"NODE_WANT_INTERNALS=1", "NODE_WANT_INTERNALS=1",
"NODE_SHARED_MODE",
"HAVE_OPENSSL=1", "HAVE_OPENSSL=1",
"HAVE_INSPECTOR=1", "HAVE_INSPECTOR=1",
] ]
if (is_component_build) {
defines += [ "NODE_SHARED_MODE" ]
}
} }
group("node") { group("node") {

View file

@ -5,6 +5,8 @@
'v8_enable_inspector': 1, 'v8_enable_inspector': 1,
'shlib_suffix': '<(shlib_suffix_gn)', 'shlib_suffix': '<(shlib_suffix_gn)',
'is_component_build%': 'false',
}, },
'conditions': [ 'conditions': [
['OS=="linux"', { ['OS=="linux"', {
@ -57,6 +59,8 @@
], ],
'conditions': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
'conditions': [
['is_component_build=="true"', {
'libraries': [ 'libraries': [
'-lv8.dll', '-lv8.dll',
'-lv8_libbase.dll', '-lv8_libbase.dll',
@ -77,7 +81,11 @@
], ],
}, },
}, },
}]
],
}, { }, {
'conditions': [
['is_component_build=="true"', {
'libraries': [ 'libraries': [
'-lv8', '-lv8',
'-lv8_libbase', '-lv8_libbase',
@ -86,6 +94,8 @@
] ]
}] }]
] ]
}]
]
}], }],
], ],
}, },