diff --git a/BUILD.gn b/BUILD.gn index f2d102cd65c9..25770b7dd1fe 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -9,6 +9,14 @@ if (is_mac) { import("//v8/gni/v8.gni") } +if (is_linux) { + import("//build/config/linux/pkg_config.gni") + + pkg_config("gio_unix") { + packages = [ "gio-unix-2.0" ] + } +} + declare_args() { electron_project_name = "electron" electron_product_name = "Electron" @@ -164,13 +172,13 @@ action("atom_js2c") { asar("js2asar") { sources = filenames_gypi.js_sources - outputs = [ "$root_out_dir/electron.asar" ] + outputs = [ "$root_out_dir/resources/electron.asar" ] root = "lib" } asar("app2asar") { sources = filenames_gypi.default_app_sources - outputs = [ "$root_out_dir/default_app.asar" ] + outputs = [ "$root_out_dir/resources/default_app.asar" ] root = "default_app" } @@ -224,6 +232,20 @@ static_library("electron_lib") { "//base/allocator:features", ] } + if (is_linux) { + deps += [ + "//build/config/linux/gtk3", + "//chrome/browser/ui/libgtkui", + "//device/bluetooth", + "//third_party/breakpad:client", + "//ui/events/devices/x11", + "//ui/events/platform/x11", + "//ui/native_theme", + "//ui/views/controls/webview", + "//ui/wm", + ] + configs += [ ":gio_unix" ] + } defines = [ # This is defined in skia/skia_common.gypi. "SK_SUPPORT_LEGACY_GETTOPDEVICE", @@ -250,6 +272,11 @@ static_library("electron_lib") { # the #includes can be agnostic about where crashpad is vendored. "//third_party/crashpad", ] + if (is_linux) { + include_dirs += [ + "//third_party/breakpad", + ] + } extra_source_filters = [] if (!is_linux) { @@ -261,6 +288,12 @@ static_library("electron_lib") { "*_gtk.cc", ] } + if (!is_win) { + extra_source_filters += [ + "*\bwin_*.h", + "*\bwin_*.cc", + ] + } if (is_mac) { extra_source_filters += [ "*_views.cc", @@ -318,6 +351,7 @@ static_library("electron_lib") { } if (is_linux) { sources += filenames_gypi.lib_sources_linux + sources += filenames_gypi.lib_sources_nss } } @@ -463,8 +497,8 @@ if (is_mac) { ":app2asar", ] sources = [ - "$root_out_dir/electron.asar", - "$root_out_dir/default_app.asar", + "$root_out_dir/resources/electron.asar", + "$root_out_dir/resources/default_app.asar", ] outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" @@ -513,3 +547,22 @@ if (is_mac) { ] } } + +if (is_linux) { + executable("electron_app") { + output_name = electron_project_name + sources = filenames_gypi.app_sources + include_dirs = [ "." ] + deps = [ + ":app2asar", + ":electron_lib", + ":js2asar", + "//build/config:exe_and_shlib_deps", + "//chrome:packed_resources", + "//content/shell:copy_shell_resources", + "//content/shell:pak", + "//third_party/WebKit/public:image_resources", + "//ui/strings", + ] + } +} diff --git a/brightray/BUILD.gn b/brightray/BUILD.gn index f82f52a903e4..c2185726abdf 100644 --- a/brightray/BUILD.gn +++ b/brightray/BUILD.gn @@ -7,6 +7,28 @@ filenames_gypi = exec_script( [ "filenames.gypi" ] ) + +if (is_linux) { + # TODO: Experiment with using //tools/generate_library_loader for generating + # the libnotify loader. + copy("libnotify_headers") { + sources = [ + "/usr/include/libnotify/notify.h", + "/usr/include/libnotify/notification.h", + "/usr/include/libnotify/notify-enum-types.h", + "/usr/include/libnotify/notify-features.h", + ] + outputs = [ "$target_gen_dir/libnotify-copy/libnotify/{{source_file_part}}" ] + } + config("libnotify_config") { + include_dirs = [ "$target_gen_dir/libnotify-copy" ] + } + group("libnotify") { + deps = [ ":libnotify_headers" ] + public_configs = [ ":libnotify_config" ] + } +} + static_library("brightray") { deps = [ "//base", @@ -27,6 +49,13 @@ static_library("brightray") { "DISABLE_NACL=1", ] + if (is_linux) { + deps += [ + "//build/config/linux/gtk3", + ":libnotify", + ] + } + extra_source_filters = [] if (is_mac) { extra_source_filters += [ diff --git a/build/node/BUILD.gn b/build/node/BUILD.gn index 2c6e67b82052..c9ecc1485505 100644 --- a/build/node/BUILD.gn +++ b/build/node/BUILD.gn @@ -9,13 +9,27 @@ action("gyp_node") { outputs = [ "$target_out_dir/Release/build.ninja", ] + + # TODO(jeremy): should shlib_suffix be set inside node.gypi? + if (is_mac) { + shlib_suffix = "dylib" + } else if (is_linux) { + shlib_suffix = "so" + } args = [ + "-I", rebase_path("toolchain.gypi", root_build_dir), "-I", rebase_path("node.gypi", root_build_dir), "-I", rebase_path("//third_party/electron_node/common.gypi", root_build_dir), + # TODO(jeremy): make these paths relative instead of absolute, to help + # caches. + "-D", "chromium_root_out_dir=" + rebase_path(root_out_dir), + "-D", "chromium_src_dir=" + rebase_path("//"), "-D", "component=shared_library", "-D", "buildtype=Custom", "-D", "target_arch=x64", "-D", "host_arch=x64", + "-D", "shlib_suffix=$shlib_suffix", + "-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), @@ -35,14 +49,19 @@ action("build_node") { "-C", rebase_path(target_out_dir, root_build_dir) + "/Release", "node_lib" ] - outputs = [ - "$target_out_dir/Release/libnode.dylib" - ] + if (is_mac) { + outputs = [ "$target_out_dir/Release/libnode.dylib" ] + } + if (is_linux) { + outputs = [ "$target_out_dir/Release/lib/libnode.so" ] + } } +node_libs = get_target_outputs(":build_node") + copy("copy_node") { deps = [ ":build_node" ] - sources = [ "$target_out_dir/Release/libnode.dylib" ] + sources = node_libs outputs = [ "$root_out_dir/{{source_file_part}}" ] } @@ -52,9 +71,7 @@ config("node_config") { "//third_party/electron_node/deps/uv/include", "//third_party/electron_node/deps/cares/include", ] - libs = [ - "$target_out_dir/Release/libnode.dylib" - ] + libs = node_libs cflags_cc = [ "-Wno-deprecated-declarations", ] diff --git a/build/node/node.gypi b/build/node/node.gypi index be563fe822be..75d1e3ab11f9 100644 --- a/build/node/node.gypi +++ b/build/node/node.gypi @@ -40,7 +40,6 @@ 'debug_nghttp2': 0, 'node_module_version': '0', - 'shlib_suffix': 'dylib', }, # Settings to compile node under Windows. 'target_defaults': { @@ -136,10 +135,10 @@ }], ['_target_name=="node_lib"', { 'include_dirs': [ - '../../../v8', - '../../../v8/include', - '../../../third_party/icu/source/common', - '../../../third_party/icu/source/i18n', + '<(chromium_src_dir)/v8', + '<(chromium_src_dir)/v8/include', + '<(chromium_src_dir)/third_party/icu/source/common', + '<(chromium_src_dir)/third_party/icu/source/i18n', ], 'defines': [ # Export V8 symbols from node.dll / libnode.so @@ -159,10 +158,10 @@ 'OTHER_CFLAGS': ['-fno-rtti'], }, 'libraries': [ - '../../../../../../libv8.dylib', - '../../../../../../libv8_libbase.dylib', - '../../../../../../libv8_libplatform.dylib', - '../../../../../../libicuuc.dylib', + '<(chromium_root_out_dir)/libv8<(SHARED_LIB_SUFFIX)', + '<(chromium_root_out_dir)/libv8_libbase<(SHARED_LIB_SUFFIX)', + '<(chromium_root_out_dir)/libv8_libplatform<(SHARED_LIB_SUFFIX)', + '<(chromium_root_out_dir)/libicuuc<(SHARED_LIB_SUFFIX)', ], 'conditions': [ #['OS=="mac" and libchromiumcontent_component==0', { @@ -242,21 +241,21 @@ }], ['OS=="linux" and _toolset=="target" and _target_name in ["dump_syms", "node_lib"]', { 'conditions': [ - #['libchromiumcontent_component==0', { - #'libraries': [ - #'<(libchromiumcontent_dir)/libc++.a', - #], - #'ldflags': [ - #'-lpthread', - ##], - #}, { - #'libraries': [ - #'<(libchromiumcontent_dir)/libc++.so', - #], - #'ldflags': [ - #'-Wl,-rpath=\$$ORIGIN', - #], - #}], + ['is_component_build==0', { + 'libraries': [ + '<(chromium_root_out_dir)/libc++.a', + ], + 'ldflags': [ + '-lpthread', + ], + }, { + 'libraries': [ + '<(chromium_root_out_dir)/libc++.so', + ], + 'ldflags': [ + '-Wl,-rpath=\$$ORIGIN', + ], + }], ], }] ], @@ -280,26 +279,4 @@ 4996, # (atlapp.h) 'GetVersionExW': was declared deprecated ], }, - 'conditions': [ - # The breakdpad on Windows assumes Debug_x64 and Release_x64 configurations. - ['OS=="win"', { - 'target_defaults': { - 'configurations': { - 'Debug_x64': { - }, - 'Release_x64': { - }, - }, - }, - }], # OS=="win" - # The breakdpad on Mac assumes Release_Base configuration. - ['OS=="mac"', { - 'target_defaults': { - 'configurations': { - 'Release_Base': { - }, - }, - }, - }], # OS=="mac" - ], } diff --git a/build/node/toolchain.gypi b/build/node/toolchain.gypi new file mode 100644 index 000000000000..802b17d51df1 --- /dev/null +++ b/build/node/toolchain.gypi @@ -0,0 +1,35 @@ +{ + 'variables': { + 'llvm_dir': '<(chromium_src_dir)/third_party/llvm-build/Release+Asserts', + }, + 'conditions': [ + ['clang==1', { + 'make_global_settings': [ + ['CC', '<(llvm_dir)/bin/clang'], + ['CXX', '<(llvm_dir)/bin/clang++'], + ['CC.host', '$(CC)'], + ['CXX.host', '$(CXX)'], + ], + 'target_defaults': { + 'target_conditions': [ + ['OS=="linux" and _toolset=="target"', { + 'cflags_cc': [ + '-std=gnu++14', + '-nostdinc++', + '-isystem<(chromium_src_dir)/buildtools/third_party/libc++/trunk/include', + '-isystem<(chromium_src_dir)/buildtools/third_party/libc++abi/trunk/include', + ], + 'ldflags': [ + '-nostdlib++', + ], + }], + ['OS=="linux" and _toolset=="host"', { + 'cflags_cc': [ + '-std=gnu++14', + ], + }], + ], + }, + }], # clang==1 + ], +}