app-editors/atom: version bump to 1.15.0.
authorElvis Pranskevichus <elvis@magic.io>
Thu, 30 Mar 2017 13:05:22 +0000 (09:05 -0400)
committerPatrice Clement <monsieurp@gentoo.org>
Sat, 8 Apr 2017 21:21:19 +0000 (23:21 +0200)
Gentoo-Bug: https://bugs.gentoo.org/608478

Package-Manager: Portage-2.3.4, Repoman-2.3.1
Closes: https://github.com/gentoo/gentoo/pull/4330

app-editors/atom/Manifest
app-editors/atom/atom-1.15.0.ebuild [new file with mode: 0644]
app-editors/atom/files/atom-marker-layer.patch [new file with mode: 0644]

index 0186079974c90352f71c94d61679347012de818b..ff41775c316854d5369ee5ff3f19f2023056500c 100644 (file)
@@ -1,9 +1,11 @@
 DIST asar-0.12.1.tar.gz 1016626 SHA256 731714f0036318fe0878b517391a01977954bb088d4dbc7dd98682ff1e03c0e7 SHA512 fc64be9b11215426d405f7acd7adf6c0eead3135b0012baf6d168a13c77675058a4e2c60682928ac014e4bef4538d452ad745d1e87dd315387997a19e04718a7 WHIRLPOOL d73b8bb459724bb3b011de312171519c1f1954a94ce1bb0a20eb9877c168baa82a15786d3ab420d5b3d32ce8a11333e85f844b43c21cbd56c3b019e73774388e
 DIST atom-1.12.7.rpm 84755598 SHA256 8eaa5426c9209efc91969e3f3b1535f2c1895daf6259c07cbd595dd0a599553f SHA512 f2d582eb916e95373a08a1e56b89492f52547ab853fae7975b8193ee5d0a23dfc86bcaf9de5b53bc0dbd955c784abfede5b162fb6ef5ee0f7424fc0882da848c WHIRLPOOL aa029e8ef519f475b0a9a9f592cb685b4f15f4c257774c7ca644ed69bf50128bce4c382581b133e7c43438f690ed6b3d791ad379109b96a8ef9893ef93e0ad98
 DIST atom-1.13.1.rpm 86119349 SHA256 593fa81abb3a3a8c89713de1fb9d7d3dd4e4b34211de69fee67469b63be98f01 SHA512 57e587441fbc5ed7864d54f067386a54e854c761b3ad577e07d58253d693c90de934af98e1dc16bf1b645a7b87e9169d0a869509c0192103ddede51a1d8b95d6 WHIRLPOOL 51b8ce72c4b9b01ca8afc3ae5a548e0dbf437fc629305acf357c6de44a05b20a7d8736c89d78cd1cb84fe22109445e5d9d773e0d50e321fcdabca015f64a55a7
+DIST atom-1.15.0.rpm 86561729 SHA256 935b444d9122f46d3ab490611476498c963de1232f9c732d9ad33f0e380a37be SHA512 e8f5ceaae020f9fbf8cb1ffbef0f64b7b5d23a0be20d063591e3ba3b9fd33c771a028aca9aa0ecad254e250342d40106dac85bf6bdeff4de64da0b57fe6de3ea WHIRLPOOL 4d4311654b8afaa4aa2d07611960d24775aeb825e97ea65e6f69d72790d4c160e8a371432346f1873a71b2e1bf4158f3eb5d35fc1fd882906765f3ea4328e526
 DIST atom-buffer-offset-index-9588080533c9d0a8a71ee1cfd98596f485940e91.tar.gz 5558 SHA256 ea940264e4d6f2b5ad319c50e7e4ece64e1fd4d1f790c847dedf0a5bc4e9b2c9 SHA512 ebcfa7057c9db85a7884cbb19fa561821fc883bbd6a5d0186fcf68782697a7c7677e019334b44b3477d26e1febccb3a7690dc3390dcb55ca838e176f390b11b7 WHIRLPOOL 1c438ec18c2fcf1c7b1a11421eb9944a2fd90f920dc4dc5cf0b8c5300f9f285cc993689312a23b9882f13316956077bf9994173c0b1c9cd54c6f5ccdd667d16f
 DIST atom-cached-run-in-this-context-0.4.1.tar.gz 3855 SHA256 5487e7641d5031e652deeef8bebe2d3af4e4d2b89989dd8700bf14e33843ce89 SHA512 dca2a6c77bb94e704aa99b405ae017bf0c56ce536a7246a8feaf133722556d444fb684cd6b9b475abcd0b946a42073a9fc0d61f5141b564320ac023ab2fbf79d WHIRLPOOL 573d0f703989f31109854f0eb324d6b1364e93cd057c4cfe20409415dee3101964cacabc246d4df43124dad881d8fec8575c6bbb23ba98698e6c73cf3c5614d4
 DIST atom-git-utils-4.1.2.tar.gz 36492 SHA256 fd627647742359946d3b8f88bc91dd4d68a047dcba5bfafbd690e1a20afeb908 SHA512 d1f0a5bbd6b059131ccf4ab92174d80caddbb254ea6d0676a5ce71d7dba55d60c86ed1c412862b9d104a5f6deb2671facad84841f9644afb9b37416b743e917a WHIRLPOOL 4ee4620b0208a30f848167fffce05c5999d38bf5a3e50567e6bcf295fdafc7861e870346cfeb28a61392e7a737e100f90ae1dbd25066469926e3148006e02937
+DIST atom-keyboard-layout-2.0.11.tar.gz 19294 SHA256 fcef31c36619b76dd5f13a53c40eb9d3a7206a85cac3cd9dd0ba8e89d128258e SHA512 e7cbf3e8686ce6a86549d913523db75af623d4c5a18104f911b7f3931c273b87b4695b9b85afaea9a5cb440201b34d9e7445786c9328b87a5b58176cf2dbb877 WHIRLPOOL 85f06e125fca0e4e4c8a50fba539d674a0aadd1fba0c75b2be5663503c97bc8b6a6c75ee6b9916df5e598f3cc2a18f84e8392f1fb1145113d36d5216c0a2e5af
 DIST atom-keyboard-layout-2.0.7.tar.gz 18687 SHA256 3fb6c702c07d4d7116d73e5ed457f8dd2b07a99eafb7da830c032545d6da1f1e SHA512 96a10dad193d2e870e518eb863e4bf758e1efa86c4e377a3dcb818b5f51d42eaab9211732eddac106b7d4dddf6d9ebe80fb4a16ca24c647a0599a3a92e2c4591 WHIRLPOOL 01c28f7dadb8961ed6480a6ca2f9fab6c7e78436317b12f2731e130af405a456ea21719c0a409aa87248eaee956792fc37dcb040d900e2acc5005917c0f4666c
 DIST atom-marker-index-4.0.1.tar.gz 18433 SHA256 ecb6a5294088feb2a2b8ae71845dc262e1ab551a6a75e9ac99b05807b62b2d4a SHA512 2f5639ac0fef1a9d735dc10b464a046ee78f8cf7ecd8a6705232c319958a46056146bd91a0bf421aa0c6da39106f6deacaedaa40c442c0c08f0e6fbfd938b3ea WHIRLPOOL ccbd0f6a515b97a1fcf460f13388206ab3ccee364264203fa6d6ad3d6e68a4e06bad5f38ce19008d2a5f79d2becb14a459cbd016f0daaea48c5387c21ad1bb77
 DIST atom-node-ctags-3.0.0.tar.gz 15062 SHA256 40605012d06d4dcbfc369862b57900b6963613e2e4ee3b37fea21693b2b418a7 SHA512 6f7277a0ff872991c365f811c635fd881c3e466c20219d8a7bdaf6fec7c26c5feaa7ae2118691a8d52ceb3ecfda6d795bf39dfda7f8df5a6d02388575a010f87 WHIRLPOOL 2cff81d2ca405a615e5c7d284785f129f8fcd968998c68a42af1ca2e6d76a6fcb404a92f3c0d20220567b28593448b91657db6df8bce19de1f2eedbfe2959140
@@ -11,7 +13,9 @@ DIST atom-node-keytar-3.0.2.tar.gz 5718 SHA256 16af03d2a7876e3008f82d35e91375338
 DIST atom-node-nslog-3.0.0.tar.gz 2774 SHA256 6f2c7b79dd27688829d72dcbb94cc3da8b86fe74f355e1d407907cc56da29747 SHA512 1891632486acfa014eec79f70b14d56d967670310e46dedccfc9dfa505581365765f6bd42ad538b29e74d7c7de83d045b4199dd634fc588734a1ee086dcddb0a WHIRLPOOL d29f2c68e6168ce020c2a73d73f107ffb4c777e006fba4f01a93045ad631fb2d8b83f989244caf4d5e2f66474e660f3479d79a03e82a6b8fa8a297586ee6e556
 DIST atom-node-oniguruma-6.1.0.tar.gz 661394 SHA256 dab5322efac0cbe2c646559f130a2832be24e7caf8becabeedaf66842b72b289 SHA512 6443881353b61ad59d29cab6628f07d488e54df7b5a04ddffe4de11329e928b2a9cfc7582e22e0a90b6a3c6bf0e37873d8a5e34036cee5f7187ed4ae11fd6507 WHIRLPOOL 9c67fc6800e3d2b15160faa763539aefa2a40584697619b46098bd0f1c2820904ca6cae638e442c102c09616f62817c0df11f9c2da11d65c7dc9c98d04f668a4
 DIST atom-node-pathwatcher-6.5.0.tar.gz 23926 SHA256 a2f72f00cbe6a49152cdae85fb7585a77f0ee8b01be54fbc27a24f93935445c3 SHA512 0b8471885acc44f38161b4758951cff762f4c9ca2d17aefdb286b99fdefa6843eaa86d463e4ac54563a79f6701fcaa40252a72d73baf2b6c4e47aa00692ee314 WHIRLPOOL f3a82776b05416eda4e763c0f1db1e422b299f78cf516576b0d13b0447024962538603ce47c12a4889f7d9c984b98ca75013230ba3f1cea1575453e5c2e445dc
+DIST atom-node-pathwatcher-6.8.0.tar.gz 24627 SHA256 a714ed58e709f72a8f687d697d68332c5a2c4d0019e3cdc09886e5ff85bd493f SHA512 ccb4d1270ba91cf31c5725e985b7bf224a8878fbeeb5fd2e78e22de7e25d382fc5b1c9e05ce1f2c23968d4ca3018e1db611c9485dbbd6eca2169228fb0a136e9 WHIRLPOOL b7080b82d6b8564aa84040c2f1d2fa4546a0dd073f7f78fb5503dc36dec4316fe4750c38757397a8c4782680ec9e0458ad4428368279990f3ba23f3f929b8459
 DIST atom-node-runas-3.1.1.tar.gz 6628 SHA256 9d7d5a157b16fdd7263f50adb2831706d6fcf0902a1af528fc2602db6f9dc1cf SHA512 bada6e99ceb833c8c6e74f4b3116c49f21b54b922c1a27668312552779b9e5ccebf380b41c781d49c1c0dd0fdff6de8b71a0dcaf1f992892593e85f4572238df WHIRLPOOL d286d76f38ee8a23b4b76a9070913abe901f4db273073d9c0dcef13004abe7e10e9b4cad451cfe8d0cd4cc1e0ac2ab28ed50f327c1b9d317689153658f7b8944
 DIST atom-node-spellchecker-3.2.3.tar.gz 481966 SHA256 bf4a07b4c671cd38b176ff8ef375f3cdf277decb941a0a279f8ffb36151fad55 SHA512 b0209fdfcbee53d289443e1c203a720888a82fa59648b4038c036c6afe68a6b04624e23267e69c36f23c185160d6ab84b1e4020047fbe6d94354e99d717a60b9 WHIRLPOOL d883cd3d3962e38ebe4c55e997ce461fa0b0da98e8b982793b77342eac1413e16090d562a9a50cb8200a18eda751a873528fdfde3b1f1928629bd56c5568f887
 DIST atom-scrollbar-style-3.2.0.tar.gz 4609 SHA256 ea0f8f00cac609537af0d10d228054371c58b5a74785bd52fbbd276af02911ef SHA512 fc3ddfe7582517df45d7258a5857ca05fbadb92417d68b0c77d1e89e54b3bdaef3a1624e29177ebe64a2a994e62e1d1f5cb438911e881124aeec359426fab1bc WHIRLPOOL f6e75aafa8946ccc16949bdffa33b2bf050f06434a3fedcf8e1abac8b6b2d31dd37fcc137a43274d4c55d5926349486fda157d3fb6948d97063aac33b99e6578
+DIST atom-superstring-1.1.0.tar.gz 259961 SHA256 fcfc7f94bc3631fda8b08b2b91778f8a62e863b346a2f90b66f9af9f4f3f8cbb SHA512 880c97d696036065aeb4320dc71c88b49b22b04e6582c75310131e61d8067fdf3d26c901d7b22a2bfd2a2a2056f350ba9485b7e55410cdee9ef29f5a75a8af59 WHIRLPOOL 6f857ea91c8df678c592232816ec3c251355cb7af4f1f6dbf0f16c44aa1a978c66c0ce8225d176e7b253addb1e38795a3902a8dd302dd72db1f35e4c18cd3236
 DIST nodejs-nan-2.4.0.tar.gz 157071 SHA256 290b4cd678bb0770fcc0dfa8415f908db09173acfdde31135a4e31716c311883 SHA512 e6f3ab3f67c72b3cc9e6e6b9b5de0f73134ef504dedae5e68376198858a6796f00c35869438e0480f28006dd8f6be13dca3bcc436a1a6b28b1dea5cbc72f9e45 WHIRLPOOL 8628452c69c1774e02b8069ee8db12b7b97bc45166dd4dbec3e8d3f532c97f15a24920f2f59ecb3b8d4addcbada33eb04c1f71222531a7377bcbfaf7d4f3d86b
diff --git a/app-editors/atom/atom-1.15.0.ebuild b/app-editors/atom/atom-1.15.0.ebuild
new file mode 100644 (file)
index 0000000..d62dfb4
--- /dev/null
@@ -0,0 +1,405 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+inherit python-any-r1 multiprocessing rpm
+
+DESCRIPTION="A hackable text editor for the 21st Century"
+HOMEPAGE="https://atom.io"
+MY_PV="${PV//_/-}"
+
+ELECTRON_V=1.3.13
+ELECTRON_SLOT=1.3
+
+# All binary packages depend on this
+NAN_V=2.4.0
+
+# Keep dep versions in sync with atom/package.json
+CACHED_RUN_IN_THIS_CONTEXT_V=0.4.1
+GIT_UTILS_V=4.1.2
+NODE_NSLOG_V=3.0.0
+NODE_ONIGURUMA_V=6.1.0
+NODE_PATHWATCHER_V=6.8.0
+NODE_RUNAS_V=3.1.1
+SCROLLBAR_STYLE_V=3.2.0
+SPELL_CHECK_V=0.70.2
+
+# text-buffer dependencies
+SUPERSTRING_V=1.1.0
+
+# apm dependency
+NODE_KEYTAR_V=3.0.2
+
+# atom-keymap dependency
+KEYBOARD_LAYOUT_V=2.0.11
+
+# symbols-view dependency
+NODE_CTAGS_V=3.0.0
+
+# spell-check dependency
+NODE_SPELLCHECKER_V=3.2.3
+
+ASAR_V=0.12.1
+
+# The x86_64 arch below is irrelevant, as we will rebuild all binary packages.
+SRC_URI="
+       https://github.com/${PN}/${PN}/releases/download/v${MY_PV}/atom.x86_64.rpm -> atom-${MY_PV}.rpm
+       https://github.com/elprans/asar/releases/download/v${ASAR_V}-gentoo/asar-build.tar.gz -> asar-${ASAR_V}.tar.gz
+       https://github.com/nodejs/nan/archive/v${NAN_V}.tar.gz -> nodejs-nan-${NAN_V}.tar.gz
+       https://github.com/atom/cached-run-in-this-context/archive/v${CACHED_RUN_IN_THIS_CONTEXT_V}.tar.gz -> atom-cached-run-in-this-context-${CACHED_RUN_IN_THIS_CONTEXT_V}.tar.gz
+       https://github.com/atom/node-ctags/archive/v${NODE_CTAGS_V}.tar.gz -> atom-node-ctags-${NODE_CTAGS_V}.tar.gz
+       https://github.com/atom/git-utils/archive/v${GIT_UTILS_V}.tar.gz -> atom-git-utils-${GIT_UTILS_V}.tar.gz
+       https://github.com/atom/keyboard-layout/archive/v${KEYBOARD_LAYOUT_V}.tar.gz -> atom-keyboard-layout-${KEYBOARD_LAYOUT_V}.tar.gz
+       https://github.com/atom/superstring/archive/v${SUPERSTRING_V}.tar.gz -> atom-superstring-${SUPERSTRING_V}.tar.gz
+       https://github.com/atom/node-keytar/archive/v${NODE_KEYTAR_V}.tar.gz -> atom-node-keytar-${NODE_KEYTAR_V}.tar.gz
+       https://github.com/atom/node-nslog/archive/v${NODE_NSLOG_V}.tar.gz -> atom-node-nslog-${NODE_NSLOG_V}.tar.gz
+       https://github.com/atom/node-oniguruma/archive/v${NODE_ONIGURUMA_V}.tar.gz -> atom-node-oniguruma-${NODE_ONIGURUMA_V}.tar.gz
+       https://github.com/atom/node-pathwatcher/archive/v${NODE_PATHWATCHER_V}.tar.gz -> atom-node-pathwatcher-${NODE_PATHWATCHER_V}.tar.gz
+       https://github.com/atom/node-runas/archive/v${NODE_RUNAS_V}.tar.gz -> atom-node-runas-${NODE_RUNAS_V}.tar.gz
+       https://github.com/atom/scrollbar-style/archive/v${SCROLLBAR_STYLE_V}.tar.gz -> atom-scrollbar-style-${SCROLLBAR_STYLE_V}.tar.gz
+       https://github.com/atom/node-spellchecker/archive/v${NODE_SPELLCHECKER_V}.tar.gz -> atom-node-spellchecker-${NODE_SPELLCHECKER_V}.tar.gz
+"
+
+BINMODS="
+               cached-run-in-this-context
+               node-ctags
+               git-utils
+               keyboard-layout
+               node-nslog
+               node-oniguruma
+               node-pathwatcher
+               node-runas
+               node-keytar
+               scrollbar-style
+               node-spellchecker
+               superstring
+"
+
+RESTRICT="mirror"
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND="
+       ${PYTHON_DEPS}
+       >=app-text/hunspell-1.3.3:=
+       >=dev-libs/libgit2-0.23:=[ssh]
+       >=gnome-base/libgnome-keyring-3.12:=
+       >=dev-libs/oniguruma-5.9.5:=
+       >=dev-util/ctags-5.8
+       >=dev-util/electron-1.3.5:${ELECTRON_SLOT}
+       x11-libs/libxkbfile"
+RDEPEND="
+       ${DEPEND}
+       !sys-apps/apmd
+"
+
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+pkg_setup() {
+       python-any-r1_pkg_setup
+}
+
+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)/atom$(get_install_suffix)"
+}
+
+get_electron_dir() {
+       echo -n "/usr/$(get_libdir)/electron-${ELECTRON_SLOT}"
+}
+
+get_electron_nodedir() {
+       echo -n "/usr/include/electron-${ELECTRON_SLOT}/node/"
+}
+
+enode_electron() {
+       "$(get_electron_dir)"/node $@
+}
+
+enodegyp_atom() {
+       local apmpath="/usr/share/atom/resources/app/apm"
+       local nodegyp="${S}/${apmpath}/node_modules/node-gyp/bin/node-gyp.js"
+
+       PATH="$(get_electron_dir):${PATH}" \
+               enode_electron "${nodegyp}" \
+                       --nodedir="$(get_electron_nodedir)" $@ || die
+}
+
+easar() {
+       local asar="${WORKDIR}/$(package_dir asar)/node_modules/asar/bin/asar"
+       echo "asar" $@
+       enode_electron "${asar}" $@ || die
+}
+
+package_dir() {
+       local binmod="${1//-/_}"
+       local binmod_v="${binmod^^}_V"
+       echo -n ${1}-${!binmod_v}
+}
+
+_unpack_npm_package() {
+       local a="${1}" basename suffix
+
+       basename=${a%.*}
+       suffix=${basename##*.}
+       if [[ "${suffix}" == "tar" ]]; then
+               basename=${basename%.*}
+       fi
+
+       unpack ${a}
+       mv package "${basename}" || die
+}
+
+_have_patches_for() {
+       local _patches="${1}-*.patch" _find
+       _find=$(find "${FILESDIR}" -maxdepth 1 -name "${_patches}" -print -quit)
+       test -n "$_find"
+}
+
+src_unpack() {
+       local a
+
+       for a in ${A} ; do
+               case ${a} in
+               *.rpm) srcrpm_unpack "${a}" ;;
+               *) unpack "${a}" ;;
+               esac
+       done
+
+       mkdir "${WORKDIR}/atom-${MY_PV}" || die
+       mv "${WORKDIR}/usr" "${WORKDIR}/atom-${MY_PV}" || die
+}
+
+src_prepare() {
+       local install_dir="$(get_install_dir)"
+       local suffix="$(get_install_suffix)"
+       local patch binmod _s nan_s="${WORKDIR}/nan-${NAN_V}"
+
+       cd "${S}/usr/share/atom/resources/app" || die
+       eapply "${FILESDIR}/${PN}-python.patch"
+       eapply "${FILESDIR}/${PN}-unbundle-electron.patch"
+
+       sed -i -e "s|{{NPM_CONFIG_NODEDIR}}|$(get_electron_nodedir)|g" \
+               ./atom.sh \
+               || die
+
+       sed -i -e "s|{{ATOM_PATH}}|$(get_electron_dir)/electron|g" \
+               ./atom.sh \
+               || die
+
+       sed -i -e "s|{{ATOM_RESOURCE_PATH}}|${install_dir}/app.asar|g" \
+               ./atom.sh \
+               || die
+
+       local env="export NPM_CONFIG_NODEDIR=$(get_electron_nodedir)"
+       sed -i -e \
+               "s|\"\$binDir/\$nodeBin\"|${env}\nexec $(get_electron_dir)/node|g" \
+                       apm/bin/apm || die
+
+       sed -i -e \
+               "s|^\([[:space:]]*\)node[[:space:]]\+|\1\"$(get_electron_dir)/node\" |g" \
+                       apm/node_modules/npm/bin/node-gyp-bin/node-gyp || die
+
+       rm apm/bin/node || die
+
+       sed -i -e "s|/usr/share/atom/atom|/usr/bin/atom|g" \
+               "${S}/usr/share/applications/atom.desktop" || die
+
+       cd "${S}" || die
+
+       for binmod in ${BINMODS}; do
+               _s="${WORKDIR}/$(package_dir ${binmod})"
+               cd "${_s}" || die
+               if _have_patches_for "${binmod}"; then
+                       for patch in "${FILESDIR}"/${binmod}-*.patch; do
+                               eapply "${patch}"
+                       done
+               fi
+       done
+
+       # Unbundle bundled libs from modules
+
+       _s="${WORKDIR}/$(package_dir git-utils)"
+       ${EPYTHON} "${FILESDIR}/gyp-unbundle.py" \
+               --inplace --unbundle "git;libgit2;git2" \
+               "${_s}/binding.gyp" || die
+
+       _s="${WORKDIR}/$(package_dir node-oniguruma)"
+       ${EPYTHON} "${FILESDIR}/gyp-unbundle.py" \
+               --inplace --unbundle "onig_scanner;oniguruma;onig" \
+               "${_s}/binding.gyp" || die
+
+       _s="${WORKDIR}/$(package_dir node-spellchecker)"
+       ${EPYTHON} "${FILESDIR}/gyp-unbundle.py" \
+               --inplace --unbundle "spellchecker;hunspell;hunspell" \
+               "${_s}/binding.gyp" || die
+
+       for binmod in ${BINMODS}; do
+               _s="${WORKDIR}/$(package_dir ${binmod})"
+               mkdir -p "${_s}/node_modules" || die
+               ln -s "${nan_s}" "${_s}/node_modules/nan" || die
+       done
+
+       # Unpack app.asar
+       easar extract "${S}/usr/share/atom/resources/app.asar" "${S}/build/app"
+
+       cd "${S}" || die
+
+       eapply "${FILESDIR}/atom-1.13-apm-path.patch"
+       eapply "${FILESDIR}/atom-license-path.patch"
+       eapply "${FILESDIR}/atom-fix-app-restart.patch"
+       eapply "${FILESDIR}/atom-marker-layer.patch"
+
+       sed -i -e "s|{{ATOM_SUFFIX}}|${suffix}|g" \
+               "${S}/build/app/src/config-schema.js" || die
+
+       eapply_user
+}
+
+src_configure() {
+       local binmod _s
+
+       for binmod in ${BINMODS}; do
+               einfo "Configuring ${binmod}..."
+               _s="${WORKDIR}/$(package_dir ${binmod})"
+               cd "${_s}" || die
+               enodegyp_atom configure
+       done
+}
+
+src_compile() {
+       local binmod _s x
+       local ctags_d="node_modules/symbols-view/vendor"
+       local jobs=$(makeopts_jobs) gypopts
+
+       gypopts="--verbose"
+
+       if [[ ${MAKEOPTS} == *-j* && ${jobs} != 999 ]]; then
+               gypopts+=" --jobs ${jobs}"
+       fi
+
+       mkdir -p "${S}/build/modules/" || die
+
+       for binmod in ${BINMODS}; do
+               einfo "Building ${binmod}..."
+               _s="${WORKDIR}/$(package_dir ${binmod})"
+               cd "${_s}" || die
+               enodegyp_atom ${gypopts} build
+               x=${binmod##node-}
+               mkdir -p "${S}/build/modules/${x}" || die
+               cp build/Release/*.node "${S}/build/modules/${x}" || die
+       done
+
+       # Put compiled binary modules in place
+       _fix_binmods "${S}/build" "app"
+       _fix_binmods "${S}/usr/share/atom/resources" "app"
+
+       # Remove non-Linux vendored ctags binaries
+       rm "${S}/build/app/${ctags_d}/ctags-darwin" \
+          "${S}/build/app/${ctags_d}/ctags-win32.exe" || die
+
+       # Re-pack app.asar
+       # Keep unpack rules in sync with build/tasks/generate-asar-task.coffee
+       cd "${S}/build" || die
+       x="--unpack={*.node,ctags-config,ctags-linux,**/node_modules/spellchecker/**,**/resources/atom.png}"
+       easar pack "${x}" "app" "app.asar"
+       cd "${S}" || die
+}
+
+_fix_binmods() {
+       local _dir="${2}" _prefix="${1}" path relpath modpath mod depth link f d
+       local cruft
+
+       (find "${_prefix}/${_dir}" -name '*.node' -print || die) \
+       | while IFS= read -r path; do
+               f=$(basename "${path}")
+               d=$(dirname "${path}")
+           relpath=${path#${_prefix}}
+               relpath=${relpath##/}
+               relpath=${relpath#W${_dir}}
+               modpath=$(dirname ${relpath})
+               modpath=${modpath%build/Release}
+               mod=$(basename ${modpath})
+
+               # must copy here as symlinks will cause the module loading to fail
+               cp -f "${S}/build/modules/${mod}/${f}" "${path}" || die
+               cruft=$(find "${d}" -name '*.a' -print)
+               if [[ -n "${cruft}" ]]; then
+                       rm ${cruft} || die
+               fi
+       done
+}
+
+_fix_executables() {
+       local _dir="${1}" _node_sb="#!$(get_electron_dir)"/node
+
+       (find -L "${ED}/${_dir}" -maxdepth 1 -mindepth 1 -type f -print || die) \
+       | while IFS= read -r f; do
+               IFS= read -r shebang < "${f}"
+
+               if [[ ${shebang} == '#!'* ]]; then
+                       fperms +x "${f#${ED}}"
+                       if [[ "${shebang}" == "#!/usr/bin/env node" || "${shebang}" == "#!/usr/bin/node" ]]; then
+                               einfo "Fixing node shebang in ${f#${ED}}"
+                               sed --follow-symlinks -i \
+                                       -e "1s:${shebang}$:${_node_sb}:" "${f}" || die
+                       fi
+               fi
+       done || die
+}
+
+src_install() {
+       local install_dir="$(get_install_dir)"
+       local suffix="$(get_install_suffix)"
+       local ctags_d="node_modules/symbols-view/vendor"
+
+       cd "${S}" || die
+
+       # Replace vendored ctags with a symlink to system ctags
+       rm "${S}/build/app.asar.unpacked/${ctags_d}/ctags-linux" || die
+       ln -s "/usr/bin/ctags" \
+               "${S}/build/app.asar.unpacked/${ctags_d}/ctags-linux" || die
+
+       insinto "${install_dir}"
+
+       doins build/app.asar
+       doins -r build/app.asar.unpacked
+       doins -r usr/share/atom/resources/app
+
+       insinto /usr/share/applications/
+       newins usr/share/applications/atom.desktop "atom${suffix}.desktop"
+
+       insinto /usr/share/icons/
+       doins -r usr/share/icons/hicolor
+
+       exeinto "${install_dir}"
+       newexe usr/share/atom/resources/app/atom.sh atom
+       insinto /usr/share/licenses/"${PN}${suffix}"
+       doins usr/share/atom/resources/LICENSE.md
+       dosym "${install_dir}/atom" "/usr/bin/atom${suffix}"
+       dosym "${install_dir}/app/apm/bin/apm" "/usr/bin/apm${suffix}"
+
+       _fix_executables "${install_dir}/app/apm/bin"
+       _fix_executables "${install_dir}/app/apm/node_modules/.bin"
+       _fix_executables "${install_dir}/app/apm/node_modules/npm/bin"
+       _fix_executables "${install_dir}/app/apm/node_modules/npm/bin/node-gyp-bin"
+       _fix_executables "${install_dir}/app/apm/node_modules/node-gyp/bin"
+}
diff --git a/app-editors/atom/files/atom-marker-layer.patch b/app-editors/atom/files/atom-marker-layer.patch
new file mode 100644 (file)
index 0000000..2d797aa
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/build/app/node_modules/text-buffer/lib/marker-layer.js
+--- b/build/app/node_modules/text-buffer/lib/marker-layer.js
+@@ -192,7 +192,7 @@
+         return function(markerId) {
+           var marker;
+           marker = _this.markersById[markerId];
+-          if (!marker.matchesParams(params)) {
++          if (marker == null || !marker.matchesParams(params)) {
+             return;
+           }
+           return result.push(marker);