diff options
Diffstat (limited to 'dev-util/electron/files/electron-1.6.15.patch')
-rw-r--r-- | dev-util/electron/files/electron-1.6.15.patch | 556 |
1 files changed, 556 insertions, 0 deletions
diff --git a/dev-util/electron/files/electron-1.6.15.patch b/dev-util/electron/files/electron-1.6.15.patch new file mode 100644 index 000000000000..9d74753fc6d3 --- /dev/null +++ b/dev-util/electron/files/electron-1.6.15.patch @@ -0,0 +1,556 @@ +From 8aa9ca32e88f7b6e66ded532d3110f4e84e99a9b Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus <elvis@magic.io> +Date: Mon, 8 Feb 2016 15:16:40 -0500 +Subject: [PATCH] electron build fixes + +--- + common.gypi | 70 ++++++++++++++++++++++++++++++++++----- + electron.gyp | 70 +++++++++++++++++++++++++++++++-------- + toolchain.gypi | 76 +++++++++++++++++-------------------------- + tools/ar-flags.py | 15 +++++++++ + tools/atom_source_root.py | 5 +++ + tools/browserify.py | 24 ++++++++++++++ + tools/get-endianness.py | 4 +++ + tools/js2asar.py | 13 ++++---- + tools/list-browserify-deps.py | 3 +- + 9 files changed, 204 insertions(+), 76 deletions(-) + create mode 100644 tools/ar-flags.py + create mode 100644 tools/atom_source_root.py + create mode 100644 tools/browserify.py + create mode 100644 tools/get-endianness.py + +diff --git a/common.gypi b/common.gypi +index 7c1bf366a..7892926eb 100644 +--- a/common.gypi ++++ b/common.gypi +@@ -2,6 +2,7 @@ + 'includes': [ + 'toolchain.gypi', + 'vendor/brightray/brightray.gypi', ++ 'vendor/node/common.gypi', + ], + 'variables': { + # Tell crashpad to build as external project. +@@ -11,31 +12,44 @@ + 'chromeos': 0, + # Reflects node's config.gypi. + 'component%': 'static_library', +- 'python': 'python', ++ 'python%': 'python', + 'openssl_fips': '', + 'openssl_no_asm': 1, ++ ++ 'host_arch': '<!(python <(DEPTH)/chromium/v8/gypfiles/detect_v8_host_arch.py)', ++ ++ # ICU configuration for Node. ++ # Note: the use of icu-system.gyp does not necessarily ++ # indicate that the system ICU will be used, it merely ++ # disables the use of the version bundled with Node. ++ 'icu_gyp_path': 'tools/icu/icu-system.gyp', ++ 'icu_small': 'false', ++ + 'use_openssl_def': 0, + 'OPENSSL_PRODUCT': 'libopenssl.a', +- 'node_release_urlbase': 'https://atom.io/download/atom-shell', +- 'node_byteorder': '<!(node <(DEPTH)/tools/get-endianness.js)', ++ 'node_release_urlbase': 'https://atom.io/download/electron', ++ 'node_byteorder': '<!(python <(DEPTH)/tools/get-endianness.py)', + 'node_target_type': 'shared_library', ++ 'node_module_version': '', + 'node_install_npm': 'false', + 'node_prefix': '', + 'node_shared': 'true', + 'node_shared_cares': 'false', +- 'node_shared_http_parser': 'false', +- 'node_shared_libuv': 'false', +- 'node_shared_openssl': 'false', + 'node_shared_v8': 'true', +- 'node_shared_zlib': 'false', ++ 'node_shared_http_parser': 'true', ++ # There are ABI-incompatible modifications to libuv ++ 'node_shared_libuv': 'false', ++ 'node_shared_openssl': 'true', ++ 'node_shared_zlib': 'true', + 'node_tag': '', + 'node_use_dtrace': 'false', + 'node_use_etw': 'false', + 'node_use_mdb': 'false', + 'node_use_openssl': 'true', + 'node_use_perfctr': 'false', +- 'node_use_v8_platform': 'false', ++ 'node_use_v8_platform': 'true', + 'node_use_bundled_v8': 'false', ++ 'node_v8_path': '<(DEPTH)/chromium/v8/', + 'node_enable_d8': 'false', + 'uv_library': 'static_library', + 'uv_parent_path': 'vendor/node/deps/uv', +@@ -44,10 +58,17 @@ + 'v8_postmortem_support': 'false', + 'v8_enable_i18n_support': 'false', + 'v8_inspector': 'false', ++ 'v8_host_byteorder': '<!(python <(DEPTH)/tools/get-endianness.py)', ++ 'v8_use_snapshot': 'true', ++ 'v8_use_external_startup_data': 1, + }, + # Settings to compile node under Windows. + 'target_defaults': { + 'target_conditions': [ ++ ['_target_name in ["icuuc", "icui18n"]', { ++ 'cflags_cc!': ['-fno-rtti'] ++ }], ++ + ['_target_name in ["libuv", "http_parser", "openssl", "openssl-cli", "cares", "node", "zlib"]', { + 'msvs_disabled_warnings': [ + 4003, # not enough actual parameters for macro 'V' +@@ -128,6 +149,20 @@ + ], + }], + ['_target_name=="node"', { ++ 'cflags!': [ ++ '-fvisibility=hidden', ++ '-fdata-sections', ++ '-ffunction-sections', ++ ], ++ 'cflags_cc!': [ ++ '-fvisibility-inlines-hidden', ++ ], ++ 'libraries': [ ++ '-lz', ++ '-lhttp_parser', ++ '-lcrypto', ++ '-lssl', ++ ], + 'include_dirs': [ + '<(libchromiumcontent_src_dir)', + '<(libchromiumcontent_src_dir)/third_party/icu/source/common', +@@ -167,7 +202,9 @@ + '-Wl,--no-whole-archive', + ], + }, { +- 'libraries': [ '<@(libchromiumcontent_v8_libraries)' ], ++ 'libraries': [ ++ '<@(libchromiumcontent_v8_libraries)', ++ ], + }], + ], + }], +@@ -228,6 +265,21 @@ + }], # OS=="win" + ], + }], ++ ['_target_name=="shell_runner_host_lib"', { ++ 'conditions': [ ++ ['icu_use_data_file_flag==1', { ++ 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE'], ++ }, { # else icu_use_data_file_flag !=1 ++ 'conditions': [ ++ ['OS=="win"', { ++ 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_SHARED'], ++ }, { ++ 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC'], ++ }], ++ ], ++ }], ++ ], ++ }], + ], + 'msvs_cygwin_shell': 0, # Strangely setting it to 1 would make building under cygwin fail. + 'msvs_disabled_warnings': [ +diff --git a/electron.gyp b/electron.gyp +index f82de1e1f..2c398fe75 100644 +--- a/electron.gyp ++++ b/electron.gyp +@@ -191,7 +191,7 @@ + }, { + 'copied_libraries': [ + '<(PRODUCT_DIR)/lib/libnode.so', +- '<(libchromiumcontent_dir)/libffmpeg.so', ++ '<@(libchromiumcontent_shared_v8_libraries)', + ], + }], + ], +@@ -244,8 +244,8 @@ + '<@(lib_sources)', + ], + 'include_dirs': [ +- '.', + 'chromium_src', ++ '.', + 'vendor/brightray', + 'vendor/native_mate', + # libicu headers shim. +@@ -255,7 +255,6 @@ + '<(SHARED_INTERMEDIATE_DIR)', + # Include directories for uv and node. + 'vendor/node/src', +- 'vendor/node/deps/http_parser', + 'vendor/node/deps/uv/include', + # The `node.h` is using `#include"v8.h"`. + '<(libchromiumcontent_src_dir)/v8/include', +@@ -344,11 +343,12 @@ + '<@(lib_sources_nss)', + ], + 'link_settings': { ++ 'libraries': [ '<@(libchromiumcontent_v8_libraries)' ], + 'ldflags': [ + # Make binary search for libraries under current directory, so we + # don't have to manually set $LD_LIBRARY_PATH: + # http://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable +- '-rpath \$$ORIGIN', ++ '-Wl,-rpath=\$$ORIGIN/', + # Make native module dynamic loading work. + '-rdynamic', + ], +@@ -370,6 +370,9 @@ + { + 'target_name': 'js2asar', + 'type': 'none', ++ 'dependencies': [ ++ 'nodebin' ++ ], + 'actions': [ + { + 'action_name': 'js2asar', +@@ -391,6 +394,7 @@ + 'action': [ + 'python', + 'tools/js2asar.py', ++ '<(PRODUCT_DIR)/nodebin', + '<@(_outputs)', + 'lib', + '<@(_inputs)', +@@ -401,6 +405,9 @@ + { + 'target_name': 'app2asar', + 'type': 'none', ++ 'dependencies': [ ++ 'nodebin' ++ ], + 'actions': [ + { + 'action_name': 'app2asar', +@@ -422,6 +429,7 @@ + 'action': [ + 'python', + 'tools/js2asar.py', ++ '<(PRODUCT_DIR)/nodebin', + '<@(_outputs)', + 'default_app', + '<@(_inputs)', +@@ -447,6 +455,7 @@ + 'dependencies': [ + # depend on this target to ensure the '<(js2c_input_dir)' is created + 'atom_js2c_copy', ++ 'nodebin' + ], + 'variables': { + 'sandbox_args': [ +@@ -476,11 +485,9 @@ + '<(js2c_input_dir)/preload_bundle.js', + ], + 'action': [ +- 'npm', +- 'run', +- '--silent', +- 'browserify', +- '--', ++ 'python', ++ 'tools/browserify.py', ++ '<(PRODUCT_DIR)/nodebin', + '<@(sandbox_args)', + '-o', + '<@(_outputs)', +@@ -495,12 +502,11 @@ + '<(js2c_input_dir)/isolated_bundle.js', + ], + 'action': [ +- 'npm', +- 'run', +- '--silent', +- 'browserify', +- '--', ++ 'python', ++ 'tools/browserify.py', ++ '<(PRODUCT_DIR)/nodebin', + '<@(isolated_args)', ++ 'lib/isolated_renderer/init.js', + '-o', + '<@(_outputs)', + ], +@@ -535,6 +541,42 @@ + } + ], + }, # target atom_js2c ++ { ++ 'target_name': 'nodebin', ++ 'type': 'executable', ++ 'defines': [ ++ 'ELECTRON_NODE_BUILD_NO_ASAR' ++ ], ++ 'sources': [ ++ 'vendor/node/src/node_main.cc', ++ ], ++ 'dependencies': [ ++ 'vendor/node/node.gyp:node', ++ ], ++ 'include_dirs': [ ++ '.', ++ '<(node_v8_path)/include', ++ 'vendor/native_mate', ++ # Include atom_natives.h. ++ '<(SHARED_INTERMEDIATE_DIR)', ++ # Include directories for uv and node. ++ 'vendor/node/src', ++ 'vendor/node/deps/uv/include', ++ '<(libchromiumcontent_src_dir)', ++ # The `node.h` is using `#include"v8.h"`. ++ '<(libchromiumcontent_src_dir)/v8/include', ++ # The `node.h` is using `#include"ares.h"`. ++ 'vendor/node/deps/cares/include', ++ ], ++ 'link_settings': { ++ 'libraries': [ '<@(libchromiumcontent_v8_libraries)' ], ++ 'ldflags': [ ++ '-Wl,-rpath=\$$ORIGIN/', ++ # Make native module dynamic loading work. ++ '-rdynamic', ++ ], ++ }, ++ }, # target nodebin + ], + 'conditions': [ + ['OS=="mac"', { +diff --git a/toolchain.gypi b/toolchain.gypi +index 1c5f8a713..c20ed1a0f 100644 +--- a/toolchain.gypi ++++ b/toolchain.gypi +@@ -16,7 +16,7 @@ + 'arm_neon%': 1, + + # Abosulte path to source root. +- 'source_root%': '<!(node <(DEPTH)/tools/atom_source_root.js)', ++ 'source_root%': '<!(python <(DEPTH)/tools/atom_source_root.py)', + }, + + # Copy conditionally-set variables out one scope. +@@ -40,34 +40,6 @@ + 'mac_sdk%': '<!(python <(DEPTH)/tools/mac/find_sdk.py <(mac_sdk_min))', + }], + +- ['OS=="linux"', { +- 'variables': { +- # The system libdir used for this ABI. +- 'system_libdir%': 'lib', +- +- # Setting the path to sysroot. +- 'conditions': [ +- ['target_arch=="arm"', { +- # sysroot needs to be an absolute path otherwise it generates +- # incorrect results when passed to pkg-config +- 'sysroot%': '<(source_root)/vendor/debian_wheezy_arm-sysroot', +- }], +- ['target_arch=="ia32"', { +- 'sysroot%': '<(source_root)/vendor/debian_wheezy_i386-sysroot', +- }], +- ['target_arch=="x64"', { +- 'sysroot%': '<(source_root)/vendor/debian_wheezy_amd64-sysroot', +- }], +- ], +- }, +- # Copy conditionally-set variables out one scope. +- 'sysroot%': '<(sysroot)', +- 'system_libdir%': '<(system_libdir)', +- +- # Redirect pkg-config to search from sysroot. +- 'pkg-config%': '<(source_root)/tools/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)" "<(system_libdir)"', +- }], +- + # Set default compiler flags depending on ARM version. + ['arm_version==6', { + 'arm_arch%': 'armv6', +@@ -136,23 +108,6 @@ + }, + }], + +- # Setup sysroot environment. +- ['OS=="linux" and target_arch in ["arm", "ia32", "x64"]', { +- 'target_defaults': { +- 'target_conditions': [ +- ['_toolset=="target"', { +- 'cflags': [ +- '--sysroot=<(sysroot)', +- ], +- 'ldflags': [ +- '--sysroot=<(sysroot)', +- '<!(<(source_root)/tools/linux/sysroot_ld_path.sh <(sysroot))', +- ], +- }] +- ], +- }, +- }], # sysroot +- + # Setup cross-compilation on Linux. + ['OS=="linux"', { + 'target_defaults': { +@@ -179,6 +134,35 @@ + 'ldflags': [ + '-m64', + ], ++ 'conditions': [ ++ ['use_lto==1 and clang==0', { ++ 'cflags': [ ++ '-fno-fat-lto-objects', ++ '-fuse-linker-plugin', ++ '-flto=4', ++ '--param=lto-partitions=1', ++ ], ++ 'ldflags': [ ++ '-fno-fat-lto-objects', ++ '-fuse-linker-plugin', ++ '-flto=4', ++ '--param=lto-partitions=1', ++ ], ++ 'arflags': [ ++ '<!@(python <(DEPTH)/tools/ar-flags.py)', ++ ] ++ }], ++ ['use_lto==1 and clang==1', { ++ 'cflags': [ ++ '-flto', ++ '-fwhole-program-vtables' ++ ], ++ 'ldflags': [ ++ '-flto', ++ '-fwhole-program-vtables' ++ ], ++ }], ++ ], + }], # target_arch=="x64" and _toolset=="target" + ['target_arch=="arm" and _toolset=="target"', { + 'conditions': [ +diff --git a/tools/ar-flags.py b/tools/ar-flags.py +new file mode 100644 +index 000000000..80b338a6e +--- /dev/null ++++ b/tools/ar-flags.py +@@ -0,0 +1,15 @@ ++#!/usr/bin/env python ++ ++import os ++import subprocess ++ ++if __name__ == '__main__': ++ cc = os.environ.get('CC', '/usr/bin/cc') ++ gcc_version = subprocess.check_output( ++ [cc, '-dumpversion'], universal_newlines=True).strip(' \n') ++ ++ lto_plugin = os.path.join( ++ '/usr/libexec/gcc/x86_64-pc-linux-gnu/', gcc_version, ++ 'liblto_plugin.so') ++ ++ print('--plugin={}'.format(lto_plugin)) +diff --git a/tools/atom_source_root.py b/tools/atom_source_root.py +new file mode 100644 +index 000000000..316e99701 +--- /dev/null ++++ b/tools/atom_source_root.py +@@ -0,0 +1,5 @@ ++#!/usr/bin/env python ++ ++import os.path ++ ++print(os.path.abspath(os.path.dirname(os.path.dirname(__file__)))) +diff --git a/tools/browserify.py b/tools/browserify.py +new file mode 100644 +index 000000000..15472c953 +--- /dev/null ++++ b/tools/browserify.py +@@ -0,0 +1,24 @@ ++#!/usr/bin/env python ++ ++import os ++import subprocess ++import sys ++ ++SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) ++ ++ ++def main(): ++ node = sys.argv[1] ++ args = sys.argv[2:] ++ ++ call_browserify(node, args) ++ ++ ++def call_browserify(node, args): ++ browserify = os.path.join( ++ SOURCE_ROOT, 'node_modules', '.bin', 'browserify') ++ subprocess.check_call([node, browserify] + args) ++ ++ ++if __name__ == '__main__': ++ sys.exit(main()) +diff --git a/tools/get-endianness.py b/tools/get-endianness.py +new file mode 100644 +index 000000000..31507936f +--- /dev/null ++++ b/tools/get-endianness.py +@@ -0,0 +1,4 @@ ++#!/usr/bin/env python ++ ++import sys ++print(sys.byteorder) +diff --git a/tools/js2asar.py b/tools/js2asar.py +index adad1751e..ca7686893 100755 +--- a/tools/js2asar.py ++++ b/tools/js2asar.py +@@ -11,13 +11,14 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) + + + def main(): +- archive = sys.argv[1] +- folder_name = sys.argv[2] +- source_files = sys.argv[3:] ++ node = sys.argv[1] ++ archive = sys.argv[2] ++ folder_name = sys.argv[3] ++ source_files = sys.argv[4:] + + output_dir = tempfile.mkdtemp() + copy_files(source_files, output_dir) +- call_asar(archive, os.path.join(output_dir, folder_name)) ++ call_asar(node, archive, os.path.join(output_dir, folder_name)) + shutil.rmtree(output_dir) + + +@@ -28,11 +29,11 @@ def copy_files(source_files, output_dir): + shutil.copy2(source_file, output_path) + + +-def call_asar(archive, output_dir): ++def call_asar(node, archive, output_dir): + asar = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'asar') + if sys.platform in ['win32', 'cygwin']: + asar += '.cmd' +- subprocess.check_call([asar, 'pack', output_dir, archive]) ++ subprocess.check_call([node, asar, 'pack', output_dir, archive]) + + + def safe_mkdir(path): +diff --git a/tools/list-browserify-deps.py b/tools/list-browserify-deps.py +index c25007d2a..bbd921bc6 100755 +--- a/tools/list-browserify-deps.py ++++ b/tools/list-browserify-deps.py +@@ -9,7 +9,8 @@ BROWSERIFY = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'browserify') + if sys.platform == 'win32': + BROWSERIFY += '.cmd' + +-deps = subprocess.check_output([BROWSERIFY, '--list'] + sys.argv[1:]) ++deps = subprocess.check_output([BROWSERIFY, '--list'] + sys.argv[1:], ++ universal_newlines=True) + for dep in deps.split('\n'): + if dep: + dep = os.path.relpath(dep, SOURCE_ROOT) +-- +2.14.3 + |