Merge pull request #13515 from nornagon/gn-linux

chore: [gn] fix linux build
This commit is contained in:
John Kleinschmidt 2018-07-11 08:02:42 -04:00 committed by GitHub
commit 376094fc0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 69 additions and 29 deletions

View file

@ -223,7 +223,6 @@ static_library("electron_lib") {
"//skia",
"//third_party/WebKit/public:blink",
"//third_party/boringssl",
"//third_party/crashpad/crashpad/client",
"//third_party/leveldatabase",
"//third_party/libyuv",
"//ui/events:dom_keycode_converter",
@ -244,14 +243,20 @@ static_library("electron_lib") {
if (is_mac) {
deps += [
"//ui/accelerated_widget_mac",
"//third_party/crashpad/crashpad/client",
]
include_dirs += [
# NOTE(nornagon): other chromium files use the full path to include
# crashpad; this is just here for compatibility between GN and GYP, so that
# the #includes can be agnostic about where crashpad is vendored.
"//third_party/crashpad",
]
}
if (is_linux) {
deps += [
"//build/config/linux/gtk3",
"//build/config/linux/gtk",
"//chrome/browser/ui/libgtkui",
"//device/bluetooth",
"//third_party/breakpad:client",
"//ui/events/devices/x11",
"//ui/events/platform/x11",
"//ui/native_theme",
@ -260,11 +265,6 @@ static_library("electron_lib") {
]
configs += [ ":gio_unix" ]
}
if (is_win) {
deps += [
"//third_party/breakpad:client",
]
}
defines = [
# Disable warnings for g_settings_list_schemas.
"GLIB_DISABLE_DEPRECATION_WARNINGS",
@ -281,12 +281,9 @@ static_library("electron_lib") {
# TODO(nornagon): replace usage of SchemeRegistry by an actually exported
# API of blink, then delete this include dir.
"//third_party/WebKit/Source",
# NOTE(nornagon): other chromium files use the full path to include
# crashpad; this is just here for compatibility between GN and GYP, so that
# the #includes can be agnostic about where crashpad is vendored.
"//third_party/crashpad",
]
if (is_linux || is_win) {
deps += [ "//third_party/breakpad:client" ]
include_dirs += [
"//third_party/breakpad",
]

View file

@ -51,7 +51,7 @@ static_library("brightray") {
if (is_linux) {
deps += [
"//build/config/linux/gtk3",
"//build/config/linux/gtk",
":libnotify",
]
}

View file

@ -1,3 +1,9 @@
if (is_debug) {
node_configuration = "Debug"
} else {
node_configuration = "Release"
}
action("configure_node") {
script = "//third_party/electron_node/configure"
ssl_libname_suffix = ""
@ -39,9 +45,22 @@ action("gyp_node") {
"node_override.gypi",
]
outputs = [
"$target_out_dir/Release/build.ninja",
"$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),
@ -50,6 +69,12 @@ 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,
"-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"),
"-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),
@ -66,23 +91,18 @@ action("build_node") {
":gyp_node",
]
script = "//electron/build/run-ninja.py"
if (is_debug) {
configuration = "Debug"
} else {
configuration = "Release"
}
args = [
"-C", rebase_path(target_out_dir, root_build_dir) + "/$configuration",
"-C", rebase_path(target_out_dir, root_build_dir) + "/$node_configuration",
"node_lib"
]
if (is_mac) {
outputs = [ "$target_out_dir/$configuration/libnode.dylib" ]
outputs = [ "$target_out_dir/$node_configuration/libnode.dylib" ]
}
if (is_linux) {
outputs = [ "$target_out_dir/$configuration/lib/libnode.so" ]
outputs = [ "$target_out_dir/$node_configuration/lib/libnode.so" ]
}
if (is_win) {
outputs = [ "$target_out_dir/$configuration/node.dll.lib", "$target_out_dir/$configuration/node.dll" ]
outputs = [ "$target_out_dir/$node_configuration/node.dll.lib", "$target_out_dir/$node_configuration/node.dll" ]
}
}

View file

@ -4,13 +4,36 @@
# 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)',
},
'conditions': [
['OS=="linux"', {
'make_global_settings': [
['CC', '<(llvm_dir)/bin/clang'],
['CXX', '<(llvm_dir)/bin/clang++'],
['CC.host', '$(CC)'],
['CXX.host', '$(CXX)'],
],
'target_defaults': {
'target_conditions': [
['_toolset=="target"', {
'cflags_cc': [
'-std=gnu++14',
'-nostdinc++',
'-isystem<(libcxx_dir)/trunk/include',
'-isystem<(libcxxabi_dir)/trunk/include',
],
'ldflags': [
'-nostdlib++',
],
'libraries': [
'../../../../../../libc++.so',
],
}]
]
}
}]
],
'target_defaults': {
'target_conditions': [
['_target_name=="node_lib"', {