| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/elisp.eclass,v 1.6 2003/07/22 05:06:33 george Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/elisp.eclass,v 1.11 2004/06/25 00:39:48 vapier Exp $ |
| 4 | # |
4 | # |
| 5 | # Author Matthew Kennedy <mkennedy@gentoo.org> |
5 | # Copyright 2002-2003 Matthew Kennedy <mkennedy@gentoo.org> |
|
|
6 | # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> |
| 6 | # |
7 | # |
| 7 | # This eclass sets the site-lisp directory for emacs-related packages. |
8 | # This eclass sets the site-lisp directory for emacs-related packages. |
| 8 | |
9 | |
|
|
10 | inherit elisp-common |
| 9 | ECLASS=elisp |
11 | ECLASS=elisp |
| 10 | INHERITED="$INHERITED $ECLASS" |
12 | INHERITED="$INHERITED $ECLASS" |
| 11 | |
13 | |
| 12 | SITELISP=/usr/share/emacs/site-lisp |
|
|
| 13 | |
|
|
| 14 | elisp-install() { |
|
|
| 15 | local subdir=$1 |
|
|
| 16 | dodir ${SITELISP}/${subdir} |
|
|
| 17 | insinto ${SITELISP}/${subdir} |
|
|
| 18 | shift |
|
|
| 19 | doins $@ |
|
|
| 20 | } |
|
|
| 21 | |
|
|
| 22 | elisp-site-file-install() { |
|
|
| 23 | local sitefile=$1 |
|
|
| 24 | pushd ${S} |
|
|
| 25 | cp ${sitefile} . |
|
|
| 26 | D=${S}/ dosed "s:@SITELISP@:${SITELISP}/${PN}:g" $(basename ${sitefile}) |
|
|
| 27 | insinto ${SITELISP} |
|
|
| 28 | doins ${S}/$(basename ${sitefile}) |
|
|
| 29 | popd |
|
|
| 30 | } |
|
|
| 31 | |
|
|
| 32 | elisp-site-regen() { |
|
|
| 33 | einfo "Regenerating ${SITELISP}/site-start.el..." |
|
|
| 34 | einfo "" |
|
|
| 35 | cat <<EOF >${SITELISP}/site-start.el |
|
|
| 36 | ;;; DO NOT EDIT THIS FILE -- IT IS GENERATED AUTOMATICALLY BY PORTAGE |
|
|
| 37 | ;;; ----------------------------------------------------------------- |
|
|
| 38 | |
|
|
| 39 | EOF |
|
|
| 40 | ls ${SITELISP}/[0-9][0-9]* |sort -n |grep -vE '~$' | \ |
|
|
| 41 | while read sf |
|
|
| 42 | do |
|
|
| 43 | einfo " Adding $sf..." |
|
|
| 44 | # Great for debugging, too noisy and slow for users though |
|
|
| 45 | # echo "(message \"Loading $sf...\")" >>${SITELISP}/site-start.el |
|
|
| 46 | cat $sf >>${SITELISP}/site-start.el |
|
|
| 47 | done |
|
|
| 48 | einfo "" |
|
|
| 49 | } |
|
|
| 50 | |
|
|
| 51 | # DEFAULT OVERRIDES |
|
|
| 52 | |
|
|
| 53 | # SRC_URI should be set to wherever the primary app-emacs/ maintainer |
14 | # SRC_URI should be set to wherever the primary app-emacs/ maintainer |
| 54 | # keeps the local elisp mirror, since most app-emacs packages are |
15 | # keeps the local elisp mirror, since most app-emacs packages are |
| 55 | # upstream as a single .el file |
16 | # upstream as a single .el file. |
|
|
17 | |
|
|
18 | # Note: This is no longer necessary. |
| 56 | |
19 | |
| 57 | SRC_URI="http://cvs.gentoo.org/~mkennedy/app-emacs/${P}.el.bz2" |
20 | SRC_URI="http://cvs.gentoo.org/~mkennedy/app-emacs/${P}.el.bz2" |
|
|
21 | if [ "${SIMPLE_ELISP}" = 't' ]; then |
| 58 | S="${WORKDIR}/" |
22 | S="${WORKDIR}/" |
| 59 | newdepend "virtual/emacs" |
23 | #else |
|
|
24 | # Use default value |
|
|
25 | # S="${WORKDIR}/${P}" |
|
|
26 | fi |
|
|
27 | |
|
|
28 | DEPEND="virtual/emacs" |
| 60 | IUSE="" |
29 | IUSE="" |
| 61 | |
30 | |
| 62 | src_unpack() { |
31 | elisp_src_unpack() { |
| 63 | unpack ${A} |
32 | unpack ${A} |
| 64 | if [ "${SIMPLE_ELISP}" = 't' ] |
33 | if [ "${SIMPLE_ELISP}" = 't' ] |
| 65 | then |
34 | then |
| 66 | cd ${S} && mv ${P}.el ${PN}.el |
35 | cd ${S} && mv ${P}.el ${PN}.el |
| 67 | fi |
36 | fi |
| 68 | } |
37 | } |
| 69 | |
38 | |
| 70 | src_compile() { |
39 | elisp_src_compile() { |
| 71 | emacs --batch -f batch-byte-compile --no-site-file --no-init-file *.el || die |
40 | elisp-compile *.el || die |
| 72 | } |
41 | } |
| 73 | |
42 | |
| 74 | src_install() { |
43 | elisp_src_install() { |
| 75 | elisp-install ${PN} *.el *.elc |
44 | elisp-install ${PN} *.el *.elc |
| 76 | elisp-site-file-install ${FILESDIR}/${SITEFILE} |
45 | elisp-site-file-install ${FILESDIR}/${SITEFILE} |
| 77 | } |
46 | } |
| 78 | |
47 | |
| 79 | pkg_postinst() { |
48 | elisp_pkg_postinst() { |
| 80 | elisp-site-regen |
49 | elisp-site-regen |
| 81 | } |
50 | } |
| 82 | |
51 | |
| 83 | pkg_postrm() { |
52 | elisp_pkg_postrm() { |
| 84 | elisp-site-regen |
53 | elisp-site-regen |
| 85 | } |
54 | } |
| 86 | |
55 | |
|
|
56 | EXPORT_FUNCTIONS src_unpack src_compile src_install \ |
|
|
57 | pkg_postinst pkg_postrm |
|
|
58 | |
|
|
59 | # Local Variables: *** |
|
|
60 | # mode: shell-script *** |
|
|
61 | # tab-width: 4 *** |
|
|
62 | # indent-tabs-mode: t *** |
|
|
63 | # End: *** |