commit:     c23fbb5334aa47af81d5dc79d8a340b299523b04
Author:     Elvis Pranskevichus <elvis <AT> magic <DOT> io>
AuthorDate: Thu Sep 15 13:30:16 2016 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Tue Sep 20 06:12:22 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c23fbb53

dev-util/electron: 0.37, 1.3 version bump, slotted build

  * Add electron-0.37.8, electron-1.3.5.
  * Ebuilds have been slotted, it is now possible
    to have multiple versions of Electron installed.
  * Numerous build fixes.
  * PaX fixes (courtesy of @zaolin).

Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=591324
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=583542

Package-Manager: portage-2.2.28

Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 dev-util/electron/Manifest                         |  14 +-
 ....36.12-r3.ebuild => electron-0.36.12-r4.ebuild} |  48 ++-
 ...on-0.36.12-r3.ebuild => electron-0.37.8.ebuild} |  89 +++--
 ...ron-0.36.12-r3.ebuild => electron-1.3.5.ebuild} | 149 +++++---
 .../files/chromium-ffmpeg-license-r0.patch         |  44 +++
 .../files/chromium-last-commit-position-r0.patch   |  26 ++
 .../files/chromium-linker-warnings-r0.patch        |  18 +
 .../electron/files/chromium-lto-fixes-r1.patch     |  36 ++
 dev-util/electron/files/chromium-pdfium-r0.patch   |  17 +
 .../electron/files/chromium-shared-v8-r1.patch     |  15 +
 .../files/chromium-snapshot-toolchain-r1.patch     |  23 ++
 .../electron/files/chromium-system-ffmpeg-r2.patch |  50 +++
 .../electron/files/chromium-system-icu-r0.patch    |  14 +
 .../electron/files/chromium-system-jinja-r9.patch  |  71 ++++
 .../electron/files/chromium-system-zlib-r0.patch   |  19 +
 ...tch => electron-0.36.12-vendor-brightray.patch} |   0
 ...ectron-0.36.12-vendor-libchromiumcontent.patch} |   0
 ...es.patch => electron-0.36.12-vendor-node.patch} |   0
 ...oo-build-fixes.patch => electron-0.36.12.patch} |  43 ++-
 ...atch => electron-0.37.8-vendor-brightray.patch} |  21 +-
 ...lectron-0.37.8-vendor-libchromiumcontent.patch} |  28 +-
 ...xes.patch => electron-0.37.8-vendor-node.patch} |  78 ++--
 ...too-build-fixes.patch => electron-0.37.8.patch} | 319 +++++++++++-----
 ...patch => electron-1.3.5-vendor-brightray.patch} |  25 +-
 ...electron-1.3.5-vendor-libchromiumcontent.patch} |  41 +-
 .../files/electron-1.3.5-vendor-node.patch         |  92 +++++
 dev-util/electron/files/electron-1.3.5.patch       | 422 +++++++++++++++++++++
 ...ectron-vendor-node-external-snapshots-r0.patch} |  12 +-
 28 files changed, 1395 insertions(+), 319 deletions(-)

diff --git a/dev-util/electron/Manifest b/dev-util/electron/Manifest
index 749fd63..eff635a 100644
--- a/dev-util/electron/Manifest
+++ b/dev-util/electron/Manifest
@@ -1,7 +1,19 @@
-DIST asar-0.10.0.tar.gz 975433 SHA256 
49e743a952957aa22668b472ba926427f9e051ececeaadb922f8aff2bc8fd1ee SHA512 
702fa0e496a1db55a61d7e00d55456f8703f7af00e458f26413771dc71cd03e9418e0334bb1a500aaabe14ab598e19c64612ebf6411c77e30004833c8d5d151e
 WHIRLPOOL 
a2e4f8563f779aea19357962f0ac0895005ff93a601d409a7b2c685348cba845106729e1f2a39f95001c186c0c0ba914d73ff1364d488e0853dbbabda0e80bb3
+DIST asar-0.12.1.tar.gz 1016626 SHA256 
731714f0036318fe0878b517391a01977954bb088d4dbc7dd98682ff1e03c0e7 SHA512 
fc64be9b11215426d405f7acd7adf6c0eead3135b0012baf6d168a13c77675058a4e2c60682928ac014e4bef4538d452ad745d1e87dd315387997a19e04718a7
 WHIRLPOOL 
d73b8bb459724bb3b011de312171519c1f1954a94ce1bb0a20eb9877c168baa82a15786d3ab420d5b3d32ce8a11333e85f844b43c21cbd56c3b019e73774388e
+DIST brightray-554946c7873bbc6930779c871fe230856575049a.tar.gz 82384 SHA256 
71965df08464a57ad599f70f32cc4adac3467b952bc6683e8d35b8e676a40935 SHA512 
79a5bb1e901fd59953f78e148fd37106bf6f0aa899b273308e2c4fa647942e853c6e3722e570f674495a775ed7d507f4ba7ee1f5ec277f5b4ed6c95fb0808267
 WHIRLPOOL 
936cb8edb6c6e68bc6b4f9780a917fadf2a62d20dba816ad71a2a05d87e6adf991d218d42f7a6e6a22f953270fc1b297e91b7767c9be6e69636f1b0b6ace3625
+DIST brightray-8dbaeed37b9c4fb8ae985670b142f659bb265fb4.tar.gz 76965 SHA256 
fb5e57cc723500c8a7b5fba8cf0a38d4ca79b3f967dd9f9427e6fca8cde81552 SHA512 
eb0ad05107ebfb4151fb0f26f7dbea58c353cde0407c13ea00c7b98487fb29582d5f3e334900749dc43c8aeca828d8885c4d77dff6739de97ec19b33017a6e93
 WHIRLPOOL 
d2aa3bd6361643304158dff859aa071400bc1b74f0fce934d5dc5eb25bf76d599a27efabde6c13bd20dadb15ffec7bb3ea8577bdb1e38e2382f81600d543fd35
 DIST brightray-9bc1d21b69ac99bed546d42035dc1205ea6b04af.tar.gz 74416 SHA256 
9cb944145085384423efdbdbe4dd523b71eaf517fd040e1993666832ffac4fa6 SHA512 
c7a16f3634111a43d45959e0406488dc7417848403a6261204b58f67d62688f888f733ca23f3eac3a2dc76955c185ce845d63a6dc1e5a0fba54fb115202414d0
 WHIRLPOOL 
c1ebe0e3adbd74da772778589f59f30a2e288723d62cf8bc686c1b0795daef4c31e9d38363b29dae9b162ccf856707f7a9eb34c8b31ca76042870d7adfa14e99
 DIST chromium-47.0.2526.110.tar.xz 394673276 SHA256 
edab0d78709ba5edd35e85d82241de884d75dc46abdf7621b6178fa6647d14af SHA512 
7b83b4b9c192782035984a08f5102dc6bc9c8590f78dc74fe46ff431b7de3d33ee48e41c0b1fb3f8ff2881871f2a1c4c4c4c16297b42456082b514fb741fc1c4
 WHIRLPOOL 
b9b4053089cdf0a37a81ef491a97749a6473d280b7ed9d391ef4b98a844dd8e0ecbc9b97b72b654c65c3ea9f706519262b8f62f5e5ba97cb005a8c98a40f2b28
+DIST chromium-49.0.2623.75.tar.xz 452264916 SHA256 
a4fd4c85b12b021789d8afc33b27555396e47d9f67c8a062ee3609c4d6b582f5 SHA512 
694f0ccd0a4ff10d8b19e52defb48f6d47daeaa47013f01c2924251f3c6ebaccb20813379c3b7dd6fd939138f25122ed7d1a56e1a6b80309aca65b6c854768fa
 WHIRLPOOL 
00d5b37f425714e4bcb2b563759a8a7b084dc01b7abe6e90f21a3aa470c42944675b5a875e3e918506469cb6cd870038791566ad647b26bd4b11502beb97ecad
+DIST chromium-52.0.2743.82.tar.xz 458110272 SHA256 
a7de6015df9cf685d68efd1e070ae9c706c723cd9395d079a7d43672a2c37eb4 SHA512 
9bba841cb726bfa06888deefacfcee628e36d25de47dd0303d3fd1ce2f07922148d60befe934f44c33fcdfed6ce3dadfb9e3ee0828b66994807178a488051806
 WHIRLPOOL 
f0d258882db85291262c2381aeb6d85ebf20a252344e114a2da35e75f79dc8b73de95b71926512537af17e109fd7a8dd04386d5b3ed610262d42d11bcc1a5707
 DIST electron-0.36.12.tar.gz 3068567 SHA256 
8e4ee7ed37d32ad73f8cbfb132ce0009506a01a68d5a71bafd6858c6bc11f9a6 SHA512 
37d016768e57f81b01338cea6d0d5eaa6ea72d83a2122b54c9c73e37b0afc7fb8351b0cb846afda29206379d5625657b815b002c2eb3c31babcd0cffa47ae3de
 WHIRLPOOL 
a358e353259d377dd59ae563f38b2fe185ade6d7a00bbad8c61831c92b4e200ac1f2f25b79564eae11d9082a569be342ccd4be6e400955cd65729e9299b48796
+DIST electron-0.37.8.tar.gz 3154625 SHA256 
d6b01e800aa4cd54b680aa1d78e8c04ed99f82423bab37fe03ad5eb12310f0c0 SHA512 
1469129cc6e07da2540ab67d2bb9e2dec4055da77b35bf0abf86a70e82e3ccf443e75edb25feac6c8855c5e841592738319e1a81a52d504e90a5ce9197153754
 WHIRLPOOL 
677fc9c5bd96d04de43a28c8db23921fb98d3d9a455c32da8235b15c72f2480cce16a3705ae258de1c2b3a5af8d11607c3f868bae248553e593a77c454f94582
+DIST electron-1.3.5.tar.gz 3504577 SHA256 
8cc97cdb46a632788daa9fc1fbdda3d9de0d23e729ec4205e962fe9a7d9c6ab3 SHA512 
83d00dc8ecb0662c27d9cacaaa901ccb28658b8de56b3444abac868b0c02df24c51d46bbb9be64d4f7435de73cb0078d2b4afb7be001e25bce27f3daba51402b
 WHIRLPOOL 
867d73c3515845c7dd536a10848da8fc8f97b89cc3c79e8d6479d604b411e8964e08683ca652709b3a3d3211b786e32b2a795a86d82852ae74523820a7451544
+DIST electron-node-6bcd8af891a991f8aa196e49e6bf908ebbe24cae.tar.gz 36600837 
SHA256 6b7bb43be6d24bc55a6ccd4b8efd2f88d8d2fd7d8437d7aa33d813c649f791f7 SHA512 
7fcafa01027bd68794a7cd2f049a7bdf45e1dd56622583bd5d53d662328e64619dd5dbeec295ff559b1b268e90bf6abf3d76cd6d00f055602bbaa7443e3a3450
 WHIRLPOOL 
c5dd664910a59c7fb1d4aaf3c91b298b7266466596ce2a4f4f41ff6637db9e480450eaf1e9255ab810de13df1abbd769f32bdc73124bea9ab4ed013cda945bd0
 DIST electron-node-a507a3c3816d6ac085ed46250c489a3d76ab8b3c.tar.gz 36578658 
SHA256 56489ffa9d58b736008f5c1c2775bc10f3afe02d3c768035e7742893cc8e1d82 SHA512 
a5b62c05ec7300a26b3feab3c1e796a87691d41fa7c039541574878491df51e9075685abc5d630fc62bca95bf821eeede041d4ab36caedaf76156844f1095ea6
 WHIRLPOOL 
8675b05753cf905cfb2fc0ebb19fc256489a7b932c57be291eb2fc7194de599c07f4120541f4a61cccdb43b09b6280c7c02f9565aef98129c584fdca4c154279
+DIST electron-node-ee8c429deaee0adeeef069c3ad34c0defe53a567.tar.gz 42764387 
SHA256 82791b95fec0dfd7b80b53f5bed7789c4ea50353dca95d23115c1aff5a5249a5 SHA512 
971fbe2d9ff899eaf8e06e131cd12539ec804f9f81b87bb43fe07c43a33838066b98a4b76b974cdfe19a002a3242b270c03325c81f52abdd1befec3dd9d649c6
 WHIRLPOOL 
d604e0101da4ae020de3092cf02becf8a1655e1aec69d1cde8dd8293a591af566f5ad9972cf00c8288e1319431be7ee54f0c460fb83246522465e569f07ab2bf
+DIST libchromiumcontent-60c7ec9f9bf465a8c9c7ccc3fcd2aa1cdf644bac.tar.gz 402072 
SHA256 69877d4b9def6dc69063f0bf37d9d59721c22acced45e271b3f36bde8446a37c SHA512 
ddd52e58df1848edab6c514e0ef8e4155eccec6bec9d4e557dc0ee7d5c2cc4036f25d1786376b5b47a5122a266f00cd589ce665b8463549e9383d60292d180dc
 WHIRLPOOL 
789be242983ab54e212df13c6f51c5c949d6a4ace21a548b99f17e292b37842ce0c748e29c17bd116a95a163ca2bd709dadc59ecacc9d3ab8c58143ddf9f2d71
 DIST libchromiumcontent-ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7.tar.gz 400648 
SHA256 36b46659fff3053ce273d3ed159fca74e18ebc873694f857a521d3c48fc079b1 SHA512 
5fcb5e3dd98d5875ff7aa9f9f4d02af45487534d0301ca7a0a7adde934f528fedc3dfaf886b9031027e41309eb8ba658b72a56af4ad8dc44cce458b9c04a0e47
 WHIRLPOOL 
31d28804f91bbdece8709ddac359e7f5c079b034137734041f274838d138d8e141fe12c0ecf1e66f92b15e8c653526a1779d3bcc342e3ecc9a39a18c689a94a6
+DIST libchromiumcontent-c5cf295ef93d4ee88bff0c4b06b28ff0969a890e.tar.gz 401427 
SHA256 6a6c1590a3a07e38af5f3b59008258ffb800ac8f8b2b63d9a3b12d6f3b41e996 SHA512 
f4732e86b3520d9a9a766d69585316889e1f35b4379ac726ac183af34f4cd066cea3b18cda1a6595bf6822f30797fb9658b1327eba9b1a5ebbb0d5aef559a23a
 WHIRLPOOL 
027a188cfc2fbccd3cd7a838582851701e7d8a35845c4088e081b515a80dc8f1b92eb46d2e3a71aade62aa5c2632f1bc4252c1f3b4e6b246f6308dec900c858b
+DIST native-mate-0df2d882ea2286e6335f206b7002037fce66c4a5.tar.gz 23738 SHA256 
d0ad6b3079fcfdf1adb09a68f5d8b7ac5b83c6d19b078993941b1a95ccac232b SHA512 
fdd928a4b170636320e6cfd65753aec47c38380ef6f1b6dde255fbdcf3756abe8568e689e1214d768056187b243f979f16d4289ce8429a5ddd17b07f806ef731
 WHIRLPOOL 
762c4f2c093853731cbf8a79953e0da0bf66d6f1f08a08ad3ba2131b87113209bc93e138e974745b89da5dd9c14c0d5035dd686ad5b79ad7faba0b6076d2a6fb
+DIST native-mate-b5e5de626c6a57e44c7e6448d8bbaaac475d493c.tar.gz 23465 SHA256 
e9a5340c51690100be798c3d8c76662f78b0f292b22e394a5703326c07fc2639 SHA512 
d004f4ec3ca77d98b2b2bc271c830b769bb6396e70d8dbf25ede87c509ce95dea083d6e5b3d050647cdf3d0a6a21c6da91176eba90d7256ab80f5d23248a6bb1
 WHIRLPOOL 
66b0d5544d8e72692150541a8f7ecac7421edef2a4d3837a1f7a1dea785f99fb40492261654ad7b6c1a38fcf04a44d4afa832d20175eb34944437712bbb711ef
 DIST native-mate-e719eab878c264bb03188d0cd6eb9ad6882bc13a.tar.gz 23818 SHA256 
82da85193f6924ce395004ce9dfd1198848cf8f14b7904321e67cad26a39f794 SHA512 
4272648127fb0bf90b36d2c090bea718d560737c1c7443a5b3c0de12999ffe607429b2112ecee36ece5d26cde54e78964303250ffd350a19c132c9733b72c523
 WHIRLPOOL 
c275163b9f3f424f5909f17c67f5b029f03bf76679296781bd6d74e64d903dd29cf5c28f1c4e399a049331f54f03175fe2c02de9ef6bf65040d9cef05be44a51

diff --git a/dev-util/electron/electron-0.36.12-r3.ebuild 
b/dev-util/electron/electron-0.36.12-r4.ebuild
similarity index 94%
copy from dev-util/electron/electron-0.36.12-r3.ebuild
copy to dev-util/electron/electron-0.36.12-r4.ebuild
index b5a2a0d..b5159e6 100644
--- a/dev-util/electron/electron-0.36.12-r3.ebuild
+++ b/dev-util/electron/electron-0.36.12-r4.ebuild
@@ -5,11 +5,11 @@
 EAPI="5"
 PYTHON_COMPAT=( python2_7 )
 
-CHROMIUM_LANGS="am ar bg bn ca cs da de el en_GB es es_419 et fa fi fil fr gu 
he
-       hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt_BR pt_PT ro ru sk sl 
sr
-       sv sw ta te th tr uk vi zh_CN zh_TW"
+CHROMIUM_LANGS="am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu 
he
+       hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl 
sr
+       sv sw ta te th tr uk vi zh-CN zh-TW"
 
-inherit check-reqs chromium eutils flag-o-matic multilib multiprocessing 
pax-utils \
+inherit check-reqs chromium-2 eutils flag-o-matic multilib multiprocessing 
pax-utils \
        portability python-any-r1 readme.gentoo-r1 toolchain-funcs versionator 
virtualx
 
 # Keep this in sync with vendor/brightray/vendor/libchromiumcontent/VERSION
@@ -23,7 +23,7 @@ NATIVE_MATE_COMMIT="e719eab878c264bb03188d0cd6eb9ad6882bc13a"
 # Keep this in sync with vendor/brightray/vendor/libchromiumcontent
 LIBCHROMIUMCONTENT_COMMIT="ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7"
 # Keep this in sync with package.json#devDependencies
-ASAR_VERSION="0.10.0"
+ASAR_VERSION="0.12.1"
 
 CHROMIUM_P="chromium-${CHROMIUM_VERSION}"
 BRIGHTRAY_P="brightray-${BRIGHTRAY_COMMIT}"
@@ -52,7 +52,7 @@ NATIVE_MATE_S="${S}/vendor/native_mate"
 LIBCC_S="${BRIGHTRAY_S}/vendor/libchromiumcontent"
 
 LICENSE="BSD"
-SLOT="0/$(get_version_component_range 2)"
+SLOT="$(get_version_component_range 1-2)"
 KEYWORDS="~amd64"
 IUSE="custom-cflags cups gnome gnome-keyring hidpi kerberos lto neon pic 
+proprietary-codecs pulseaudio selinux +system-ffmpeg +tcmalloc"
 RESTRICT="!system-ffmpeg? ( proprietary-codecs? ( bindist ) )"
@@ -64,9 +64,11 @@ QA_FLAGS_IGNORED=".*\.nexe"
 # right tools for it, bug #469144 .
 QA_PRESTRIPPED=".*\.nexe"
 
-RDEPEND=">=app-accessibility/speech-dispatcher-0.8:=
+RDEPEND="!<dev-util/electron-0.36.12-r4
+       >=app-accessibility/speech-dispatcher-0.8:=
        app-arch/bzip2:=
        app-arch/snappy:=
+       >=app-eselect/eselect-electron-1.0.0
        cups? ( >=net-print/cups-1.3.11:= )
        >=dev-libs/elfutils-0.149
        dev-libs/expat:=
@@ -255,12 +257,12 @@ src_prepare() {
        ln -s "${WORKDIR}/${ASAR_P}/node_modules" "${S}/node_modules" || die
 
        # electron patches
-       epatch "${FILESDIR}/electron-gentoo-build-fixes.patch"
+       epatch "${FILESDIR}/${P}.patch"
 
        # node patches
        cd "${NODE_S}" || die
-       epatch "${FILESDIR}/node-gentoo-build-fixes.patch"
-       epatch "${FILESDIR}/node-external-snapshots.patch"
+       epatch "${FILESDIR}/${P}-vendor-node.patch"
+       epatch "${FILESDIR}/electron-vendor-node-external-snapshots-r0.patch"
        # make sure node uses the correct version of v8
        rm -r deps/v8 || die
        ln -s ../../../v8 deps/ || die
@@ -280,11 +282,11 @@ src_prepare() {
 
        # brightray patches
        cd "${BRIGHTRAY_S}" || die
-       epatch "${FILESDIR}/brightray-gentoo-build-fixes-r1.patch"
+       epatch "${FILESDIR}/${P}-vendor-brightray.patch"
 
        # libcc patches
        cd "${LIBCC_S}" || die
-       epatch "${FILESDIR}/libchromiumcontent-gentoo-build-fixes.patch"
+       epatch "${FILESDIR}/${P}-vendor-libchromiumcontent.patch"
 
        # chromium patches
        cd "${S}" || die
@@ -632,7 +634,9 @@ src_configure() {
        pushd vendor/node > /dev/null || die
        # Make sure gyp_node does not run
        echo '#!/usr/bin/env python' > tools/gyp_node.py || die
-       ./configure --shared-openssl --shared-libuv --shared-http-parser \
+       # --shared-libuv cannot be used as electron's node fork
+       # patches uv_loop structure.
+       ./configure --shared-openssl --shared-http-parser \
                                --shared-zlib --without-npm 
--with-intl=system-icu \
                                --without-dtrace --dest-cpu=${target_arch} \
                                --prefix="" || die
@@ -674,11 +678,17 @@ eninja() {
 }
 
 src_compile() {
-       local ninja_targets="electron"
+       local ninja_targets="electron" compile_target="out/R"
+
+       eninja -C ${compile_target} mksnapshot || die
+       pax-mark -m ${compile_target}/mksnapshot
+
+       eninja -C ${compile_target} nodebin || die
+       pax-mark -m ${compile_target}/nodebin
 
        # Even though ninja autodetects number of CPUs, we respect
        # user's options, for debugging with -j 1 or any other reason.
-       eninja -C out/R ${ninja_targets} || die
+       eninja -C ${compile_target} ${ninja_targets} || die
 }
 
 src_install() {
@@ -720,3 +730,11 @@ src_install() {
        mv "${ED}/usr/include/node" \
           "${ED}/usr/include/electron${install_suffix}/node" || die
 }
+
+pkg_postinst() {
+       eselect electron update
+}
+
+pkg_prerm() {
+       eselect electron update
+}

diff --git a/dev-util/electron/electron-0.36.12-r3.ebuild 
b/dev-util/electron/electron-0.37.8.ebuild
similarity index 89%
copy from dev-util/electron/electron-0.36.12-r3.ebuild
copy to dev-util/electron/electron-0.37.8.ebuild
index b5a2a0d..5824044 100644
--- a/dev-util/electron/electron-0.36.12-r3.ebuild
+++ b/dev-util/electron/electron-0.37.8.ebuild
@@ -5,25 +5,26 @@
 EAPI="5"
 PYTHON_COMPAT=( python2_7 )
 
-CHROMIUM_LANGS="am ar bg bn ca cs da de el en_GB es es_419 et fa fi fil fr gu 
he
-       hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt_BR pt_PT ro ru sk sl 
sr
-       sv sw ta te th tr uk vi zh_CN zh_TW"
+CHROMIUM_LANGS="am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu 
he
+       hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl 
sr
+       sv sw ta te th tr uk vi zh-CN zh-TW"
 
-inherit check-reqs chromium eutils flag-o-matic multilib multiprocessing 
pax-utils \
-       portability python-any-r1 readme.gentoo-r1 toolchain-funcs versionator 
virtualx
+inherit check-reqs chromium-2 eutils flag-o-matic multilib multiprocessing \
+       pax-utils portability python-any-r1 readme.gentoo-r1 toolchain-funcs \
+       versionator virtualx
 
 # Keep this in sync with vendor/brightray/vendor/libchromiumcontent/VERSION
-CHROMIUM_VERSION="47.0.2526.110"
+CHROMIUM_VERSION="49.0.2623.75"
 # Keep this in sync with vendor/brightray
-BRIGHTRAY_COMMIT="9bc1d21b69ac99bed546d42035dc1205ea6b04af"
+BRIGHTRAY_COMMIT="8dbaeed37b9c4fb8ae985670b142f659bb265fb4"
 # Keep this in sync with vendor/node
-NODE_COMMIT="a507a3c3816d6ac085ed46250c489a3d76ab8b3c"
+NODE_COMMIT="6bcd8af891a991f8aa196e49e6bf908ebbe24cae"
 # Keep this in sync with vendor/native_mate
-NATIVE_MATE_COMMIT="e719eab878c264bb03188d0cd6eb9ad6882bc13a"
+NATIVE_MATE_COMMIT="0df2d882ea2286e6335f206b7002037fce66c4a5"
 # Keep this in sync with vendor/brightray/vendor/libchromiumcontent
-LIBCHROMIUMCONTENT_COMMIT="ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7"
+LIBCHROMIUMCONTENT_COMMIT="60c7ec9f9bf465a8c9c7ccc3fcd2aa1cdf644bac"
 # Keep this in sync with package.json#devDependencies
-ASAR_VERSION="0.10.0"
+ASAR_VERSION="0.12.1"
 
 CHROMIUM_P="chromium-${CHROMIUM_VERSION}"
 BRIGHTRAY_P="brightray-${BRIGHTRAY_COMMIT}"
@@ -52,9 +53,9 @@ NATIVE_MATE_S="${S}/vendor/native_mate"
 LIBCC_S="${BRIGHTRAY_S}/vendor/libchromiumcontent"
 
 LICENSE="BSD"
-SLOT="0/$(get_version_component_range 2)"
+SLOT="$(get_version_component_range 1-2)"
 KEYWORDS="~amd64"
-IUSE="custom-cflags cups gnome gnome-keyring hidpi kerberos lto neon pic 
+proprietary-codecs pulseaudio selinux +system-ffmpeg +tcmalloc"
+IUSE="custom-cflags cups debug gnome gnome-keyring hidpi kerberos lto neon pic 
+proprietary-codecs pulseaudio selinux +system-ffmpeg +tcmalloc"
 RESTRICT="!system-ffmpeg? ( proprietary-codecs? ( bindist ) )"
 
 # Native Client binaries are compiled with different set of flags, bug #452066.
@@ -64,9 +65,11 @@ QA_FLAGS_IGNORED=".*\.nexe"
 # right tools for it, bug #469144 .
 QA_PRESTRIPPED=".*\.nexe"
 
-RDEPEND=">=app-accessibility/speech-dispatcher-0.8:=
+RDEPEND="!<dev-util/electron-0.36.12-r4
+       >=app-accessibility/speech-dispatcher-0.8:=
        app-arch/bzip2:=
        app-arch/snappy:=
+       >=app-eselect/eselect-electron-1.0.0
        cups? ( >=net-print/cups-1.3.11:= )
        >=dev-libs/elfutils-0.149
        dev-libs/expat:=
@@ -118,7 +121,6 @@ RDEPEND=">=app-accessibility/speech-dispatcher-0.8:=
        x11-libs/pango:=
        kerberos? ( virtual/krb5 )
        >=net-libs/http-parser-2.6.2:=
-       >=dev-libs/libuv-1.8.0:=
        >=dev-libs/openssl-1.0.2g:0=[-bindist]"
 DEPEND="${RDEPEND}
        !arm? (
@@ -255,12 +257,12 @@ src_prepare() {
        ln -s "${WORKDIR}/${ASAR_P}/node_modules" "${S}/node_modules" || die
 
        # electron patches
-       epatch "${FILESDIR}/electron-gentoo-build-fixes.patch"
+       epatch "${FILESDIR}/${P}.patch"
 
        # node patches
        cd "${NODE_S}" || die
-       epatch "${FILESDIR}/node-gentoo-build-fixes.patch"
-       epatch "${FILESDIR}/node-external-snapshots.patch"
+       epatch "${FILESDIR}/${P}-vendor-node.patch"
+       epatch "${FILESDIR}/electron-vendor-node-external-snapshots-r0.patch"
        # make sure node uses the correct version of v8
        rm -r deps/v8 || die
        ln -s ../../../v8 deps/ || die
@@ -280,17 +282,19 @@ src_prepare() {
 
        # brightray patches
        cd "${BRIGHTRAY_S}" || die
-       epatch "${FILESDIR}/brightray-gentoo-build-fixes-r1.patch"
+       epatch "${FILESDIR}/${P}-vendor-brightray.patch"
 
        # libcc patches
        cd "${LIBCC_S}" || die
-       epatch "${FILESDIR}/libchromiumcontent-gentoo-build-fixes.patch"
+       epatch "${FILESDIR}/${P}-vendor-libchromiumcontent.patch"
 
        # chromium patches
        cd "${S}" || die
-       epatch "${FILESDIR}/chromium-system-ffmpeg-r0.patch"
+       epatch "${FILESDIR}/chromium-system-ffmpeg-r2.patch"
        epatch "${FILESDIR}/chromium-system-jinja-r7.patch"
        epatch "${FILESDIR}/chromium-disable-widevine.patch"
+       epatch "${FILESDIR}/chromium-last-commit-position-r0.patch"
+       epatch "${FILESDIR}/chromium-snapshot-toolchain-r1.patch"
        epatch "${FILESDIR}/chromium-remove-gardiner-mod-font.patch"
        epatch "${FILESDIR}/chromium-shared-v8.patch"
        epatch "${FILESDIR}/chromium-lto-fixes.patch"
@@ -337,17 +341,19 @@ src_prepare() {
                'third_party/analytics' \
                'third_party/angle' \
                'third_party/angle/src/third_party/compiler' \
+               'third_party/angle/src/third_party/murmurhash' \
+               'third_party/angle/src/third_party/trace_event' \
                'third_party/boringssl' \
                'third_party/brotli' \
                'third_party/cacheinvalidation' \
                'third_party/catapult' \
+               'third_party/catapult/third_party/py_vulcanize' \
+               
'third_party/catapult/third_party/py_vulcanize/third_party/rcssmin' \
+               
'third_party/catapult/third_party/py_vulcanize/third_party/rjsmin' \
                'third_party/catapult/tracing/third_party/components/polymer' \
                'third_party/catapult/tracing/third_party/d3' \
                'third_party/catapult/tracing/third_party/gl-matrix' \
                'third_party/catapult/tracing/third_party/jszip' \
-               'third_party/catapult/tracing/third_party/tvcm' \
-               
'third_party/catapult/tracing/third_party/tvcm/third_party/rcssmin' \
-               
'third_party/catapult/tracing/third_party/tvcm/third_party/rjsmin' \
                'third_party/cld_2' \
                'third_party/cros_system_api' \
                'third_party/cython/python_flags.py' \
@@ -399,7 +405,7 @@ src_prepare() {
                'third_party/polymer' \
                'third_party/protobuf' \
                'third_party/qcms' \
-               'third_party/readability' \
+               'third_party/re2' \
                'third_party/sfntly' \
                'third_party/skia' \
                'third_party/smhasher' \
@@ -410,6 +416,7 @@ src_prepare() {
                'third_party/webdriver' \
                'third_party/webrtc' \
                'third_party/widevine' \
+               'third_party/woff2' \
                'third_party/x86inc' \
                'third_party/zlib/google' \
                'url/third_party/mozilla' \
@@ -468,7 +475,6 @@ src_configure() {
                -Duse_system_libxslt=1
                -Duse_system_minizip=1
                -Duse_system_nspr=1
-               -Duse_system_re2=1
                -Duse_system_snappy=1
                -Duse_system_speex=1
                -Duse_system_xdg_utils=1
@@ -525,7 +531,8 @@ src_configure() {
                -Dhost_clang=0
                -Dlinux_use_bundled_binutils=0
                -Dlinux_use_bundled_gold=0
-               -Dlinux_use_gold_flags=0"
+               -Dlinux_use_gold_flags=0
+               -Dsysroot="
 
        ffmpeg_branding="$(usex proprietary-codecs Chrome Chromium)"
        myconf+=" -Dproprietary_codecs=1 -Dffmpeg_branding=${ffmpeg_branding}"
@@ -628,11 +635,15 @@ src_configure() {
 
        third_party/libaddressinput/chromium/tools/update-strings.py || die
 
+       touch chrome/test/data/webui/i18n_process_css_test.html || die
+
        einfo "Configuring bundled nodejs..."
        pushd vendor/node > /dev/null || die
        # Make sure gyp_node does not run
        echo '#!/usr/bin/env python' > tools/gyp_node.py || die
-       ./configure --shared-openssl --shared-libuv --shared-http-parser \
+       # --shared-libuv cannot be used as electron's node fork
+       # patches uv_loop structure.
+       ./configure --shared-openssl --shared-http-parser \
                                --shared-zlib --without-npm 
--with-intl=system-icu \
                                --without-dtrace --dest-cpu=${target_arch} \
                                --prefix="" || die
@@ -651,7 +662,7 @@ src_configure() {
 
        myconf+=" -Ivendor/node/config.gypi
                          -Icommon.gypi
-                         atom.gyp"
+                         electron.gyp"
 
        egyp_chromium ${myconf} || die
 }
@@ -674,11 +685,17 @@ eninja() {
 }
 
 src_compile() {
-       local ninja_targets="electron"
+       local ninja_targets="electron" compile_target="out/R"
+
+       eninja -C ${compile_target} mksnapshot || die
+       pax-mark -m ${compile_target}/mksnapshot
+
+       eninja -C ${compile_target} nodebin || die
+       pax-mark -m ${compile_target}/nodebin
 
        # Even though ninja autodetects number of CPUs, we respect
        # user's options, for debugging with -j 1 or any other reason.
-       eninja -C out/R ${ninja_targets} || die
+       eninja -C ${compile_target} ${ninja_targets} || die
 }
 
 src_install() {
@@ -706,6 +723,8 @@ src_install() {
        doins -r out/R/locales
        dosym "${install_dir}/electron" "/usr/bin/electron${install_suffix}"
 
+       pax-mark -rm "${ED}/${install_dir}/electron"
+
        # Install Node headers
        HEADERS_ONLY=1 \
                "${S}/vendor/node/tools/install.py" install "${ED}" "/usr" || 
die
@@ -720,3 +739,11 @@ src_install() {
        mv "${ED}/usr/include/node" \
           "${ED}/usr/include/electron${install_suffix}/node" || die
 }
+
+pkg_postinst() {
+       eselect electron update
+}
+
+pkg_prerm() {
+       eselect electron update
+}

diff --git a/dev-util/electron/electron-0.36.12-r3.ebuild 
b/dev-util/electron/electron-1.3.5.ebuild
similarity index 83%
rename from dev-util/electron/electron-0.36.12-r3.ebuild
rename to dev-util/electron/electron-1.3.5.ebuild
index b5a2a0d..50d5929 100644
--- a/dev-util/electron/electron-0.36.12-r3.ebuild
+++ b/dev-util/electron/electron-1.3.5.ebuild
@@ -5,25 +5,26 @@
 EAPI="5"
 PYTHON_COMPAT=( python2_7 )
 
-CHROMIUM_LANGS="am ar bg bn ca cs da de el en_GB es es_419 et fa fi fil fr gu 
he
-       hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt_BR pt_PT ro ru sk sl 
sr
-       sv sw ta te th tr uk vi zh_CN zh_TW"
+CHROMIUM_LANGS="am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu 
he
+       hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl 
sr
+       sv sw ta te th tr uk vi zh-CN zh-TW"
 
-inherit check-reqs chromium eutils flag-o-matic multilib multiprocessing 
pax-utils \
-       portability python-any-r1 readme.gentoo-r1 toolchain-funcs versionator 
virtualx
+inherit check-reqs chromium-2 eutils gnome2-utils flag-o-matic multilib \
+       multiprocessing pax-utils portability python-any-r1 readme.gentoo-r1 \
+       toolchain-funcs versionator virtualx xdg-utils
 
 # Keep this in sync with vendor/brightray/vendor/libchromiumcontent/VERSION
-CHROMIUM_VERSION="47.0.2526.110"
+CHROMIUM_VERSION="52.0.2743.82"
 # Keep this in sync with vendor/brightray
-BRIGHTRAY_COMMIT="9bc1d21b69ac99bed546d42035dc1205ea6b04af"
+BRIGHTRAY_COMMIT="554946c7873bbc6930779c871fe230856575049a"
 # Keep this in sync with vendor/node
-NODE_COMMIT="a507a3c3816d6ac085ed46250c489a3d76ab8b3c"
+NODE_COMMIT="ee8c429deaee0adeeef069c3ad34c0defe53a567"
 # Keep this in sync with vendor/native_mate
-NATIVE_MATE_COMMIT="e719eab878c264bb03188d0cd6eb9ad6882bc13a"
+NATIVE_MATE_COMMIT="b5e5de626c6a57e44c7e6448d8bbaaac475d493c"
 # Keep this in sync with vendor/brightray/vendor/libchromiumcontent
-LIBCHROMIUMCONTENT_COMMIT="ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7"
+LIBCHROMIUMCONTENT_COMMIT="c5cf295ef93d4ee88bff0c4b06b28ff0969a890e"
 # Keep this in sync with package.json#devDependencies
-ASAR_VERSION="0.10.0"
+ASAR_VERSION="0.12.1"
 
 CHROMIUM_P="chromium-${CHROMIUM_VERSION}"
 BRIGHTRAY_P="brightray-${BRIGHTRAY_COMMIT}"
@@ -52,7 +53,7 @@ NATIVE_MATE_S="${S}/vendor/native_mate"
 LIBCC_S="${BRIGHTRAY_S}/vendor/libchromiumcontent"
 
 LICENSE="BSD"
-SLOT="0/$(get_version_component_range 2)"
+SLOT="$(get_version_component_range 1-2)"
 KEYWORDS="~amd64"
 IUSE="custom-cflags cups gnome gnome-keyring hidpi kerberos lto neon pic 
+proprietary-codecs pulseaudio selinux +system-ffmpeg +tcmalloc"
 RESTRICT="!system-ffmpeg? ( proprietary-codecs? ( bindist ) )"
@@ -64,9 +65,11 @@ QA_FLAGS_IGNORED=".*\.nexe"
 # right tools for it, bug #469144 .
 QA_PRESTRIPPED=".*\.nexe"
 
-RDEPEND=">=app-accessibility/speech-dispatcher-0.8:=
+RDEPEND="!<dev-util/electron-0.36.12-r4
+       >=app-accessibility/speech-dispatcher-0.8:=
        app-arch/bzip2:=
        app-arch/snappy:=
+       >=app-eselect/eselect-electron-1.0.0
        cups? ( >=net-print/cups-1.3.11:= )
        >=dev-libs/elfutils-0.149
        dev-libs/expat:=
@@ -154,7 +157,7 @@ DEPEND+=" $(python_gen_any_dep '
 ')"
 python_check_deps() {
        has_version --host-root 
"dev-python/beautifulsoup:python-2[${PYTHON_USEDEP}]" &&
-       has_version --host-root "dev-python/beautifulsoup:4[${PYTHON_USEDEP}]" 
&&
+       has_version --host-root 
">=dev-python/beautifulsoup-4.3.2:4[${PYTHON_USEDEP}]" &&
        has_version --host-root "dev-python/html5lib[${PYTHON_USEDEP}]" &&
        has_version --host-root "dev-python/jinja[${PYTHON_USEDEP}]" &&
        has_version --host-root "dev-python/jsmin[${PYTHON_USEDEP}]" &&
@@ -255,12 +258,12 @@ src_prepare() {
        ln -s "${WORKDIR}/${ASAR_P}/node_modules" "${S}/node_modules" || die
 
        # electron patches
-       epatch "${FILESDIR}/electron-gentoo-build-fixes.patch"
+       epatch "${FILESDIR}/${P}.patch"
 
        # node patches
        cd "${NODE_S}" || die
-       epatch "${FILESDIR}/node-gentoo-build-fixes.patch"
-       epatch "${FILESDIR}/node-external-snapshots.patch"
+       epatch "${FILESDIR}/${P}-vendor-node.patch"
+       epatch "${FILESDIR}/electron-vendor-node-external-snapshots-r0.patch"
        # make sure node uses the correct version of v8
        rm -r deps/v8 || die
        ln -s ../../../v8 deps/ || die
@@ -280,20 +283,26 @@ src_prepare() {
 
        # brightray patches
        cd "${BRIGHTRAY_S}" || die
-       epatch "${FILESDIR}/brightray-gentoo-build-fixes-r1.patch"
+       epatch "${FILESDIR}/${P}-vendor-brightray.patch"
 
        # libcc patches
        cd "${LIBCC_S}" || die
-       epatch "${FILESDIR}/libchromiumcontent-gentoo-build-fixes.patch"
+       epatch "${FILESDIR}/${P}-vendor-libchromiumcontent.patch"
 
        # chromium patches
        cd "${S}" || die
-       epatch "${FILESDIR}/chromium-system-ffmpeg-r0.patch"
-       epatch "${FILESDIR}/chromium-system-jinja-r7.patch"
+       epatch "${FILESDIR}/chromium-system-ffmpeg-r2.patch"
+       epatch "${FILESDIR}/chromium-system-jinja-r9.patch"
        epatch "${FILESDIR}/chromium-disable-widevine.patch"
+       epatch "${FILESDIR}/chromium-last-commit-position-r0.patch"
+       epatch "${FILESDIR}/chromium-snapshot-toolchain-r1.patch"
        epatch "${FILESDIR}/chromium-remove-gardiner-mod-font.patch"
-       epatch "${FILESDIR}/chromium-shared-v8.patch"
-       epatch "${FILESDIR}/chromium-lto-fixes.patch"
+       epatch "${FILESDIR}/chromium-pdfium-r0.patch"
+       epatch "${FILESDIR}/chromium-system-zlib-r0.patch"
+       epatch "${FILESDIR}/chromium-linker-warnings-r0.patch"
+       epatch "${FILESDIR}/chromium-ffmpeg-license-r0.patch"
+       epatch "${FILESDIR}/chromium-shared-v8-r1.patch"
+       epatch "${FILESDIR}/chromium-lto-fixes-r1.patch"
 
        # libcc chromium patches
        _unnest_patches "${LIBCC_S}/patches"
@@ -328,26 +337,29 @@ src_prepare() {
                'base/third_party/xdg_mime' \
                'base/third_party/xdg_user_dirs' \
                'breakpad/src/third_party/curl' \
+               'breakpad/src/third_party/musl' \
                'chrome/third_party/mozilla_security_manager' \
                'courgette/third_party' \
-               'crypto/third_party/nss' \
                'net/third_party/mozilla_security_manager' \
                'net/third_party/nss' \
                'third_party/WebKit' \
                'third_party/analytics' \
                'third_party/angle' \
                'third_party/angle/src/third_party/compiler' \
+               'third_party/angle/src/third_party/libXNVCtrl' \
+               'third_party/angle/src/third_party/murmurhash' \
+               'third_party/angle/src/third_party/trace_event' \
                'third_party/boringssl' \
                'third_party/brotli' \
                'third_party/cacheinvalidation' \
                'third_party/catapult' \
+               'third_party/catapult/third_party/py_vulcanize' \
+               
'third_party/catapult/third_party/py_vulcanize/third_party/rcssmin' \
+               
'third_party/catapult/third_party/py_vulcanize/third_party/rjsmin' \
                'third_party/catapult/tracing/third_party/components/polymer' \
                'third_party/catapult/tracing/third_party/d3' \
                'third_party/catapult/tracing/third_party/gl-matrix' \
                'third_party/catapult/tracing/third_party/jszip' \
-               'third_party/catapult/tracing/third_party/tvcm' \
-               
'third_party/catapult/tracing/third_party/tvcm/third_party/rcssmin' \
-               
'third_party/catapult/tracing/third_party/tvcm/third_party/rjsmin' \
                'third_party/cld_2' \
                'third_party/cros_system_api' \
                'third_party/cython/python_flags.py' \
@@ -367,23 +379,24 @@ src_prepare() {
                'third_party/libXNVCtrl' \
                'third_party/libaddressinput' \
                'third_party/libjingle' \
+               'third_party/libjpeg_turbo' \
                'third_party/libphonenumber' \
+               'third_party/libpng' \
                'third_party/libsecret' \
                'third_party/libsrtp' \
                'third_party/libudev' \
                'third_party/libusb' \
-               'third_party/libvpx_new' \
-               'third_party/libvpx_new/source/libvpx/third_party/x86inc' \
-               'third_party/libxml/chromium' \
+               'third_party/libvpx' \
+               'third_party/libvpx/source/libvpx/third_party/x86inc' \
                'third_party/libwebm' \
+               'third_party/libxml/chromium' \
                'third_party/libyuv' \
                'third_party/lss' \
                'third_party/lzma_sdk' \
                'third_party/mesa' \
                'third_party/modp_b64' \
-               'third_party/mojo' \
                'third_party/mt19937ar' \
-               'third_party/npapi' \
+               'third_party/openh264' \
                'third_party/openmax_dl' \
                'third_party/opus' \
                'third_party/ots' \
@@ -395,11 +408,14 @@ src_prepare() {
                'third_party/pdfium/third_party/lcms2-2.6' \
                'third_party/pdfium/third_party/libjpeg' \
                'third_party/pdfium/third_party/libopenjpeg20' \
+               'third_party/pdfium/third_party/libpng16' \
+               'third_party/pdfium/third_party/libtiff' \
                'third_party/pdfium/third_party/zlib_v128' \
                'third_party/polymer' \
                'third_party/protobuf' \
+               'third_party/protobuf/third_party/six' \
                'third_party/qcms' \
-               'third_party/readability' \
+               'third_party/re2' \
                'third_party/sfntly' \
                'third_party/skia' \
                'third_party/smhasher' \
@@ -410,6 +426,7 @@ src_prepare() {
                'third_party/webdriver' \
                'third_party/webrtc' \
                'third_party/widevine' \
+               'third_party/woff2' \
                'third_party/x86inc' \
                'third_party/zlib/google' \
                'url/third_party/mozilla' \
@@ -461,14 +478,11 @@ src_configure() {
                -Duse_system_icu=1
                -Duse_system_jsoncpp=1
                -Duse_system_libevent=1
-               -Duse_system_libjpeg=1
-               -Duse_system_libpng=1
                -Duse_system_libwebp=1
                -Duse_system_libxml=1
                -Duse_system_libxslt=1
                -Duse_system_minizip=1
                -Duse_system_nspr=1
-               -Duse_system_re2=1
                -Duse_system_snappy=1
                -Duse_system_speex=1
                -Duse_system_xdg_utils=1
@@ -476,6 +490,7 @@ src_configure() {
 
        # Needed for system icu - we don't need additional data files.
        myconf+=" -Dicu_use_data_file_flag=0"
+       myconf+=" -Dgenerate_character_data=0"
 
        # TODO: patch gyp so that this arm conditional is not needed.
        if ! use arm; then
@@ -525,7 +540,8 @@ src_configure() {
                -Dhost_clang=0
                -Dlinux_use_bundled_binutils=0
                -Dlinux_use_bundled_gold=0
-               -Dlinux_use_gold_flags=0"
+               -Dlinux_use_gold_flags=0
+               -Dsysroot="
 
        ffmpeg_branding="$(usex proprietary-codecs Chrome Chromium)"
        myconf+=" -Dproprietary_codecs=1 -Dffmpeg_branding=${ffmpeg_branding}"
@@ -534,9 +550,12 @@ src_configure() {
        # Note: these are for Gentoo use ONLY. For your own distribution,
        # please get your own set of keys. Feel free to contact 
chrom...@gentoo.org
        # for more info.
-       myconf+=" -Dgoogle_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc
-               
-Dgoogle_default_client_id=329227923882.apps.googleusercontent.com
-               -Dgoogle_default_client_secret=vgKG0NNv7GoDpbtoFNLxCUXu"
+       local google_api_key="AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc"
+       local google_default_client_id="329227923882.apps.googleusercontent.com"
+       local google_default_client_secret="vgKG0NNv7GoDpbtoFNLxCUXu"
+       myconf+=" -Dgoogle_api_key=${google_api_key}
+               -Dgoogle_default_client_id=${google_default_client_id}
+               -Dgoogle_default_client_secret=${google_default_client_secret}"
 
        local myarch="$(tc-arch)"
        if [[ $myarch = amd64 ]] ; then
@@ -545,6 +564,9 @@ src_configure() {
        elif [[ $myarch = x86 ]] ; then
                target_arch=ia32
                ffmpeg_target_arch=ia32
+       elif [[ $myarch = arm64 ]] ; then
+               target_arch=arm64
+               ffmpeg_target_arch=arm64
        elif [[ $myarch = arm ]] ; then
                target_arch=arm
                ffmpeg_target_arch=$(usex neon arm-neon arm)
@@ -552,17 +574,17 @@ src_configure() {
                local CTARGET=${CTARGET:-${CHOST}}
                if [[ $(tc-is-softfloat) == "no" ]]; then
 
-                       myconf+=" -Darm_float_abi=hard"
+                       myconf_gyp+=" -Darm_float_abi=hard"
                fi
                filter-flags "-mfpu=*"
-               use neon || myconf+=" -Darm_fpu=${ARM_FPU:-vfpv3-d16}"
+               use neon || myconf_gyp+=" -Darm_fpu=${ARM_FPU:-vfpv3-d16}"
 
                if [[ ${CTARGET} == armv[78]* ]]; then
-                       myconf+=" -Darmv7=1"
+                       myconf_gyp+=" -Darmv7=1"
                else
-                       myconf+=" -Darmv7=0"
+                       myconf_gyp+=" -Darmv7=0"
                fi
-               myconf+=" -Dsysroot=
+               myconf_gyp+=" -Dsysroot=
                        $(gyp_use neon arm_neon)
                        -Ddisable_nacl=1"
        else
@@ -591,7 +613,8 @@ src_configure() {
 
                # Prevent libvpx build failures. Bug 530248, 544702, 546984.
                if [[ ${myarch} == amd64 || ${myarch} == x86 ]]; then
-                       filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 
-mno-avx -mno-avx2
+                       filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 \
+                                                -mno-avx -mno-avx2
                fi
        fi
 
@@ -628,14 +651,18 @@ src_configure() {
 
        third_party/libaddressinput/chromium/tools/update-strings.py || die
 
+       touch chrome/test/data/webui/i18n_process_css_test.html || die
+
        einfo "Configuring bundled nodejs..."
        pushd vendor/node > /dev/null || die
        # Make sure gyp_node does not run
        echo '#!/usr/bin/env python' > tools/gyp_node.py || die
-       ./configure --shared-openssl --shared-libuv --shared-http-parser \
-                               --shared-zlib --without-npm 
--with-intl=system-icu \
-                               --without-dtrace --dest-cpu=${target_arch} \
-                               --prefix="" || die
+       # --shared-libuv cannot be used as electron's node fork
+       # patches uv_loop structure.
+       ./configure --shared --without-bundled-v8 --shared-openssl \
+                               --shared-http-parser --shared-zlib 
--without-npm \
+                               --with-intl=system-icu --without-dtrace \
+                               --dest-cpu=${target_arch} --prefix="" || die
        popd > /dev/null || die
 
        # libchromiumcontent configuration
@@ -651,7 +678,7 @@ src_configure() {
 
        myconf+=" -Ivendor/node/config.gypi
                          -Icommon.gypi
-                         atom.gyp"
+                         electron.gyp"
 
        egyp_chromium ${myconf} || die
 }
@@ -674,11 +701,17 @@ eninja() {
 }
 
 src_compile() {
-       local ninja_targets="electron"
+       local ninja_targets="electron" compile_target="out/R"
+
+       eninja -C ${compile_target} mksnapshot || die
+       pax-mark -m ${compile_target}/mksnapshot
+
+       eninja -C ${compile_target} nodebin || die
+       pax-mark -m ${compile_target}/nodebin
 
        # Even though ninja autodetects number of CPUs, we respect
        # user's options, for debugging with -j 1 or any other reason.
-       eninja -C out/R ${ninja_targets} || die
+       eninja -C ${compile_target} ${ninja_targets} || die
 }
 
 src_install() {
@@ -706,6 +739,8 @@ src_install() {
        doins -r out/R/locales
        dosym "${install_dir}/electron" "/usr/bin/electron${install_suffix}"
 
+       pax-mark -rm "${ED}/${install_dir}/electron"
+
        # Install Node headers
        HEADERS_ONLY=1 \
                "${S}/vendor/node/tools/install.py" install "${ED}" "/usr" || 
die
@@ -720,3 +755,11 @@ src_install() {
        mv "${ED}/usr/include/node" \
           "${ED}/usr/include/electron${install_suffix}/node" || die
 }
+
+pkg_postinst() {
+       eselect electron update
+}
+
+pkg_prerm() {
+       eselect electron update
+}

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 00000000..8e44cbd
--- /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 <chcunning...@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-last-commit-position-r0.patch 
b/dev-util/electron/files/chromium-last-commit-position-r0.patch
new file mode 100644
index 00000000..344ed4c
--- /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 00000000..97d5e16
--- /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 00000000..b8bd855
--- /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-pdfium-r0.patch 
b/dev-util/electron/files/chromium-pdfium-r0.patch
new file mode 100644
index 00000000..2ba2684
--- /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-shared-v8-r1.patch 
b/dev-util/electron/files/chromium-shared-v8-r1.patch
new file mode 100644
index 00000000..eb4d998
--- /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-snapshot-toolchain-r1.patch 
b/dev-util/electron/files/chromium-snapshot-toolchain-r1.patch
new file mode 100644
index 00000000..56f35b3
--- /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-r2.patch 
b/dev-util/electron/files/chromium-system-ffmpeg-r2.patch
new file mode 100644
index 00000000..8d67ef3
--- /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-icu-r0.patch 
b/dev-util/electron/files/chromium-system-icu-r0.patch
new file mode 100644
index 00000000..5f620d1
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-icu-r0.patch
@@ -0,0 +1,14 @@
+diff --git a/third_party/WebKit/Source/platform/text/Character.cpp 
b/third_party/WebKit/Source/platform/text/Character.cpp
+index d59ae41..50932bd 100644
+--- a/third_party/WebKit/Source/platform/text/Character.cpp
++++ b/third_party/WebKit/Source/platform/text/Character.cpp
+
+@@ -37,7 +37,7 @@
+ #include <unicode/uscript.h>
+ 
+ #if defined(USING_SYSTEM_ICU)
+-#include "platform/fonts/CharacterPropertyDataGenerator.h"
++#include "platform/text/CharacterPropertyDataGenerator.h"
+ #include <unicode/uniset.h>
+ #else
+ #define MUTEX_H // Prevent compile failure of utrie2.h on Windows

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 00000000..1de9083
--- /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 00000000..3bf38e5
--- /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/brightray-gentoo-build-fixes-r1.patch 
b/dev-util/electron/files/electron-0.36.12-vendor-brightray.patch
similarity index 100%
copy from dev-util/electron/files/brightray-gentoo-build-fixes-r1.patch
copy to dev-util/electron/files/electron-0.36.12-vendor-brightray.patch

diff --git 
a/dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch 
b/dev-util/electron/files/electron-0.36.12-vendor-libchromiumcontent.patch
similarity index 100%
copy from dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch
copy to dev-util/electron/files/electron-0.36.12-vendor-libchromiumcontent.patch

diff --git a/dev-util/electron/files/node-gentoo-build-fixes.patch 
b/dev-util/electron/files/electron-0.36.12-vendor-node.patch
similarity index 100%
copy from dev-util/electron/files/node-gentoo-build-fixes.patch
copy to dev-util/electron/files/electron-0.36.12-vendor-node.patch

diff --git a/dev-util/electron/files/electron-gentoo-build-fixes.patch 
b/dev-util/electron/files/electron-0.36.12.patch
similarity index 91%
copy from dev-util/electron/files/electron-gentoo-build-fixes.patch
copy to dev-util/electron/files/electron-0.36.12.patch
index 3cd90d0..ec21b25 100644
--- a/dev-util/electron/files/electron-gentoo-build-fixes.patch
+++ b/dev-util/electron/files/electron-0.36.12.patch
@@ -1,17 +1,17 @@
-From 122f619bb04fa61f9d5757881a3031b00dee5339 Mon Sep 17 00:00:00 2001
+From 293b40208c981a3a18a1ccd5c5ea0a50611e2356 Mon Sep 17 00:00:00 2001
 From: Elvis Pranskevichus <el...@magic.io>
 Date: Mon, 8 Feb 2016 15:16:40 -0500
 Subject: [PATCH] electron build fixes
 
 ---
- atom.gyp         | 55 ++++++++++++++++++++++++++++++++++++++++++++-----------
- common.gypi      | 32 +++++++++++++++++++++++---------
+ atom.gyp         | 55 +++++++++++++++++++++++++++++++++++++++++++------------
+ common.gypi      | 29 +++++++++++++++++++++++------
  filenames.gypi   |  1 -
  tools/js2asar.py | 11 ++++++-----
- 4 files changed, 73 insertions(+), 26 deletions(-)
+ 4 files changed, 72 insertions(+), 24 deletions(-)
 
 diff --git a/atom.gyp b/atom.gyp
-index 5554adb..30ae39b 100644
+index 5554adb..61ec47c 100644
 --- a/atom.gyp
 +++ b/atom.gyp
 @@ -29,6 +29,7 @@
@@ -50,7 +50,7 @@ index 5554adb..30ae39b 100644
                  '<(libchromiumcontent_dir)/natives_blob.bin',
                  '<(libchromiumcontent_dir)/snapshot_blob.bin',
                ],
-@@ -242,8 +240,8 @@
+@@ -242,15 +240,14 @@
          '<@(lib_sources)',
        ],
        'include_dirs': [
@@ -60,7 +60,14 @@ index 5554adb..30ae39b 100644
          'vendor/brightray',
          'vendor/native_mate',
          # Include atom_natives.h.
-@@ -301,8 +299,8 @@
+         '<(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.
@@ -71,7 +78,7 @@ index 5554adb..30ae39b 100644
            ],
          }],  # OS=="win"
          ['OS=="mac" and mas_build==0', {
-@@ -333,7 +331,7 @@
+@@ -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
@@ -80,7 +87,7 @@ index 5554adb..30ae39b 100644
                # Make native module dynamic loading work.
                '-rdynamic',
              ],
-@@ -344,10 +342,10 @@
+@@ -344,10 +341,10 @@
              '-Wno-reserved-user-defined-literal',
            ],
            'include_dirs': [
@@ -93,7 +100,7 @@ index 5554adb..30ae39b 100644
            ],
          }],  # OS=="linux"
        ],
-@@ -355,6 +353,9 @@
+@@ -355,6 +352,9 @@
      {
        'target_name': 'js2asar',
        'type': 'none',
@@ -103,7 +110,7 @@ index 5554adb..30ae39b 100644
        'actions': [
          {
            'action_name': 'js2asar',
-@@ -376,6 +377,7 @@
+@@ -376,6 +376,7 @@
            'action': [
              'python',
              'tools/js2asar.py',
@@ -111,7 +118,7 @@ index 5554adb..30ae39b 100644
              '<@(_outputs)',
              '<@(_inputs)',
            ],
-@@ -403,6 +405,37 @@
+@@ -403,6 +404,36 @@
          }
        ],
      },  # target atom_js2c
@@ -131,7 +138,6 @@ index 5554adb..30ae39b 100644
 +        '<(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',
@@ -150,10 +156,10 @@ index 5554adb..30ae39b 100644
    'conditions': [
      ['OS=="mac"', {
 diff --git a/common.gypi b/common.gypi
-index 7c41c36..97a3d3a 100644
+index 7c41c36..2da2fea 100644
 --- a/common.gypi
 +++ b/common.gypi
-@@ -17,28 +17,42 @@
+@@ -17,12 +17,6 @@
      'node_target_type': 'shared_library',
      'node_install_npm': 'false',
      'node_prefix': '',
@@ -166,12 +172,7 @@ index 7c41c36..97a3d3a 100644
      'node_tag': '',
      'node_use_dtrace': 'false',
      'node_use_etw': 'false',
-     'node_use_mdb': 'false',
-     'node_use_openssl': 'true',
-     'node_use_perfctr': 'false',
--    'uv_library': 'static_library',
--    'uv_parent_path': 'vendor/node/deps/uv',
--    'uv_use_dtrace': 'false',
+@@ -35,10 +29,33 @@
      'V8_BASE': '',
      'v8_postmortem_support': 'false',
      'v8_enable_i18n_support': 'false',

diff --git a/dev-util/electron/files/brightray-gentoo-build-fixes-r1.patch 
b/dev-util/electron/files/electron-0.37.8-vendor-brightray.patch
similarity index 91%
copy from dev-util/electron/files/brightray-gentoo-build-fixes-r1.patch
copy to dev-util/electron/files/electron-0.37.8-vendor-brightray.patch
index 7acbe04..4c68e41 100644
--- a/dev-util/electron/files/brightray-gentoo-build-fixes-r1.patch
+++ b/dev-util/electron/files/electron-0.37.8-vendor-brightray.patch
@@ -1,15 +1,15 @@
-From 4ec57d1c20b841c6121a77f1539b0c759a031904 Mon Sep 17 00:00:00 2001
+From e28b41fcc6d59d1774995c5a7b6aa4c634616481 Mon Sep 17 00:00:00 2001
 From: Elvis Pranskevichus <el...@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(-)
+ brightray.gypi | 20 +++++++-------------
+ 2 files changed, 55 insertions(+), 17 deletions(-)
 
 diff --git a/brightray.gyp b/brightray.gyp
-index d7120ea..d0fd603 100644
+index 4a821d1..0897f9d 100644
 --- a/brightray.gyp
 +++ b/brightray.gyp
 @@ -1,7 +1,7 @@
@@ -33,7 +33,7 @@ index d7120ea..d0fd603 100644
        'type': 'static_library',
        'include_dirs': [
          '.',
-@@ -100,12 +105,9 @@
+@@ -101,12 +106,9 @@
              }, {
                'link_settings': {
                  'libraries': [
@@ -46,7 +46,7 @@ index d7120ea..d0fd603 100644
                    '-lrt',
                    '-ldl',
                    '-lresolv',
-@@ -274,5 +276,47 @@
+@@ -302,5 +304,47 @@
          }],  # OS=="win"
        ],
      },
@@ -95,10 +95,10 @@ index d7120ea..d0fd603 100644
    ],
  }
 diff --git a/brightray.gypi b/brightray.gypi
-index 4513fa9..95bdfa1 100644
+index 8bae073..95bdfa1 100644
 --- a/brightray.gypi
 +++ b/brightray.gypi
-@@ -1,9 +1,14 @@
+@@ -1,9 +1,13 @@
  {
 -  'includes': [
 -    'vendor/download/libchromiumcontent/filenames.gypi',
@@ -112,11 +112,10 @@ index 4513fa9..95bdfa1 100644
 +    'libchromiumcontent_static_libraries': [],
 +    'libchromiumcontent_shared_v8_libraries': [],
 +    'libchromiumcontent_static_v8_libraries': [],
-+    'pkg-config%': 'pkg-config',
+     'pkg-config%': 'pkg-config',
      'conditions': [
        # The "libchromiumcontent_component" is defined when calling "gyp".
-       ['libchromiumcontent_component', {
-@@ -258,22 +263,12 @@
+@@ -259,22 +263,12 @@
          'conditions': [
            ['OS=="linux"', {
              'cflags': [

diff --git 
a/dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch 
b/dev-util/electron/files/electron-0.37.8-vendor-libchromiumcontent.patch
similarity index 76%
copy from dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch
copy to dev-util/electron/files/electron-0.37.8-vendor-libchromiumcontent.patch
index 168d8db..8115345 100644
--- a/dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch
+++ b/dev-util/electron/files/electron-0.37.8-vendor-libchromiumcontent.patch
@@ -1,15 +1,15 @@
-From b7022129450eaf2136746f5332956e76848796ef Mon Sep 17 00:00:00 2001
+From bfa42ae7f5251a65fd90a68d0914384b7e63b8ad Mon Sep 17 00:00:00 2001
 From: Elvis Pranskevichus <el...@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(-)
+ chromiumcontent/chromiumcontent.gypi | 22 ----------------------
+ 2 files changed, 3 insertions(+), 25 deletions(-)
 
 diff --git a/chromiumcontent/chromiumcontent.gyp 
b/chromiumcontent/chromiumcontent.gyp
-index 52a1d36..db74a52 100644
+index ddaa0b9..cc8c7c6 100644
 --- a/chromiumcontent/chromiumcontent.gyp
 +++ b/chromiumcontent/chromiumcontent.gyp
 @@ -24,11 +24,11 @@
@@ -28,28 +28,29 @@ index 52a1d36..db74a52 100644
          '<(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
+index 73bc78a..53694e7 100644
 --- a/chromiumcontent/chromiumcontent.gypi
 +++ b/chromiumcontent/chromiumcontent.gypi
-@@ -1,17 +1,5 @@
+@@ -1,18 +1,5 @@
  {
    'variables': {
+-    # Don't use nacl.
+-    'disable_nacl': 1,
 -    # Enalbe using proprietary codecs.
 -    'proprietary_codecs': 1,
--    'ffmpeg_branding': 'Chrome',
+-    # 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',
--    # 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 @@
+@@ -23,15 +10,6 @@
          'v8_use_external_startup_data': 1,
        }],
        ['OS=="linux"', {
@@ -60,16 +61,11 @@ index 37c572b..3f4dcea 100644
 -        # 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
+2.7.3
 

diff --git a/dev-util/electron/files/node-gentoo-build-fixes.patch 
b/dev-util/electron/files/electron-0.37.8-vendor-node.patch
similarity index 60%
rename from dev-util/electron/files/node-gentoo-build-fixes.patch
rename to dev-util/electron/files/electron-0.37.8-vendor-node.patch
index 85f34b6..6e706c3 100644
--- a/dev-util/electron/files/node-gentoo-build-fixes.patch
+++ b/dev-util/electron/files/electron-0.37.8-vendor-node.patch
@@ -1,17 +1,31 @@
-From 56b57ea7f0c111bfd9c719060cf17346e638fdd1 Mon Sep 17 00:00:00 2001
+From ee5dd0d41e8426d6915c4b2b9095674ab4175fee Mon Sep 17 00:00:00 2001
 From: Elvis Pranskevichus <el...@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(-)
+ 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 d431210..fea5e07 100644
+index df3bb6a..fbe21d8 100644
 --- a/node.gyp
 +++ b/node.gyp
 @@ -1,6 +1,7 @@
@@ -22,7 +36,7 @@ index d431210..fea5e07 100644
      'node_use_dtrace%': 'false',
      'node_use_lttng%': 'false',
      'node_use_etw%': 'false',
-@@ -89,8 +90,8 @@
+@@ -107,8 +108,8 @@
        'dependencies': [
          'node_js2c#host',
          'deps/cares/cares.gyp:cares',
@@ -34,66 +48,48 @@ index d431210..fea5e07 100644
  
        'include_dirs': [
 diff --git a/src/node.cc b/src/node.cc
-index 7df6053..cbe1538 100644
+index 66f31d0..961abc2 100644
 --- a/src/node.cc
 +++ b/src/node.cc
-@@ -4085,15 +4085,11 @@ static void StartNodeInstance(void* arg) {
+@@ -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
+ #endif
          more = uv_run(env->event_loop(), UV_RUN_ONCE);
  
          if (more == false) {
 -#if 0
++#if 1
            v8::platform::PumpMessageLoop(default_platform, isolate);
--#endif
+ #endif
            EmitBeforeExit(env);
- 
-           // Emit `beforeExit` if the loop became alive either after emitting
-@@ -4153,10 +4149,8 @@ int Start(int argc, char** argv) {
+@@ -4312,7 +4312,7 @@ int Start(int argc, char** argv) {
+   V8::SetEntropySource(crypto::EntropySource);
  #endif
  
-   const int thread_pool_size = 4;
 -#if 0
-   default_platform = v8::platform::CreateDefaultPlatform(thread_pool_size);
++#if 1
+   default_platform = v8::platform::CreateDefaultPlatform(v8_thread_pool_size);
    V8::InitializePlatform(default_platform);
--#endif
    V8::Initialize();
- 
-   int exit_code = 1;
-@@ -4173,10 +4167,8 @@ int Start(int argc, char** argv) {
+@@ -4332,7 +4332,7 @@ int Start(int argc, char** argv) {
    }
    V8::Dispose();
  
 -#if 0
++#if 1
    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();
+ #endif
 diff --git a/src/node_main.cc b/src/node_main.cc
-index 58e747e..24949f3 100644
+index dce72af..e567cc4 100644
 --- a/src/node_main.cc
 +++ b/src/node_main.cc
-@@ -40,8 +40,10 @@ int wmain(int argc, wchar_t *wargv[]) {
+@@ -48,8 +48,10 @@ int wmain(int argc, wchar_t *wargv[]) {
  }
  #else
  // UNIX

diff --git a/dev-util/electron/files/electron-gentoo-build-fixes.patch 
b/dev-util/electron/files/electron-0.37.8.patch
similarity index 51%
rename from dev-util/electron/files/electron-gentoo-build-fixes.patch
rename to dev-util/electron/files/electron-0.37.8.patch
index 3cd90d0..943281c 100644
--- a/dev-util/electron/files/electron-gentoo-build-fixes.patch
+++ b/dev-util/electron/files/electron-0.37.8.patch
@@ -1,28 +1,91 @@
-From 122f619bb04fa61f9d5757881a3031b00dee5339 Mon Sep 17 00:00:00 2001
+From 79e5320a6544a24e45d275cf64bff27fbf6289f2 Mon Sep 17 00:00:00 2001
 From: Elvis Pranskevichus <el...@magic.io>
 Date: Mon, 8 Feb 2016 15:16:40 -0500
 Subject: [PATCH] electron build fixes
 
 ---
- atom.gyp         | 55 ++++++++++++++++++++++++++++++++++++++++++++-----------
- common.gypi      | 32 +++++++++++++++++++++++---------
- filenames.gypi   |  1 -
- tools/js2asar.py | 11 ++++++-----
- 4 files changed, 73 insertions(+), 26 deletions(-)
+ 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/atom.gyp b/atom.gyp
-index 5554adb..30ae39b 100644
---- a/atom.gyp
-+++ b/atom.gyp
-@@ -29,6 +29,7 @@
-       'type': 'executable',
+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': [
-@@ -177,7 +178,7 @@
+@@ -165,7 +166,7 @@
            ],
          }, {
            'dependencies': [
@@ -31,7 +94,7 @@ index 5554adb..30ae39b 100644
            ],
          }],  # OS=="win"
          ['OS=="linux"', {
-@@ -194,7 +195,7 @@
+@@ -182,7 +183,7 @@
                    }, {
                      'copied_libraries': [
                        '<(PRODUCT_DIR)/lib/libnode.so',
@@ -40,7 +103,7 @@ index 5554adb..30ae39b 100644
                      ],
                    }],
                  ],
-@@ -202,9 +203,6 @@
+@@ -190,9 +191,6 @@
                'destination': '<(PRODUCT_DIR)',
                'files': [
                  '<@(copied_libraries)',
@@ -50,7 +113,16 @@ index 5554adb..30ae39b 100644
                  '<(libchromiumcontent_dir)/natives_blob.bin',
                  '<(libchromiumcontent_dir)/snapshot_blob.bin',
                ],
-@@ -242,8 +240,8 @@
+@@ -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': [
@@ -60,7 +132,14 @@ index 5554adb..30ae39b 100644
          'vendor/brightray',
          'vendor/native_mate',
          # Include atom_natives.h.
-@@ -301,8 +299,8 @@
+         '<(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.
@@ -71,7 +150,7 @@ index 5554adb..30ae39b 100644
            ],
          }],  # OS=="win"
          ['OS=="mac" and mas_build==0', {
-@@ -333,7 +331,7 @@
+@@ -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
@@ -80,7 +159,7 @@ index 5554adb..30ae39b 100644
                # Make native module dynamic loading work.
                '-rdynamic',
              ],
-@@ -344,10 +342,10 @@
+@@ -329,10 +328,10 @@
              '-Wno-reserved-user-defined-literal',
            ],
            'include_dirs': [
@@ -93,7 +172,7 @@ index 5554adb..30ae39b 100644
            ],
          }],  # OS=="linux"
        ],
-@@ -355,6 +353,9 @@
+@@ -340,6 +339,9 @@
      {
        'target_name': 'js2asar',
        'type': 'none',
@@ -103,15 +182,33 @@ index 5554adb..30ae39b 100644
        'actions': [
          {
            'action_name': 'js2asar',
-@@ -376,6 +377,7 @@
+@@ -361,6 +363,7 @@
            'action': [
              'python',
              'tools/js2asar.py',
 +            '<(PRODUCT_DIR)/nodebin',
              '<@(_outputs)',
+             'lib',
              '<@(_inputs)',
-           ],
-@@ -403,6 +405,37 @@
+@@ -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
@@ -149,67 +246,11 @@ index 5554adb..30ae39b 100644
    ],
    'conditions': [
      ['OS=="mac"', {
-diff --git a/common.gypi b/common.gypi
-index 7c41c36..97a3d3a 100644
---- a/common.gypi
-+++ b/common.gypi
-@@ -17,28 +17,42 @@
-     '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',
-     'node_use_mdb': 'false',
-     'node_use_openssl': 'true',
-     'node_use_perfctr': 'false',
--    'uv_library': 'static_library',
--    'uv_parent_path': 'vendor/node/deps/uv',
--    'uv_use_dtrace': 'false',
-     '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
+index 1c21394..3e07096 100644
 --- a/filenames.gypi
 +++ b/filenames.gypi
-@@ -498,7 +498,6 @@
+@@ -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',
@@ -217,37 +258,131 @@ index f9e1955..84999a3 100644
        '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 cb02e33..3d80a11 100755
+index 7860176..b08a38d 100755
 --- a/tools/js2asar.py
 +++ b/tools/js2asar.py
-@@ -11,12 +11,13 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
+@@ -11,13 +11,14 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
  
  
  def main():
 -  archive = sys.argv[1]
--  js_source_files = sys.argv[2:]
+-  folder_name = sys.argv[2]
+-  source_files = sys.argv[3:]
 +  node = sys.argv[1]
 +  archive = sys.argv[2]
-+  js_source_files = sys.argv[3:]
++  folder_name = sys.argv[3]
++  source_files = sys.argv[4:]
  
    output_dir = tempfile.mkdtemp()
-   copy_js(js_source_files, output_dir)
--  call_asar(archive, output_dir)
-+  call_asar(node, archive, output_dir)
+   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,10 +29,10 @@ def copy_js(js_source_files, 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):
-   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])
+-  subprocess.check_call([find_node(), asar, 'pack', output_dir, archive])
++  subprocess.check_call([node, asar, 'pack', output_dir, archive])
  
  
  def find_node():

diff --git a/dev-util/electron/files/brightray-gentoo-build-fixes-r1.patch 
b/dev-util/electron/files/electron-1.3.5-vendor-brightray.patch
similarity index 85%
rename from dev-util/electron/files/brightray-gentoo-build-fixes-r1.patch
rename to dev-util/electron/files/electron-1.3.5-vendor-brightray.patch
index 7acbe04..5f789e7 100644
--- a/dev-util/electron/files/brightray-gentoo-build-fixes-r1.patch
+++ b/dev-util/electron/files/electron-1.3.5-vendor-brightray.patch
@@ -1,23 +1,23 @@
-From 4ec57d1c20b841c6121a77f1539b0c759a031904 Mon Sep 17 00:00:00 2001
+From 08a13bec9d06a0ea3d86b8a3126cf83a200a8320 Mon Sep 17 00:00:00 2001
 From: Elvis Pranskevichus <el...@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(-)
+ brightray.gypi | 20 +++++++-------------
+ 2 files changed, 55 insertions(+), 17 deletions(-)
 
 diff --git a/brightray.gyp b/brightray.gyp
-index d7120ea..d0fd603 100644
+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 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'
+-    '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',
@@ -33,7 +33,7 @@ index d7120ea..d0fd603 100644
        'type': 'static_library',
        'include_dirs': [
          '.',
-@@ -100,12 +105,9 @@
+@@ -104,12 +109,9 @@
              }, {
                'link_settings': {
                  'libraries': [
@@ -46,7 +46,7 @@ index d7120ea..d0fd603 100644
                    '-lrt',
                    '-ldl',
                    '-lresolv',
-@@ -274,5 +276,47 @@
+@@ -333,5 +335,47 @@
          }],  # OS=="win"
        ],
      },
@@ -95,10 +95,10 @@ index d7120ea..d0fd603 100644
    ],
  }
 diff --git a/brightray.gypi b/brightray.gypi
-index 4513fa9..95bdfa1 100644
+index 634aec0..8d86999 100644
 --- a/brightray.gypi
 +++ b/brightray.gypi
-@@ -1,9 +1,14 @@
+@@ -1,9 +1,13 @@
  {
 -  'includes': [
 -    'vendor/download/libchromiumcontent/filenames.gypi',
@@ -112,11 +112,10 @@ index 4513fa9..95bdfa1 100644
 +    'libchromiumcontent_static_libraries': [],
 +    'libchromiumcontent_shared_v8_libraries': [],
 +    'libchromiumcontent_static_v8_libraries': [],
-+    'pkg-config%': 'pkg-config',
+     'pkg-config%': 'pkg-config',
      'conditions': [
        # The "libchromiumcontent_component" is defined when calling "gyp".
-       ['libchromiumcontent_component', {
-@@ -258,22 +263,12 @@
+@@ -234,22 +238,12 @@
          'conditions': [
            ['OS=="linux"', {
              'cflags': [

diff --git 
a/dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch 
b/dev-util/electron/files/electron-1.3.5-vendor-libchromiumcontent.patch
similarity index 66%
rename from dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch
rename to dev-util/electron/files/electron-1.3.5-vendor-libchromiumcontent.patch
index 168d8db..ed38150 100644
--- a/dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch
+++ b/dev-util/electron/files/electron-1.3.5-vendor-libchromiumcontent.patch
@@ -1,15 +1,15 @@
-From b7022129450eaf2136746f5332956e76848796ef Mon Sep 17 00:00:00 2001
+From 0448735817b941e5039616144aa836c2f08c9c54 Mon Sep 17 00:00:00 2001
 From: Elvis Pranskevichus <el...@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(-)
+ 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 52a1d36..db74a52 100644
+index 5278324..41e7de3 100644
 --- a/chromiumcontent/chromiumcontent.gyp
 +++ b/chromiumcontent/chromiumcontent.gyp
 @@ -24,11 +24,11 @@
@@ -21,35 +21,43 @@ index 52a1d36..db74a52 100644
 -      'type': 'shared_library',
 +      'type': 'static_library',
        'dependencies': [
-         '<(DEPTH)/base/base.gyp:base_prefs',
+         '<(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 37c572b..3f4dcea 100644
+index 6d605a2..bd28a21 100644
 --- a/chromiumcontent/chromiumcontent.gypi
 +++ b/chromiumcontent/chromiumcontent.gypi
 @@ -1,17 +1,5 @@
  {
    'variables': {
--    # Enalbe using proprietary codecs.
+-    # Don't use nacl.
+-    'disable_nacl': 1,
+-    # Enable using proprietary codecs.
 -    'proprietary_codecs': 1,
--    'ffmpeg_branding': 'Chrome',
+-    # 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',
--    # 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 @@
+@@ -22,15 +10,6 @@
          'v8_use_external_startup_data': 1,
        }],
        ['OS=="linux"', {
@@ -60,16 +68,11 @@ index 37c572b..3f4dcea 100644
 -        # 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
+2.7.3
 

diff --git a/dev-util/electron/files/electron-1.3.5-vendor-node.patch 
b/dev-util/electron/files/electron-1.3.5-vendor-node.patch
new file mode 100644
index 00000000..6d55d87
--- /dev/null
+++ b/dev-util/electron/files/electron-1.3.5-vendor-node.patch
@@ -0,0 +1,92 @@
+From 742d610e4936d7377dd66b8ec6213c6c0afa121f Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <el...@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.5.patch 
b/dev-util/electron/files/electron-1.3.5.patch
new file mode 100644
index 00000000..57ebe31
--- /dev/null
+++ b/dev-util/electron/files/electron-1.3.5.patch
@@ -0,0 +1,422 @@
+From d6b2c31fe1b21d171ecedcd2a198bd5b8347bd98 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <el...@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/node-external-snapshots.patch 
b/dev-util/electron/files/electron-vendor-node-external-snapshots-r0.patch
similarity index 89%
rename from dev-util/electron/files/node-external-snapshots.patch
rename to 
dev-util/electron/files/electron-vendor-node-external-snapshots-r0.patch
index 1cd49ec..d3fce08 100644
--- a/dev-util/electron/files/node-external-snapshots.patch
+++ b/dev-util/electron/files/electron-vendor-node-external-snapshots-r0.patch
@@ -1,4 +1,4 @@
-From 2493dac20f0b4134bbf02ac48dffde6c2643608b Mon Sep 17 00:00:00 2001
+From 820cb5ce8e1aa08e68fe0f2e3cbbe74972e7af84 Mon Sep 17 00:00:00 2001
 From: Elvis Pranskevichus <el...@magic.io>
 Date: Sat, 11 Jun 2016 18:27:19 -0400
 Subject: [PATCH] Add support for external V8 snapshots
@@ -8,10 +8,10 @@ Subject: [PATCH] Add support for external V8 snapshots
  1 file changed, 86 insertions(+)
 
 diff --git a/src/node.cc b/src/node.cc
-index cbe1538..521708a 100644
+index 961abc2..4dac94b 100644
 --- a/src/node.cc
 +++ b/src/node.cc
-@@ -4037,6 +4037,90 @@ Environment* CreateEnvironment(Isolate* isolate,
+@@ -4188,6 +4188,90 @@ Environment* CreateEnvironment(Isolate* isolate,
    return env;
  }
  
@@ -102,15 +102,15 @@ index cbe1538..521708a 100644
  
  // Entry point for new node instances, also called directly for the main
  // node instance.
-@@ -4142,6 +4226,8 @@ int Start(int argc, char** argv) {
+@@ -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
-   // V8 on Windows doesn't have a good source of entropy. Seed it from
-   // OpenSSL's pool.
+ #ifdef NODE_FIPS_MODE
+   // In the case of FIPS builds we should make sure
 -- 
 2.7.3
 

Reply via email to