build: add enable_pepper_flash flag to GN build (#14349)

* chore: reformat BUILD.gn

* build: add enable_pepper_flash flag to GN build

Fixes #14339.

* build: move pepper flash under components/

* [ci skip] build: add electron.icns to mac app resources

* build: [gyp] update config to use component pepper flash

* build: [gyp] copy pepper shared libraries into executable folder in component build
This commit is contained in:
Alexey Kuzmin 2018-08-29 10:39:47 +02:00 committed by Samuel Attard
parent 2f759151d2
commit ccd63b5ed0
3 changed files with 164 additions and 39 deletions

View file

@ -32,6 +32,7 @@ declare_args() {
enable_desktop_capturer = true
enable_run_as_node = true
enable_osr = false
enable_view_api = false
# Provide a fake location provider for mocking
# the geolocation responses. Disable it if you
@ -39,7 +40,8 @@ declare_args() {
# Should not be enabled for release build.
enable_fake_location_provider = !is_official_build
enable_view_api = false
# Enable flash plugin support.
enable_pepper_flash = true
}
if (is_mas_build) {
@ -77,6 +79,9 @@ config("features") {
if (enable_view_api) {
defines += [ "ENABLE_VIEW_API" ]
}
if (enable_pepper_flash) {
defines += [ "ENABLE_PEPPER_FLASH" ]
}
}
npm_action("atom_browserify_sandbox") {
@ -294,15 +299,11 @@ static_library("electron_lib") {
set_sources_assignment_filter(sources_assignment_filter)
if (is_component_build) {
defines += [
"NODE_SHARED_MODE",
]
defines += [ "NODE_SHARED_MODE" ]
}
if (enable_fake_location_provider) {
defines += [
"OVERRIDE_LOCATION_PROVIDER"
]
defines += [ "OVERRIDE_LOCATION_PROVIDER" ]
sources += filenames_gypi.lib_sources_location_provider
}
@ -426,6 +427,10 @@ static_library("electron_lib") {
"atom/browser/api/atom_api_text_field.h",
]
}
if (enable_pepper_flash) {
deps += [ "components/pepper_flash" ]
}
}
electron_paks("packed_resources") {
@ -479,12 +484,8 @@ if (is_mac) {
sources = []
public_deps = []
if (is_component_ffmpeg) {
sources += [
"$root_out_dir/libffmpeg.dylib",
]
public_deps += [
"//third_party/ffmpeg:ffmpeg",
]
sources += [ "$root_out_dir/libffmpeg.dylib" ]
public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
}
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
@ -517,8 +518,8 @@ if (is_mac) {
":electron_lib",
]
deps = [
":electron_framework_resources",
":electron_framework_libraries",
":electron_framework_resources",
":electron_xibs",
]
if (!is_mas_build) {
@ -620,6 +621,7 @@ if (is_mac) {
sources = [
"$root_out_dir/resources/default_app.asar",
"$root_out_dir/resources/electron.asar",
"atom/browser/resources/mac/electron.icns",
]
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
@ -809,51 +811,80 @@ group("chromium_browsertests") {
template("dist_zip") {
_runtime_deps_target = "${target_name}__deps"
_runtime_deps_file =
"$root_out_dir/gen.runtime/" +
get_label_info(target_name, "dir") + "/" +
"$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
get_label_info(target_name, "name") + ".runtime_deps"
group(_runtime_deps_target) {
forward_variables_from(invoker, [ "deps", "data_deps", "data" ])
forward_variables_from(invoker,
[
"deps",
"data_deps",
"data",
])
write_runtime_deps = _runtime_deps_file
}
action(target_name) {
script = "//electron/build/zip.py"
deps = [ ":$_runtime_deps_target" ]
deps = [
":$_runtime_deps_target",
]
forward_variables_from(invoker, [ "outputs" ])
args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [target_cpu, target_os]
args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
target_cpu,
target_os,
]
}
}
copy("electron_license") {
sources = [ "LICENSE" ]
outputs = [ "$root_build_dir/{{source_file_part}}" ]
sources = [
"LICENSE",
]
outputs = [
"$root_build_dir/{{source_file_part}}",
]
}
copy("chromium_licenses") {
deps = [ "//components/resources:about_credits" ]
sources = [ "$root_gen_dir/components/resources/about_credits.html" ]
outputs = [ "$root_build_dir/LICENSES.chromium.html" ]
deps = [
"//components/resources:about_credits",
]
sources = [
"$root_gen_dir/components/resources/about_credits.html",
]
outputs = [
"$root_build_dir/LICENSES.chromium.html",
]
}
group("licenses") {
data_deps = [ ":electron_license", ":chromium_licenses" ]
data_deps = [
":electron_license",
":chromium_licenses",
]
}
action("electron_version") {
script = "build/write_version.py"
outputs = [ "$root_build_dir/version" ]
outputs = [
"$root_build_dir/version",
]
args = rebase_path(outputs, root_build_dir) + [ electron_version ]
}
dist_zip("electron_dist_zip") {
data_deps = [ ":electron_app", ":licenses", ":electron_version" ]
outputs = [ "$root_build_dir/dist.zip" ]
data_deps = [
":electron_app",
":licenses",
":electron_version",
]
outputs = [
"$root_build_dir/dist.zip",
]
}
group("electron") {
deps = [ ":electron_app" ]
deps = [
":electron_app",
]
}

View file

@ -0,0 +1,57 @@
# Copyright (c) 2018 GitHub, Inc.
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.
component("pepper_flash") {
visibility = [ "//electron:electron_lib" ]
defines = [ "IS_PEPPER_FLASH_IMPL" ]
sources = [
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc",
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h",
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc",
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h",
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc",
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h",
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc",
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h",
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc",
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h",
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc",
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h",
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc",
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.h",
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
"//chrome/renderer/pepper/pepper_flash_font_file_host.h",
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.cc",
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.h",
"//chrome/renderer/pepper/pepper_flash_menu_host.cc",
"//chrome/renderer/pepper/pepper_flash_menu_host.h",
"//chrome/renderer/pepper/pepper_flash_renderer_host.cc",
"//chrome/renderer/pepper/pepper_flash_renderer_host.h",
"//chrome/renderer/pepper/pepper_helper.cc",
"//chrome/renderer/pepper/pepper_helper.h",
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
]
deps = [
"//content/public/browser",
"//content/public/renderer",
"//media:media_features",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
"//services/device/public/mojom",
"//skia",
"//third_party/adobe/flash:flapper_version_h",
"//ui/base",
]
if (is_mac) {
sources += [
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.h",
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
]
}
}

View file

@ -196,6 +196,11 @@
'<(libchromiumcontent_dir)/ffmpeg.dll',
],
}],
['enable_pepper_flash==1', {
'copied_libraries': [
'<(libchromiumcontent_dir)/pepper_flash.dll',
],
}],
],
},
'destination': '<(PRODUCT_DIR)',
@ -238,6 +243,11 @@
'<(libchromiumcontent_dir)/libffmpeg.so',
],
}],
['enable_pepper_flash==1', {
'copied_libraries': [
'<(libchromiumcontent_dir)/libpepper_flash.so',
],
}],
],
},
'destination': '<(PRODUCT_DIR)',
@ -340,14 +350,36 @@
],
'link_settings': {
'conditions': [
['OS=="win"', {
'libraries': [
'<(libchromiumcontent_dir)/pepper_flash.lib',
]
['libchromiumcontent_component', {
'conditions': [
['OS=="win"', {
'libraries': [
'<(libchromiumcontent_dir)/pepper_flash.dll',
]
}],
['OS=="mac"', {
'libraries': [
'<(libchromiumcontent_dir)/libpepper_flash.dylib',
]
}],
['OS=="linux"', {
'libraries': [
'<(libchromiumcontent_dir)/libpepper_flash.so',
]
}],
],
}, {
'libraries': [
'<(libchromiumcontent_dir)/libpepper_flash.a',
]
'conditions': [
['OS=="win"', {
'libraries': [
'<(libchromiumcontent_dir)/pepper_flash.lib',
]
}, {
'libraries': [
'<(libchromiumcontent_dir)/libpepper_flash.a',
]
}],
],
}],
],
},
@ -710,6 +742,11 @@
'<(libchromiumcontent_dir)/libffmpeg.dylib',
],
}],
['enable_pepper_flash==1', {
'copied_libraries': [
'<(libchromiumcontent_dir)/libpepper_flash.dylib',
],
}],
],
},
'destination': '<(PRODUCT_DIR)/<(product_name) Framework.framework/Versions/A/Libraries',