aboutsummaryrefslogtreecommitdiff
blob: e331786ae94f5bf2fc546ce593b8e11856ecb163 (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
# Copyright 1999-2014 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# automatically generated by gs-elpa
# please do not edit this file
#
# Original Author: Jauhien Piatlicki <jauhien@gentoo.org>
# Purpose: support installation of elisp packages for emacs
# from overlays generated by gs-elpa
#
# Bugs to jauhien@gentoo.org
#
# @ECLASS: gs-elpa.eclass
#
# @ECLASS-VARIABLE: REPO_URI
# @DESCRIPTION: address of a repository of elisp packages
#
# @ECLASS-VARIABLE: SOURCE_TYPE
# @DESCRIPTION: type of a package (single or tar)
#
# @ECLASS-VARIABLE: DIGEST_SOURCES
# @DESCRIPTION: whether manifest for sources exists
#
# @ECLASS-VARIABLE: REALNAME
# @DESCRIPTION: real name of a package in the repository
#

inherit elisp g-sorcery

EXPORT_FUNCTIONS src_{unpack,compile,install}

if [[ ${SOURCE_TYPE} != "single" ]]; then
	SUFFIX="${SOURCE_TYPE}"
else
	SUFFIX="el"
fi

SOURCEFILE=${REALNAME}-${PV}.${SUFFIX}

gs-elpa_src_unpack() {
	g-sorcery_src_unpack
	if [[ ${SOURCE_TYPE} = "single" ]]; then
		mkdir ${P} || die
		mv ./${SOURCEFILE} ./${P}/${REALNAME}.${SUFFIX} || die
	fi
}

gs-elpa_src_compile() {
	local directories=""
	rm -f ${PN}-pkg.el || die
	elisp-make-autoload-file || die
	directories=`find . -name "*.el" | xargs -I{} dirname {} | sort | uniq`
	for i in ${directories}; do
		BYTECOMPFLAGS+=" -L ${i}"
	done
	ebegin "Compiling GNU Emacs Elisp files"
	${EMACS} ${EMACSFLAGS} ${BYTECOMPFLAGS} --eval '(byte-recompile-directory "./" 0 t)'
	eend $? "elisp-compile: batch-byte-compile failed" || die
}

gs-elpa_src_install() {
	local sitefile="50${PN}-gentoo.el"
	cat <<EOF >> ${sitefile} || die
(add-to-list 'load-path "@SITELISP@")
(load "${PN}-autoloads" nil t)
EOF
	elisp-site-file-install ${sitefile} || die
	rm -f ${sitefile} || die

	insinto "${SITELISP}/${PN}"
	doins -r ./*
}