# Template file for 'atom'
pkgname=atom
version=1.0.19
revision=1
nocross=yes
nostrip=yes
hostmakedepends="git pkg-config python-devel curl"
makedepends="python-devel GConf-devel libgnome-keyring-devel"
short_desc="Chrome-based text editor from Github"
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
license="MIT"
homepage="https://atom.io"
distfiles="https://github.com/$pkgname/$pkgname/archive/v$version.tar.gz"
checksum=775742460826ab7d6b0ffd035632019041b0a1ae40f47e15f4098241744252b5
_NODE_VERSION=0.12.7

pre_build() {
	local NVM_VERSION=0.26.1
	curl -o- https://raw.githubusercontent.com/creationix/nvm/v$NVM_VERSION/install.sh | bash
	source ~/.nvm/nvm.sh
	nvm install $_NODE_VERSION
	nvm use $_NODE_VERSION
}
do_build() {
	script/build
}
do_install() {
	source ~/.nvm/nvm.sh
	nvm use $_NODE_VERSION
	script/grunt install --install-dir ${DESTDIR}/usr
	sed -i "s|${DESTDIR}||g" ${DESTDIR}/usr/share/applications/atom.desktop
	vlicense LICENSE.md
	# remove useless static libs
	find ${DESTDIR} -type f -name \*.a -delete
}
