summaryrefslogtreecommitdiff
blob: 65a5af61be79614b3e47a45ab3f49ae32cd80936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $id$

EAPI=5

PYTHON_COMPAT=( python2_7 )
inherit flag-o-matic python-any-r1 eutils

DESCRIPTION="A hackable text editor for the 21st Century"
HOMEPAGE="https://atom.io"
SRC_URI="https://github.com/atom/atom/archive/v${PV}.tar.gz -> ${PV}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND="
	${PYTHON_DEPS}
	|| ( net-libs/nodejs[npm] net-libs/iojs[npm] )
	media-fonts/inconsolata
	gnome-base/gconf
	x11-libs/gtk+:2
	gnome-base/libgnome-keyring
	x11-libs/libnotify
	x11-libs/libXtst
	dev-libs/nss
	media-libs/alsa-lib
	net-print/cups
"
RDEPEND="${DEPEND}"

pkg_setup() {
	python-any-r1_pkg_setup

	npm config set python $PYTHON
}

src_prepare(){
	epatch "${FILESDIR}/${PN}-python.patch"
	sed -i  -e "/exception-reporting/d" \
		-e "/metrics/d" package.json
	sed -e "s/<%= description %>/$pkgdesc/" \
		-e "s|<%= installDir %>/share/<%= appFileName %>/atom|/usr/bin/atom|"\
		-e "s|<%= iconPath %>|atom|"\
		-e "s|<%= appName %>|Atom|" \
		resources/linux/atom.desktop.in > resources/linux/Atom.desktop

    	# Fix atom location guessing
	sed -i -e 's/ATOM_PATH="$USR_DIRECTORY\/share\/atom/ATOM_PATH="$USR_DIRECTORY\/../g' \
		./atom.sh \
		|| die "Fail fixing atom-shell directory"

	# Make bootstrap process more verbose
	sed -i -e 's@node script/bootstrap@node script/bootstrap --no-quiet@g' \
		./script/build \
		|| die "Fail fixing verbosity of script/build"
}

src_compile(){
	if ! ./script/build --verbose --build-dir "${T}"; then if ! ./script/build --verbose --build-dir "${T}"; then if ! ./script/build --verbose --build-dir "${T}"; then if ! ./script/build --verbose --build-dir "${T}"; then if ! ./script/build --verbose --build-dir "${T}"; then if ! ./script/build --verbose --build-dir "${T}"; then if ! ./script/build --verbose --build-dir "${T}"; then die "Build failed"; fi; fi; fi; fi; fi; fi; fi
	"${T}/Atom/resources/app/apm/bin/apm" rebuild || die "Failed to rebuild native module"
	echo "python = $PYTHON" >> "${T}/Atom/resources/app/apm/.apmrc"
}

src_install(){
	insinto ${EPREFIX}/usr/share/${PN}
	doins -r ${T}/Atom/*
	insinto ${EPREFIX}/usr/share/applications
	newins resources/linux/Atom.desktop atom.desktop
	insinto ${EPREFIX}/usr/share/pixmaps
	newins resources/app-icons/stable/png/128.png atom.png
	insinto ${EPREFIX}/usr/share/licenses/${PN}
	doins LICENSE.md
	# Fixes permissions
	fperms +x ${EPREFIX}/usr/share/${PN}/${PN}
	fperms +x ${EPREFIX}/usr/share/${PN}/libgcrypt.so.11
	fperms +x ${EPREFIX}/usr/share/${PN}/libnotify.so.4
	fperms +x ${EPREFIX}/usr/share/${PN}/resources/app/atom.sh
	fperms +x ${EPREFIX}/usr/share/${PN}/resources/app/apm/bin/apm
	fperms +x ${EPREFIX}/usr/share/${PN}/resources/app/apm/bin/node
	fperms +x ${EPREFIX}/usr/share/${PN}/resources/app/apm/node_modules/npm/bin/node-gyp-bin/node-gyp
	# Symlinking to /usr/bin
	dosym ${EPREFIX}/usr/share/${PN}/resources/app/atom.sh /usr/bin/atom
	dosym ${EPREFIX}/usr/share/${PN}/resources/app/apm/bin/apm /usr/bin/apm
}