summaryrefslogtreecommitdiff
path: root/dev-util/electron/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-util/electron/files
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-util/electron/files')
-rw-r--r--dev-util/electron/files/chromium-56-gcc4.patch48
-rw-r--r--dev-util/electron/files/chromium-FORTIFY_SOURCE.patch27
-rw-r--r--dev-util/electron/files/chromium-cups-fix.patch12
-rw-r--r--dev-util/electron/files/chromium-disable-widevine.patch9
-rw-r--r--dev-util/electron/files/chromium-ffmpeg-license-r0.patch44
-rw-r--r--dev-util/electron/files/chromium-glibc-2.24.patch15
-rw-r--r--dev-util/electron/files/chromium-icu-58-r0.patch51
-rw-r--r--dev-util/electron/files/chromium-icu-58-r1.patch128
-rw-r--r--dev-util/electron/files/chromium-jinja-fix.patch24
-rw-r--r--dev-util/electron/files/chromium-last-commit-position-r0.patch26
-rw-r--r--dev-util/electron/files/chromium-linker-warnings-r0.patch18
-rw-r--r--dev-util/electron/files/chromium-lto-fixes-r1.patch36
-rw-r--r--dev-util/electron/files/chromium-lto-fixes-r3.patch108
-rw-r--r--dev-util/electron/files/chromium-lto-fixes.patch26
-rw-r--r--dev-util/electron/files/chromium-pdfium-r0.patch17
-rw-r--r--dev-util/electron/files/chromium-remove-gardiner-mod-font-r1.patch13
-rw-r--r--dev-util/electron/files/chromium-remove-gardiner-mod-font.patch13
-rw-r--r--dev-util/electron/files/chromium-shared-v8-r1.patch15
-rw-r--r--dev-util/electron/files/chromium-shared-v8-r2.patch79
-rw-r--r--dev-util/electron/files/chromium-shared-v8.patch15
-rw-r--r--dev-util/electron/files/chromium-snapshot-toolchain-r1.patch23
-rw-r--r--dev-util/electron/files/chromium-system-ffmpeg-r0.patch54
-rw-r--r--dev-util/electron/files/chromium-system-ffmpeg-r2.patch50
-rw-r--r--dev-util/electron/files/chromium-system-ffmpeg-r4.patch48
-rw-r--r--dev-util/electron/files/chromium-system-jinja-r11.patch79
-rw-r--r--dev-util/electron/files/chromium-system-jinja-r7.patch35
-rw-r--r--dev-util/electron/files/chromium-system-jinja-r9.patch71
-rw-r--r--dev-util/electron/files/chromium-system-zlib-r0.patch19
-rw-r--r--dev-util/electron/files/electron-0.36.12-vendor-brightray.patch144
-rw-r--r--dev-util/electron/files/electron-0.36.12-vendor-libchromiumcontent.patch75
-rw-r--r--dev-util/electron/files/electron-0.36.12-vendor-node.patch109
-rw-r--r--dev-util/electron/files/electron-0.36.12.patch257
-rw-r--r--dev-util/electron/files/electron-0.37.8-vendor-brightray.patch143
-rw-r--r--dev-util/electron/files/electron-0.37.8-vendor-libchromiumcontent.patch71
-rw-r--r--dev-util/electron/files/electron-0.37.8-vendor-node.patch105
-rw-r--r--dev-util/electron/files/electron-0.37.8.patch391
-rw-r--r--dev-util/electron/files/electron-1.3.13-vendor-node.patch95
-rw-r--r--dev-util/electron/files/electron-1.3.6-vendor-brightray.patch143
-rw-r--r--dev-util/electron/files/electron-1.3.6-vendor-libchromiumcontent.patch78
-rw-r--r--dev-util/electron/files/electron-1.3.6-vendor-node.patch92
-rw-r--r--dev-util/electron/files/electron-1.3.6.patch422
-rw-r--r--dev-util/electron/files/electron-1.6.11-vendor-brightray.patch163
-rw-r--r--dev-util/electron/files/electron-1.6.11-vendor-libchromiumcontent.patch86
-rw-r--r--dev-util/electron/files/electron-1.6.11-vendor-node.patch80
-rw-r--r--dev-util/electron/files/electron-1.6.11.patch512
-rw-r--r--dev-util/electron/files/electron-vendor-node-external-snapshots-r0.patch116
-rw-r--r--dev-util/electron/files/electron-vendor-node-external-snapshots-r2.patch117
-rw-r--r--dev-util/electron/files/toolchain/BUILD.gn19
48 files changed, 4321 insertions, 0 deletions
diff --git a/dev-util/electron/files/chromium-56-gcc4.patch b/dev-util/electron/files/chromium-56-gcc4.patch
new file mode 100644
index 000000000000..e3188668ce5a
--- /dev/null
+++ b/dev-util/electron/files/chromium-56-gcc4.patch
@@ -0,0 +1,48 @@
+From 888874f761fdd69bb9448b3905627289b5fd66dd Mon Sep 17 00:00:00 2001
+From: floppymaster <floppymaster@gmail.com>
+Date: Thu, 19 Jan 2017 20:20:45 -0800
+Subject: [PATCH] Allow GCC 4.9 to compile Chromium
+
+In order to implicit cast an lvalue to an rvalue when returning
+from a function, the return type and type of variable in the return
+statement previously had to be exactly the same. When this was not
+the case, std::move was required. For instance, when returning a
+std::unique_ptr<Derived> variable in a function with a
+std::unique_ptr<Base> return type, std::move is required.
+
+DR 1579 changed this, and allows for implicitly converting
+to the return type, if the return type has a constructor(T&&), where
+T is the type of the local variable being returned. DR 1579 was
+implemented in GCC 5, but not in GCC 4.9 and below. By explicitly
+qualifying the local variable with std::move, we allow for compiling
+with GCC 4.9 and incur no performance penalty. The code is still
+absolutely correct to the word of C++11.
+
+BUG=chromium:682965
+
+See also:
+* https://bugs.gentoo.org/show_bug.cgi?id=600288
+* https://stackoverflow.com/questions/22018115/converting-stdunique-ptrderived-to-stdunique-ptrbase#comment33375875_22018521
+* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3833.html#1579
+
+Review-Url: https://codereview.webrtc.org/2642053003
+Cr-Commit-Position: refs/heads/master@{#16175}
+---
+ AUTHORS | 1 +
+ webrtc/modules/desktop_capture/screen_capturer_x11.cc | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+--- a/third_party/webrtc/modules/desktop_capture/screen_capturer_x11.cc
++++ b/third_party/webrtc/modules/desktop_capture/screen_capturer_x11.cc
+@@ -412,7 +412,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
+ return nullptr;
+ }
+
+- return capturer;
++ return std::move(capturer);
+ }
+
+ } // namespace webrtc
+--
+2.11.0
+
diff --git a/dev-util/electron/files/chromium-FORTIFY_SOURCE.patch b/dev-util/electron/files/chromium-FORTIFY_SOURCE.patch
new file mode 100644
index 000000000000..c6477d690872
--- /dev/null
+++ b/dev-util/electron/files/chromium-FORTIFY_SOURCE.patch
@@ -0,0 +1,27 @@
+Drop _FORTIFY_SOURCE=2 from defines
+
+Gentoo toolchains enable this by default. Removing this prevents spammy
+warnings about the macro being redefined.
+
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -1069,19 +1069,6 @@ config("chromium_code") {
+ "__STDC_FORMAT_MACROS",
+ ]
+
+- if (!is_debug && !using_sanitizer &&
+- (!is_linux || !is_clang || is_official_build)) {
+- # _FORTIFY_SOURCE isn't really supported by Clang now, see
+- # http://llvm.org/bugs/show_bug.cgi?id=16821.
+- # It seems to work fine with Ubuntu 12 headers though, so use it in
+- # official builds.
+- #
+- # Non-chromium code is not guaranteed to compile cleanly with
+- # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are
+- # disabled, so only do that for Release build.
+- defines += [ "_FORTIFY_SOURCE=2" ]
+- }
+-
+ if (is_mac || is_ios) {
+ cflags_objc = [ "-Wobjc-missing-property-synthesis" ]
+ cflags_objcc = [ "-Wobjc-missing-property-synthesis" ]
diff --git a/dev-util/electron/files/chromium-cups-fix.patch b/dev-util/electron/files/chromium-cups-fix.patch
new file mode 100644
index 000000000000..bbd462a8081e
--- /dev/null
+++ b/dev-util/electron/files/chromium-cups-fix.patch
@@ -0,0 +1,12 @@
+index 8bacfd7..b469a1c 100644
+--- a/printing/backend/print_backend_cups.cc
++++ b/printing/backend/print_backend_cups.cc
+
+@@ -4,6 +4,7 @@
+
+ #include "printing/backend/print_backend_cups.h"
+
++#include <cups/ppd.h>
+ #include <dlfcn.h>
+ #include <errno.h>
+ #include <pthread.h>
diff --git a/dev-util/electron/files/chromium-disable-widevine.patch b/dev-util/electron/files/chromium-disable-widevine.patch
new file mode 100644
index 000000000000..5b166463c88c
--- /dev/null
+++ b/dev-util/electron/files/chromium-disable-widevine.patch
@@ -0,0 +1,9 @@
+--- a/third_party/widevine/cdm/stub/widevine_cdm_version.h
++++ b/third_party/widevine/cdm/stub/widevine_cdm_version.h
+@@ -10,6 +10,5 @@
+
+ #include "third_party/widevine/cdm/widevine_cdm_common.h"
+
+-#define WIDEVINE_CDM_AVAILABLE
+
+ #endif // WIDEVINE_CDM_VERSION_H_
diff --git a/dev-util/electron/files/chromium-ffmpeg-license-r0.patch b/dev-util/electron/files/chromium-ffmpeg-license-r0.patch
new file mode 100644
index 000000000000..8e44cbdbb0ac
--- /dev/null
+++ b/dev-util/electron/files/chromium-ffmpeg-license-r0.patch
@@ -0,0 +1,44 @@
+From 3c9d5afe45bf1c4656b8f630525433f29017cd08 Mon Sep 17 00:00:00 2001
+From: Chris Cunningham <chcunningham@chromium.org>
+Date: Tue, 21 Jun 2016 10:52:45 -0700
+Subject: [PATCH] Avoid ffmpeg licences/credits checking generated autorename_ files.
+
+We generated these renames as a fix for http://crbug.com/495833. The
+generated rename contains no license or credits info and should be
+skipped to avoid confusing license/credits scripts. Care must be
+taken to not also skip the underlying include file from upstream ffmpeg.
+
+Found by: Zoltan Kuscsik
+
+BUG=495833
+
+Change-Id: I3359f4de0281b5f057d4b109ab2a4f31895b5cb1
+---
+
+diff --git a/chromium/scripts/generate_gyp.py b/chromium/scripts/generate_gyp.py
+index c3fd3c0..94c2aad 100755
+--- a/third_party/ffmpeg/chromium/scripts/generate_gyp.py
++++ b/third_party/ffmpeg/chromium/scripts/generate_gyp.py
+@@ -790,6 +790,9 @@
+ # Prefix added to renamed files as part of
+ RENAME_PREFIX = 'autorename'
+
++# Match an absolute path to a generated auotorename_ file.
++RENAME_REGEX = re.compile('.*' + RENAME_PREFIX + '_.+');
++
+ # Content for the rename file. #includes the original file to ensure the two
+ # files stay in sync.
+ RENAME_CONTENT = """// File automatically generated. See crbug.com/495833.
+@@ -1020,6 +1023,12 @@
+ for source in source_set.sources:
+ GetIncludedSources(source, source_dir, sources_to_check)
+
++ # Remove autorename_ files now that we've grabbed their underlying includes.
++ # We generated autorename_ files above and should not consider them for
++ # licensing or credits.
++ sources_to_check = filter(lambda s: not RENAME_REGEX.search(s),
++ sources_to_check)
++
+ if not CheckLicensesForStaticLinking(sources_to_check, source_dir,
+ options.print_licenses):
+ exit('GENERATE FAILED: invalid licenses detected.')
diff --git a/dev-util/electron/files/chromium-glibc-2.24.patch b/dev-util/electron/files/chromium-glibc-2.24.patch
new file mode 100644
index 000000000000..f7bfd816433f
--- /dev/null
+++ b/dev-util/electron/files/chromium-glibc-2.24.patch
@@ -0,0 +1,15 @@
+--- a/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.orig 2017-01-05 20:50:56.329369189 +0000
++++ b/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp 2017-01-05 20:51:32.926099779 +0000
+@@ -242,6 +242,12 @@
+ ASSERT(!(len & kSystemPageOffsetMask));
+ #if OS(POSIX)
+ int ret = madvise(addr, len, MADV_FREE);
++ if (ret != 0 && errno == EINVAL) {
++ // MADV_FREE only works on Linux 4.5+ . If request failed,
++ // retry with older MADV_DONTNEED . Note that MADV_FREE
++ // being defined at compile time doesn't imply runtime support.
++ ret = madvise(addr, len, MADV_DONTNEED);
++ }
+ RELEASE_ASSERT(!ret);
+ #else
+ setSystemPagesInaccessible(addr, len);
diff --git a/dev-util/electron/files/chromium-icu-58-r0.patch b/dev-util/electron/files/chromium-icu-58-r0.patch
new file mode 100644
index 000000000000..ca402f6e4a89
--- /dev/null
+++ b/dev-util/electron/files/chromium-icu-58-r0.patch
@@ -0,0 +1,51 @@
+--- a/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp.orig 2016-11-11 13:21:19.747054059 -0500
++++ b/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp 2016-11-11 13:24:34.474939062 -0500
+@@ -26,6 +26,9 @@
+ #include "wtf/StdLibExtras.h"
+ #include "wtf/text/CharacterNames.h"
+
++#include <unicode/uchar.h>
++#include <unicode/uvernum.h>
++
+ namespace blink {
+
+ unsigned numGraphemeClusters(const String& string)
+@@ -122,13 +125,19 @@
+ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // DEL
+ };
+
++#if U_ICU_VERSION_MAJOR_NUM >= 58
++#define BA_LB_COUNT (U_LB_COUNT - 3)
++#else
++#define BA_LB_COUNT U_LB_COUNT
++#endif
++
+ // Line breaking table for CSS word-break: break-all. This table differs from
+ // asciiLineBreakTable in:
+ // - Indices are Line Breaking Classes defined in UAX#14 Unicode Line Breaking
+ // Algorithm: http://unicode.org/reports/tr14/#DescriptionOfProperties
+ // - 1 indicates additional break opportunities. 0 indicates to fallback to
+ // normal line break, not "prohibit break."
+-static const unsigned char breakAllLineBreakClassTable[][U_LB_COUNT / 8 + 1] = {
++static const unsigned char breakAllLineBreakClassTable[][BA_LB_COUNT / 8 + 1] = {
+ // XX AI AL B2 BA BB BK CB CL CM CR EX GL HY ID IN IS LF NS NU OP PO PR QU SA SG SP SY ZW NL WJ H2 H3 JL JT JV CP CJ HL RI
+ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // XX
+ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // AI
+@@ -178,7 +187,7 @@
+ #undef AL
+
+ static_assert(WTF_ARRAY_LENGTH(asciiLineBreakTable) == asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar + 1, "asciiLineBreakTable should be consistent");
+-static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == U_LB_COUNT, "breakAllLineBreakClassTable should be consistent");
++static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == BA_LB_COUNT, "breakAllLineBreakClassTable should be consistent");
+
+ static inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh)
+ {
+@@ -209,7 +218,7 @@
+
+ static inline bool shouldBreakAfterBreakAll(ULineBreak lastLineBreak, ULineBreak lineBreak)
+ {
+- if (lineBreak >= 0 && lineBreak < U_LB_COUNT && lastLineBreak >= 0 && lastLineBreak < U_LB_COUNT) {
++ if (lineBreak >= 0 && lineBreak < BA_LB_COUNT && lastLineBreak >= 0 && lastLineBreak < BA_LB_COUNT) {
+ const unsigned char* tableRow = breakAllLineBreakClassTable[lastLineBreak];
+ return tableRow[lineBreak / 8] & (1 << (lineBreak % 8));
+ }
diff --git a/dev-util/electron/files/chromium-icu-58-r1.patch b/dev-util/electron/files/chromium-icu-58-r1.patch
new file mode 100644
index 000000000000..9e6e5fd72d70
--- /dev/null
+++ b/dev-util/electron/files/chromium-icu-58-r1.patch
@@ -0,0 +1,128 @@
+From 424584b4984bde7c831f42e9fb47f1ad583a1c46 Mon Sep 17 00:00:00 2001
+From: jshin <jshin@chromium.org>
+Date: Fri, 21 Oct 2016 01:15:50 -0700
+Subject: [PATCH] Update aspirational_scripts per Unicode 9
+
+This is a preparation to update ICU to 58.1.
+Without this change, ICU update CL cannot be tested on
+trybots because a compile will fail due to '#error' checking
+if ICU version is less than 58.
+
+BUG=637001
+TEST=None
+TBR=pkasting@chromium.org
+
+Review-Url: https://chromiumcodereview.appspot.com/2436113003
+Cr-Commit-Position: refs/heads/master@{#426749}
+---
+ components/url_formatter/url_formatter.cc | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/components/url_formatter/url_formatter.cc b/components/url_formatter/url_formatter.cc
+index 4455db3..2b82c0c 100644
+--- a/components/url_formatter/url_formatter.cc
++++ b/components/url_formatter/url_formatter.cc
+@@ -431,7 +431,7 @@
+ // are added to the allowed set. The list has to be updated when a new
+ // version of Unicode is released. The current version is 8.0.0 and ICU 58
+ // will have Unicode 9.0 data.
+-#if U_ICU_VERSION_MAJOR_NUM < 58
++#if U_ICU_VERSION_MAJOR_NUM < 60
+ const icu::UnicodeSet aspirational_scripts(
+ icu::UnicodeString(
+ // Unified Canadian Syllabics
+@@ -445,13 +445,13 @@
+ // Yi
+ "\\uA000-\\uA48C"
+ // Miao
+- "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7F"
++ "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7E"
+ "\\U00016F8F-\\U00016F9F]",
+ -1, US_INV),
+ *status);
+ allowed_set.addAll(aspirational_scripts);
+ #else
+-#error "Update aspirational_scripts per Unicode 9.0"
++#error "Update aspirational_scripts per Unicode 10.0"
+ #endif
+
+ // U+0338 is included in the recommended set, while U+05F4 and U+2027 are in
+--
+2.10.2
+
+From e60b571faa3f14dd9119a6792dccf12f8bf80192 Mon Sep 17 00:00:00 2001
+From: jshin <jshin@chromium.org>
+Date: Fri, 21 Oct 2016 12:20:05 -0700
+Subject: [PATCH] Prepare to upgrade ICU to 58 part 2
+
+U_LB_COUNT is assumed to be 40 in Blink line breaking code, but it's
+43 in ICU 58/Unicode 9.
+
+Three new classes (Emoji Base, Emoji Modifier, and ZWJ) should behave
+identically whether or not 'word-break: break-all' is in effect.
+
+BUG=637001
+TEST=TextBreakIterator.cpp is compiled without an error with ICU 58.
+R=kojii@chromium.org
+CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel
+
+Review-Url: https://chromiumcodereview.appspot.com/2440923002
+Cr-Commit-Position: refs/heads/master@{#426860}
+---
+ .../WebKit/Source/platform/text/TextBreakIterator.cpp | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp b/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
+index 568dc0a..36121eb 100644
+--- a/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
++++ b/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
+@@ -27,6 +27,9 @@
+ #include "wtf/StdLibExtras.h"
+ #include "wtf/text/CharacterNames.h"
+
++#include <unicode/uchar.h>
++#include <unicode/uvernum.h>
++
+ namespace blink {
+
+ unsigned numGraphemeClusters(const String& string)
+@@ -123,13 +126,18 @@
+ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, B(0, 0, 0, 0, 0, 0, 0, 0) }, // DEL
+ };
+
++#if U_ICU_VERSION_MAJOR_NUM >= 58
++#define BA_LB_COUNT (U_LB_COUNT - 3)
++#else
++#define BA_LB_COUNT U_LB_COUNT
++#endif
+ // Line breaking table for CSS word-break: break-all. This table differs from
+ // asciiLineBreakTable in:
+ // - Indices are Line Breaking Classes defined in UAX#14 Unicode Line Breaking
+ // Algorithm: http://unicode.org/reports/tr14/#DescriptionOfProperties
+ // - 1 indicates additional break opportunities. 0 indicates to fallback to
+ // normal line break, not "prohibit break."
+-static const unsigned char breakAllLineBreakClassTable[][U_LB_COUNT / 8 + 1] = {
++static const unsigned char breakAllLineBreakClassTable[][BA_LB_COUNT / 8 + 1] = {
+ // XX AI AL B2 BA BB BK CB CL CM CR EX GL HY ID IN IS LF NS NU OP PO PR QU SA SG SP SY ZW NL WJ H2 H3 JL JT JV CP CJ HL RI
+ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // XX
+ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // AI
+@@ -179,7 +187,7 @@
+ #undef AL
+
+ static_assert(WTF_ARRAY_LENGTH(asciiLineBreakTable) == asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar + 1, "asciiLineBreakTable should be consistent");
+-static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == U_LB_COUNT, "breakAllLineBreakClassTable should be consistent");
++static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == BA_LB_COUNT, "breakAllLineBreakClassTable should be consistent");
+
+ static inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh)
+ {
+@@ -210,7 +218,7 @@
+
+ static inline bool shouldBreakAfterBreakAll(ULineBreak lastLineBreak, ULineBreak lineBreak)
+ {
+- if (lineBreak >= 0 && lineBreak < U_LB_COUNT && lastLineBreak >= 0 && lastLineBreak < U_LB_COUNT) {
++ if (lineBreak >= 0 && lineBreak < BA_LB_COUNT && lastLineBreak >= 0 && lastLineBreak < BA_LB_COUNT) {
+ const unsigned char* tableRow = breakAllLineBreakClassTable[lastLineBreak];
+ return tableRow[lineBreak / 8] & (1 << (lineBreak % 8));
+ }
+--
+2.10.2
diff --git a/dev-util/electron/files/chromium-jinja-fix.patch b/dev-util/electron/files/chromium-jinja-fix.patch
new file mode 100644
index 000000000000..83ac33be31b6
--- /dev/null
+++ b/dev-util/electron/files/chromium-jinja-fix.patch
@@ -0,0 +1,24 @@
+--- a/third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp
+--- b/third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp
+@@ -53,21 +53,10 @@
+ 'type': 'none',
+ 'dependencies': ['protocol_version'],
+ 'variables': {
+- 'conditions': [
+- ['debug_devtools=="node"', {
+- # Node build
+- 'jinja_module_files': [
+- '../../deps/jinja2/jinja2/__init__.py',
+- '../../deps/markupsafe/markupsafe/__init__.py', # jinja2 dep
+- ],
+- }, {
+ 'jinja_module_files': [
+ '<(DEPTH)/third_party/jinja2/__init__.py',
+ '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
+ ],
+- }
+- ],
+- ],
+ },
+ 'actions': [
+ {
diff --git a/dev-util/electron/files/chromium-last-commit-position-r0.patch b/dev-util/electron/files/chromium-last-commit-position-r0.patch
new file mode 100644
index 000000000000..344ed4c7deb7
--- /dev/null
+++ b/dev-util/electron/files/chromium-last-commit-position-r0.patch
@@ -0,0 +1,26 @@
+--- tools/gn/gn_main.cc.orig 2015-11-12 11:49:56.260549036 +0000
++++ tools/gn/gn_main.cc 2015-11-12 11:50:14.780931485 +0000
+@@ -11,13 +11,7 @@
+ #include "tools/gn/standard_out.h"
+ #include "tools/gn/switches.h"
+
+-// Only the GN-generated build makes this header for now.
+-// TODO(brettw) consider adding this if we need it in GYP.
+-#if defined(GN_BUILD)
+-#include "tools/gn/last_commit_position.h"
+-#else
+ #define LAST_COMMIT_POSITION "UNKNOWN"
+-#endif
+
+ namespace {
+
+--- tools/gn/BUILD.gn.orig 2015-11-12 11:50:43.513524769 +0000
++++ tools/gn/BUILD.gn 2015-11-12 11:50:57.697817632 +0000
+@@ -227,7 +227,6 @@
+
+ deps = [
+ ":gn_lib",
+- ":last_commit_position",
+ "//base",
+ "//build/config/sanitizers:deps",
+ ]
diff --git a/dev-util/electron/files/chromium-linker-warnings-r0.patch b/dev-util/electron/files/chromium-linker-warnings-r0.patch
new file mode 100644
index 000000000000..97d5e1670bdb
--- /dev/null
+++ b/dev-util/electron/files/chromium-linker-warnings-r0.patch
@@ -0,0 +1,18 @@
+--- build/config/compiler/BUILD.gn.orig 2016-05-30 13:50:15.341749039 +0000
++++ build/config/compiler/BUILD.gn 2016-05-30 13:50:30.502061407 +0000
+@@ -203,15 +203,6 @@
+ cflags += [ "-fstack-protector" ]
+ }
+ }
+-
+- # Linker warnings.
+- if (!(is_chromeos && current_cpu == "arm") &&
+- !(is_android && use_order_profiling) && !is_mac && !is_ios) {
+- # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580
+- # TODO(lizeb,pasko): Fix link errors when linking with order_profiling=1
+- # crbug.com/485542
+- ldflags += [ "-Wl,--fatal-warnings" ]
+- }
+ }
+
+ if (is_clang && is_debug) {
diff --git a/dev-util/electron/files/chromium-lto-fixes-r1.patch b/dev-util/electron/files/chromium-lto-fixes-r1.patch
new file mode 100644
index 000000000000..b8bd8558b520
--- /dev/null
+++ b/dev-util/electron/files/chromium-lto-fixes-r1.patch
@@ -0,0 +1,36 @@
+diff --git a/build/common.gypi.orig b/build/common.gypi
+index cce7b3c..3b905c0 100644
+--- a/build/common.gypi.orig
++++ b/build/common.gypi
+@@ -6096,7 +6096,7 @@
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'ldflags': [
+- '-flto=32',
++ '-flto=4'
+ ],
+ }],
+ ],
+@@ -6248,7 +6248,7 @@
+ },
+ }],
+ # TODO(pcc): Make these flags work correctly with CFI.
+- ['use_lto!=0 and cfi_vptr==0', {
++ ['use_lto!=0 and cfi_vptr==0 and clang==1', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+
+diff --git a/build/android/disable_gcc_lto.gypi.orig b/build/android/disable_gcc_lto.gypi
+index a733c7a..57570f8 100644
+--- a/build/android/disable_gcc_lto.gypi.orig
++++ b/build/android/disable_gcc_lto.gypi
+@@ -8,7 +8,7 @@
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'conditions': [
+- ['OS=="android" and clang==0 and (use_lto==1 or use_lto_o2==1)', {
++ ['(OS=="android" or OS=="linux") and clang==0 and (use_lto==1 or use_lto_o2==1)', {
+ 'cflags!': [
+ '-flto',
+ '-ffat-lto-objects',
diff --git a/dev-util/electron/files/chromium-lto-fixes-r3.patch b/dev-util/electron/files/chromium-lto-fixes-r3.patch
new file mode 100644
index 000000000000..10493e6fd388
--- /dev/null
+++ b/dev-util/electron/files/chromium-lto-fixes-r3.patch
@@ -0,0 +1,108 @@
+From 2f2028a19fd12477fcd9050ea354174f33b68b46 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Mon, 21 Aug 2017 10:16:44 -0400
+Subject: [PATCH] LTO fixes
+
+---
+ build/config/compiler/BUILD.gn | 35 +++++++++++++++++++++++++----------
+ build/config/posix/BUILD.gn | 2 +-
+ build/toolchain/gcc_ar_wrapper.py | 12 +++++++++++-
+ 3 files changed, 37 insertions(+), 12 deletions(-)
+
+diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
+index d0510b8..583f186 100644
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -448,20 +448,35 @@ config("compiler") {
+ } else {
+ # Note: ThinLTO does not currently have this feature implemented
+ # For Full LTO, it provides a measurable runtime speedup of Chrome.
+- cflags += [
+- "-flto",
+- "-fwhole-program-vtables",
+- ]
+- ldflags += [
+- "-flto",
+- "-fwhole-program-vtables",
+- ]
++ if (is_clang) {
++ cflags += [
++ "-flto",
++ "-fwhole-program-vtables"
++ ]
++ ldflags += [
++ "-flto",
++ "-fwhole-program-vtables"
++ ]
++ } else {
++ cflags += [
++ "-flto=4",
++ "-fno-fat-lto-objects",
++ "-fuse-linker-plugin",
++ "--param=lto-partitions=1",
++ ]
++ ldflags += [
++ "-flto=4",
++ "-fno-fat-lto-objects",
++ "-fuse-linker-plugin",
++ "--param=lto-partitions=1",
++ ]
++ }
+
+ # Apply a lower LTO optimization level as the default is too slow.
+ if (is_linux) {
+ if (use_lld) {
+ ldflags += [ "-Wl,--lto-O1" ]
+- } else {
++ } else if (is_clang) {
+ ldflags += [ "-Wl,-plugin-opt,O1" ]
+ }
+ } else if (is_mac) {
+@@ -478,7 +493,7 @@ config("compiler") {
+ # targeting ARM, without this flag, LTO produces a .text section that is
+ # larger than the maximum call displacement, preventing the linker from
+ # relocating calls (http://llvm.org/PR22999).
+- if (is_linux) {
++ if (is_linux && is_clang) {
+ ldflags += [ "-Wl,-plugin-opt,-function-sections" ]
+ }
+ }
+diff --git a/build/config/posix/BUILD.gn b/build/config/posix/BUILD.gn
+index d7e917a..fc68864 100644
+--- a/build/config/posix/BUILD.gn
++++ b/build/config/posix/BUILD.gn
+@@ -21,7 +21,7 @@ config("compiler") {
+ if ((allow_posix_link_time_opt || is_cfi) && !is_nacl) {
+ arflags = [
+ "--plugin",
+- rebase_path("$clang_base_path/lib/LLVMgold.so", root_build_dir),
++ "auto"
+ ]
+ }
+ }
+diff --git a/build/toolchain/gcc_ar_wrapper.py b/build/toolchain/gcc_ar_wrapper.py
+index de53df0..39c7b56 100755
+--- a/build/toolchain/gcc_ar_wrapper.py
++++ b/build/toolchain/gcc_ar_wrapper.py
+@@ -47,7 +47,17 @@ def main():
+
+ command = [args.ar, args.operation]
+ if args.plugin is not None:
+- command += ['--plugin', args.plugin]
++ if args.plugin == 'auto':
++ gcc = os.environ.get('CC', '/usr/bin/cc')
++ gcc_ver = subprocess.check_output([gcc, '-dumpversion'],
++ universal_newlines=True)
++ gcc_ver = gcc_ver.strip(' \n')
++ plugin = '/usr/libexec/gcc/x86_64-pc-linux-gnu/{}/liblto_plugin.so'. \
++ format(gcc_ver)
++ else:
++ plugin = args.plugin
++
++ command += ['--plugin', plugin]
+ command.append(args.output)
+ command += args.inputs
+
+--
+2.14.1
+
diff --git a/dev-util/electron/files/chromium-lto-fixes.patch b/dev-util/electron/files/chromium-lto-fixes.patch
new file mode 100644
index 000000000000..7de3df1b26f6
--- /dev/null
+++ b/dev-util/electron/files/chromium-lto-fixes.patch
@@ -0,0 +1,26 @@
+diff --git a/build/common.gypi.orig b/build/common.gypi
+index cce7b3c..3b905c0 100644
+--- a/build/common.gypi.orig
++++ b/build/common.gypi
+@@ -6096,7 +6096,7 @@
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'ldflags': [
+- '-flto=32',
++ '-flto=4'
+ ],
+ }],
+ ],
+diff --git a/build/android/disable_gcc_lto.gypi.orig b/build/android/disable_gcc_lto.gypi
+index a733c7a..57570f8 100644
+--- a/build/android/disable_gcc_lto.gypi.orig
++++ b/build/android/disable_gcc_lto.gypi
+@@ -8,7 +8,7 @@
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'conditions': [
+- ['OS=="android" and clang==0 and (use_lto==1 or use_lto_o2==1)', {
++ ['(OS=="android" or OS=="linux") and clang==0 and (use_lto==1 or use_lto_o2==1)', {
+ 'cflags!': [
+ '-flto',
+ '-ffat-lto-objects',
diff --git a/dev-util/electron/files/chromium-pdfium-r0.patch b/dev-util/electron/files/chromium-pdfium-r0.patch
new file mode 100644
index 000000000000..2ba268467ef8
--- /dev/null
+++ b/dev-util/electron/files/chromium-pdfium-r0.patch
@@ -0,0 +1,17 @@
+--- third_party/pdfium/xfa/fxbarcode/utils.h.orig 2016-05-30 10:24:54.071773744 +0000
++++ third_party/pdfium/xfa/fxbarcode/utils.h 2016-05-30 10:25:15.808219373 +0000
+@@ -26,12 +26,10 @@
+ #endif
+ #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
+ #define FXSYS_isnan(x) _isnan(x)
+-#elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_)
++#elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ || \
++ _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_)
+ #include <cmath>
+ #define FXSYS_isnan(x) std::isnan(x)
+-#elif(_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_)
+-#include <math.h>
+-#define FXSYS_isnan(x) isnan(x)
+ #endif
+ #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
+ #define FXSYS_nan() (std::numeric_limits<float>::quiet_NaN())
diff --git a/dev-util/electron/files/chromium-remove-gardiner-mod-font-r1.patch b/dev-util/electron/files/chromium-remove-gardiner-mod-font-r1.patch
new file mode 100644
index 000000000000..f59549094107
--- /dev/null
+++ b/dev-util/electron/files/chromium-remove-gardiner-mod-font-r1.patch
@@ -0,0 +1,13 @@
+diff --git a/components/test_runner/BUILD.gn~ b/components/test_runner/BUILD.gn
+index 3ac8955..6a968cb 100644
+--- a/components/test_runner/BUILD.gn~
++++ b/components/test_runner/BUILD.gn
+@@ -155,8 +155,6 @@ if (use_x11) {
+ copy("copy_x11_fonts") {
+ visibility = [ ":*" ]
+ sources = [
+- "//third_party/gardiner_mod/GardinerModBug.ttf",
+- "//third_party/gardiner_mod/GardinerModCat.ttf",
+ "resources/fonts/fonts.conf",
+ ]
+ outputs = [
diff --git a/dev-util/electron/files/chromium-remove-gardiner-mod-font.patch b/dev-util/electron/files/chromium-remove-gardiner-mod-font.patch
new file mode 100644
index 000000000000..cf1955ffbfd2
--- /dev/null
+++ b/dev-util/electron/files/chromium-remove-gardiner-mod-font.patch
@@ -0,0 +1,13 @@
+diff --git a/test_runner.gyp b/test_runner.gyp
+index 30ffa75..8838bdf 100644
+--- a/components/test_runner/test_runner.gyp
++++ b/components/test_runner/test_runner.gyp
+@@ -162,8 +162,6 @@
+ 'files': [
+ 'resources/fonts/AHEM____.TTF',
+ 'resources/fonts/fonts.conf',
+- '../../third_party/gardiner_mod/GardinerModBug.ttf',
+- '../../third_party/gardiner_mod/GardinerModCat.ttf',
+ ]
+ }],
+ }],
diff --git a/dev-util/electron/files/chromium-shared-v8-r1.patch b/dev-util/electron/files/chromium-shared-v8-r1.patch
new file mode 100644
index 000000000000..eb4d998d9b03
--- /dev/null
+++ b/dev-util/electron/files/chromium-shared-v8-r1.patch
@@ -0,0 +1,15 @@
+diff --git a/v8/src/v8.gyp.orig b/v8/src/v8.gyp
+index bcb5801..3162456 100644
+--- a/v8/src/v8.gyp.orig
++++ b/v8/src/v8.gyp
+@@ -48,8 +48,8 @@
+ }, {
+ 'toolsets': ['target'],
+ }],
+- ['component=="shared_library"', {
+- 'type': '<(component)',
++ ['v8_target_type=="shared_library"', {
++ 'type': 'shared_library',
+ 'sources': [
+ # Note: on non-Windows we still build this file so that gyp
+ # has some sources to link into the component.
diff --git a/dev-util/electron/files/chromium-shared-v8-r2.patch b/dev-util/electron/files/chromium-shared-v8-r2.patch
new file mode 100644
index 000000000000..475da8193a92
--- /dev/null
+++ b/dev-util/electron/files/chromium-shared-v8-r2.patch
@@ -0,0 +1,79 @@
+diff --git a/v8/BUILD.gn.orig b/v8/BUILD.gn
+index 8587356..4365e03 100644
+--- a/v8/BUILD.gn
++++ b/v8/BUILD.gn
+@@ -113,7 +113,7 @@ config("internal_config") {
+
+ include_dirs = [ "." ]
+
+- if (is_component_build) {
++ if (is_component_build || is_electron_build) {
+ defines = [ "BUILDING_V8_SHARED" ]
+ }
+ }
+@@ -127,14 +127,14 @@ config("internal_config_base") {
+ # This config should be applied to code using the libplatform.
+ config("libplatform_config") {
+ include_dirs = [ "include" ]
+- if (is_component_build) {
++ if (is_component_build || is_electron_build) {
+ defines = [ "USING_V8_PLATFORM_SHARED" ]
+ }
+ }
+
+ # This config should be applied to code using the libbase.
+ config("libbase_config") {
+- if (is_component_build) {
++ if (is_component_build || is_electron_build) {
+ defines = [ "USING_V8_BASE_SHARED" ]
+ }
+ libs = []
+@@ -151,7 +151,7 @@ config("libsampler_config") {
+ # This config should only be applied to code using V8 and not any V8 code
+ # itself.
+ config("external_config") {
+- if (is_component_build) {
++ if (is_component_build || is_electron_build) {
+ defines = [ "USING_V8_SHARED" ]
+ }
+ include_dirs = [ "include" ]
+@@ -2265,7 +2265,7 @@ v8_component("v8_libbase") {
+
+ defines = []
+
+- if (is_component_build) {
++ if (is_component_build || is_electron_build) {
+ defines = [ "BUILDING_V8_BASE_SHARED" ]
+ }
+
+@@ -2355,7 +2355,7 @@ v8_component("v8_libplatform") {
+
+ configs = [ ":internal_config_base" ]
+
+- if (is_component_build) {
++ if (is_component_build || is_electron_build) {
+ defines = [ "BUILDING_V8_PLATFORM_SHARED" ]
+ }
+
+@@ -2498,7 +2498,7 @@ group("gn_all") {
+ }
+ }
+
+-if (is_component_build) {
++if (is_component_build || is_electron_build) {
+ v8_component("v8") {
+ sources = [
+ "src/v8dll-main.cc",
+diff --git a/v8/src/inspector/BUILD.gn b/v8/src/inspector/BUILD.gn
+index 6ebb91c..b6a2489 100644
+--- a/v8/src/inspector/BUILD.gn
++++ b/v8/src/inspector/BUILD.gn
+@@ -106,7 +106,7 @@ config("inspector_config") {
+ "/wd4996", # Deprecated function call.
+ ]
+ }
+- if (is_component_build) {
++ if (is_component_build || is_electron_build) {
+ defines = [ "BUILDING_V8_SHARED" ]
+ }
+ }
diff --git a/dev-util/electron/files/chromium-shared-v8.patch b/dev-util/electron/files/chromium-shared-v8.patch
new file mode 100644
index 000000000000..67d97c8b3974
--- /dev/null
+++ b/dev-util/electron/files/chromium-shared-v8.patch
@@ -0,0 +1,15 @@
+diff --git a/v8/tools/gyp/v8.gyp.orig b/v8/tools/gyp/v8.gyp
+index bcb5801..3162456 100644
+--- a/v8/tools/gyp/v8.gyp.orig
++++ b/v8/tools/gyp/v8.gyp
+@@ -48,8 +48,8 @@
+ }, {
+ 'toolsets': ['target'],
+ }],
+- ['component=="shared_library"', {
+- 'type': '<(component)',
++ ['v8_target_type=="shared_library"', {
++ 'type': 'shared_library',
+ 'sources': [
+ # Note: on non-Windows we still build this file so that gyp
+ # has some sources to link into the component.
diff --git a/dev-util/electron/files/chromium-snapshot-toolchain-r1.patch b/dev-util/electron/files/chromium-snapshot-toolchain-r1.patch
new file mode 100644
index 000000000000..56f35b303077
--- /dev/null
+++ b/dev-util/electron/files/chromium-snapshot-toolchain-r1.patch
@@ -0,0 +1,23 @@
+--- v8/snapshot_toolchain.gni.orig 2016-01-07 15:47:46.772435180 +0000
++++ v8/snapshot_toolchain.gni 2016-01-07 15:48:06.144841801 +0000
+@@ -28,19 +28,4 @@
+ # The snapshot needs to be compiled for the host, but compiled with
+ # a toolchain that matches the bit-width of the target.
+
+-# TODO(GYP): For now we only support 32-bit little-endian target builds from an
+-# x64 Linux host. Eventually we need to support all of the host/target
+-# configurations v8 runs on.
+-if (host_cpu == "x64" && host_os == "linux") {
+- if (target_cpu == "arm" || target_cpu == "mipsel" || target_cpu == "x86") {
+- snapshot_toolchain = "//build/toolchain/linux:clang_x86"
+- } else if (target_cpu == "x64" || target_cpu == "arm64" || target_cpu == "mips64el") {
+- snapshot_toolchain = "//build/toolchain/linux:clang_x64"
+- } else {
+- assert(false, "Need environment for this arch: $target_cpu")
+- }
+-} else {
+- snapshot_toolchain = default_toolchain
+-}
+-
+-
++snapshot_toolchain = default_toolchain
diff --git a/dev-util/electron/files/chromium-system-ffmpeg-r0.patch b/dev-util/electron/files/chromium-system-ffmpeg-r0.patch
new file mode 100644
index 000000000000..667e0ecb2a72
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-ffmpeg-r0.patch
@@ -0,0 +1,54 @@
+diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
+index 677bd76..23a21f8 100644
+--- a/media/ffmpeg/ffmpeg_common.h
++++ b/media/ffmpeg/ffmpeg_common.h
+@@ -19,20 +19,12 @@
+
+ // Include FFmpeg header files.
+ extern "C" {
+-// Disable deprecated features which result in spammy compile warnings. This
+-// list of defines must mirror those in the 'defines' section of the ffmpeg.gyp
+-// file or the headers below will generate different structures.
+-#define FF_API_PIX_FMT_DESC 0
+-#define FF_API_OLD_DECODE_AUDIO 0
+-#define FF_API_DESTRUCT_PACKET 0
+-#define FF_API_GET_BUFFER 0
+
+ // Temporarily disable possible loss of data warning.
+ // TODO(scherkus): fix and upstream the compiler warnings.
+ MSVC_PUSH_DISABLE_WARNING(4244);
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+-#include <libavformat/internal.h>
+ #include <libavformat/avio.h>
+ #include <libavutil/avutil.h>
+ #include <libavutil/imgutils.h>
+diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
+index 155e980..7ba327a 100644
+--- a/media/filters/ffmpeg_demuxer.cc
++++ b/media/filters/ffmpeg_demuxer.cc
+@@ -966,24 +966,6 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
+ // If no estimate is found, the stream entry will be kInfiniteDuration().
+ std::vector<base::TimeDelta> start_time_estimates(format_context->nb_streams,
+ kInfiniteDuration());
+- const AVFormatInternal* internal = format_context->internal;
+- if (internal && internal->packet_buffer &&
+- format_context->start_time != static_cast<int64>(AV_NOPTS_VALUE)) {
+- struct AVPacketList* packet_buffer = internal->packet_buffer;
+- while (packet_buffer != internal->packet_buffer_end) {
+- DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index),
+- start_time_estimates.size());
+- const AVStream* stream =
+- format_context->streams[packet_buffer->pkt.stream_index];
+- if (packet_buffer->pkt.pts != static_cast<int64>(AV_NOPTS_VALUE)) {
+- const base::TimeDelta packet_pts =
+- ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts);
+- if (packet_pts < start_time_estimates[stream->index])
+- start_time_estimates[stream->index] = packet_pts;
+- }
+- packet_buffer = packet_buffer->next;
+- }
+- }
+
+ AVStream* audio_stream = NULL;
+ AudioDecoderConfig audio_config;
diff --git a/dev-util/electron/files/chromium-system-ffmpeg-r2.patch b/dev-util/electron/files/chromium-system-ffmpeg-r2.patch
new file mode 100644
index 000000000000..8d67ef3898df
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-ffmpeg-r2.patch
@@ -0,0 +1,50 @@
+--- a/media/ffmpeg/ffmpeg_common.h 2015-11-27 12:01:56.155462264 +0000
++++ b/media/ffmpeg/ffmpeg_common.h 2015-11-27 12:03:03.348846300 +0000
+@@ -19,10 +19,6 @@
+
+ // Include FFmpeg header files.
+ extern "C" {
+-// Disable deprecated features which result in spammy compile warnings. This
+-// list of defines must mirror those in the 'defines' section of BUILD.gn file &
+-// ffmpeg.gyp file or the headers below will generate different structures!
+-#define FF_API_CONVERGENCE_DURATION 0
+ // Upstream libavcodec/utils.c still uses the deprecated
+ // av_dup_packet(), causing deprecation warnings.
+ // The normal fix for such things is to disable the feature as below,
+@@ -36,7 +32,6 @@
+ MSVC_PUSH_DISABLE_WARNING(4244);
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+-#include <libavformat/internal.h>
+ #include <libavformat/avio.h>
+ #include <libavutil/avutil.h>
+ #include <libavutil/imgutils.h>
+diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
+index 155e980..7ba327a 100644
+--- a/media/filters/ffmpeg_demuxer.cc
++++ b/media/filters/ffmpeg_demuxer.cc
+@@ -1034,24 +1034,6 @@
+ // If no estimate is found, the stream entry will be kInfiniteDuration().
+ std::vector<base::TimeDelta> start_time_estimates(format_context->nb_streams,
+ kInfiniteDuration());
+- const AVFormatInternal* internal = format_context->internal;
+- if (internal && internal->packet_buffer &&
+- format_context->start_time != static_cast<int64_t>(AV_NOPTS_VALUE)) {
+- struct AVPacketList* packet_buffer = internal->packet_buffer;
+- while (packet_buffer != internal->packet_buffer_end) {
+- DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index),
+- start_time_estimates.size());
+- const AVStream* stream =
+- format_context->streams[packet_buffer->pkt.stream_index];
+- if (packet_buffer->pkt.pts != static_cast<int64_t>(AV_NOPTS_VALUE)) {
+- const base::TimeDelta packet_pts =
+- ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts);
+- if (packet_pts < start_time_estimates[stream->index])
+- start_time_estimates[stream->index] = packet_pts;
+- }
+- packet_buffer = packet_buffer->next;
+- }
+- }
+
+ AVStream* audio_stream = NULL;
+ AudioDecoderConfig audio_config;
diff --git a/dev-util/electron/files/chromium-system-ffmpeg-r4.patch b/dev-util/electron/files/chromium-system-ffmpeg-r4.patch
new file mode 100644
index 000000000000..3abfc163e8a2
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-ffmpeg-r4.patch
@@ -0,0 +1,48 @@
+--- a/media/ffmpeg/ffmpeg_common.h.orig 2016-09-09 13:16:07.757294768 +0000
++++ b/media/ffmpeg/ffmpeg_common.h 2016-09-09 13:16:41.705989273 +0000
+@@ -22,10 +22,6 @@
+
+ // Include FFmpeg header files.
+ extern "C" {
+-// Disable deprecated features which result in spammy compile warnings. This
+-// list of defines must mirror those in the 'defines' section of FFmpeg's
+-// BUILD.gn file or the headers below will generate different structures!
+-#define FF_API_CONVERGENCE_DURATION 0
+ // Upstream libavcodec/utils.c still uses the deprecated
+ // av_dup_packet(), causing deprecation warnings.
+ // The normal fix for such things is to disable the feature as below,
+@@ -35,7 +35,6 @@
+ MSVC_PUSH_DISABLE_WARNING(4244);
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+-#include <libavformat/internal.h>
+ #include <libavformat/avio.h>
+ #include <libavutil/avutil.h>
+ #include <libavutil/imgutils.h>
+--- a/media/filters/ffmpeg_demuxer.cc.orig 2016-09-09 14:21:40.185828912 +0000
++++ b/media/filters/ffmpeg_demuxer.cc 2016-09-09 14:21:52.894089352 +0000
+@@ -1185,24 +1185,6 @@
+ // If no estimate is found, the stream entry will be kInfiniteDuration.
+ std::vector<base::TimeDelta> start_time_estimates(format_context->nb_streams,
+ kInfiniteDuration);
+- const AVFormatInternal* internal = format_context->internal;
+- if (internal && internal->packet_buffer &&
+- format_context->start_time != static_cast<int64_t>(AV_NOPTS_VALUE)) {
+- struct AVPacketList* packet_buffer = internal->packet_buffer;
+- while (packet_buffer != internal->packet_buffer_end) {
+- DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index),
+- start_time_estimates.size());
+- const AVStream* stream =
+- format_context->streams[packet_buffer->pkt.stream_index];
+- if (packet_buffer->pkt.pts != static_cast<int64_t>(AV_NOPTS_VALUE)) {
+- const base::TimeDelta packet_pts =
+- ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts);
+- if (packet_pts < start_time_estimates[stream->index])
+- start_time_estimates[stream->index] = packet_pts;
+- }
+- packet_buffer = packet_buffer->next;
+- }
+- }
+
+ std::unique_ptr<MediaTracks> media_tracks(new MediaTracks());
+
diff --git a/dev-util/electron/files/chromium-system-jinja-r11.patch b/dev-util/electron/files/chromium-system-jinja-r11.patch
new file mode 100644
index 000000000000..0b3c9b72478b
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-jinja-r11.patch
@@ -0,0 +1,79 @@
+--- third_party/WebKit/Source/bindings/scripts/scripts.gyp.orig 2014-08-19 09:55:10.330972228 +0000
++++ third_party/WebKit/Source/bindings/scripts/scripts.gyp 2014-08-19 09:55:26.387286232 +0000
+@@ -54,7 +54,6 @@
+ 'actions': [{
+ 'action_name': 'cache_jinja_templates',
+ 'inputs': [
+- '<@(jinja_module_files)',
+ 'code_generator_v8.py',
+ '<@(code_generator_template_files)',
+ ],
+--- third_party/WebKit/Source/build/scripts/scripts.gypi.orig 2014-08-19 10:00:00.216521733 +0000
++++ third_party/WebKit/Source/build/scripts/scripts.gypi 2014-08-19 10:00:11.464735099 +0000
+@@ -2,10 +2,6 @@
+ {
+ 'variables': {
+ 'scripts_for_in_files': [
+- # jinja2/__init__.py contains version string, so sufficient as
+- # dependency for whole jinja2 package
+- '<(DEPTH)/third_party/jinja2/__init__.py',
+- '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
+ 'hasher.py',
+ 'in_file.py',
+ 'in_generator.py',
+--- third_party/WebKit/Source/bindings/scripts/scripts.gypi.orig 2014-08-19 10:53:02.824618979 +0000
++++ third_party/WebKit/Source/bindings/scripts/scripts.gypi 2014-08-19 10:53:20.784957370 +0000
+@@ -12,9 +12,6 @@
+ '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
+ ],
+ 'idl_lexer_parser_files': [
+- # PLY (Python Lex-Yacc)
+- '<(DEPTH)/third_party/ply/lex.py',
+- '<(DEPTH)/third_party/ply/yacc.py',
+ # Web IDL lexer/parser (base parser)
+ '<(DEPTH)/tools/idl_parser/idl_lexer.py',
+ '<(DEPTH)/tools/idl_parser/idl_node.py',
+--- third_party/WebKit/Source/build/scripts/scripts.gni.orig 2016-06-02 09:54:28.510152077 +0000
++++ third_party/WebKit/Source/build/scripts/scripts.gni 2016-06-02 09:54:50.966612510 +0000
+@@ -9,10 +9,6 @@
+ _scripts_dir = "//third_party/WebKit/Source/build/scripts"
+
+ scripts_for_in_files = [
+- # jinja2/__init__.py contains version string, so sufficient as
+- # dependency for whole jinja2 package
+- "//third_party/jinja2/__init__.py",
+- "//third_party/markupsafe/__init__.py", # jinja2 dep
+ "$_scripts_dir/hasher.py",
+ "$_scripts_dir/in_file.py",
+ "$_scripts_dir/in_generator.py",
+--- third_party/WebKit/Source/bindings/scripts/BUILD.gn.orig 2016-06-02 10:03:01.100658943 +0000
++++ third_party/WebKit/Source/bindings/scripts/BUILD.gn 2016-06-02 10:03:13.240907715 +0000
+@@ -36,7 +36,7 @@
+ action("cached_jinja_templates") {
+ script = "code_generator_v8.py"
+
+- inputs = jinja_module_files + [ "code_generator_v8.py" ] +
++ inputs = [ "code_generator_v8.py" ] +
+ code_generator_template_files
+
+ # Dummy file to track dependency.
+--- third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp.orig 2016-06-03 12:31:49.844954196 +0000
++++ third_party/WebKit/Source/platform/v8_inspector/v8_inspector.gyp 2016-06-03 12:32:01.869198425 +0000
+@@ -60,7 +60,6 @@
+ {
+ 'action_name': 'generateV8InspectorProtocolBackendSources',
+ 'inputs': [
+- '<@(jinja_module_files)',
+ # The python script in action below.
+ '../inspector_protocol/CodeGenerator.py',
+ # Input files for the script.
+--- third_party/WebKit/Source/core/inspector/inspector.gyp.orig 2016-06-03 12:38:20.712891692 +0000
++++ third_party/WebKit/Source/core/inspector/inspector.gyp 2016-06-03 12:38:31.197104557 +0000
+@@ -52,7 +52,6 @@
+ {
+ 'action_name': 'generateInspectorProtocolBackendSources',
+ 'inputs': [
+- '<@(jinja_module_files)',
+ # The python script in action below.
+ '../../platform/inspector_protocol/CodeGenerator.py',
+ # Input files for the script.
diff --git a/dev-util/electron/files/chromium-system-jinja-r7.patch b/dev-util/electron/files/chromium-system-jinja-r7.patch
new file mode 100644
index 000000000000..fe28e12c333c
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-jinja-r7.patch
@@ -0,0 +1,35 @@
+--- third_party/WebKit/Source/bindings/scripts/scripts.gyp.orig 2014-08-19 09:55:10.330972228 +0000
++++ third_party/WebKit/Source/bindings/scripts/scripts.gyp 2014-08-19 09:55:26.387286232 +0000
+@@ -54,7 +54,6 @@
+ 'actions': [{
+ 'action_name': 'cache_jinja_templates',
+ 'inputs': [
+- '<@(jinja_module_files)',
+ 'code_generator_v8.py',
+ '<@(code_generator_template_files)',
+ ],
+--- third_party/WebKit/Source/build/scripts/scripts.gypi.orig 2014-08-19 10:00:00.216521733 +0000
++++ third_party/WebKit/Source/build/scripts/scripts.gypi 2014-08-19 10:00:11.464735099 +0000
+@@ -2,10 +2,6 @@
+ {
+ 'variables': {
+ 'scripts_for_in_files': [
+- # jinja2/__init__.py contains version string, so sufficient as
+- # dependency for whole jinja2 package
+- '<(DEPTH)/third_party/jinja2/__init__.py',
+- '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
+ 'hasher.py',
+ 'in_file.py',
+ 'in_generator.py',
+--- third_party/WebKit/Source/bindings/scripts/scripts.gypi.orig 2014-08-19 10:53:02.824618979 +0000
++++ third_party/WebKit/Source/bindings/scripts/scripts.gypi 2014-08-19 10:53:20.784957370 +0000
+@@ -12,9 +12,6 @@
+ '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
+ ],
+ 'idl_lexer_parser_files': [
+- # PLY (Python Lex-Yacc)
+- '<(DEPTH)/third_party/ply/lex.py',
+- '<(DEPTH)/third_party/ply/yacc.py',
+ # Web IDL lexer/parser (base parser)
+ '<(DEPTH)/tools/idl_parser/idl_lexer.py',
+ '<(DEPTH)/tools/idl_parser/idl_node.py',
diff --git a/dev-util/electron/files/chromium-system-jinja-r9.patch b/dev-util/electron/files/chromium-system-jinja-r9.patch
new file mode 100644
index 000000000000..1de9083f307c
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-jinja-r9.patch
@@ -0,0 +1,71 @@
+--- third_party/WebKit/Source/bindings/scripts/scripts.gyp.orig 2014-08-19 09:55:10.330972228 +0000
++++ third_party/WebKit/Source/bindings/scripts/scripts.gyp 2014-08-19 09:55:26.387286232 +0000
+@@ -54,7 +54,6 @@
+ 'actions': [{
+ 'action_name': 'cache_jinja_templates',
+ 'inputs': [
+- '<@(jinja_module_files)',
+ 'code_generator_v8.py',
+ '<@(code_generator_template_files)',
+ ],
+--- third_party/WebKit/Source/build/scripts/scripts.gypi.orig 2014-08-19 10:00:00.216521733 +0000
++++ third_party/WebKit/Source/build/scripts/scripts.gypi 2014-08-19 10:00:11.464735099 +0000
+@@ -2,10 +2,6 @@
+ {
+ 'variables': {
+ 'scripts_for_in_files': [
+- # jinja2/__init__.py contains version string, so sufficient as
+- # dependency for whole jinja2 package
+- '<(DEPTH)/third_party/jinja2/__init__.py',
+- '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
+ 'hasher.py',
+ 'in_file.py',
+ 'in_generator.py',
+--- third_party/WebKit/Source/bindings/scripts/scripts.gypi.orig 2014-08-19 10:53:02.824618979 +0000
++++ third_party/WebKit/Source/bindings/scripts/scripts.gypi 2014-08-19 10:53:20.784957370 +0000
+@@ -12,9 +12,6 @@
+ '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
+ ],
+ 'idl_lexer_parser_files': [
+- # PLY (Python Lex-Yacc)
+- '<(DEPTH)/third_party/ply/lex.py',
+- '<(DEPTH)/third_party/ply/yacc.py',
+ # Web IDL lexer/parser (base parser)
+ '<(DEPTH)/tools/idl_parser/idl_lexer.py',
+ '<(DEPTH)/tools/idl_parser/idl_node.py',
+--- third_party/WebKit/Source/platform/inspector_protocol/protocol.gyp.orig 2016-03-23 15:10:41.522637837 +0000
++++ third_party/WebKit/Source/platform/inspector_protocol/protocol.gyp 2016-03-23 15:10:56.938953740 +0000
+@@ -6,9 +6,6 @@
+ 'variables': {
+ 'blink_platform_output_dir': '<(SHARED_INTERMEDIATE_DIR)/blink/platform',
+ 'jinja_module_files': [
+- # jinja2/__init__.py contains version string, so sufficient for package
+- '<(DEPTH)/third_party/jinja2/__init__.py',
+- '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
+ ],
+ },
+
+--- third_party/WebKit/Source/build/scripts/scripts.gni.orig 2016-06-02 09:54:28.510152077 +0000
++++ third_party/WebKit/Source/build/scripts/scripts.gni 2016-06-02 09:54:50.966612510 +0000
+@@ -9,10 +9,6 @@
+ _scripts_dir = "//third_party/WebKit/Source/build/scripts"
+
+ scripts_for_in_files = [
+- # jinja2/__init__.py contains version string, so sufficient as
+- # dependency for whole jinja2 package
+- "//third_party/jinja2/__init__.py",
+- "//third_party/markupsafe/__init__.py", # jinja2 dep
+ "$_scripts_dir/hasher.py",
+ "$_scripts_dir/in_file.py",
+ "$_scripts_dir/in_generator.py",
+--- third_party/WebKit/Source/bindings/scripts/BUILD.gn.orig 2016-06-02 10:03:01.100658943 +0000
++++ third_party/WebKit/Source/bindings/scripts/BUILD.gn 2016-06-02 10:03:13.240907715 +0000
+@@ -36,7 +36,7 @@
+ action("cached_jinja_templates") {
+ script = "code_generator_v8.py"
+
+- inputs = jinja_module_files + [ "code_generator_v8.py" ] +
++ inputs = [ "code_generator_v8.py" ] +
+ code_generator_template_files
+
+ # Dummy file to track dependency.
diff --git a/dev-util/electron/files/chromium-system-zlib-r0.patch b/dev-util/electron/files/chromium-system-zlib-r0.patch
new file mode 100644
index 000000000000..3bf38e5904fa
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-zlib-r0.patch
@@ -0,0 +1,19 @@
+--- build/linux/unbundle/zlib.gn.orig 2016-05-30 13:09:56.987716771 +0000
++++ build/linux/unbundle/zlib.gn 2016-05-30 13:12:36.879014187 +0000
+@@ -9,11 +9,16 @@
+ headers = [ "zlib.h" ]
+ }
+
++config("system_zlib") {
++ defines = [ "USE_SYSTEM_ZLIB=1" ]
++}
++
+ source_set("zlib") {
+ deps = [
+ ":zlib_shim",
+ ]
+ libs = [ "z" ]
++ public_configs = [ ":system_zlib" ]
+ }
+
+ shim_headers("minizip_shim") {
diff --git a/dev-util/electron/files/electron-0.36.12-vendor-brightray.patch b/dev-util/electron/files/electron-0.36.12-vendor-brightray.patch
new file mode 100644
index 000000000000..7acbe04ff9d7
--- /dev/null
+++ b/dev-util/electron/files/electron-0.36.12-vendor-brightray.patch
@@ -0,0 +1,144 @@
+From 4ec57d1c20b841c6121a77f1539b0c759a031904 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Mon, 8 Feb 2016 15:14:58 -0500
+Subject: [PATCH] brightray build fixes
+
+---
+ brightray.gyp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
+ brightray.gypi | 21 ++++++++-------------
+ 2 files changed, 56 insertions(+), 17 deletions(-)
+
+diff --git a/brightray.gyp b/brightray.gyp
+index d7120ea..d0fd603 100644
+--- a/brightray.gyp
++++ b/brightray.gyp
+@@ -1,7 +1,7 @@
+ {
+ 'variables': {
+ # The libraries brightray will be compiled to.
+- 'linux_system_libraries': 'gtk+-2.0 libnotify dbus-1 x11 xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst gconf-2.0 gmodule-2.0 nss'
++ 'linux_system_libraries': 'gtk+-2.0 libnotify dbus-1 x11 xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst gmodule-2.0 nss'
+ },
+ 'includes': [
+ 'filenames.gypi',
+@@ -9,6 +9,11 @@
+ 'targets': [
+ {
+ 'target_name': 'brightray',
++ 'dependencies': [
++ 'cups',
++ 'gconf',
++ '<(libchromiumcontent_src_dir)/chromiumcontent/chromiumcontent.gyp:chromiumcontent_all'
++ ],
+ 'type': 'static_library',
+ 'include_dirs': [
+ '.',
+@@ -100,12 +105,9 @@
+ }, {
+ 'link_settings': {
+ 'libraries': [
+- # Link with ffmpeg.
+- '<(libchromiumcontent_dir)/libffmpeg.so',
+ # Following libraries are required by libchromiumcontent:
+ '-lasound',
+ '-lcap',
+- '-lcups',
+ '-lrt',
+ '-ldl',
+ '-lresolv',
+@@ -274,5 +276,47 @@
+ }], # OS=="win"
+ ],
+ },
++ {
++ 'target_name': 'gconf',
++ 'type': 'none',
++ 'conditions': [
++ ['use_gconf==1 and _toolset=="target"', {
++ 'direct_dependent_settings': {
++ 'cflags': [
++ '<!@(<(pkg-config) --cflags gconf-2.0)',
++ ],
++ 'defines': [
++ 'USE_GCONF',
++ ],
++ },
++ 'link_settings': {
++ 'ldflags': [
++ '<!@(<(pkg-config) --libs-only-L --libs-only-other gconf-2.0)',
++ ],
++ 'libraries': [
++ '<!@(<(pkg-config) --libs-only-l gconf-2.0)',
++ ],
++ },
++ }],
++ ],
++ },
++ {
++ 'target_name': 'cups',
++ 'type': 'none',
++ 'conditions': [
++ ['use_cups==1', {
++ 'direct_dependent_settings': {
++ 'defines': [
++ 'USE_CUPS',
++ ],
++ 'link_settings': {
++ 'libraries': [
++ '-lcups',
++ ],
++ },
++ },
++ }],
++ ],
++ },
+ ],
+ }
+diff --git a/brightray.gypi b/brightray.gypi
+index 4513fa9..95bdfa1 100644
+--- a/brightray.gypi
++++ b/brightray.gypi
+@@ -1,9 +1,14 @@
+ {
+- 'includes': [
+- 'vendor/download/libchromiumcontent/filenames.gypi',
+- ],
+ 'variables': {
+ 'libchromiumcontent_component%': 1,
++ 'libchromiumcontent_src_dir': '<(DEPTH)',
++ 'libchromiumcontent_shared_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)',
++ 'libchromiumcontent_static_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)',
++ 'libchromiumcontent_shared_libraries': [],
++ 'libchromiumcontent_static_libraries': [],
++ 'libchromiumcontent_shared_v8_libraries': [],
++ 'libchromiumcontent_static_v8_libraries': [],
++ 'pkg-config%': 'pkg-config',
+ 'conditions': [
+ # The "libchromiumcontent_component" is defined when calling "gyp".
+ ['libchromiumcontent_component', {
+@@ -258,22 +263,12 @@
+ 'conditions': [
+ ['OS=="linux"', {
+ 'cflags': [
+- '-O2',
+- # Generate symbols, will be stripped later.
+- '-g',
+- # Don't emit the GCC version ident directives, they just end up
+- # in the .comment section taking up binary size.
+- '-fno-ident',
+ # Put data and code in their own sections, so that unused symbols
+ # can be removed at link time with --gc-sections.
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'ldflags': [
+- # Specifically tell the linker to perform optimizations.
+- # See http://lwn.net/Articles/192624/ .
+- '-Wl,-O1',
+- '-Wl,--as-needed',
+ '-Wl,--gc-sections',
+ ],
+ }], # OS=="linux"
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-0.36.12-vendor-libchromiumcontent.patch b/dev-util/electron/files/electron-0.36.12-vendor-libchromiumcontent.patch
new file mode 100644
index 000000000000..168d8db477a9
--- /dev/null
+++ b/dev-util/electron/files/electron-0.36.12-vendor-libchromiumcontent.patch
@@ -0,0 +1,75 @@
+From b7022129450eaf2136746f5332956e76848796ef Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Mon, 8 Feb 2016 15:12:12 -0500
+Subject: [PATCH] libchromiumcontent build fixes
+
+---
+ chromiumcontent/chromiumcontent.gyp | 6 +++---
+ chromiumcontent/chromiumcontent.gypi | 26 --------------------------
+ 2 files changed, 3 insertions(+), 29 deletions(-)
+
+diff --git a/chromiumcontent/chromiumcontent.gyp b/chromiumcontent/chromiumcontent.gyp
+index 52a1d36..db74a52 100644
+--- a/chromiumcontent/chromiumcontent.gyp
++++ b/chromiumcontent/chromiumcontent.gyp
+@@ -24,11 +24,11 @@
+ },
+ {
+ 'target_name': 'chromiumcontent',
+- # Build chromiumcontent as shared_library otherwise some static libraries
+- # will not build.
+- 'type': 'shared_library',
++ 'type': 'static_library',
+ 'dependencies': [
+ '<(DEPTH)/base/base.gyp:base_prefs',
++ '<(DEPTH)/chrome/chrome_resources.gyp:packed_extra_resources',
++ '<(DEPTH)/chrome/chrome_resources.gyp:packed_resources',
+ '<(DEPTH)/components/components.gyp:cdm_renderer',
+ '<(DEPTH)/components/components.gyp:devtools_discovery',
+ '<(DEPTH)/components/components.gyp:devtools_http_handler',
+diff --git a/chromiumcontent/chromiumcontent.gypi b/chromiumcontent/chromiumcontent.gypi
+index 37c572b..3f4dcea 100644
+--- a/chromiumcontent/chromiumcontent.gypi
++++ b/chromiumcontent/chromiumcontent.gypi
+@@ -1,17 +1,5 @@
+ {
+ 'variables': {
+- # Enalbe using proprietary codecs.
+- 'proprietary_codecs': 1,
+- 'ffmpeg_branding': 'Chrome',
+- # Enable support for Widevine CDM.
+- 'enable_widevine': 1,
+- # Using libc++ requires building for >= 10.7.
+- 'mac_deployment_target': '10.8',
+- # The 10.8 SDK does not work well with C++11.
+- 'mac_sdk_min': '10.9',
+- # Use the standard way of linking with msvc runtime.
+- 'win_use_allocator_shim': 0,
+- 'win_release_RuntimeLibrary': '2',
+ # The V8 libraries.
+ 'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", "v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]',
+ # The icu libraries.
+@@ -22,20 +10,6 @@
+ 'v8_use_external_startup_data': 1,
+ }],
+ ['OS=="linux"', {
+- # Enable high DPI support on Linux.
+- 'enable_hidpi': 1,
+- # Use Dbus.
+- 'use_dbus': 1,
+- # Make Linux build contain debug symbols, this flag will add '-g' to
+- # cflags.
+- 'linux_dump_symbols': 1,
+- # The Linux build of libchromiumcontent.so depends on, but doesn't
+- # provide, tcmalloc by default. Disabling tcmalloc here also prevents
+- # any conflicts when linking to binaries or libraries that don't use
+- # tcmalloc.
+- 'linux_use_tcmalloc': 0,
+- # Force using gold linker.
+- 'linux_use_bundled_gold': 1,
+ 'conditions': [
+ ['target_arch=="arm"', {
+ 'arm_version': 7,
+--
+2.4.10
+
diff --git a/dev-util/electron/files/electron-0.36.12-vendor-node.patch b/dev-util/electron/files/electron-0.36.12-vendor-node.patch
new file mode 100644
index 000000000000..85f34b6178fe
--- /dev/null
+++ b/dev-util/electron/files/electron-0.36.12-vendor-node.patch
@@ -0,0 +1,109 @@
+From 56b57ea7f0c111bfd9c719060cf17346e638fdd1 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Wed, 10 Feb 2016 14:45:13 -0500
+Subject: [PATCH] Build fixes
+
+---
+ node.gyp | 5 +++--
+ src/node.cc | 8 --------
+ src/node.js | 2 ++
+ src/node_main.cc | 2 ++
+ 4 files changed, 7 insertions(+), 10 deletions(-)
+
+diff --git a/node.gyp b/node.gyp
+index d431210..fea5e07 100644
+--- a/node.gyp
++++ b/node.gyp
+@@ -1,6 +1,7 @@
+ {
+ 'variables': {
+ 'v8_use_snapshot%': 'false',
++ 'v8_gyp_path%': 'deps/v8/tools/gyp/v8.gyp',
+ 'node_use_dtrace%': 'false',
+ 'node_use_lttng%': 'false',
+ 'node_use_etw%': 'false',
+@@ -89,8 +90,8 @@
+ 'dependencies': [
+ 'node_js2c#host',
+ 'deps/cares/cares.gyp:cares',
+- # 'deps/v8/tools/gyp/v8.gyp:v8',
+- # 'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
++ '<(v8_gyp_path):v8',
++ '<(v8_gyp_path):v8_libplatform'
+ ],
+
+ 'include_dirs': [
+diff --git a/src/node.cc b/src/node.cc
+index 7df6053..cbe1538 100644
+--- a/src/node.cc
++++ b/src/node.cc
+@@ -4085,15 +4085,11 @@ static void StartNodeInstance(void* arg) {
+ SealHandleScope seal(isolate);
+ bool more;
+ do {
+-#if 0
+ v8::platform::PumpMessageLoop(default_platform, isolate);
+-#endif
+ more = uv_run(env->event_loop(), UV_RUN_ONCE);
+
+ if (more == false) {
+-#if 0
+ v8::platform::PumpMessageLoop(default_platform, isolate);
+-#endif
+ EmitBeforeExit(env);
+
+ // Emit `beforeExit` if the loop became alive either after emitting
+@@ -4153,10 +4149,8 @@ int Start(int argc, char** argv) {
+ #endif
+
+ const int thread_pool_size = 4;
+-#if 0
+ default_platform = v8::platform::CreateDefaultPlatform(thread_pool_size);
+ V8::InitializePlatform(default_platform);
+-#endif
+ V8::Initialize();
+
+ int exit_code = 1;
+@@ -4173,10 +4167,8 @@ int Start(int argc, char** argv) {
+ }
+ V8::Dispose();
+
+-#if 0
+ delete default_platform;
+ default_platform = nullptr;
+-#endif
+
+ delete[] exec_argv;
+ exec_argv = nullptr;
+diff --git a/src/node.js b/src/node.js
+index 37aa371..a835d0a 100644
+--- a/src/node.js
++++ b/src/node.js
+@@ -40,7 +40,9 @@
+ startup.globalConsole();
+ } // not isRenderer
+
++ if (!process.env.ELECTRON_NODE_DISABLE_ASAR_SUPPORT) {
+ startup.initAsarSupport();
++ }
+
+ startup.processAssert();
+ startup.processConfig();
+diff --git a/src/node_main.cc b/src/node_main.cc
+index 58e747e..24949f3 100644
+--- a/src/node_main.cc
++++ b/src/node_main.cc
+@@ -40,8 +40,10 @@ int wmain(int argc, wchar_t *wargv[]) {
+ }
+ #else
+ // UNIX
++#include <stdlib.h>
+ int main(int argc, char *argv[]) {
+ setvbuf(stderr, NULL, _IOLBF, 1024);
++ putenv("ELECTRON_NODE_DISABLE_ASAR_SUPPORT=1");
+ return node::Start(argc, argv);
+ }
+ #endif
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-0.36.12.patch b/dev-util/electron/files/electron-0.36.12.patch
new file mode 100644
index 000000000000..ec21b25af508
--- /dev/null
+++ b/dev-util/electron/files/electron-0.36.12.patch
@@ -0,0 +1,257 @@
+From 293b40208c981a3a18a1ccd5c5ea0a50611e2356 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
+
+---
+ atom.gyp | 55 +++++++++++++++++++++++++++++++++++++++++++------------
+ common.gypi | 29 +++++++++++++++++++++++------
+ filenames.gypi | 1 -
+ tools/js2asar.py | 11 ++++++-----
+ 4 files changed, 72 insertions(+), 24 deletions(-)
+
+diff --git a/atom.gyp b/atom.gyp
+index 5554adb..61ec47c 100644
+--- a/atom.gyp
++++ b/atom.gyp
+@@ -29,6 +29,7 @@
+ 'type': 'executable',
+ 'dependencies': [
+ 'js2asar',
++ 'nodebin',
+ '<(project_name)_lib',
+ ],
+ 'sources': [
+@@ -177,7 +178,7 @@
+ ],
+ }, {
+ 'dependencies': [
+- 'vendor/breakpad/breakpad.gyp:dump_syms#host',
++ 'breakpad/breakpad.gyp:dump_syms#host',
+ ],
+ }], # OS=="win"
+ ['OS=="linux"', {
+@@ -194,7 +195,7 @@
+ }, {
+ 'copied_libraries': [
+ '<(PRODUCT_DIR)/lib/libnode.so',
+- '<(libchromiumcontent_dir)/libffmpeg.so',
++ '<(PRODUCT_DIR)/lib/libv8.so',
+ ],
+ }],
+ ],
+@@ -202,9 +203,6 @@
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ '<@(copied_libraries)',
+- '<(libchromiumcontent_dir)/locales',
+- '<(libchromiumcontent_dir)/icudtl.dat',
+- '<(libchromiumcontent_dir)/content_shell.pak',
+ '<(libchromiumcontent_dir)/natives_blob.bin',
+ '<(libchromiumcontent_dir)/snapshot_blob.bin',
+ ],
+@@ -242,15 +240,14 @@
+ '<@(lib_sources)',
+ ],
+ 'include_dirs': [
+- '.',
+ 'chromium_src',
++ '.',
+ 'vendor/brightray',
+ 'vendor/native_mate',
+ # Include atom_natives.h.
+ '<(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',
+@@ -301,8 +298,8 @@
+ 'vendor/node/deps/uv/uv.gyp:libuv',
+ 'vendor/node/deps/zlib/zlib.gyp:zlib',
+ # Build with breakpad support.
+- 'vendor/breakpad/breakpad.gyp:breakpad_handler',
+- 'vendor/breakpad/breakpad.gyp:breakpad_sender',
++ 'breakpad/breakpad.gyp:breakpad_handler',
++ 'breakpad/breakpad.gyp:breakpad_sender',
+ ],
+ }], # OS=="win"
+ ['OS=="mac" and mas_build==0', {
+@@ -333,7 +330,7 @@
+ # 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',
+ ],
+@@ -344,10 +341,10 @@
+ '-Wno-reserved-user-defined-literal',
+ ],
+ 'include_dirs': [
+- 'vendor/breakpad/src',
++ 'breakpad/src',
+ ],
+ 'dependencies': [
+- 'vendor/breakpad/breakpad.gyp:breakpad_client',
++ 'breakpad/breakpad.gyp:breakpad_client',
+ ],
+ }], # OS=="linux"
+ ],
+@@ -355,6 +352,9 @@
+ {
+ 'target_name': 'js2asar',
+ 'type': 'none',
++ 'dependencies': [
++ 'nodebin'
++ ],
+ 'actions': [
+ {
+ 'action_name': 'js2asar',
+@@ -376,6 +376,7 @@
+ 'action': [
+ 'python',
+ 'tools/js2asar.py',
++ '<(PRODUCT_DIR)/nodebin',
+ '<@(_outputs)',
+ '<@(_inputs)',
+ ],
+@@ -403,6 +404,36 @@
+ }
+ ],
+ }, # target atom_js2c
++ {
++ 'target_name': 'nodebin',
++ 'type': 'executable',
++ 'sources': [
++ 'vendor/node/src/node_main.cc',
++ ],
++ 'dependencies': [
++ 'vendor/node/node.gyp:node',
++ ],
++ 'include_dirs': [
++ '.',
++ 'vendor/native_mate',
++ # Include atom_natives.h.
++ '<(SHARED_INTERMEDIATE_DIR)',
++ # Include directories for uv and node.
++ 'vendor/node/src',
++ 'vendor/node/deps/uv/include',
++ # 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': {
++ 'ldflags': [
++ '-Wl,-rpath=\$$ORIGIN/',
++ # Make native module dynamic loading work.
++ '-rdynamic',
++ ],
++ },
++ }, # target nodebin
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+diff --git a/common.gypi b/common.gypi
+index 7c41c36..2da2fea 100644
+--- a/common.gypi
++++ b/common.gypi
+@@ -17,12 +17,6 @@
+ 'node_target_type': 'shared_library',
+ 'node_install_npm': 'false',
+ 'node_prefix': '',
+- '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_tag': '',
+ 'node_use_dtrace': 'false',
+ 'node_use_etw': 'false',
+@@ -35,10 +29,33 @@
+ 'V8_BASE': '',
+ 'v8_postmortem_support': 'false',
+ 'v8_enable_i18n_support': 'false',
++ 'v8_gyp_path': '<(DEPTH)/v8/tools/gyp/v8.gyp',
++ 'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", "v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]',
++ 'v8_target_type': 'shared_library',
++ 'v8_use_snapshot': 'true',
++ 'v8_use_external_startup_data': 1,
+ },
+ # Settings to compile node under Windows.
+ 'target_defaults': {
+ 'target_conditions': [
++ ['_target_name in <(v8_libraries) + ["node"]', {
++ 'cflags!': [
++ '-fvisibility=hidden',
++ '-fdata-sections',
++ '-ffunction-sections',
++ ],
++ 'cflags_cc!': [
++ '-fvisibility-inlines-hidden'
++ ],
++ }],
++
++ ['_target_name in <(v8_libraries) + ["mksnapshot"]', {
++ 'defines': [
++ 'V8_SHARED',
++ 'BUILDING_V8_SHARED',
++ ],
++ }],
++
+ ['_target_name in ["libuv", "http_parser", "openssl", "cares", "node", "zlib"]', {
+ 'msvs_disabled_warnings': [
+ 4013, # 'free' undefined; assuming extern returning int
+diff --git a/filenames.gypi b/filenames.gypi
+index f9e1955..84999a3 100644
+--- a/filenames.gypi
++++ b/filenames.gypi
+@@ -498,7 +498,6 @@
+ 'chromium_src/extensions/browser/app_window/size_constraints.h',
+ 'chromium_src/extensions/common/url_pattern.cc',
+ 'chromium_src/extensions/common/url_pattern.h',
+- 'chromium_src/library_loaders/libspeechd_loader.cc',
+ 'chromium_src/library_loaders/libspeechd.h',
+ 'chromium_src/net/test/embedded_test_server/stream_listen_socket.cc',
+ 'chromium_src/net/test/embedded_test_server/stream_listen_socket.h',
+diff --git a/tools/js2asar.py b/tools/js2asar.py
+index cb02e33..3d80a11 100755
+--- a/tools/js2asar.py
++++ b/tools/js2asar.py
+@@ -11,12 +11,13 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
+
+
+ def main():
+- archive = sys.argv[1]
+- js_source_files = sys.argv[2:]
++ node = sys.argv[1]
++ archive = sys.argv[2]
++ js_source_files = sys.argv[3:]
+
+ output_dir = tempfile.mkdtemp()
+ copy_js(js_source_files, output_dir)
+- call_asar(archive, output_dir)
++ call_asar(node, archive, output_dir)
+ shutil.rmtree(output_dir)
+
+
+@@ -28,10 +29,10 @@ def copy_js(js_source_files, output_dir):
+ shutil.copy2(source_file, output_path)
+
+
+-def call_asar(archive, output_dir):
++def call_asar(node, archive, output_dir):
+ js_dir = os.path.join(output_dir, 'lib')
+ asar = os.path.join(SOURCE_ROOT, 'node_modules', 'asar', 'bin', 'asar')
+- subprocess.check_call([find_node(), asar, 'pack', js_dir, archive])
++ subprocess.check_call([node, asar, 'pack', js_dir, archive])
+
+
+ def find_node():
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-0.37.8-vendor-brightray.patch b/dev-util/electron/files/electron-0.37.8-vendor-brightray.patch
new file mode 100644
index 000000000000..4c68e4199e91
--- /dev/null
+++ b/dev-util/electron/files/electron-0.37.8-vendor-brightray.patch
@@ -0,0 +1,143 @@
+From e28b41fcc6d59d1774995c5a7b6aa4c634616481 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Mon, 8 Feb 2016 15:14:58 -0500
+Subject: [PATCH] brightray build fixes
+
+---
+ brightray.gyp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
+ brightray.gypi | 20 +++++++-------------
+ 2 files changed, 55 insertions(+), 17 deletions(-)
+
+diff --git a/brightray.gyp b/brightray.gyp
+index 4a821d1..0897f9d 100644
+--- a/brightray.gyp
++++ b/brightray.gyp
+@@ -1,7 +1,7 @@
+ {
+ 'variables': {
+ # The libraries brightray will be compiled to.
+- 'linux_system_libraries': 'gtk+-2.0 libnotify dbus-1 x11 xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst gconf-2.0 gmodule-2.0 nss'
++ 'linux_system_libraries': 'gtk+-2.0 libnotify dbus-1 x11 xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst gmodule-2.0 nss'
+ },
+ 'includes': [
+ 'filenames.gypi',
+@@ -9,6 +9,11 @@
+ 'targets': [
+ {
+ 'target_name': 'brightray',
++ 'dependencies': [
++ 'cups',
++ 'gconf',
++ '<(libchromiumcontent_src_dir)/chromiumcontent/chromiumcontent.gyp:chromiumcontent_all'
++ ],
+ 'type': 'static_library',
+ 'include_dirs': [
+ '.',
+@@ -101,12 +106,9 @@
+ }, {
+ 'link_settings': {
+ 'libraries': [
+- # Link with ffmpeg.
+- '<(libchromiumcontent_dir)/libffmpeg.so',
+ # Following libraries are required by libchromiumcontent:
+ '-lasound',
+ '-lcap',
+- '-lcups',
+ '-lrt',
+ '-ldl',
+ '-lresolv',
+@@ -302,5 +304,47 @@
+ }], # OS=="win"
+ ],
+ },
++ {
++ 'target_name': 'gconf',
++ 'type': 'none',
++ 'conditions': [
++ ['use_gconf==1 and _toolset=="target"', {
++ 'direct_dependent_settings': {
++ 'cflags': [
++ '<!@(<(pkg-config) --cflags gconf-2.0)',
++ ],
++ 'defines': [
++ 'USE_GCONF',
++ ],
++ },
++ 'link_settings': {
++ 'ldflags': [
++ '<!@(<(pkg-config) --libs-only-L --libs-only-other gconf-2.0)',
++ ],
++ 'libraries': [
++ '<!@(<(pkg-config) --libs-only-l gconf-2.0)',
++ ],
++ },
++ }],
++ ],
++ },
++ {
++ 'target_name': 'cups',
++ 'type': 'none',
++ 'conditions': [
++ ['use_cups==1', {
++ 'direct_dependent_settings': {
++ 'defines': [
++ 'USE_CUPS',
++ ],
++ 'link_settings': {
++ 'libraries': [
++ '-lcups',
++ ],
++ },
++ },
++ }],
++ ],
++ },
+ ],
+ }
+diff --git a/brightray.gypi b/brightray.gypi
+index 8bae073..95bdfa1 100644
+--- a/brightray.gypi
++++ b/brightray.gypi
+@@ -1,9 +1,13 @@
+ {
+- 'includes': [
+- 'vendor/download/libchromiumcontent/filenames.gypi',
+- ],
+ 'variables': {
+ 'libchromiumcontent_component%': 1,
++ 'libchromiumcontent_src_dir': '<(DEPTH)',
++ 'libchromiumcontent_shared_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)',
++ 'libchromiumcontent_static_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)',
++ 'libchromiumcontent_shared_libraries': [],
++ 'libchromiumcontent_static_libraries': [],
++ 'libchromiumcontent_shared_v8_libraries': [],
++ 'libchromiumcontent_static_v8_libraries': [],
+ 'pkg-config%': 'pkg-config',
+ 'conditions': [
+ # The "libchromiumcontent_component" is defined when calling "gyp".
+@@ -259,22 +263,12 @@
+ 'conditions': [
+ ['OS=="linux"', {
+ 'cflags': [
+- '-O2',
+- # Generate symbols, will be stripped later.
+- '-g',
+- # Don't emit the GCC version ident directives, they just end up
+- # in the .comment section taking up binary size.
+- '-fno-ident',
+ # Put data and code in their own sections, so that unused symbols
+ # can be removed at link time with --gc-sections.
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'ldflags': [
+- # Specifically tell the linker to perform optimizations.
+- # See http://lwn.net/Articles/192624/ .
+- '-Wl,-O1',
+- '-Wl,--as-needed',
+ '-Wl,--gc-sections',
+ ],
+ }], # OS=="linux"
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-0.37.8-vendor-libchromiumcontent.patch b/dev-util/electron/files/electron-0.37.8-vendor-libchromiumcontent.patch
new file mode 100644
index 000000000000..8115345b077d
--- /dev/null
+++ b/dev-util/electron/files/electron-0.37.8-vendor-libchromiumcontent.patch
@@ -0,0 +1,71 @@
+From bfa42ae7f5251a65fd90a68d0914384b7e63b8ad Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Mon, 8 Feb 2016 15:12:12 -0500
+Subject: [PATCH] libchromiumcontent build fixes
+
+---
+ chromiumcontent/chromiumcontent.gyp | 6 +++---
+ chromiumcontent/chromiumcontent.gypi | 22 ----------------------
+ 2 files changed, 3 insertions(+), 25 deletions(-)
+
+diff --git a/chromiumcontent/chromiumcontent.gyp b/chromiumcontent/chromiumcontent.gyp
+index ddaa0b9..cc8c7c6 100644
+--- a/chromiumcontent/chromiumcontent.gyp
++++ b/chromiumcontent/chromiumcontent.gyp
+@@ -24,11 +24,11 @@
+ },
+ {
+ 'target_name': 'chromiumcontent',
+- # Build chromiumcontent as shared_library otherwise some static libraries
+- # will not build.
+- 'type': 'shared_library',
++ 'type': 'static_library',
+ 'dependencies': [
+ '<(DEPTH)/base/base.gyp:base_prefs',
++ '<(DEPTH)/chrome/chrome_resources.gyp:packed_extra_resources',
++ '<(DEPTH)/chrome/chrome_resources.gyp:packed_resources',
+ '<(DEPTH)/components/components.gyp:cdm_renderer',
+ '<(DEPTH)/components/components.gyp:devtools_discovery',
+ '<(DEPTH)/components/components.gyp:devtools_http_handler',
+diff --git a/chromiumcontent/chromiumcontent.gypi b/chromiumcontent/chromiumcontent.gypi
+index 73bc78a..53694e7 100644
+--- a/chromiumcontent/chromiumcontent.gypi
++++ b/chromiumcontent/chromiumcontent.gypi
+@@ -1,18 +1,5 @@
+ {
+ 'variables': {
+- # Don't use nacl.
+- 'disable_nacl': 1,
+- # Enalbe using proprietary codecs.
+- 'proprietary_codecs': 1,
+- # Build ffmpeg as shared library.
+- 'ffmpeg_component': 'shared_library',
+- # Enable support for Widevine CDM.
+- 'enable_widevine': 1,
+- # Using libc++ requires building for >= 10.7.
+- 'mac_deployment_target': '10.8',
+- # Use the standard way of linking with msvc runtime.
+- 'win_use_allocator_shim': 0,
+- 'win_release_RuntimeLibrary': '2',
+ # The V8 libraries.
+ 'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", "v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]',
+ # The icu libraries.
+@@ -23,15 +10,6 @@
+ 'v8_use_external_startup_data': 1,
+ }],
+ ['OS=="linux"', {
+- # Enable high DPI support on Linux.
+- 'enable_hidpi': 1,
+- # Use Dbus.
+- 'use_dbus': 1,
+- # Make Linux build contain debug symbols, this flag will add '-g' to
+- # cflags.
+- 'linux_dump_symbols': 1,
+- # Force using gold linker.
+- 'linux_use_bundled_gold': 1,
+ 'conditions': [
+ ['target_arch=="arm"', {
+ 'arm_version': 7,
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-0.37.8-vendor-node.patch b/dev-util/electron/files/electron-0.37.8-vendor-node.patch
new file mode 100644
index 000000000000..6e706c3ab49b
--- /dev/null
+++ b/dev-util/electron/files/electron-0.37.8-vendor-node.patch
@@ -0,0 +1,105 @@
+From ee5dd0d41e8426d6915c4b2b9095674ab4175fee Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Wed, 10 Feb 2016 14:45:13 -0500
+Subject: [PATCH] Build fixes
+
+---
+ lib/internal/bootstrap_node.js | 2 ++
+ node.gyp | 5 +++--
+ src/node.cc | 8 ++++----
+ src/node_main.cc | 2 ++
+ 4 files changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js
+index f2edf80..dd2fdb4 100644
+--- a/lib/internal/bootstrap_node.js
++++ b/lib/internal/bootstrap_node.js
+@@ -53,7 +53,9 @@
+ setupGlobalConsole();
+ } // not isRenderer
+
++ if (!process.env.ELECTRON_NODE_DISABLE_ASAR_SUPPORT) {
+ setupAsarSupport();
++ }
+
+ const _process = NativeModule.require('internal/process');
+
+diff --git a/node.gyp b/node.gyp
+index df3bb6a..fbe21d8 100644
+--- a/node.gyp
++++ b/node.gyp
+@@ -1,6 +1,7 @@
+ {
+ 'variables': {
+ 'v8_use_snapshot%': 'false',
++ 'v8_gyp_path%': 'deps/v8/tools/gyp/v8.gyp',
+ 'node_use_dtrace%': 'false',
+ 'node_use_lttng%': 'false',
+ 'node_use_etw%': 'false',
+@@ -107,8 +108,8 @@
+ 'dependencies': [
+ 'node_js2c#host',
+ 'deps/cares/cares.gyp:cares',
+- # 'deps/v8/tools/gyp/v8.gyp:v8',
+- # 'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
++ '<(v8_gyp_path):v8',
++ '<(v8_gyp_path):v8_libplatform'
+ ],
+
+ 'include_dirs': [
+diff --git a/src/node.cc b/src/node.cc
+index 66f31d0..961abc2 100644
+--- a/src/node.cc
++++ b/src/node.cc
+@@ -4240,13 +4240,13 @@ static void StartNodeInstance(void* arg) {
+ SealHandleScope seal(isolate);
+ bool more;
+ do {
+-#if 0
++#if 1
+ v8::platform::PumpMessageLoop(default_platform, isolate);
+ #endif
+ more = uv_run(env->event_loop(), UV_RUN_ONCE);
+
+ if (more == false) {
+-#if 0
++#if 1
+ v8::platform::PumpMessageLoop(default_platform, isolate);
+ #endif
+ EmitBeforeExit(env);
+@@ -4312,7 +4312,7 @@ int Start(int argc, char** argv) {
+ V8::SetEntropySource(crypto::EntropySource);
+ #endif
+
+-#if 0
++#if 1
+ default_platform = v8::platform::CreateDefaultPlatform(v8_thread_pool_size);
+ V8::InitializePlatform(default_platform);
+ V8::Initialize();
+@@ -4332,7 +4332,7 @@ int Start(int argc, char** argv) {
+ }
+ V8::Dispose();
+
+-#if 0
++#if 1
+ delete default_platform;
+ default_platform = nullptr;
+ #endif
+diff --git a/src/node_main.cc b/src/node_main.cc
+index dce72af..e567cc4 100644
+--- a/src/node_main.cc
++++ b/src/node_main.cc
+@@ -48,8 +48,10 @@ int wmain(int argc, wchar_t *wargv[]) {
+ }
+ #else
+ // UNIX
++#include <stdlib.h>
+ int main(int argc, char *argv[]) {
+ setvbuf(stderr, NULL, _IOLBF, 1024);
++ putenv("ELECTRON_NODE_DISABLE_ASAR_SUPPORT=1");
+ return node::Start(argc, argv);
+ }
+ #endif
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-0.37.8.patch b/dev-util/electron/files/electron-0.37.8.patch
new file mode 100644
index 000000000000..943281cae834
--- /dev/null
+++ b/dev-util/electron/files/electron-0.37.8.patch
@@ -0,0 +1,391 @@
+From 79e5320a6544a24e45d275cf64bff27fbf6289f2 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 | 32 ++++++++++++++++++------
+ electron.gyp | 62 ++++++++++++++++++++++++++++++++++++++---------
+ filenames.gypi | 1 -
+ toolchain.gypi | 47 +----------------------------------
+ tools/atom_source_root.py | 5 ++++
+ tools/get-endianness.py | 4 +++
+ tools/js2asar.py | 13 +++++-----
+ 7 files changed, 92 insertions(+), 72 deletions(-)
+ create mode 100644 tools/atom_source_root.py
+ create mode 100644 tools/get-endianness.py
+
+diff --git a/common.gypi b/common.gypi
+index 1088beb..2364ebe 100644
+--- a/common.gypi
++++ b/common.gypi
+@@ -15,16 +15,11 @@
+ 'openssl_fips': '',
+ 'openssl_no_asm': 1,
+ 'node_release_urlbase': 'https://atom.io/download/atom-shell',
+- 'node_byteorder': '<!(node <(DEPTH)/tools/get-endianness.js)',
++ 'node_byteorder': '<!(python <(DEPTH)/tools/get-endianness.py)',
+ 'node_target_type': 'shared_library',
+ 'node_install_npm': 'false',
+ 'node_prefix': '',
+- '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_tag': '',
+ 'node_use_dtrace': 'false',
+ 'node_use_etw': 'false',
+@@ -36,11 +31,34 @@
+ 'uv_use_dtrace': 'false',
+ 'V8_BASE': '',
+ 'v8_postmortem_support': 'false',
+- 'v8_enable_i18n_support': 'false',
++ 'v8_enable_i18n_support': 'true',
++ 'v8_gyp_path': '<(DEPTH)/v8/tools/gyp/v8.gyp',
++ 'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", "v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]',
++ 'v8_target_type': 'shared_library',
++ 'v8_use_snapshot': 'true',
++ 'v8_use_external_startup_data': 1,
+ },
+ # Settings to compile node under Windows.
+ 'target_defaults': {
+ 'target_conditions': [
++ ['_target_name in <(v8_libraries) + ["node", "electron_lib"]', {
++ 'cflags!': [
++ '-fvisibility=hidden',
++ '-fdata-sections',
++ '-ffunction-sections',
++ ],
++ 'cflags_cc!': [
++ '-fvisibility-inlines-hidden'
++ ],
++ }],
++
++ ['_target_name in <(v8_libraries) + ["mksnapshot"]', {
++ 'defines': [
++ 'V8_SHARED',
++ 'BUILDING_V8_SHARED',
++ ],
++ }],
++
+ ['_target_name in ["libuv", "http_parser", "openssl", "cares", "node", "zlib"]', {
+ 'msvs_disabled_warnings': [
+ 4003, # not enough actual parameters for macro 'V'
+diff --git a/electron.gyp b/electron.gyp
+index 66ff2fd..e0e782c 100644
+--- a/electron.gyp
++++ b/electron.gyp
+@@ -30,6 +30,7 @@
+ 'dependencies': [
+ 'js2asar',
+ 'app2asar',
++ 'nodebin',
+ '<(project_name)_lib',
+ ],
+ 'sources': [
+@@ -165,7 +166,7 @@
+ ],
+ }, {
+ 'dependencies': [
+- 'vendor/breakpad/breakpad.gyp:dump_syms#host',
++ 'breakpad/breakpad.gyp:dump_syms#host',
+ ],
+ }], # OS=="win"
+ ['OS=="linux"', {
+@@ -182,7 +183,7 @@
+ }, {
+ 'copied_libraries': [
+ '<(PRODUCT_DIR)/lib/libnode.so',
+- '<(libchromiumcontent_dir)/libffmpeg.so',
++ '<(PRODUCT_DIR)/lib/libv8.so',
+ ],
+ }],
+ ],
+@@ -190,9 +191,6 @@
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ '<@(copied_libraries)',
+- '<(libchromiumcontent_dir)/locales',
+- '<(libchromiumcontent_dir)/icudtl.dat',
+- '<(libchromiumcontent_dir)/content_shell.pak',
+ '<(libchromiumcontent_dir)/natives_blob.bin',
+ '<(libchromiumcontent_dir)/snapshot_blob.bin',
+ ],
+@@ -216,6 +214,8 @@
+ 'GLIB_DISABLE_DEPRECATION_WARNINGS',
+ # Defined in Chromium but not exposed in its gyp file.
+ 'V8_USE_EXTERNAL_STARTUP_DATA',
++ 'V8_SHARED',
++ 'USING_V8_SHARED',
+ 'ENABLE_PLUGINS',
+ 'ENABLE_PEPPER_CDMS',
+ 'USE_PROPRIETARY_CODECS',
+@@ -224,15 +224,14 @@
+ '<@(lib_sources)',
+ ],
+ 'include_dirs': [
+- '.',
+ 'chromium_src',
++ '.',
+ 'vendor/brightray',
+ 'vendor/native_mate',
+ # Include atom_natives.h.
+ '<(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',
+@@ -283,8 +282,8 @@
+ 'vendor/node/deps/uv/uv.gyp:libuv',
+ 'vendor/node/deps/zlib/zlib.gyp:zlib',
+ # Build with breakpad support.
+- 'vendor/breakpad/breakpad.gyp:breakpad_handler',
+- 'vendor/breakpad/breakpad.gyp:breakpad_sender',
++ 'breakpad/breakpad.gyp:breakpad_handler',
++ 'breakpad/breakpad.gyp:breakpad_sender',
+ ],
+ }], # OS=="win"
+ ['OS=="mac" and mas_build==0', {
+@@ -318,7 +317,7 @@
+ # 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',
+ ],
+@@ -329,10 +328,10 @@
+ '-Wno-reserved-user-defined-literal',
+ ],
+ 'include_dirs': [
+- 'vendor/breakpad/src',
++ 'breakpad/src',
+ ],
+ 'dependencies': [
+- 'vendor/breakpad/breakpad.gyp:breakpad_client',
++ 'breakpad/breakpad.gyp:breakpad_client',
+ ],
+ }], # OS=="linux"
+ ],
+@@ -340,6 +339,9 @@
+ {
+ 'target_name': 'js2asar',
+ 'type': 'none',
++ 'dependencies': [
++ 'nodebin'
++ ],
+ 'actions': [
+ {
+ 'action_name': 'js2asar',
+@@ -361,6 +363,7 @@
+ 'action': [
+ 'python',
+ 'tools/js2asar.py',
++ '<(PRODUCT_DIR)/nodebin',
+ '<@(_outputs)',
+ 'lib',
+ '<@(_inputs)',
+@@ -371,6 +374,9 @@
+ {
+ 'target_name': 'app2asar',
+ 'type': 'none',
++ 'dependencies': [
++ 'nodebin'
++ ],
+ 'actions': [
+ {
+ 'action_name': 'app2asar',
+@@ -392,6 +398,7 @@
+ 'action': [
+ 'python',
+ 'tools/js2asar.py',
++ '<(PRODUCT_DIR)/nodebin',
+ '<@(_outputs)',
+ 'default_app',
+ '<@(_inputs)',
+@@ -420,6 +427,37 @@
+ }
+ ],
+ }, # target atom_js2c
++ {
++ 'target_name': 'nodebin',
++ 'type': 'executable',
++ 'sources': [
++ 'vendor/node/src/node_main.cc',
++ ],
++ 'dependencies': [
++ 'vendor/node/node.gyp:node',
++ ],
++ 'include_dirs': [
++ '.',
++ 'vendor/native_mate',
++ # Include atom_natives.h.
++ '<(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',
++ # The `node.h` is using `#include"ares.h"`.
++ 'vendor/node/deps/cares/include',
++ ],
++ 'link_settings': {
++ 'ldflags': [
++ '-Wl,-rpath=\$$ORIGIN/',
++ # Make native module dynamic loading work.
++ '-rdynamic',
++ ],
++ },
++ }, # target nodebin
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+diff --git a/filenames.gypi b/filenames.gypi
+index 1c21394..3e07096 100644
+--- a/filenames.gypi
++++ b/filenames.gypi
+@@ -516,7 +516,6 @@
+ 'chromium_src/extensions/browser/app_window/size_constraints.h',
+ 'chromium_src/extensions/common/url_pattern.cc',
+ 'chromium_src/extensions/common/url_pattern.h',
+- 'chromium_src/library_loaders/libspeechd_loader.cc',
+ 'chromium_src/library_loaders/libspeechd.h',
+ 'chromium_src/net/test/embedded_test_server/stream_listen_socket.cc',
+ 'chromium_src/net/test/embedded_test_server/stream_listen_socket.h',
+diff --git a/toolchain.gypi b/toolchain.gypi
+index 11da28f..52c0316 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': {
+diff --git a/tools/atom_source_root.py b/tools/atom_source_root.py
+new file mode 100644
+index 0000000..316e997
+--- /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/get-endianness.py b/tools/get-endianness.py
+new file mode 100644
+index 0000000..3150793
+--- /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 7860176..b08a38d 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,9 +29,9 @@ 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', 'asar', 'bin', 'asar')
+- subprocess.check_call([find_node(), asar, 'pack', output_dir, archive])
++ subprocess.check_call([node, asar, 'pack', output_dir, archive])
+
+
+ def find_node():
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-1.3.13-vendor-node.patch b/dev-util/electron/files/electron-1.3.13-vendor-node.patch
new file mode 100644
index 000000000000..8db4a0527df2
--- /dev/null
+++ b/dev-util/electron/files/electron-1.3.13-vendor-node.patch
@@ -0,0 +1,95 @@
+From fe90355a9b8db14ad94cae189ccb90cab0800d5b Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Wed, 10 Feb 2016 14:45:13 -0500
+Subject: [PATCH] Build fixes
+
+---
+ lib/internal/bootstrap_node.js | 2 ++
+ node.gyp | 13 ++++++++-----
+ src/node_main.cc | 2 ++
+ 3 files changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js
+index 9505c7b8a..27d7b9da9 100644
+--- a/lib/internal/bootstrap_node.js
++++ b/lib/internal/bootstrap_node.js
+@@ -50,7 +50,9 @@
+ setupGlobalConsole();
+ }
+
++ if (!process.env.ELECTRON_NODE_DISABLE_ASAR_SUPPORT) {
+ setupAsarSupport();
++ }
+
+ const _process = NativeModule.require('internal/process');
+
+diff --git a/node.gyp b/node.gyp
+index a6f7e6e5b..5b95c5778 100644
+--- a/node.gyp
++++ b/node.gyp
+@@ -1,6 +1,7 @@
+ {
+ 'variables': {
+ 'v8_use_snapshot%': 'false',
++ 'v8_gyp_path%': 'deps/v8/tools/gyp/v8.gyp',
+ 'node_use_dtrace%': 'false',
+ 'node_use_lttng%': 'false',
+ 'node_use_etw%': 'false',
+@@ -127,6 +128,8 @@
+
+ 'dependencies': [
+ 'node_js2c#host',
++ '<(v8_gyp_path):v8',
++ '<(v8_gyp_path):v8_libplatform'
+ ],
+
+ 'include_dirs': [
+@@ -258,8 +261,8 @@
+ }],
+ [ 'node_use_bundled_v8=="true"', {
+ 'dependencies': [
+- 'deps/v8/tools/gyp/v8.gyp:v8',
+- 'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
++ '<(v8_gyp_path):v8',
++ '<(v8_gyp_path):v8_libplatform'
+ ],
+ }],
+ [ 'node_use_v8_platform=="true"', {
+@@ -869,13 +872,13 @@
+ }],
+ [ 'node_use_v8_platform=="true"', {
+ 'dependencies': [
+- 'deps/v8/tools/gyp/v8.gyp:v8_libplatform',
++ '<(v8_gyp_path):v8_libplatform',
+ ],
+ }],
+ [ 'node_use_bundled_v8=="true"', {
+ 'dependencies': [
+- 'deps/v8/tools/gyp/v8.gyp:v8',
+- 'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
++ '<(v8_gyp_path):v8',
++ '<(v8_gyp_path):v8_libplatform'
+ ],
+ }],
+ ]
+diff --git a/src/node_main.cc b/src/node_main.cc
+index bde397562..5b5a6dd99 100644
+--- a/src/node_main.cc
++++ b/src/node_main.cc
+@@ -49,11 +49,13 @@ int wmain(int argc, wchar_t *wargv[]) {
+ }
+ #else
+ // UNIX
++#include <stdlib.h>
+ int main(int argc, char *argv[]) {
+ // Disable stdio buffering, it interacts poorly with printf()
+ // calls elsewhere in the program (e.g., any logging from V8.)
+ setvbuf(stdout, nullptr, _IONBF, 0);
+ setvbuf(stderr, nullptr, _IONBF, 0);
++ putenv("ELECTRON_NODE_DISABLE_ASAR_SUPPORT=1");
+ return node::Start(argc, argv);
+ }
+ #endif
+--
+2.11.0
+
diff --git a/dev-util/electron/files/electron-1.3.6-vendor-brightray.patch b/dev-util/electron/files/electron-1.3.6-vendor-brightray.patch
new file mode 100644
index 000000000000..5f789e784479
--- /dev/null
+++ b/dev-util/electron/files/electron-1.3.6-vendor-brightray.patch
@@ -0,0 +1,143 @@
+From 08a13bec9d06a0ea3d86b8a3126cf83a200a8320 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Mon, 8 Feb 2016 15:14:58 -0500
+Subject: [PATCH] brightray build fixes
+
+---
+ brightray.gyp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
+ brightray.gypi | 20 +++++++-------------
+ 2 files changed, 55 insertions(+), 17 deletions(-)
+
+diff --git a/brightray.gyp b/brightray.gyp
+index d089dba..a34b090 100644
+--- a/brightray.gyp
++++ b/brightray.gyp
+@@ -1,7 +1,7 @@
+ {
+ 'variables': {
+ # The libraries brightray will be compiled to.
+- 'linux_system_libraries': 'gtk+-2.0 dbus-1 x11 xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gconf-2.0 gmodule-2.0 nss'
++ 'linux_system_libraries': 'gtk+-2.0 dbus-1 x11 xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gmodule-2.0 nss'
+ },
+ 'includes': [
+ 'filenames.gypi',
+@@ -9,6 +9,11 @@
+ 'targets': [
+ {
+ 'target_name': 'brightray',
++ 'dependencies': [
++ 'cups',
++ 'gconf',
++ '<(libchromiumcontent_src_dir)/chromiumcontent/chromiumcontent.gyp:chromiumcontent_all'
++ ],
+ 'type': 'static_library',
+ 'include_dirs': [
+ '.',
+@@ -104,12 +109,9 @@
+ }, {
+ 'link_settings': {
+ 'libraries': [
+- # Link with ffmpeg.
+- '<(libchromiumcontent_dir)/libffmpeg.so',
+ # Following libraries are required by libchromiumcontent:
+ '-lasound',
+ '-lcap',
+- '-lcups',
+ '-lrt',
+ '-ldl',
+ '-lresolv',
+@@ -333,5 +335,47 @@
+ }], # OS=="win"
+ ],
+ },
++ {
++ 'target_name': 'gconf',
++ 'type': 'none',
++ 'conditions': [
++ ['use_gconf==1 and _toolset=="target"', {
++ 'direct_dependent_settings': {
++ 'cflags': [
++ '<!@(<(pkg-config) --cflags gconf-2.0)',
++ ],
++ 'defines': [
++ 'USE_GCONF',
++ ],
++ },
++ 'link_settings': {
++ 'ldflags': [
++ '<!@(<(pkg-config) --libs-only-L --libs-only-other gconf-2.0)',
++ ],
++ 'libraries': [
++ '<!@(<(pkg-config) --libs-only-l gconf-2.0)',
++ ],
++ },
++ }],
++ ],
++ },
++ {
++ 'target_name': 'cups',
++ 'type': 'none',
++ 'conditions': [
++ ['use_cups==1', {
++ 'direct_dependent_settings': {
++ 'defines': [
++ 'USE_CUPS',
++ ],
++ 'link_settings': {
++ 'libraries': [
++ '-lcups',
++ ],
++ },
++ },
++ }],
++ ],
++ },
+ ],
+ }
+diff --git a/brightray.gypi b/brightray.gypi
+index 634aec0..8d86999 100644
+--- a/brightray.gypi
++++ b/brightray.gypi
+@@ -1,9 +1,13 @@
+ {
+- 'includes': [
+- 'vendor/download/libchromiumcontent/filenames.gypi',
+- ],
+ 'variables': {
+ 'libchromiumcontent_component%': 1,
++ 'libchromiumcontent_src_dir': '<(DEPTH)',
++ 'libchromiumcontent_shared_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)',
++ 'libchromiumcontent_static_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)',
++ 'libchromiumcontent_shared_libraries': [],
++ 'libchromiumcontent_static_libraries': [],
++ 'libchromiumcontent_shared_v8_libraries': [],
++ 'libchromiumcontent_static_v8_libraries': [],
+ 'pkg-config%': 'pkg-config',
+ 'conditions': [
+ # The "libchromiumcontent_component" is defined when calling "gyp".
+@@ -234,22 +238,12 @@
+ 'conditions': [
+ ['OS=="linux"', {
+ 'cflags': [
+- '-O2',
+- # Generate symbols, will be stripped later.
+- '-g',
+- # Don't emit the GCC version ident directives, they just end up
+- # in the .comment section taking up binary size.
+- '-fno-ident',
+ # Put data and code in their own sections, so that unused symbols
+ # can be removed at link time with --gc-sections.
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'ldflags': [
+- # Specifically tell the linker to perform optimizations.
+- # See http://lwn.net/Articles/192624/ .
+- '-Wl,-O1',
+- '-Wl,--as-needed',
+ '-Wl,--gc-sections',
+ ],
+ }], # OS=="linux"
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-1.3.6-vendor-libchromiumcontent.patch b/dev-util/electron/files/electron-1.3.6-vendor-libchromiumcontent.patch
new file mode 100644
index 000000000000..ed3815006164
--- /dev/null
+++ b/dev-util/electron/files/electron-1.3.6-vendor-libchromiumcontent.patch
@@ -0,0 +1,78 @@
+From 0448735817b941e5039616144aa836c2f08c9c54 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Mon, 8 Feb 2016 15:12:12 -0500
+Subject: [PATCH] libchromiumcontent build fixes
+
+---
+ chromiumcontent/chromiumcontent.gyp | 7 ++++---
+ chromiumcontent/chromiumcontent.gypi | 21 ---------------------
+ 2 files changed, 4 insertions(+), 24 deletions(-)
+
+diff --git a/chromiumcontent/chromiumcontent.gyp b/chromiumcontent/chromiumcontent.gyp
+index 5278324..41e7de3 100644
+--- a/chromiumcontent/chromiumcontent.gyp
++++ b/chromiumcontent/chromiumcontent.gyp
+@@ -24,11 +24,11 @@
+ },
+ {
+ 'target_name': 'chromiumcontent',
+- # Build chromiumcontent as shared_library otherwise some static libraries
+- # will not build.
+- 'type': 'shared_library',
++ 'type': 'static_library',
+ 'dependencies': [
+ '<(DEPTH)/components/prefs/prefs.gyp:prefs',
++ '<(DEPTH)/chrome/chrome_resources.gyp:packed_extra_resources',
++ '<(DEPTH)/chrome/chrome_resources.gyp:packed_resources',
+ '<(DEPTH)/components/components.gyp:cdm_renderer',
+ '<(DEPTH)/components/components.gyp:devtools_discovery',
+ '<(DEPTH)/components/components.gyp:devtools_http_handler',
+@@ -41,6 +41,7 @@
+ '<(DEPTH)/ppapi/ppapi_internal.gyp:ppapi_proxy',
+ '<(DEPTH)/ppapi/ppapi_internal.gyp:ppapi_ipc',
+ '<(DEPTH)/ppapi/ppapi_internal.gyp:ppapi_shared',
++ '<(DEPTH)/third_party/WebKit/Source/config.gyp:config',
+ '<(DEPTH)/third_party/webrtc/modules/modules.gyp:desktop_capture',
+ '<(DEPTH)/third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter',
+ '<(DEPTH)/third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',
+diff --git a/chromiumcontent/chromiumcontent.gypi b/chromiumcontent/chromiumcontent.gypi
+index 6d605a2..bd28a21 100644
+--- a/chromiumcontent/chromiumcontent.gypi
++++ b/chromiumcontent/chromiumcontent.gypi
+@@ -1,17 +1,5 @@
+ {
+ 'variables': {
+- # Don't use nacl.
+- 'disable_nacl': 1,
+- # Enable using proprietary codecs.
+- 'proprietary_codecs': 1,
+- # Build ffmpeg as shared library.
+- 'ffmpeg_component': 'shared_library',
+- # Enable support for Widevine CDM.
+- 'enable_widevine': 1,
+- # Using libc++ requires building for >= 10.7.
+- 'mac_deployment_target': '10.8',
+- # Use the standard way of linking with msvc runtime.
+- 'win_use_allocator_shim': 0,
+ # The V8 libraries.
+ 'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", "v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]',
+ # The icu libraries.
+@@ -22,15 +10,6 @@
+ 'v8_use_external_startup_data': 1,
+ }],
+ ['OS=="linux"', {
+- # Enable high DPI support on Linux.
+- 'enable_hidpi': 1,
+- # Use Dbus.
+- 'use_dbus': 1,
+- # Make Linux build contain debug symbols, this flag will add '-g' to
+- # cflags.
+- 'linux_dump_symbols': 1,
+- # Force using gold linker.
+- 'linux_use_bundled_gold': 1,
+ 'conditions': [
+ ['target_arch=="arm"', {
+ 'arm_version': 7,
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-1.3.6-vendor-node.patch b/dev-util/electron/files/electron-1.3.6-vendor-node.patch
new file mode 100644
index 000000000000..6d55d87de68e
--- /dev/null
+++ b/dev-util/electron/files/electron-1.3.6-vendor-node.patch
@@ -0,0 +1,92 @@
+From 742d610e4936d7377dd66b8ec6213c6c0afa121f Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Wed, 10 Feb 2016 14:45:13 -0500
+Subject: [PATCH] Build fixes
+
+---
+ lib/internal/bootstrap_node.js | 2 ++
+ node.gyp | 13 ++++++++-----
+ src/node_main.cc | 2 ++
+ 3 files changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js
+index 3e698ed..c748f64 100644
+--- a/lib/internal/bootstrap_node.js
++++ b/lib/internal/bootstrap_node.js
+@@ -50,7 +50,9 @@
+ setupGlobalConsole();
+ }
+
++ if (!process.env.ELECTRON_NODE_DISABLE_ASAR_SUPPORT) {
+ setupAsarSupport();
++ }
+
+ const _process = NativeModule.require('internal/process');
+
+diff --git a/node.gyp b/node.gyp
+index 1ad0137..8f24426 100644
+--- a/node.gyp
++++ b/node.gyp
+@@ -1,6 +1,7 @@
+ {
+ 'variables': {
+ 'v8_use_snapshot%': 'false',
++ 'v8_gyp_path%': 'deps/v8/tools/gyp/v8.gyp',
+ 'node_use_dtrace%': 'false',
+ 'node_use_lttng%': 'false',
+ 'node_use_etw%': 'false',
+@@ -126,6 +127,8 @@
+
+ 'dependencies': [
+ 'node_js2c#host',
++ '<(v8_gyp_path):v8',
++ '<(v8_gyp_path):v8_libplatform'
+ ],
+
+ 'include_dirs': [
+@@ -254,8 +257,8 @@
+ ],
+
+ 'dependencies': [
+- 'deps/v8/tools/gyp/v8.gyp:v8',
+- 'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
++ '<(v8_gyp_path):v8',
++ '<(v8_gyp_path):v8_libplatform'
+ ],
+ }],
+ [ 'node_use_v8_platform=="true"', {
+@@ -842,13 +845,13 @@
+ }],
+ [ 'node_use_v8_platform=="true"', {
+ 'dependencies': [
+- 'deps/v8/tools/gyp/v8.gyp:v8_libplatform',
++ '<(v8_gyp_path):v8_libplatform',
+ ],
+ }],
+ [ 'node_use_bundled_v8=="true"', {
+ 'dependencies': [
+- 'deps/v8/tools/gyp/v8.gyp:v8',
+- 'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
++ '<(v8_gyp_path):v8',
++ '<(v8_gyp_path):v8_libplatform'
+ ],
+ }],
+ ]
+diff --git a/src/node_main.cc b/src/node_main.cc
+index 02082ba..641e8db 100644
+--- a/src/node_main.cc
++++ b/src/node_main.cc
+@@ -49,8 +49,10 @@ int wmain(int argc, wchar_t *wargv[]) {
+ }
+ #else
+ // UNIX
++#include <stdlib.h>
+ int main(int argc, char *argv[]) {
+ setvbuf(stderr, NULL, _IOLBF, 1024);
++ putenv("ELECTRON_NODE_DISABLE_ASAR_SUPPORT=1");
+ return node::Start(argc, argv);
+ }
+ #endif
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-1.3.6.patch b/dev-util/electron/files/electron-1.3.6.patch
new file mode 100644
index 000000000000..57ebe31a27b9
--- /dev/null
+++ b/dev-util/electron/files/electron-1.3.6.patch
@@ -0,0 +1,422 @@
+From d6b2c31fe1b21d171ecedcd2a198bd5b8347bd98 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 | 52 ++++++++++++++++++++++++++++++++------
+ electron.gyp | 63 ++++++++++++++++++++++++++++++++++++-----------
+ filenames.gypi | 1 -
+ toolchain.gypi | 47 +----------------------------------
+ tools/atom_source_root.py | 5 ++++
+ tools/get-endianness.py | 4 +++
+ tools/js2asar.py | 13 +++++-----
+ 7 files changed, 110 insertions(+), 75 deletions(-)
+ create mode 100644 tools/atom_source_root.py
+ create mode 100644 tools/get-endianness.py
+
+diff --git a/common.gypi b/common.gypi
+index 52eba31..55f061a 100644
+--- a/common.gypi
++++ b/common.gypi
+@@ -17,24 +17,20 @@
+ '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_byteorder': '<!(python <(DEPTH)/tools/get-endianness.py)',
+ 'node_target_type': 'shared_library',
+ '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_tag': '',
++ 'node_module_version': '',
+ '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',
+ 'uv_library': 'static_library',
+ 'uv_parent_path': 'vendor/node/deps/uv',
+@@ -43,10 +39,37 @@
+ 'v8_postmortem_support': 'false',
+ 'v8_enable_i18n_support': 'false',
+ 'v8_inspector': 'false',
++ 'v8_gyp_path': '<(DEPTH)/v8/src/v8.gyp',
++ 'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", "v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]',
++ 'v8_target_type': 'shared_library',
++ 'v8_use_snapshot': 'true',
++ 'v8_use_external_startup_data': 1,
+ },
+ # Settings to compile node under Windows.
+ 'target_defaults': {
+ 'target_conditions': [
++ ['_target_name in <(v8_libraries) + ["node"]', {
++ 'cflags!': [
++ '-fvisibility=hidden',
++ '-fdata-sections',
++ '-ffunction-sections',
++ ],
++ 'cflags_cc!': [
++ '-fvisibility-inlines-hidden'
++ ],
++ }],
++
++ ['_target_name in <(v8_libraries) + ["mksnapshot"]', {
++ 'defines': [
++ 'V8_SHARED',
++ 'BUILDING_V8_SHARED',
++ ],
++ }],
++
++ ['_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'
+@@ -253,6 +276,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 eb671fd..7253b37 100644
+--- a/electron.gyp
++++ b/electron.gyp
+@@ -30,6 +30,7 @@
+ 'dependencies': [
+ 'js2asar',
+ 'app2asar',
++ 'nodebin',
+ '<(project_name)_lib',
+ ],
+ 'sources': [
+@@ -164,7 +165,7 @@
+ ],
+ }, {
+ 'dependencies': [
+- 'vendor/breakpad/breakpad.gyp:dump_syms#host',
++ 'breakpad/breakpad.gyp:dump_syms#host',
+ ],
+ }], # OS=="win"
+ ['OS=="linux"', {
+@@ -181,7 +182,7 @@
+ }, {
+ 'copied_libraries': [
+ '<(PRODUCT_DIR)/lib/libnode.so',
+- '<(libchromiumcontent_dir)/libffmpeg.so',
++ '<(PRODUCT_DIR)/lib/libv8.so',
+ ],
+ }],
+ ],
+@@ -189,13 +190,8 @@
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ '<@(copied_libraries)',
+- '<(libchromiumcontent_dir)/locales',
+- '<(libchromiumcontent_dir)/icudtl.dat',
+- '<(libchromiumcontent_dir)/blink_image_resources_200_percent.pak',
+- '<(libchromiumcontent_dir)/content_resources_200_percent.pak',
++ '<(libchromiumcontent_dir)/repack/chrome_200_percent.pak',
+ '<(libchromiumcontent_dir)/content_shell.pak',
+- '<(libchromiumcontent_dir)/ui_resources_200_percent.pak',
+- '<(libchromiumcontent_dir)/views_resources_200_percent.pak',
+ '<(libchromiumcontent_dir)/natives_blob.bin',
+ '<(libchromiumcontent_dir)/snapshot_blob.bin',
+ ],
+@@ -230,15 +226,14 @@
+ '<@(lib_sources)',
+ ],
+ 'include_dirs': [
+- '.',
+ 'chromium_src',
++ '.',
+ 'vendor/brightray',
+ 'vendor/native_mate',
+ # Include atom_natives.h.
+ '<(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',
+@@ -289,8 +284,8 @@
+ 'vendor/node/deps/uv/uv.gyp:libuv',
+ 'vendor/node/deps/zlib/zlib.gyp:zlib',
+ # Build with breakpad support.
+- 'vendor/breakpad/breakpad.gyp:breakpad_handler',
+- 'vendor/breakpad/breakpad.gyp:breakpad_sender',
++ 'breakpad/breakpad.gyp:breakpad_handler',
++ 'breakpad/breakpad.gyp:breakpad_sender',
+ ],
+ }], # OS=="win"
+ ['OS=="mac" and mas_build==0', {
+@@ -328,7 +323,7 @@
+ # 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',
+ ],
+@@ -339,10 +334,10 @@
+ '-Wno-reserved-user-defined-literal',
+ ],
+ 'include_dirs': [
+- 'vendor/breakpad/src',
++ 'breakpad/src',
+ ],
+ 'dependencies': [
+- 'vendor/breakpad/breakpad.gyp:breakpad_client',
++ 'breakpad/breakpad.gyp:breakpad_client',
+ ],
+ }], # OS=="linux"
+ ],
+@@ -350,6 +345,9 @@
+ {
+ 'target_name': 'js2asar',
+ 'type': 'none',
++ 'dependencies': [
++ 'nodebin'
++ ],
+ 'actions': [
+ {
+ 'action_name': 'js2asar',
+@@ -371,6 +369,7 @@
+ 'action': [
+ 'python',
+ 'tools/js2asar.py',
++ '<(PRODUCT_DIR)/nodebin',
+ '<@(_outputs)',
+ 'lib',
+ '<@(_inputs)',
+@@ -381,6 +380,9 @@
+ {
+ 'target_name': 'app2asar',
+ 'type': 'none',
++ 'dependencies': [
++ 'nodebin'
++ ],
+ 'actions': [
+ {
+ 'action_name': 'app2asar',
+@@ -402,6 +404,7 @@
+ 'action': [
+ 'python',
+ 'tools/js2asar.py',
++ '<(PRODUCT_DIR)/nodebin',
+ '<@(_outputs)',
+ 'default_app',
+ '<@(_inputs)',
+@@ -430,6 +433,36 @@
+ }
+ ],
+ }, # target atom_js2c
++ {
++ 'target_name': 'nodebin',
++ 'type': 'executable',
++ 'sources': [
++ 'vendor/node/src/node_main.cc',
++ ],
++ 'dependencies': [
++ 'vendor/node/node.gyp:node',
++ ],
++ 'include_dirs': [
++ '.',
++ 'vendor/native_mate',
++ # Include atom_natives.h.
++ '<(SHARED_INTERMEDIATE_DIR)',
++ # Include directories for uv and node.
++ 'vendor/node/src',
++ 'vendor/node/deps/uv/include',
++ # 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': {
++ 'ldflags': [
++ '-Wl,-rpath=\$$ORIGIN/',
++ # Make native module dynamic loading work.
++ '-rdynamic',
++ ],
++ },
++ }, # target nodebin
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+diff --git a/filenames.gypi b/filenames.gypi
+index 9e20582..c7960a9 100644
+--- a/filenames.gypi
++++ b/filenames.gypi
+@@ -558,7 +558,6 @@
+ 'chromium_src/extensions/browser/app_window/size_constraints.h',
+ 'chromium_src/extensions/common/url_pattern.cc',
+ 'chromium_src/extensions/common/url_pattern.h',
+- 'chromium_src/library_loaders/libspeechd_loader.cc',
+ 'chromium_src/library_loaders/libspeechd.h',
+ 'chromium_src/net/test/embedded_test_server/stream_listen_socket.cc',
+ 'chromium_src/net/test/embedded_test_server/stream_listen_socket.h',
+diff --git a/toolchain.gypi b/toolchain.gypi
+index 1c5f8a7..2af11f5 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': {
+diff --git a/tools/atom_source_root.py b/tools/atom_source_root.py
+new file mode 100644
+index 0000000..316e997
+--- /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/get-endianness.py b/tools/get-endianness.py
+new file mode 100644
+index 0000000..3150793
+--- /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 adad175..ca76868 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):
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-1.6.11-vendor-brightray.patch b/dev-util/electron/files/electron-1.6.11-vendor-brightray.patch
new file mode 100644
index 000000000000..a1a351195d00
--- /dev/null
+++ b/dev-util/electron/files/electron-1.6.11-vendor-brightray.patch
@@ -0,0 +1,163 @@
+From 610ee2681f9532a13f63edf78aab55b1dcb8abf2 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Mon, 8 Feb 2016 15:14:58 -0500
+Subject: [PATCH] brightray build fixes
+
+---
+ brightray.gyp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
+ brightray.gypi | 14 ++-----------
+ 2 files changed, 64 insertions(+), 16 deletions(-)
+
+diff --git a/brightray.gyp b/brightray.gyp
+index e60d17a..37e5159 100644
+--- a/brightray.gyp
++++ b/brightray.gyp
+@@ -1,7 +1,7 @@
+ {
+ 'variables': {
+ # The libraries brightray will be compiled to.
+- 'linux_system_libraries': 'gtk+-2.0 dbus-1 x11 x11-xcb xcb xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gconf-2.0 gmodule-2.0 nss'
++ 'linux_system_libraries': 'gtk+-2.0 dbus-1 x11 x11-xcb xcb xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gmodule-2.0 nss'
+ },
+ 'includes': [
+ 'filenames.gypi',
+@@ -9,6 +9,10 @@
+ 'targets': [
+ {
+ 'target_name': 'brightray',
++ 'dependencies': [
++ 'cups',
++ 'gconf',
++ ],
+ 'type': 'static_library',
+ 'include_dirs': [
+ '.',
+@@ -130,18 +134,30 @@
+ }, {
+ 'link_settings': {
+ 'libraries': [
+- # Link with ffmpeg.
+- '<(libchromiumcontent_dir)/libffmpeg.so',
+ # Following libraries are required by libchromiumcontent:
+ '-lasound',
+ '-lcap',
+- '-lcups',
+ '-lrt',
+ '-ldl',
+ '-lresolv',
+ '-lfontconfig',
+ '-lfreetype',
+ '-lexpat',
++ '-lre2',
++ '-ljpeg',
++ '-lsnappy',
++ '-lharfbuzz',
++ '-lpng',
++ '-lxml2',
++ '-lxslt',
++ '-lwebp',
++ '-lwebpdemux',
++ '-lavcodec',
++ '-lavformat',
++ '-lavutil',
++ '-lvpx',
++ '-lFLAC',
++ '-lminizip',
+ ],
+ },
+ }],
+@@ -390,5 +406,47 @@
+ }], # OS=="win"
+ ],
+ },
++ {
++ 'target_name': 'gconf',
++ 'type': 'none',
++ 'conditions': [
++ ['use_gconf==1 and _toolset=="target"', {
++ 'direct_dependent_settings': {
++ 'cflags': [
++ '<!@(<(pkg-config) --cflags gconf-2.0)',
++ ],
++ 'defines': [
++ 'USE_GCONF',
++ ],
++ },
++ 'link_settings': {
++ 'ldflags': [
++ '<!@(<(pkg-config) --libs-only-L --libs-only-other gconf-2.0)',
++ ],
++ 'libraries': [
++ '<!@(<(pkg-config) --libs-only-l gconf-2.0)',
++ ],
++ },
++ }],
++ ],
++ },
++ {
++ 'target_name': 'cups',
++ 'type': 'none',
++ 'conditions': [
++ ['use_cups==1', {
++ 'direct_dependent_settings': {
++ 'defines': [
++ 'USE_CUPS',
++ ],
++ 'link_settings': {
++ 'libraries': [
++ '-lcups',
++ ],
++ },
++ },
++ }],
++ ],
++ },
+ ],
+ }
+diff --git a/brightray.gypi b/brightray.gypi
+index 064ae1a..95d6f14 100644
+--- a/brightray.gypi
++++ b/brightray.gypi
+@@ -1,6 +1,6 @@
+ {
+ 'includes': [
+- 'vendor/download/libchromiumcontent/filenames.gypi',
++ 'vendor/libchromiumcontent/dist/main/filenames.gypi',
+ ],
+ 'variables': {
+ 'libchromiumcontent_component%': 1,
+@@ -14,7 +14,7 @@
+ }, {
+ 'libchromiumcontent_dir%': '<(libchromiumcontent_static_libraries_dir)',
+ 'libchromiumcontent_libraries%': '<(libchromiumcontent_static_libraries)',
+- 'libchromiumcontent_v8_libraries%': '<(libchromiumcontent_static_v8_libraries)',
++ 'libchromiumcontent_v8_libraries%': '<(libchromiumcontent_shared_v8_libraries)',
+ }],
+ ],
+ },
+@@ -235,22 +235,12 @@
+ 'conditions': [
+ ['OS=="linux"', {
+ 'cflags': [
+- '-O2',
+- # Generate symbols, will be stripped later.
+- '-g',
+- # Don't emit the GCC version ident directives, they just end up
+- # in the .comment section taking up binary size.
+- '-fno-ident',
+ # Put data and code in their own sections, so that unused symbols
+ # can be removed at link time with --gc-sections.
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'ldflags': [
+- # Specifically tell the linker to perform optimizations.
+- # See http://lwn.net/Articles/192624/ .
+- '-Wl,-O1',
+- '-Wl,--as-needed',
+ '-Wl,--gc-sections',
+ ],
+ }], # OS=="linux"
+--
+2.13.3
+
diff --git a/dev-util/electron/files/electron-1.6.11-vendor-libchromiumcontent.patch b/dev-util/electron/files/electron-1.6.11-vendor-libchromiumcontent.patch
new file mode 100644
index 000000000000..d724e41f1fdb
--- /dev/null
+++ b/dev-util/electron/files/electron-1.6.11-vendor-libchromiumcontent.patch
@@ -0,0 +1,86 @@
+From 0a28ad879b544f73f74491ddd58646750335bf1d Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Fri, 28 Apr 2017 17:22:38 -0400
+Subject: [PATCH] Gentoo build fixes
+
+---
+ chromiumcontent/BUILD.gn | 8 ++------
+ chromiumcontent/build_libs.py | 2 +-
+ script/create-dist | 4 ----
+ script/lib/config.py | 2 +-
+ 4 files changed, 4 insertions(+), 12 deletions(-)
+
+diff --git a/chromiumcontent/BUILD.gn b/chromiumcontent/BUILD.gn
+index e4e4166..25be865 100644
+--- a/chromiumcontent/BUILD.gn
++++ b/chromiumcontent/BUILD.gn
+@@ -343,12 +343,8 @@ if (is_electron_build && !is_component_build) {
+ }
+ }
+
+- static_library("v8") {
+- complete_static_lib = true
+- sources = []
+- if (defined(obj_v8)) {
+- sources += obj_v8
+- }
++ shared_library("v8") {
++ deps = [ "//v8:v8", "//v8:v8_libplatform" ]
+ }
+
+ } else {
+diff --git a/chromiumcontent/build_libs.py b/chromiumcontent/build_libs.py
+index e10f320..716c5f2 100644
+--- a/chromiumcontent/build_libs.py
++++ b/chromiumcontent/build_libs.py
+@@ -82,7 +82,7 @@ with open(args.out, 'w') as out:
+ "third_party/usrsctp",
+ "third_party/woff2",
+ "third_party/zlib",
+- "tools",
++ "tools/battor_agent",
+ "ui",
+ "url",
+ ])
+diff --git a/script/create-dist b/script/create-dist
+index aec75e5..64c7401 100755
+--- a/script/create-dist
++++ b/script/create-dist
+@@ -45,7 +45,6 @@ COMPONENTS = ['static_library', 'shared_library']
+ BINARIES = {
+ 'all': [
+ 'content_shell.pak',
+- 'icudtl.dat',
+ 'natives_blob.bin',
+ 'snapshot_blob.bin',
+ os.path.join('gen', 'blink', 'public', 'resources', 'blink_image_resources_200_percent.pak'),
+@@ -59,7 +58,6 @@ BINARIES = {
+ 'libffmpeg.dylib',
+ ],
+ 'linux': [
+- 'libffmpeg.so',
+ ],
+ 'win32': [
+ 'd3dcompiler_47.dll',
+@@ -312,8 +310,6 @@ def main():
+ copy_generated_sources(target_arch, component)
+ copy_locales(target_arch, component)
+
+- copy_ffmpeg(target_arch)
+- copy_sources()
+ generate_licenses()
+ if not args.no_zip:
+ create_zip(create_debug_archive)
+diff --git a/script/lib/config.py b/script/lib/config.py
+index 3455161..195b2a1 100644
+--- a/script/lib/config.py
++++ b/script/lib/config.py
+@@ -4,4 +4,4 @@ import os
+
+
+ def get_output_dir(source_root, target_arch, component):
+- return os.path.join(source_root, 'src', 'out-' + target_arch, component)
++ return os.environ.get('CHROMIUM_BUILD_DIR')
+--
+2.13.3
+
diff --git a/dev-util/electron/files/electron-1.6.11-vendor-node.patch b/dev-util/electron/files/electron-1.6.11-vendor-node.patch
new file mode 100644
index 000000000000..2f931771f91a
--- /dev/null
+++ b/dev-util/electron/files/electron-1.6.11-vendor-node.patch
@@ -0,0 +1,80 @@
+From fc6ba3a74ffa88b22435531d6522d934a52187e5 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Wed, 10 Feb 2016 14:45:13 -0500
+Subject: [PATCH] Build fixes
+
+---
+ lib/internal/bootstrap_node.js | 2 ++
+ node.gyp | 9 +++++++++
+ src/node_main.cc | 2 ++
+ 3 files changed, 13 insertions(+)
+
+diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js
+index 085ea00fd0..cb49fc87a7 100644
+--- a/lib/internal/bootstrap_node.js
++++ b/lib/internal/bootstrap_node.js
+@@ -40,7 +40,9 @@
+ setupGlobalConsole();
+ }
+
++ if (!process.env.ELECTRON_NODE_DISABLE_ASAR_SUPPORT) {
+ setupAsarSupport();
++ }
+
+ const _process = NativeModule.require('internal/process');
+
+diff --git a/node.gyp b/node.gyp
+index 95f24933fc..1434904324 100644
+--- a/node.gyp
++++ b/node.gyp
+@@ -17,6 +17,7 @@
+ 'node_shared_libuv%': 'false',
+ 'node_use_openssl%': 'true',
+ 'node_shared_openssl%': 'false',
++ 'node_v8_path%': 'deps/v8',
+ 'node_v8_options%': '',
+ 'node_enable_v8_vtunejit%': 'false',
+ 'node_core_target_name%': 'node',
+@@ -133,6 +134,7 @@
+ ],
+
+ 'include_dirs': [
++ '<(node_v8_path)/include',
+ 'src',
+ 'tools/msvs/genfiles',
+ 'deps/uv/src/ares',
+@@ -238,6 +240,13 @@
+ 'V8_DEPRECATION_WARNINGS=1',
+ ],
+
++ 'link_settings': {
++ 'ldflags': [
++ '-Wl,-rpath=\$$ORIGIN/',
++ # Make native module dynamic loading work.
++ '-rdynamic',
++ ],
++ },
+
+ 'conditions': [
+ [ 'node_shared=="false"', {
+diff --git a/src/node_main.cc b/src/node_main.cc
+index 16bda81ae6..fd559ef1c3 100644
+--- a/src/node_main.cc
++++ b/src/node_main.cc
+@@ -50,11 +50,13 @@ int wmain(int argc, wchar_t *wargv[]) {
+ }
+ #else
+ // UNIX
++#include <stdlib.h>
+ int main(int argc, char *argv[]) {
+ // Disable stdio buffering, it interacts poorly with printf()
+ // calls elsewhere in the program (e.g., any logging from V8.)
+ setvbuf(stdout, nullptr, _IONBF, 0);
+ setvbuf(stderr, nullptr, _IONBF, 0);
++ putenv("ELECTRON_NODE_DISABLE_ASAR_SUPPORT=1");
+ return node::Start(argc, argv);
+ }
+ #endif
+--
+2.13.3
+
diff --git a/dev-util/electron/files/electron-1.6.11.patch b/dev-util/electron/files/electron-1.6.11.patch
new file mode 100644
index 000000000000..b40d471348ab
--- /dev/null
+++ b/dev-util/electron/files/electron-1.6.11.patch
@@ -0,0 +1,512 @@
+From b756fa976480791c76e9338a16ee2b0a29265b93 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 | 43 ++++++++++++++++++++++-----
+ electron.gyp | 74 +++++++++++++++++++++++++++++++++++----------
+ 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 ++++----
+ 8 files changed, 179 insertions(+), 75 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..c441ae04b 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.
+@@ -16,26 +17,23 @@
+ 'openssl_no_asm': 1,
+ '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_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 +42,16 @@
+ 'v8_postmortem_support': 'false',
+ 'v8_enable_i18n_support': 'false',
+ 'v8_inspector': 'false',
++ '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 +132,14 @@
+ ],
+ }],
+ ['_target_name=="node"', {
++ 'cflags!': [
++ '-fvisibility=hidden',
++ '-fdata-sections',
++ '-ffunction-sections',
++ ],
++ 'cflags_cc!': [
++ '-fvisibility-inlines-hidden',
++ ],
+ 'include_dirs': [
+ '<(libchromiumcontent_src_dir)',
+ '<(libchromiumcontent_src_dir)/third_party/icu/source/common',
+@@ -228,6 +240,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 b415525b1..4d0185561 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)',
+ ],
+ }],
+ ],
+@@ -200,7 +200,6 @@
+ 'files': [
+ '<@(copied_libraries)',
+ '<(libchromiumcontent_dir)/locales',
+- '<(libchromiumcontent_dir)/icudtl.dat',
+ '<(libchromiumcontent_dir)/blink_image_resources_200_percent.pak',
+ '<(libchromiumcontent_dir)/content_resources_200_percent.pak',
+ '<(libchromiumcontent_dir)/content_shell.pak',
+@@ -245,15 +244,17 @@
+ '<@(lib_sources)',
+ ],
+ 'include_dirs': [
+- '.',
+ 'chromium_src',
++ '.',
+ 'vendor/brightray',
+ 'vendor/native_mate',
++ # libicu headers shim.
++ '<(SHARED_INTERMEDIATE_DIR)/shim_headers/icui18n_shim',
++ '<(SHARED_INTERMEDIATE_DIR)/shim_headers/icuuc_shim',
+ # Include atom_natives.h.
+ '<(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',
+@@ -342,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',
+ ],
+@@ -368,6 +370,9 @@
+ {
+ 'target_name': 'js2asar',
+ 'type': 'none',
++ 'dependencies': [
++ 'nodebin'
++ ],
+ 'actions': [
+ {
+ 'action_name': 'js2asar',
+@@ -389,6 +394,7 @@
+ 'action': [
+ 'python',
+ 'tools/js2asar.py',
++ '<(PRODUCT_DIR)/nodebin',
+ '<@(_outputs)',
+ 'lib',
+ '<@(_inputs)',
+@@ -399,6 +405,9 @@
+ {
+ 'target_name': 'app2asar',
+ 'type': 'none',
++ 'dependencies': [
++ 'nodebin'
++ ],
+ 'actions': [
+ {
+ 'action_name': 'app2asar',
+@@ -420,6 +429,7 @@
+ 'action': [
+ 'python',
+ 'tools/js2asar.py',
++ '<(PRODUCT_DIR)/nodebin',
+ '<@(_outputs)',
+ 'default_app',
+ '<@(_inputs)',
+@@ -445,6 +455,7 @@
+ 'dependencies': [
+ # depend on this target to ensure the '<(js2c_input_dir)' is created
+ 'atom_js2c_copy',
++ 'nodebin'
+ ],
+ 'variables': {
+ 'sandbox_args': [
+@@ -474,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)',
+@@ -493,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)',
+ ],
+@@ -533,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):
+--
+2.14.1
+
diff --git a/dev-util/electron/files/electron-vendor-node-external-snapshots-r0.patch b/dev-util/electron/files/electron-vendor-node-external-snapshots-r0.patch
new file mode 100644
index 000000000000..d3fce0868cd4
--- /dev/null
+++ b/dev-util/electron/files/electron-vendor-node-external-snapshots-r0.patch
@@ -0,0 +1,116 @@
+From 820cb5ce8e1aa08e68fe0f2e3cbbe74972e7af84 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Sat, 11 Jun 2016 18:27:19 -0400
+Subject: [PATCH] Add support for external V8 snapshots
+
+---
+ src/node.cc | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 86 insertions(+)
+
+diff --git a/src/node.cc b/src/node.cc
+index 961abc2..4dac94b 100644
+--- a/src/node.cc
++++ b/src/node.cc
+@@ -4188,6 +4188,90 @@ Environment* CreateEnvironment(Isolate* isolate,
+ return env;
+ }
+
++#include <sys/mman.h>
++
++const char kProcSelfExe[] = "/proc/self/exe";
++const char kNativesFileName[] = "natives_blob.bin";
++const char kSnapshotFileName[] = "snapshot_blob.bin";
++const char *g_mapped_natives = nullptr;
++const char *g_mapped_snapshot = nullptr;
++
++static char* SnapshotPath(const char* filename) {
++ char *path;
++ char *dir;
++ ssize_t r;
++
++ path = reinterpret_cast<char*>(malloc(4096 + strlen(filename) + 2));
++ if (path == nullptr) {
++ fprintf(stderr, "out of memory\n");
++ ABORT();
++ }
++
++ r = readlink(kProcSelfExe, path, 4096 + 1);
++ if (r == -1) {
++ perror("could not determine node executable directory");
++ ABORT();
++ }
++
++ path[r] = '\0';
++
++ dir = strrchr(path, '/');
++
++ strcpy(dir + 1, filename);
++
++ return path;
++}
++
++static void LoadV8Snapshot(const char* name, const char** addr, size_t *size) {
++ char *path = SnapshotPath(name);
++ int fd;
++ struct stat sb;
++
++ fd = open(path, O_RDONLY);
++
++ if (fd == -1) {
++ fprintf(stderr, "could not open snapshot file '%s': %s\n",
++ path, sys_errlist[errno]);
++ ABORT();
++ }
++
++ if (fstat(fd, &sb) == -1) {
++ fprintf(stderr, "could not stat snapshot file '%s': %s\n",
++ path, sys_errlist[errno]);
++ ABORT();
++ }
++
++ *size = sb.st_size;
++
++ *addr = reinterpret_cast<const char*>(
++ mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0));
++ if (*addr == MAP_FAILED) {
++ fprintf(stderr, "could not read snapshot file '%s': %s\n",
++ path, sys_errlist[errno]);
++ ABORT();
++ }
++
++ close(fd);
++ free(path);
++}
++
++static void LoadV8Snapshots() {
++ size_t natives_size;
++ size_t snapshot_size;
++
++ LoadV8Snapshot(kNativesFileName, &g_mapped_natives, &natives_size);
++ LoadV8Snapshot(kSnapshotFileName, &g_mapped_snapshot, &snapshot_size);
++
++ v8::StartupData natives;
++ natives.data = g_mapped_natives;
++ natives.raw_size = natives_size;
++ V8::SetNativesDataBlob(&natives);
++
++ v8::StartupData snapshot;
++ snapshot.data = g_mapped_snapshot;
++ snapshot.raw_size = snapshot_size;
++ V8::SetSnapshotDataBlob(&snapshot);
++}
+
+ // Entry point for new node instances, also called directly for the main
+ // node instance.
+@@ -4301,6 +4385,8 @@ int Start(int argc, char** argv) {
+ const char** exec_argv;
+ Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
+
++ LoadV8Snapshots();
++
+ #if HAVE_OPENSSL
+ #ifdef NODE_FIPS_MODE
+ // In the case of FIPS builds we should make sure
+--
+2.7.3
+
diff --git a/dev-util/electron/files/electron-vendor-node-external-snapshots-r2.patch b/dev-util/electron/files/electron-vendor-node-external-snapshots-r2.patch
new file mode 100644
index 000000000000..b3cd18c2fe2b
--- /dev/null
+++ b/dev-util/electron/files/electron-vendor-node-external-snapshots-r2.patch
@@ -0,0 +1,117 @@
+From da7d4d995b31fcdc94158bbc4adc01bf9bab78a9 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Sat, 11 Jun 2016 18:27:19 -0400
+Subject: [PATCH] Add support for external V8 snapshots
+
+---
+ src/node.cc | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 87 insertions(+)
+
+diff --git a/src/node.cc b/src/node.cc
+index 66233d451..96e4e22d6 100644
+--- a/src/node.cc
++++ b/src/node.cc
+@@ -4493,6 +4493,91 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
+ return exit_code;
+ }
+
++#include <sys/mman.h>
++
++const char kProcSelfExe[] = "/proc/self/exe";
++const char kNativesFileName[] = "natives_blob.bin";
++const char kSnapshotFileName[] = "snapshot_blob.bin";
++const char *g_mapped_natives = nullptr;
++const char *g_mapped_snapshot = nullptr;
++
++static char* SnapshotPath(const char* filename) {
++ char *path;
++ char *dir;
++ ssize_t r;
++
++ path = reinterpret_cast<char*>(malloc(4096 + strlen(filename) + 2));
++ if (path == nullptr) {
++ fprintf(stderr, "out of memory\n");
++ ABORT();
++ }
++
++ r = readlink(kProcSelfExe, path, 4096 + 1);
++ if (r == -1) {
++ perror("could not determine node executable directory");
++ ABORT();
++ }
++
++ path[r] = '\0';
++
++ dir = strrchr(path, '/');
++
++ strcpy(dir + 1, filename);
++
++ return path;
++}
++
++static void LoadV8Snapshot(const char* name, const char** addr, size_t *size) {
++ char *path = SnapshotPath(name);
++ int fd;
++ struct stat sb;
++
++ fd = open(path, O_RDONLY);
++
++ if (fd == -1) {
++ fprintf(stderr, "could not open snapshot file '%s': %s\n",
++ path, sys_errlist[errno]);
++ ABORT();
++ }
++
++ if (fstat(fd, &sb) == -1) {
++ fprintf(stderr, "could not stat snapshot file '%s': %s\n",
++ path, sys_errlist[errno]);
++ ABORT();
++ }
++
++ *size = sb.st_size;
++
++ *addr = reinterpret_cast<const char*>(
++ mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0));
++ if (*addr == MAP_FAILED) {
++ fprintf(stderr, "could not read snapshot file '%s': %s\n",
++ path, sys_errlist[errno]);
++ ABORT();
++ }
++
++ close(fd);
++ free(path);
++}
++
++static void LoadV8Snapshots() {
++ size_t natives_size;
++ size_t snapshot_size;
++
++ LoadV8Snapshot(kNativesFileName, &g_mapped_natives, &natives_size);
++ LoadV8Snapshot(kSnapshotFileName, &g_mapped_snapshot, &snapshot_size);
++
++ v8::StartupData natives;
++ natives.data = g_mapped_natives;
++ natives.raw_size = natives_size;
++ V8::SetNativesDataBlob(&natives);
++
++ v8::StartupData snapshot;
++ snapshot.data = g_mapped_snapshot;
++ snapshot.raw_size = snapshot_size;
++ V8::SetSnapshotDataBlob(&snapshot);
++}
++
+ inline int Start(uv_loop_t* event_loop,
+ int argc, const char* const* argv,
+ int exec_argc, const char* const* exec_argv) {
+@@ -4557,6 +4642,8 @@ int Start(int argc, char** argv) {
+ const char** exec_argv;
+ Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
+
++ LoadV8Snapshots();
++
+ #if HAVE_OPENSSL
+ if (const char* extra = secure_getenv("NODE_EXTRA_CA_CERTS"))
+ crypto::UseExtraCaCerts(extra);
+--
+2.11.1
+
diff --git a/dev-util/electron/files/toolchain/BUILD.gn b/dev-util/electron/files/toolchain/BUILD.gn
new file mode 100644
index 000000000000..78f7b57e3be5
--- /dev/null
+++ b/dev-util/electron/files/toolchain/BUILD.gn
@@ -0,0 +1,19 @@
+import("//build/toolchain/gcc_toolchain.gni")
+
+gcc_toolchain("default") {
+ cc = getenv("CC")
+ cxx = getenv("CXX")
+ ar = getenv("AR")
+ nm = getenv("NM")
+ ld = cxx
+
+ extra_cflags = getenv("CFLAGS")
+ extra_cppflags = getenv("CPPFLAGS")
+ extra_cxxflags = getenv("CXXFLAGS")
+ extra_ldflags = getenv("LDFLAGS")
+
+ toolchain_args = {
+ current_cpu = current_cpu
+ current_os = current_os
+ }
+}