commit:     1b299909903085240575a3f5c9aaf5377a4a13fe
Author:     Elvis Pranskevichus <elvis <AT> magic <DOT> io>
AuthorDate: Tue Apr  5 16:29:26 2016 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Tue May  3 14:45:56 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b299909

dev-util/electron: Add ebuild for Github's Electron (v0.36.9)

Electron is an application framework built on top of Chromium and NodeJS.
It allows creating cross-platform desktop apps using Web tech. [1]

The main user of Electron is the Atom IDE [2].  Microsoft Visual Studio
Code is also based on Electron.  It is also useful for the creation of
desktop wrappers for popular web services, e.g. Google Music [3].

Unfortunately, current upstream's approach to "building Electron from
source" involves downloading a pre-built libchromiumcontent.so binary
from the Internet, which poses obvious security and compatibility risks.

This ebuild is based heavily on the Chromium ebuild and follows similar
unbunling policy.

Additionally, Electron-specific NodeJS headers are installed to
/usr/include so that native modules built for Electron-based apps can be
compiled against the correct version of NodeJS embedded in Electron.

[1] http://electron.atom.io/
[2] http://atom.io/
[3] https://github.com/twolfson/google-music-electron

Gentoo-Bug: https://bugs.gentoo.org/579116
Closes: https://github.com/gentoo/gentoo/pull/1200
Package-Manager: portage-2.2.28

Acked-by: Mike Gilbert <floppym <AT> gentoo.org>
Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>

 dev-util/electron/Manifest                         |   7 +
 dev-util/electron/electron-0.36.12.ebuild          | 722 +++++++++++++++++++++
 .../files/brightray-gentoo-build-fixes.patch       |  81 +++
 .../electron/files/chromium-disable-widevine.patch |   9 +
 dev-util/electron/files/chromium-lto-fixes.patch   |  26 +
 .../files/chromium-remove-gardiner-mod-font.patch  |  13 +
 dev-util/electron/files/chromium-shared-v8.patch   |  15 +
 .../electron/files/chromium-system-ffmpeg-r0.patch |  54 ++
 .../electron/files/chromium-system-jinja-r7.patch  |  35 +
 .../electron/files/chromium-system-libvpx-r0.patch |  20 +
 .../files/electron-gentoo-build-fixes.patch        | 157 +++++
 .../libchromiumcontent-gentoo-build-fixes.patch    |  75 +++
 .../electron/files/node-gentoo-build-fixes.patch   |  50 ++
 dev-util/electron/metadata.xml                     |  22 +
 14 files changed, 1286 insertions(+)

diff --git a/dev-util/electron/Manifest b/dev-util/electron/Manifest
new file mode 100644
index 0000000..749fd63
--- /dev/null
+++ b/dev-util/electron/Manifest
@@ -0,0 +1,7 @@
+DIST asar-0.10.0.tar.gz 975433 SHA256 
49e743a952957aa22668b472ba926427f9e051ececeaadb922f8aff2bc8fd1ee SHA512 
702fa0e496a1db55a61d7e00d55456f8703f7af00e458f26413771dc71cd03e9418e0334bb1a500aaabe14ab598e19c64612ebf6411c77e30004833c8d5d151e
 WHIRLPOOL 
a2e4f8563f779aea19357962f0ac0895005ff93a601d409a7b2c685348cba845106729e1f2a39f95001c186c0c0ba914d73ff1364d488e0853dbbabda0e80bb3
+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 electron-0.36.12.tar.gz 3068567 SHA256 
8e4ee7ed37d32ad73f8cbfb132ce0009506a01a68d5a71bafd6858c6bc11f9a6 SHA512 
37d016768e57f81b01338cea6d0d5eaa6ea72d83a2122b54c9c73e37b0afc7fb8351b0cb846afda29206379d5625657b815b002c2eb3c31babcd0cffa47ae3de
 WHIRLPOOL 
a358e353259d377dd59ae563f38b2fe185ade6d7a00bbad8c61831c92b4e200ac1f2f25b79564eae11d9082a569be342ccd4be6e400955cd65729e9299b48796
+DIST electron-node-a507a3c3816d6ac085ed46250c489a3d76ab8b3c.tar.gz 36578658 
SHA256 56489ffa9d58b736008f5c1c2775bc10f3afe02d3c768035e7742893cc8e1d82 SHA512 
a5b62c05ec7300a26b3feab3c1e796a87691d41fa7c039541574878491df51e9075685abc5d630fc62bca95bf821eeede041d4ab36caedaf76156844f1095ea6
 WHIRLPOOL 
8675b05753cf905cfb2fc0ebb19fc256489a7b932c57be291eb2fc7194de599c07f4120541f4a61cccdb43b09b6280c7c02f9565aef98129c584fdca4c154279
+DIST libchromiumcontent-ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7.tar.gz 400648 
SHA256 36b46659fff3053ce273d3ed159fca74e18ebc873694f857a521d3c48fc079b1 SHA512 
5fcb5e3dd98d5875ff7aa9f9f4d02af45487534d0301ca7a0a7adde934f528fedc3dfaf886b9031027e41309eb8ba658b72a56af4ad8dc44cce458b9c04a0e47
 WHIRLPOOL 
31d28804f91bbdece8709ddac359e7f5c079b034137734041f274838d138d8e141fe12c0ecf1e66f92b15e8c653526a1779d3bcc342e3ecc9a39a18c689a94a6
+DIST native-mate-e719eab878c264bb03188d0cd6eb9ad6882bc13a.tar.gz 23818 SHA256 
82da85193f6924ce395004ce9dfd1198848cf8f14b7904321e67cad26a39f794 SHA512 
4272648127fb0bf90b36d2c090bea718d560737c1c7443a5b3c0de12999ffe607429b2112ecee36ece5d26cde54e78964303250ffd350a19c132c9733b72c523
 WHIRLPOOL 
c275163b9f3f424f5909f17c67f5b029f03bf76679296781bd6d74e64d903dd29cf5c28f1c4e399a049331f54f03175fe2c02de9ef6bf65040d9cef05be44a51

diff --git a/dev-util/electron/electron-0.36.12.ebuild 
b/dev-util/electron/electron-0.36.12.ebuild
new file mode 100644
index 0000000..73d6199
--- /dev/null
+++ b/dev-util/electron/electron-0.36.12.ebuild
@@ -0,0 +1,722 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 )
+
+CHROMIUM_LANGS="am ar bg bn ca cs da de el en_GB es es_LA 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
+
+# Keep this in sync with vendor/brightray/vendor/libchromiumcontent/VERSION
+CHROMIUM_VERSION="47.0.2526.110"
+# Keep this in sync with vendor/brightray
+BRIGHTRAY_COMMIT="9bc1d21b69ac99bed546d42035dc1205ea6b04af"
+# Keep this in sync with vendor/node
+NODE_COMMIT="a507a3c3816d6ac085ed46250c489a3d76ab8b3c"
+# Keep this in sync with vendor/native_mate
+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"
+
+CHROMIUM_P="chromium-${CHROMIUM_VERSION}"
+BRIGHTRAY_P="brightray-${BRIGHTRAY_COMMIT}"
+NODE_P="node-${NODE_COMMIT}"
+NATIVE_MATE_P="native-mate-${NATIVE_MATE_COMMIT}"
+LIBCHROMIUMCONTENT_P="libchromiumcontent-${LIBCHROMIUMCONTENT_COMMIT}"
+ASAR_P="asar-${ASAR_VERSION}"
+
+DESCRIPTION="Cross platform application development framework based on web 
technologies"
+HOMEPAGE="http://electron.atom.io/";
+SRC_URI="
+       
https://commondatastorage.googleapis.com/chromium-browser-official/${CHROMIUM_P}.tar.xz
+       https://github.com/electron/electron/archive/v${PV}.tar.gz -> 
${P}.tar.gz
+       
https://github.com/electron/brightray/archive/${BRIGHTRAY_COMMIT}.tar.gz -> 
${BRIGHTRAY_P}.tar.gz
+       https://github.com/electron/node/archive/${NODE_COMMIT}.tar.gz -> 
electron-${NODE_P}.tar.gz
+       
https://github.com/zcbenz/native-mate/archive/${NATIVE_MATE_COMMIT}.tar.gz -> 
${NATIVE_MATE_P}.tar.gz
+       
https://github.com/electron/libchromiumcontent/archive/${LIBCHROMIUMCONTENT_COMMIT}.tar.gz
 -> ${LIBCHROMIUMCONTENT_P}.tar.gz
+       
https://github.com/elprans/asar/releases/download/v${ASAR_VERSION}-gentoo/asar-build.tar.gz
 -> ${ASAR_P}.tar.gz
+"
+
+S="${WORKDIR}/${CHROMIUM_P}"
+ELECTRON_S="${WORKDIR}/${P}"
+NODE_S="${S}/vendor/node"
+BRIGHTRAY_S="${S}/vendor/brightray"
+NATIVE_MATE_S="${S}/vendor/native_mate"
+LIBCC_S="${BRIGHTRAY_S}/vendor/libchromiumcontent"
+
+LICENSE="BSD"
+SLOT="0/$(get_version_component_range 2)"
+KEYWORDS="~amd64"
+IUSE="custom-cflags cups gnome gnome-keyring gtk3 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.
+QA_FLAGS_IGNORED=".*\.nexe"
+
+# Native Client binaries may be stripped by the build system, which uses the
+# right tools for it, bug #469144 .
+QA_PRESTRIPPED=".*\.nexe"
+
+RDEPEND=">=app-accessibility/speech-dispatcher-0.8:=
+       app-arch/bzip2:=
+       app-arch/snappy:=
+       cups? ( >=net-print/cups-1.3.11:= )
+       >=dev-libs/elfutils-0.149
+       dev-libs/expat:=
+       dev-libs/glib:=
+       >=dev-libs/icu-55.1:=
+       >=dev-libs/jsoncpp-0.5.0-r1:=
+       >=dev-libs/libevent-1.4.13:=
+       dev-libs/libxml2:=[icu]
+       dev-libs/libxslt:=
+       dev-libs/nspr:=
+       >=dev-libs/nss-3.14.3:=
+       dev-libs/re2:=
+       gnome? ( >=gnome-base/gconf-2.24.0:= )
+       gnome-keyring? ( >=gnome-base/libgnome-keyring-3.12:= )
+       >=media-libs/alsa-lib-1.0.19:=
+       media-libs/flac:=
+       media-libs/fontconfig:=
+       media-libs/freetype:=
+       >=media-libs/harfbuzz-0.9.41:=[icu(+)]
+       media-libs/libexif:=
+       >=media-libs/libjpeg-turbo-1.2.0-r1:=
+       media-libs/libpng:0=
+       >=media-libs/libwebp-0.4.0:=
+       media-libs/speex:=
+       pulseaudio? ( media-sound/pulseaudio:= )
+       system-ffmpeg? ( >=media-video/ffmpeg-2.7.2:=[opus,vorbis,vpx] )
+       sys-apps/dbus:=
+       sys-apps/pciutils:=
+       >=sys-libs/libcap-2.22:=
+       sys-libs/zlib:=[minizip]
+       virtual/udev
+       x11-libs/cairo:=
+       x11-libs/gdk-pixbuf:=
+       gtk3? ( x11-libs/gtk+:3= )
+       !gtk3? ( x11-libs/gtk+:2= )
+       x11-libs/libdrm
+       x11-libs/libX11:=
+       x11-libs/libXcomposite:=
+       x11-libs/libXcursor:=
+       x11-libs/libXdamage:=
+       x11-libs/libXext:=
+       x11-libs/libXfixes:=
+       >=x11-libs/libXi-1.6.0:=
+       x11-libs/libXinerama:=
+       x11-libs/libXrandr:=
+       x11-libs/libXrender:=
+       x11-libs/libXScrnSaver:=
+       x11-libs/libXtst:=
+       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? (
+               dev-lang/yasm
+       )
+       dev-lang/perl
+       dev-perl/JSON
+       >=dev-util/gperf-3.0.3
+       dev-util/ninja
+       net-libs/nodejs[npm]
+       sys-apps/hwids[usb(+)]
+       >=sys-devel/bison-2.4.3
+       sys-devel/flex
+       virtual/pkgconfig"
+
+# For nvidia-drivers blocker, see bug #413637 .
+RDEPEND+="
+       x11-misc/xdg-utils
+       virtual/opengl
+       virtual/ttf-fonts
+       selinux? ( sec-policy/selinux-chromium )
+       tcmalloc? ( !<x11-drivers/nvidia-drivers-331.20 )"
+
+# Python dependencies. The DEPEND part needs to be kept in sync
+# with python_check_deps.
+DEPEND+=" $(python_gen_any_dep '
+       dev-python/beautifulsoup:python-2[${PYTHON_USEDEP}]
+       dev-python/beautifulsoup:4[${PYTHON_USEDEP}]
+       dev-python/html5lib[${PYTHON_USEDEP}]
+       dev-python/jinja[${PYTHON_USEDEP}]
+       dev-python/jsmin[${PYTHON_USEDEP}]
+       dev-python/ply[${PYTHON_USEDEP}]
+       dev-python/simplejson[${PYTHON_USEDEP}]
+')"
+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/html5lib[${PYTHON_USEDEP}]" &&
+       has_version --host-root "dev-python/jinja[${PYTHON_USEDEP}]" &&
+       has_version --host-root "dev-python/jsmin[${PYTHON_USEDEP}]" &&
+       has_version --host-root "dev-python/ply[${PYTHON_USEDEP}]" &&
+       has_version --host-root "dev-python/simplejson[${PYTHON_USEDEP}]"
+}
+
+if ! has chromium_pkg_die ${EBUILD_DEATH_HOOKS}; then
+       EBUILD_DEATH_HOOKS+=" chromium_pkg_die";
+fi
+
+pkg_pretend() {
+       if [[ $(tc-getCC)$ == *gcc* ]] && \
+               [[ $(gcc-major-version)$(gcc-minor-version) -lt 48 ]]; then
+               die 'At least gcc 4.8 is required, see bugs: #535730, #525374, 
#518668.'
+       fi
+
+       # LTO pass requires more file descriptors
+       if use lto; then
+               local lto_n_rlimit_min="16384"
+               local maxfiles=$(ulimit -n -H)
+               if [ "${maxfiles}" -lt "${lto_n_rlimit_min}" ]; then
+                       eerror ""
+                       eerror "Building with USE=\"lto\" requires file 
descriptor" \
+                                  "limit to be no less than 
${lto_n_rlimit_min}."
+                   eerror "The current limit for portage is ${maxfiles}."
+                       eerror "Please add the following to 
/etc/security/limits.conf:"
+                       eerror ""
+                       eerror "   root hard    nofile  ${lto_n_rlimit_min}"
+                       eerror "   root soft    nofile  ${lto_n_rlimit_min}"
+                       eerror ""
+                       die
+               fi
+       fi
+
+       # Check build requirements, bug #541816 and bug #471810 .
+       CHECKREQS_MEMORY="3G"
+       use lto && CHECKREQS_MEMORY="5G"
+       CHECKREQS_DISK_BUILD="10G"
+       eshopts_push -s extglob
+       if is-flagq '-g?(gdb)?([1-9])'; then
+               CHECKREQS_DISK_BUILD="25G"
+       fi
+       eshopts_pop
+       check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+       # Make sure the build system will use the right python, bug #344367.
+       python-any-r1_pkg_setup
+
+       chromium_suid_sandbox_check_kernel_config
+}
+
+_unnest_patches() {
+       local _s="${1%/}/" relpath out
+
+       for f in $(find "${_s}" -mindepth 2 -name *.patch -printf \"%P\"\\n); do
+               relpath="$(dirname ${f})"
+               out="${_s}/${relpath////_}_$(basename ${f})"
+               sed -r -e "s|^([-+]{3}) (.*)$|\1 ${relpath}/\2 ${f}|g" > 
"${out}"
+       done
+}
+
+_get_install_suffix() {
+       local c=(${SLOT//\// })
+       local slot=${c[0]}
+       local suffix
+
+       if [[ "${slot}" == "0" ]]; then
+               suffix=""
+       else
+               suffix="-${slot}"
+       fi
+
+       echo -n "${suffix}"
+}
+
+_get_install_dir() {
+       echo -n "/usr/$(get_libdir)/electron$(_get_install_suffix)"
+}
+
+src_prepare() {
+       # Merge Electron code and its submodules into the Chromium source tree
+       # so that everything can be configured and built in a single pass.
+       #
+       rsync -a --ignore-existing "${ELECTRON_S}/" "${S}/" || die
+       rm -r "${NODE_S}" &&
+               mv "${WORKDIR}/${NODE_P}" "${NODE_S}" || die
+       rm -r "${BRIGHTRAY_S}" &&
+               mv "${WORKDIR}/${BRIGHTRAY_P}" "${BRIGHTRAY_S}" || die
+       rm -r "${NATIVE_MATE_S}" &&
+               mv "${WORKDIR}/${NATIVE_MATE_P}" "${NATIVE_MATE_S}" || die
+       rm -r "${LIBCC_S}" &&
+               mv "${WORKDIR}/${LIBCHROMIUMCONTENT_P}" "${LIBCC_S}" || die
+       rm -r "${S}/vendor/breakpad" &&
+               ln -s "../breakpad" "${S}/vendor/breakpad" || die
+       ln -s "${WORKDIR}/${ASAR_P}/node_modules" "${S}/node_modules" || die
+
+       # electron patches
+       epatch "${FILESDIR}/electron-gentoo-build-fixes.patch"
+
+       # node patches
+       cd "${NODE_S}" || die
+       epatch "${FILESDIR}/node-gentoo-build-fixes.patch"
+       # make sure node uses the correct version of v8
+       rm -r deps/v8 || die
+       ln -s ../../../v8 deps/ || die
+
+       # make sure we use python2.* while using gyp
+       sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp 
|| die
+       sed -i -e "s/|| 'python'/|| '${EPYTHON}'/" 
deps/npm/node_modules/node-gyp/lib/configure.js || die
+
+       # less verbose install output (stating the same as portage, basically)
+       sed -i -e "/print/d" tools/install.py || die
+
+       # proper libdir, hat tip @ryanpcmcquen 
https://github.com/iojs/io.js/issues/504
+       local LIBDIR=$(get_libdir)
+       sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
+       sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js || die
+       sed -i -e "s|\"lib\"|\"${LIBDIR}\"|" deps/npm/lib/npm.js || die
+
+       # brightray patches
+       cd "${BRIGHTRAY_S}" || die
+       epatch "${FILESDIR}/brightray-gentoo-build-fixes.patch"
+
+       # libcc patches
+       cd "${LIBCC_S}" || die
+       epatch "${FILESDIR}/libchromiumcontent-gentoo-build-fixes.patch"
+
+       # chromium patches
+       cd "${S}" || die
+       epatch "${FILESDIR}/chromium-system-ffmpeg-r0.patch"
+       epatch "${FILESDIR}/chromium-system-jinja-r7.patch"
+       epatch "${FILESDIR}/chromium-disable-widevine.patch"
+       epatch "${FILESDIR}/chromium-remove-gardiner-mod-font.patch"
+       epatch "${FILESDIR}/chromium-shared-v8.patch"
+       epatch "${FILESDIR}/chromium-lto-fixes.patch"
+
+       # libcc chromium patches
+       _unnest_patches "${LIBCC_S}/patches"
+
+       EPATCH_SOURCE="${LIBCC_S}/patches" \
+       EPATCH_SUFFIX="patch" \
+       EPATCH_FORCE="yes" \
+       EPATCH_EXCLUDE="third_party_icu*" \
+       EPATCH_MULTI_MSG="Applying libchromiumcontent patches..." \
+               epatch
+
+       # build scripts
+       mkdir -p "${S}/chromiumcontent" || die
+       cp -a "${LIBCC_S}/chromiumcontent" "${S}/" || die
+       cp -a "${LIBCC_S}/tools/linux/" "${S}/tools/" || die
+
+       local conditional_bundled_libraries=""
+       if ! use system-ffmpeg; then
+               conditional_bundled_libraries+=" third_party/ffmpeg"
+       fi
+
+       # Remove most bundled libraries. Some are still needed.
+       build/linux/unbundle/remove_bundled_libraries.py \
+               ${conditional_bundled_libraries} \
+               'base/third_party/dmg_fp' \
+               'base/third_party/dynamic_annotations' \
+               'base/third_party/icu' \
+               'base/third_party/nspr' \
+               'base/third_party/superfasthash' \
+               'base/third_party/symbolize' \
+               'base/third_party/valgrind' \
+               'base/third_party/xdg_mime' \
+               'base/third_party/xdg_user_dirs' \
+               'breakpad/src/third_party/curl' \
+               '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/boringssl' \
+               'third_party/brotli' \
+               'third_party/cacheinvalidation' \
+               'third_party/catapult' \
+               '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' \
+               'third_party/devscripts' \
+               'third_party/dom_distiller_js' \
+               
'third_party/dom_distiller_js/dist/proto_gen/third_party/dom_distiller_js' \
+               'third_party/fips181' \
+               'third_party/flot' \
+               'third_party/google_input_tools' \
+               'third_party/google_input_tools/third_party/closure_library' \
+               
'third_party/google_input_tools/third_party/closure_library/third_party/closure'
 \
+               'third_party/hunspell' \
+               'third_party/iccjpeg' \
+               'third_party/jstemplate' \
+               'third_party/khronos' \
+               'third_party/leveldatabase' \
+               'third_party/libXNVCtrl' \
+               'third_party/libaddressinput' \
+               'third_party/libjingle' \
+               'third_party/libphonenumber' \
+               '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/libwebm' \
+               '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/openmax_dl' \
+               'third_party/opus' \
+               'third_party/ots' \
+               'third_party/pdfium' \
+               'third_party/pdfium/third_party/agg23' \
+               'third_party/pdfium/third_party/base' \
+               'third_party/pdfium/third_party/bigint' \
+               'third_party/pdfium/third_party/freetype' \
+               '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/zlib_v128' \
+               'third_party/polymer' \
+               'third_party/protobuf' \
+               'third_party/qcms' \
+               'third_party/readability' \
+               'third_party/sfntly' \
+               'third_party/skia' \
+               'third_party/smhasher' \
+               'third_party/sqlite' \
+               'third_party/tcmalloc' \
+               'third_party/usrsctp' \
+               'third_party/web-animations-js' \
+               'third_party/webdriver' \
+               'third_party/webrtc' \
+               'third_party/widevine' \
+               'third_party/x86inc' \
+               'third_party/zlib/google' \
+               'url/third_party/mozilla' \
+               'v8/src/third_party/fdlibm' \
+               'v8/src/third_party/valgrind' \
+               --do-remove || die
+
+       epatch_user
+}
+
+src_configure() {
+       local myconf=""
+
+       # Never tell the build system to "enable" SSE2, it has a few unexpected
+       # additions, bug #336871.
+       myconf+=" -Ddisable_sse2=1"
+
+       # Disable nacl, we can't build without pnacl (http://crbug.com/269560).
+       myconf+=" -Ddisable_nacl=1"
+
+       # Disable glibc Native Client toolchain, we don't need it (bug #417019).
+       # myconf+=" -Ddisable_glibc=1"
+
+       # TODO: also build with pnacl
+       # myconf+=" -Ddisable_pnacl=1"
+
+       # It would be awkward for us to tar the toolchain and get it untarred 
again
+       # during the build.
+       # myconf+=" -Ddisable_newlib_untar=1"
+
+       # Make it possible to remove third_party/adobe.
+       echo > "${T}/flapper_version.h" || die
+       myconf+=" -Dflapper_version_h_file=${T}/flapper_version.h"
+
+       # Use system-provided libraries.
+       # TODO: use_system_hunspell (upstream changes needed).
+       # TODO: use_system_libsrtp (bug #459932).
+       # TODO: use_system_libusb (http://crbug.com/266149).
+       # TODO: use_system_libvpx (http://crbug.com/494939).
+       # TODO: use_system_opus 
(https://code.google.com/p/webrtc/issues/detail?id=3077).
+       # TODO: use_system_protobuf (bug #525560).
+       # TODO: use_system_ssl (http://crbug.com/58087).
+       # TODO: use_system_sqlite (http://crbug.com/22208).
+       myconf+="
+               -Duse_system_bzip2=1
+               -Duse_system_ffmpeg=$(usex system-ffmpeg 1 0)
+               -Duse_system_flac=1
+               -Duse_system_harfbuzz=1
+               -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
+               -Duse_system_zlib=1"
+
+       # Needed for system icu - we don't need additional data files.
+       myconf+=" -Dicu_use_data_file_flag=0"
+
+       # TODO: patch gyp so that this arm conditional is not needed.
+       if ! use arm; then
+               myconf+="
+                       -Duse_system_yasm=1"
+       fi
+
+       # Optional dependencies.
+       # TODO: linux_link_kerberos, bug #381289.
+       myconf+="
+               $(gyp_use cups)
+               $(gyp_use gnome use_gconf)
+               $(gyp_use gnome-keyring use_gnome_keyring)
+               $(gyp_use gnome-keyring linux_link_gnome_keyring)
+               $(gyp_use gtk3)
+               $(gyp_use hidpi enable_hidpi)
+               $(gyp_use kerberos)
+               $(gyp_use lto)
+               $(gyp_use pulseaudio)
+               $(gyp_use tcmalloc use_allocator tcmalloc none)"
+
+       # Use explicit library dependencies instead of dlopen.
+       # This makes breakages easier to detect by revdep-rebuild.
+       myconf+="
+               -Dlinux_link_gsettings=1
+               -Dlinux_link_libpci=1
+               -Dlinux_link_libspeechd=1
+               -Dlibspeechd_h_prefix=speech-dispatcher/"
+
+       # TODO: use the file at run time instead of effectively compiling it in.
+       myconf+="
+               -Dusb_ids_path=/usr/share/misc/usb.ids"
+
+       # Save space by removing DLOG and DCHECK messages (about 6% reduction).
+       myconf+="
+               -Dlogging_like_official_build=1"
+
+       if [[ $(tc-getCC) == *clang* ]]; then
+               myconf+=" -Dclang=1"
+       else
+               myconf+=" -Dclang=0"
+       fi
+
+       # Never use bundled gold binary. Disable gold linker flags for now.
+       # Do not use bundled clang.
+       myconf+="
+               -Dclang_use_chrome_plugins=0
+               -Dhost_clang=0
+               -Dlinux_use_bundled_binutils=0
+               -Dlinux_use_bundled_gold=0
+               -Dlinux_use_gold_flags=0"
+
+       ffmpeg_branding="$(usex proprietary-codecs Chrome Chromium)"
+       myconf+=" -Dproprietary_codecs=1 -Dffmpeg_branding=${ffmpeg_branding}"
+
+       # Set up Google API keys, see 
http://www.chromium.org/developers/how-tos/api-keys .
+       # Note: these are for Gentoo use ONLY. For your own distribution,
+       # please get your own set of keys. Feel free to contact 
[email protected]
+       # for more info.
+       myconf+=" -Dgoogle_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc
+               
-Dgoogle_default_client_id=329227923882.apps.googleusercontent.com
+               -Dgoogle_default_client_secret=vgKG0NNv7GoDpbtoFNLxCUXu"
+
+       local myarch="$(tc-arch)"
+       if [[ $myarch = amd64 ]] ; then
+               target_arch=x64
+               ffmpeg_target_arch=x64
+       elif [[ $myarch = x86 ]] ; then
+               target_arch=ia32
+               ffmpeg_target_arch=ia32
+       elif [[ $myarch = arm ]] ; then
+               target_arch=arm
+               ffmpeg_target_arch=$(usex neon arm-neon arm)
+               # TODO: re-enable NaCl (NativeClient).
+               local CTARGET=${CTARGET:-${CHOST}}
+               if [[ $(tc-is-softfloat) == "no" ]]; then
+
+                       myconf+=" -Darm_float_abi=hard"
+               fi
+               filter-flags "-mfpu=*"
+               use neon || myconf+=" -Darm_fpu=${ARM_FPU:-vfpv3-d16}"
+
+               if [[ ${CTARGET} == armv[78]* ]]; then
+                       myconf+=" -Darmv7=1"
+               else
+                       myconf+=" -Darmv7=0"
+               fi
+               myconf+=" -Dsysroot=
+                       $(gyp_use neon arm_neon)
+                       -Ddisable_nacl=1"
+       else
+               die "Failed to determine target arch, got '$myarch'."
+       fi
+
+       myconf+=" -Dtarget_arch=${target_arch}"
+
+       # Make sure that -Werror doesn't get added to CFLAGS by the build 
system.
+       # Depending on GCC version the warnings are different and we don't want
+       # the build to fail because of that.
+       myconf+=" -Dwerror="
+
+       # Disable fatal linker warnings, bug 506268.
+       myconf+=" -Ddisable_fatal_linker_warnings=1"
+
+       # Avoid CFLAGS problems, bug #352457, bug #390147.
+       if ! use custom-cflags; then
+               replace-flags "-Os" "-O2"
+               strip-flags
+
+               # Prevent linker from running out of address space, bug #471810 
.
+               if use x86; then
+                       filter-flags "-g*"
+               fi
+
+               # 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
+               fi
+       fi
+
+       # Make sure the build system will use the right tools, bug #340795.
+       tc-export AR CC CXX NM
+
+       # Tools for building programs to be executed on the build system, bug 
#410883.
+       if tc-is-cross-compiler; then
+               export AR_host=$(tc-getBUILD_AR)
+               export CC_host=$(tc-getBUILD_CC)
+               export CXX_host=$(tc-getBUILD_CXX)
+               export NM_host=$(tc-getBUILD_NM)
+       fi
+
+       # Bug 491582.
+       export TMPDIR="${WORKDIR}/temp"
+       mkdir -p -m 755 "${TMPDIR}" || die
+
+       if ! use system-ffmpeg; then
+               local build_ffmpeg_args=""
+               if use pic && [[ "${ffmpeg_target_arch}" == "ia32" ]]; then
+                       build_ffmpeg_args+=" --disable-asm"
+               fi
+
+               # Re-configure bundled ffmpeg. See bug #491378 for example 
reasons.
+               einfo "Configuring bundled ffmpeg..."
+               pushd third_party/ffmpeg > /dev/null || die
+               chromium/scripts/build_ffmpeg.py linux ${ffmpeg_target_arch} \
+                       --branding ${ffmpeg_branding} -- ${build_ffmpeg_args} 
|| die
+               chromium/scripts/copy_config.sh || die
+               chromium/scripts/generate_gyp.py || die
+               popd > /dev/null || die
+       fi
+
+       third_party/libaddressinput/chromium/tools/update-strings.py || 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
+       popd > /dev/null || die
+
+       # libchromiumcontent configuration
+       myconf+=" -Dcomponent=static_library"
+       myconf+=" -Dmac_mas_build=0"
+       myconf+=' -Dicu_small="false"'
+       myconf+=" -Dlibchromiumcontent_component=0"
+       myconf+=" -Dlibrary=static_library"
+       myconf+=" -Dmas_build=0"
+
+       einfo "Configuring electron..."
+       build/linux/unbundle/replace_gyp_files.py ${myconf} || die
+
+       myconf+=" -Ivendor/node/config.gypi
+                         -Icommon.gypi
+                         atom.gyp"
+
+       egyp_chromium ${myconf} || die
+}
+
+eninja() {
+       if [[ -z ${NINJAOPTS+set} ]]; then
+               local jobs=$(makeopts_jobs)
+               local loadavg=$(makeopts_loadavg)
+
+               if [[ ${MAKEOPTS} == *-j* && ${jobs} != 999 ]]; then
+                       NINJAOPTS+=" -j ${jobs}"
+               fi
+               if [[ ${MAKEOPTS} == *-l* && ${loadavg} != 999 ]]; then
+                       NINJAOPTS+=" -l ${loadavg}"
+               fi
+       fi
+       set -- ninja -v ${NINJAOPTS} "$@"
+       echo "$@"
+       "$@"
+}
+
+src_compile() {
+       local ninja_targets="electron"
+
+       # 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
+}
+
+src_install() {
+       local install_dir="$(_get_install_dir)"
+       local install_suffix="$(_get_install_suffix)"
+       local LIBDIR="${ED}/usr/$(get_libdir)"
+
+       pushd out/R/locales > /dev/null || die
+       chromium_remove_language_paks
+       popd > /dev/null || die
+
+       # Install Electron
+       insinto "${install_dir}"
+       exeinto "${install_dir}"
+       doexe out/R/electron
+       doins out/R/libv8.so
+       doins out/R/libnode.so
+       fperms +x "${install_dir}/libv8.so" "${install_dir}/libnode.so"
+       doins out/R/content_shell.pak
+       doins out/R/natives_blob.bin
+       doins out/R/snapshot_blob.bin
+       rm -r out/R/resources/inspector || die
+       doins -r out/R/resources
+       doins -r out/R/locales
+       dosym "${install_dir}/electron" "/usr/bin/electron${install_suffix}"
+
+       # Install Node headers
+       HEADERS_ONLY=1 \
+               "${S}/vendor/node/tools/install.py" install "${ED}" "/usr" || 
die
+       # set up a symlink structure that npm expects..
+       dodir /usr/include/node/deps/{v8,uv}
+       dosym . /usr/include/node/src
+       for var in deps/{uv,v8}/include; do
+               dosym ../.. /usr/include/node/${var}
+       done
+
+       dodir "/usr/include/electron${install_suffix}"
+       mv "${ED}/usr/include/node" \
+          "${ED}/usr/include/electron${install_suffix}/node" || die
+}

diff --git a/dev-util/electron/files/brightray-gentoo-build-fixes.patch 
b/dev-util/electron/files/brightray-gentoo-build-fixes.patch
new file mode 100644
index 0000000..a678084
--- /dev/null
+++ b/dev-util/electron/files/brightray-gentoo-build-fixes.patch
@@ -0,0 +1,81 @@
+From c9e2e0237170884bc1069a64f2635bb1ffc1b948 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <[email protected]>
+Date: Mon, 8 Feb 2016 15:14:58 -0500
+Subject: [PATCH] brightray build fixes
+
+---
+ brightray.gyp  |  5 +++--
+ brightray.gypi | 21 ++++++++-------------
+ 2 files changed, 11 insertions(+), 15 deletions(-)
+
+diff --git a/brightray.gyp b/brightray.gyp
+index d7120ea..6150318 100644
+--- a/brightray.gyp
++++ b/brightray.gyp
+@@ -9,6 +9,9 @@
+   'targets': [
+     {
+       'target_name': 'brightray',
++      'dependencies': [
++        
'<(libchromiumcontent_src_dir)/chromiumcontent/chromiumcontent.gyp:chromiumcontent_all'
++      ],
+       'type': 'static_library',
+       'include_dirs': [
+         '.',
+@@ -100,8 +103,6 @@
+             }, {
+               'link_settings': {
+                 'libraries': [
+-                  # Link with ffmpeg.
+-                  '<(libchromiumcontent_dir)/libffmpeg.so',
+                   # Following libraries are required by libchromiumcontent:
+                   '-lasound',
+                   '-lcap',
+diff --git a/brightray.gypi b/brightray.gypi
+index 4513fa9..95bdfa1 100644
+--- a/brightray.gypi
++++ b/brightray.gypi
+@@ -1,9 +1,14 @@
+ {
+-  'includes': [
+-    'vendor/download/libchromiumcontent/filenames.gypi',
+-  ],
+   'variables': {
+     'libchromiumcontent_component%': 1,
++    'libchromiumcontent_src_dir': '<(DEPTH)',
++    'libchromiumcontent_shared_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)',
++    'libchromiumcontent_static_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)',
++    'libchromiumcontent_shared_libraries': [],
++    'libchromiumcontent_static_libraries': [],
++    'libchromiumcontent_shared_v8_libraries': [],
++    'libchromiumcontent_static_v8_libraries': [],
++    'pkg-config%': 'pkg-config',
+     'conditions': [
+       # The "libchromiumcontent_component" is defined when calling "gyp".
+       ['libchromiumcontent_component', {
+@@ -258,22 +263,12 @@
+         'conditions': [
+           ['OS=="linux"', {
+             'cflags': [
+-              '-O2',
+-              # Generate symbols, will be stripped later.
+-              '-g',
+-              # Don't emit the GCC version ident directives, they just end up
+-              # in the .comment section taking up binary size.
+-              '-fno-ident',
+               # Put data and code in their own sections, so that unused 
symbols
+               # can be removed at link time with --gc-sections.
+               '-fdata-sections',
+               '-ffunction-sections',
+             ],
+             'ldflags': [
+-              # Specifically tell the linker to perform optimizations.
+-              # See http://lwn.net/Articles/192624/ .
+-              '-Wl,-O1',
+-              '-Wl,--as-needed',
+               '-Wl,--gc-sections',
+             ],
+           }],  # OS=="linux"
+-- 
+2.7.3
+

diff --git a/dev-util/electron/files/chromium-disable-widevine.patch 
b/dev-util/electron/files/chromium-disable-widevine.patch
new file mode 100644
index 0000000..5b16646
--- /dev/null
+++ b/dev-util/electron/files/chromium-disable-widevine.patch
@@ -0,0 +1,9 @@
+--- a/third_party/widevine/cdm/stub/widevine_cdm_version.h
++++ b/third_party/widevine/cdm/stub/widevine_cdm_version.h
+@@ -10,6 +10,5 @@
+
+ #include "third_party/widevine/cdm/widevine_cdm_common.h"
+
+-#define WIDEVINE_CDM_AVAILABLE
+
+ #endif  // WIDEVINE_CDM_VERSION_H_

diff --git a/dev-util/electron/files/chromium-lto-fixes.patch 
b/dev-util/electron/files/chromium-lto-fixes.patch
new file mode 100644
index 0000000..7de3df1
--- /dev/null
+++ b/dev-util/electron/files/chromium-lto-fixes.patch
@@ -0,0 +1,26 @@
+diff --git a/build/common.gypi.orig b/build/common.gypi
+index cce7b3c..3b905c0 100644
+--- a/build/common.gypi.orig
++++ b/build/common.gypi
+@@ -6096,7 +6096,7 @@
+         'target_conditions': [
+           ['_toolset=="target"', {
+             'ldflags': [
+-              '-flto=32',
++              '-flto=4'
+             ],
+           }],
+         ],
+diff --git a/build/android/disable_gcc_lto.gypi.orig 
b/build/android/disable_gcc_lto.gypi
+index a733c7a..57570f8 100644
+--- a/build/android/disable_gcc_lto.gypi.orig
++++ b/build/android/disable_gcc_lto.gypi
+@@ -8,7 +8,7 @@
+   'target_conditions': [
+     ['_toolset=="target"', {
+       'conditions': [
+-        ['OS=="android" and clang==0 and (use_lto==1 or use_lto_o2==1)', {
++        ['(OS=="android" or OS=="linux") and clang==0 and (use_lto==1 or 
use_lto_o2==1)', {
+           'cflags!': [
+             '-flto',
+             '-ffat-lto-objects',

diff --git a/dev-util/electron/files/chromium-remove-gardiner-mod-font.patch 
b/dev-util/electron/files/chromium-remove-gardiner-mod-font.patch
new file mode 100644
index 0000000..cf1955f
--- /dev/null
+++ b/dev-util/electron/files/chromium-remove-gardiner-mod-font.patch
@@ -0,0 +1,13 @@
+diff --git a/test_runner.gyp b/test_runner.gyp
+index 30ffa75..8838bdf 100644
+--- a/components/test_runner/test_runner.gyp
++++ b/components/test_runner/test_runner.gyp
+@@ -162,8 +162,6 @@
+             'files': [
+               'resources/fonts/AHEM____.TTF',
+               'resources/fonts/fonts.conf',
+-              '../../third_party/gardiner_mod/GardinerModBug.ttf',
+-              '../../third_party/gardiner_mod/GardinerModCat.ttf',
+             ]
+           }],
+         }],

diff --git a/dev-util/electron/files/chromium-shared-v8.patch 
b/dev-util/electron/files/chromium-shared-v8.patch
new file mode 100644
index 0000000..67d97c8
--- /dev/null
+++ b/dev-util/electron/files/chromium-shared-v8.patch
@@ -0,0 +1,15 @@
+diff --git a/v8/tools/gyp/v8.gyp.orig b/v8/tools/gyp/v8.gyp
+index bcb5801..3162456 100644
+--- a/v8/tools/gyp/v8.gyp.orig
++++ b/v8/tools/gyp/v8.gyp
+@@ -48,8 +48,8 @@
+         }, {
+           'toolsets': ['target'],
+         }],
+-        ['component=="shared_library"', {
+-          'type': '<(component)',
++        ['v8_target_type=="shared_library"', {
++          'type': 'shared_library',
+           'sources': [
+             # Note: on non-Windows we still build this file so that gyp
+             # has some sources to link into the component.

diff --git a/dev-util/electron/files/chromium-system-ffmpeg-r0.patch 
b/dev-util/electron/files/chromium-system-ffmpeg-r0.patch
new file mode 100644
index 0000000..667e0ec
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-ffmpeg-r0.patch
@@ -0,0 +1,54 @@
+diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
+index 677bd76..23a21f8 100644
+--- a/media/ffmpeg/ffmpeg_common.h
++++ b/media/ffmpeg/ffmpeg_common.h
+@@ -19,20 +19,12 @@
+ 
+ // Include FFmpeg header files.
+ extern "C" {
+-// Disable deprecated features which result in spammy compile warnings.  This
+-// list of defines must mirror those in the 'defines' section of the 
ffmpeg.gyp
+-// file or the headers below will generate different structures.
+-#define FF_API_PIX_FMT_DESC 0
+-#define FF_API_OLD_DECODE_AUDIO 0
+-#define FF_API_DESTRUCT_PACKET 0
+-#define FF_API_GET_BUFFER 0
+ 
+ // Temporarily disable possible loss of data warning.
+ // TODO(scherkus): fix and upstream the compiler warnings.
+ MSVC_PUSH_DISABLE_WARNING(4244);
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+-#include <libavformat/internal.h>
+ #include <libavformat/avio.h>
+ #include <libavutil/avutil.h>
+ #include <libavutil/imgutils.h>
+diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
+index 155e980..7ba327a 100644
+--- a/media/filters/ffmpeg_demuxer.cc
++++ b/media/filters/ffmpeg_demuxer.cc
+@@ -966,24 +966,6 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const 
PipelineStatusCB& status_cb,
+   // If no estimate is found, the stream entry will be kInfiniteDuration().
+   std::vector<base::TimeDelta> 
start_time_estimates(format_context->nb_streams,
+                                                     kInfiniteDuration());
+-  const AVFormatInternal* internal = format_context->internal;
+-  if (internal && internal->packet_buffer &&
+-      format_context->start_time != static_cast<int64>(AV_NOPTS_VALUE)) {
+-    struct AVPacketList* packet_buffer = internal->packet_buffer;
+-    while (packet_buffer != internal->packet_buffer_end) {
+-      DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index),
+-                start_time_estimates.size());
+-      const AVStream* stream =
+-          format_context->streams[packet_buffer->pkt.stream_index];
+-      if (packet_buffer->pkt.pts != static_cast<int64>(AV_NOPTS_VALUE)) {
+-        const base::TimeDelta packet_pts =
+-            ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts);
+-        if (packet_pts < start_time_estimates[stream->index])
+-          start_time_estimates[stream->index] = packet_pts;
+-      }
+-      packet_buffer = packet_buffer->next;
+-    }
+-  }
+ 
+   AVStream* audio_stream = NULL;
+   AudioDecoderConfig audio_config;

diff --git a/dev-util/electron/files/chromium-system-jinja-r7.patch 
b/dev-util/electron/files/chromium-system-jinja-r7.patch
new file mode 100644
index 0000000..fe28e12
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-jinja-r7.patch
@@ -0,0 +1,35 @@
+--- third_party/WebKit/Source/bindings/scripts/scripts.gyp.orig        
2014-08-19 09:55:10.330972228 +0000
++++ third_party/WebKit/Source/bindings/scripts/scripts.gyp     2014-08-19 
09:55:26.387286232 +0000
+@@ -54,7 +54,6 @@
+     'actions': [{
+       'action_name': 'cache_jinja_templates',
+       'inputs': [
+-        '<@(jinja_module_files)',
+         'code_generator_v8.py',
+         '<@(code_generator_template_files)',
+       ],
+--- third_party/WebKit/Source/build/scripts/scripts.gypi.orig  2014-08-19 
10:00:00.216521733 +0000
++++ third_party/WebKit/Source/build/scripts/scripts.gypi       2014-08-19 
10:00:11.464735099 +0000
+@@ -2,10 +2,6 @@
+ {
+     'variables': {
+         'scripts_for_in_files': [
+-            # jinja2/__init__.py contains version string, so sufficient as
+-            # dependency for whole jinja2 package
+-            '<(DEPTH)/third_party/jinja2/__init__.py',
+-            '<(DEPTH)/third_party/markupsafe/__init__.py',  # jinja2 dep
+             'hasher.py',
+             'in_file.py',
+             'in_generator.py',
+--- third_party/WebKit/Source/bindings/scripts/scripts.gypi.orig       
2014-08-19 10:53:02.824618979 +0000
++++ third_party/WebKit/Source/bindings/scripts/scripts.gypi    2014-08-19 
10:53:20.784957370 +0000
+@@ -12,9 +12,6 @@
+       '<(DEPTH)/third_party/markupsafe/__init__.py',  # jinja2 dep
+     ],
+     'idl_lexer_parser_files': [
+-      # PLY (Python Lex-Yacc)
+-      '<(DEPTH)/third_party/ply/lex.py',
+-      '<(DEPTH)/third_party/ply/yacc.py',
+       # Web IDL lexer/parser (base parser)
+       '<(DEPTH)/tools/idl_parser/idl_lexer.py',
+       '<(DEPTH)/tools/idl_parser/idl_node.py',

diff --git a/dev-util/electron/files/chromium-system-libvpx-r0.patch 
b/dev-util/electron/files/chromium-system-libvpx-r0.patch
new file mode 100644
index 0000000..cd7c164
--- /dev/null
+++ b/dev-util/electron/files/chromium-system-libvpx-r0.patch
@@ -0,0 +1,20 @@
+--- build/linux/unbundle/libvpx.gyp.orig       2016-02-08 19:16:24.646981037 
-0500
++++ build/linux/unbundle/libvpx.gyp    2016-02-08 19:15:42.449979462 -0500
+@@ -4,7 +4,7 @@
+ {
+   'targets': [
+     {
+-      'target_name': 'libvpx',
++      'target_name': 'libvpx_new',
+       'type': 'none',
+       'direct_dependent_settings': {
+         'cflags': [
+@@ -18,8 +18,6 @@
+           'vpx/vp8cx.h',
+           'vpx/vp8dx.h',
+           'vpx/vpx_codec.h',
+-          'vpx/vpx_codec_impl_bottom.h',
+-          'vpx/vpx_codec_impl_top.h',
+           'vpx/vpx_decoder.h',
+           'vpx/vpx_encoder.h',
+           'vpx/vpx_frame_buffer.h',

diff --git a/dev-util/electron/files/electron-gentoo-build-fixes.patch 
b/dev-util/electron/files/electron-gentoo-build-fixes.patch
new file mode 100644
index 0000000..5a91a8f
--- /dev/null
+++ b/dev-util/electron/files/electron-gentoo-build-fixes.patch
@@ -0,0 +1,157 @@
+From 174dd209209d8f67f534ad761d8adeeddc6bf5c0 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <[email protected]>
+Date: Mon, 8 Feb 2016 15:16:40 -0500
+Subject: [PATCH] electron build fixes
+
+---
+ atom.gyp       | 19 ++++++++-----------
+ common.gypi    | 32 +++++++++++++++++++++++---------
+ filenames.gypi |  1 -
+ 3 files changed, 31 insertions(+), 21 deletions(-)
+
+diff --git a/atom.gyp b/atom.gyp
+index 68a30cc..06109a9 100644
+--- a/atom.gyp
++++ b/atom.gyp
+@@ -177,7 +177,7 @@
+           ],
+         }, {
+           'dependencies': [
+-            'vendor/breakpad/breakpad.gyp:dump_syms#host',
++            'breakpad/breakpad.gyp:dump_syms#host',
+           ],
+         }],  # OS=="win"
+         ['OS=="linux"', {
+@@ -194,7 +194,7 @@
+                   }, {
+                     'copied_libraries': [
+                       '<(PRODUCT_DIR)/lib/libnode.so',
+-                      '<(libchromiumcontent_dir)/libffmpeg.so',
++                      '<(PRODUCT_DIR)/lib/libv8.so',
+                     ],
+                   }],
+                 ],
+@@ -202,9 +202,6 @@
+               'destination': '<(PRODUCT_DIR)',
+               'files': [
+                 '<@(copied_libraries)',
+-                '<(libchromiumcontent_dir)/locales',
+-                '<(libchromiumcontent_dir)/icudtl.dat',
+-                '<(libchromiumcontent_dir)/content_shell.pak',
+                 '<(libchromiumcontent_dir)/natives_blob.bin',
+                 '<(libchromiumcontent_dir)/snapshot_blob.bin',
+               ],
+@@ -242,8 +239,8 @@
+         '<@(lib_sources)',
+       ],
+       'include_dirs': [
+-        '.',
+         'chromium_src',
++        '.',
+         'vendor/brightray',
+         'vendor/native_mate',
+         # Include atom_natives.h.
+@@ -301,8 +298,8 @@
+             'vendor/node/deps/uv/uv.gyp:libuv',
+             'vendor/node/deps/zlib/zlib.gyp:zlib',
+             # Build with breakpad support.
+-            'vendor/breakpad/breakpad.gyp:breakpad_handler',
+-            'vendor/breakpad/breakpad.gyp:breakpad_sender',
++            'breakpad/breakpad.gyp:breakpad_handler',
++            'breakpad/breakpad.gyp:breakpad_sender',
+           ],
+         }],  # OS=="win"
+         ['OS=="mac" and mas_build==0', {
+@@ -333,7 +330,7 @@
+               # Make binary search for libraries under current directory, so 
we
+               # don't have to manually set $LD_LIBRARY_PATH:
+               # 
http://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable
+-              '-rpath \$$ORIGIN',
++              '-Wl,-rpath=\$$ORIGIN/',
+               # Make native module dynamic loading work.
+               '-rdynamic',
+             ],
+@@ -344,10 +341,10 @@
+             '-Wno-reserved-user-defined-literal',
+           ],
+           'include_dirs': [
+-            'vendor/breakpad/src',
++            'breakpad/src',
+           ],
+           'dependencies': [
+-            'vendor/breakpad/breakpad.gyp:breakpad_client',
++            'breakpad/breakpad.gyp:breakpad_client',
+           ],
+         }],  # OS=="linux"
+       ],
+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 abb1145..2330ccf 100644
+--- a/filenames.gypi
++++ b/filenames.gypi
+@@ -498,7 +498,6 @@
+       'chromium_src/extensions/browser/app_window/size_constraints.h',
+       'chromium_src/extensions/common/url_pattern.cc',
+       'chromium_src/extensions/common/url_pattern.h',
+-      'chromium_src/library_loaders/libspeechd_loader.cc',
+       'chromium_src/library_loaders/libspeechd.h',
+       'chromium_src/net/test/embedded_test_server/stream_listen_socket.cc',
+       'chromium_src/net/test/embedded_test_server/stream_listen_socket.h',
+-- 
+2.7.3
+

diff --git 
a/dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch 
b/dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch
new file mode 100644
index 0000000..168d8db
--- /dev/null
+++ b/dev-util/electron/files/libchromiumcontent-gentoo-build-fixes.patch
@@ -0,0 +1,75 @@
+From b7022129450eaf2136746f5332956e76848796ef Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <[email protected]>
+Date: Mon, 8 Feb 2016 15:12:12 -0500
+Subject: [PATCH] libchromiumcontent build fixes
+
+---
+ chromiumcontent/chromiumcontent.gyp  |  6 +++---
+ chromiumcontent/chromiumcontent.gypi | 26 --------------------------
+ 2 files changed, 3 insertions(+), 29 deletions(-)
+
+diff --git a/chromiumcontent/chromiumcontent.gyp 
b/chromiumcontent/chromiumcontent.gyp
+index 52a1d36..db74a52 100644
+--- a/chromiumcontent/chromiumcontent.gyp
++++ b/chromiumcontent/chromiumcontent.gyp
+@@ -24,11 +24,11 @@
+     },
+     {
+       'target_name': 'chromiumcontent',
+-      # Build chromiumcontent as shared_library otherwise some static 
libraries
+-      # will not build.
+-      'type': 'shared_library',
++      'type': 'static_library',
+       'dependencies': [
+         '<(DEPTH)/base/base.gyp:base_prefs',
++        '<(DEPTH)/chrome/chrome_resources.gyp:packed_extra_resources',
++        '<(DEPTH)/chrome/chrome_resources.gyp:packed_resources',
+         '<(DEPTH)/components/components.gyp:cdm_renderer',
+         '<(DEPTH)/components/components.gyp:devtools_discovery',
+         '<(DEPTH)/components/components.gyp:devtools_http_handler',
+diff --git a/chromiumcontent/chromiumcontent.gypi 
b/chromiumcontent/chromiumcontent.gypi
+index 37c572b..3f4dcea 100644
+--- a/chromiumcontent/chromiumcontent.gypi
++++ b/chromiumcontent/chromiumcontent.gypi
+@@ -1,17 +1,5 @@
+ {
+   'variables': {
+-    # Enalbe using proprietary codecs.
+-    'proprietary_codecs': 1,
+-    'ffmpeg_branding': 'Chrome',
+-    # Enable support for Widevine CDM.
+-    'enable_widevine': 1,
+-    # Using libc++ requires building for >= 10.7.
+-    'mac_deployment_target': '10.8',
+-    # The 10.8 SDK does not work well with C++11.
+-    'mac_sdk_min': '10.9',
+-    # Use the standard way of linking with msvc runtime.
+-    'win_use_allocator_shim': 0,
+-    'win_release_RuntimeLibrary': '2',
+     # The V8 libraries.
+     'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", 
"v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]',
+     # The icu libraries.
+@@ -22,20 +10,6 @@
+         'v8_use_external_startup_data': 1,
+       }],
+       ['OS=="linux"', {
+-        # Enable high DPI support on Linux.
+-        'enable_hidpi': 1,
+-        # Use Dbus.
+-        'use_dbus': 1,
+-        # Make Linux build contain debug symbols, this flag will add '-g' to
+-        # cflags.
+-        'linux_dump_symbols': 1,
+-        # The Linux build of libchromiumcontent.so depends on, but doesn't
+-        # provide, tcmalloc by default.  Disabling tcmalloc here also prevents
+-        # any conflicts when linking to binaries or libraries that don't use
+-        # tcmalloc.
+-        'linux_use_tcmalloc': 0,
+-        # Force using gold linker.
+-        'linux_use_bundled_gold': 1,
+         'conditions': [
+           ['target_arch=="arm"', {
+             'arm_version': 7,
+-- 
+2.4.10
+

diff --git a/dev-util/electron/files/node-gentoo-build-fixes.patch 
b/dev-util/electron/files/node-gentoo-build-fixes.patch
new file mode 100644
index 0000000..b19cc37
--- /dev/null
+++ b/dev-util/electron/files/node-gentoo-build-fixes.patch
@@ -0,0 +1,50 @@
+From 668a003706d57c3e7a460e2fce5d110fe9737a62 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <[email protected]>
+Date: Wed, 10 Feb 2016 14:45:13 -0500
+Subject: [PATCH] Parametrize v8.gyp location
+
+---
+ node.gyp         | 5 +++--
+ tools/install.py | 3 +++
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/node.gyp b/node.gyp
+index d431210..fea5e07 100644
+--- a/node.gyp
++++ b/node.gyp
+@@ -1,6 +1,7 @@
+ {
+   'variables': {
+     'v8_use_snapshot%': 'false',
++    'v8_gyp_path%': 'deps/v8/tools/gyp/v8.gyp',
+     'node_use_dtrace%': 'false',
+     'node_use_lttng%': 'false',
+     'node_use_etw%': 'false',
+@@ -89,8 +90,8 @@
+       'dependencies': [
+         'node_js2c#host',
+         'deps/cares/cares.gyp:cares',
+-        # 'deps/v8/tools/gyp/v8.gyp:v8',
+-        # 'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
++        '<(v8_gyp_path):v8',
++        '<(v8_gyp_path):v8_libplatform'
+       ],
+ 
+       'include_dirs': [
+diff --git a/tools/install.py b/tools/install.py
+index cb86c65..ee85e33 100755
+--- a/tools/install.py
++++ b/tools/install.py
+@@ -207,6 +207,9 @@ def run(args):
+   if os.environ.get('HEADERS_ONLY'):
+     if cmd == 'install': return headers(install)
+     if cmd == 'uninstall': return headers(uninstall)
++  elif os.environ.get('NPM_ONLY'):
++    if cmd == 'install': return npm_files(install)
++    if cmd == 'uninstall': return npm_files(uninstall)
+   else:
+     if cmd == 'install': return files(install)
+     if cmd == 'uninstall': return files(uninstall)
+-- 
+2.7.3
+

diff --git a/dev-util/electron/metadata.xml b/dev-util/electron/metadata.xml
new file mode 100644
index 0000000..d079fad
--- /dev/null
+++ b/dev-util/electron/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Elvis Pranskevichus</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription>Electron is a cross platform application development 
framework based on web technologies based on Chromium</longdescription>
+       <use>
+               <flag name="gtk3">Use gtk3 instead of gtk2</flag>
+               <flag name="hidpi">Enable support for high-resolution screens 
(high dots per inch)</flag>
+               <flag name="lto">Build with link time optimization 
enabled</flag>
+               <flag name="pic">Disable optimized assembly code that is not 
PIC friendly</flag>
+               <flag name="proprietary-codecs">Enable proprietary codecs like 
H.264, MP3</flag>
+               <flag name="system-ffmpeg">Use system ffmpeg instead of the 
bundled one</flag>
+               <flag name="tcmalloc">Use bundled tcmalloc instead of system 
malloc</flag>
+       </use>
+</pkgmetadata>

Reply via email to