| 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-common.eclass,v 1.1 2003/09/21 01:40:41 mkennedy Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.7 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 is not an eclass, but it does provide emacs-related |
8 | # This is not an eclass, but it does provide emacs-related |
| 8 | # installation utilities. |
9 | # installation utilities. |
| 9 | |
10 | |
| 10 | ECLASS=elisp-common |
11 | ECLASS=elisp-common |
| 11 | INHERITED="$INHERITED $ECLASS" |
12 | INHERITED="$INHERITED $ECLASS" |
| 12 | |
13 | |
| 13 | SITELISP=/usr/share/emacs/site-lisp |
14 | SITELISP=/usr/share/emacs/site-lisp |
|
|
15 | |
|
|
16 | elisp-compile() { |
|
|
17 | /usr/bin/emacs --batch -f batch-byte-compile --no-site-file --no-init-file $* |
|
|
18 | } |
| 14 | |
19 | |
| 15 | elisp-install() { |
20 | elisp-install() { |
| 16 | local subdir=$1 |
21 | local subdir=$1 |
| 17 | dodir ${SITELISP}/${subdir} |
22 | dodir ${SITELISP}/${subdir} |
| 18 | insinto ${SITELISP}/${subdir} |
23 | insinto ${SITELISP}/${subdir} |
| 19 | shift |
24 | shift |
| 20 | doins $@ |
25 | doins $@ |
| 21 | } |
26 | } |
| 22 | |
27 | |
| 23 | elisp-site-file-install() { |
28 | elisp-site-file-install() { |
| 24 | local sitefile=$1 |
29 | local sitefile=$1 my_pn=${2:-${PN}} |
| 25 | pushd ${S} |
30 | pushd ${S} |
| 26 | cp ${sitefile} . |
31 | cp ${sitefile} ${T} |
| 27 | D=${S}/ dosed "s:@SITELISP@:${SITELISP}/${PN}:g" $(basename ${sitefile}) |
32 | sed -i "s:@SITELISP@:${SITELISP}/${my_pn}:g" ${T}/$(basename ${sitefile}) |
| 28 | insinto ${SITELISP} |
33 | insinto ${SITELISP} |
| 29 | doins ${S}/$(basename ${sitefile}) |
34 | doins ${T}/$(basename ${sitefile}) |
| 30 | popd |
35 | popd |
| 31 | } |
36 | } |
| 32 | |
37 | |
| 33 | elisp-site-regen() { |
38 | elisp-site-regen() { |
| 34 | einfo "Regenerating ${SITELISP}/site-start.el..." |
39 | einfo "Regenerating ${SITELISP}/site-gentoo.el..." |
| 35 | einfo "" |
40 | einfo "" |
| 36 | cat <<EOF >${SITELISP}/site-start.el |
41 | cat <<EOF >${SITELISP}/site-gentoo.el |
| 37 | ;;; DO NOT EDIT THIS FILE -- IT IS GENERATED AUTOMATICALLY BY PORTAGE |
42 | ;;; DO NOT EDIT THIS FILE -- IT IS GENERATED AUTOMATICALLY BY PORTAGE |
| 38 | ;;; ----------------------------------------------------------------- |
43 | ;;; ----------------------------------------------------------------- |
| 39 | |
44 | |
| 40 | EOF |
45 | EOF |
| 41 | ls ${SITELISP}/[0-9][0-9]* |sort -n |grep -vE '~$' | \ |
46 | ls ${SITELISP}/[0-9][0-9]*-gentoo.el |sort -n | \ |
| 42 | while read sf |
47 | while read sf |
| 43 | do |
48 | do |
| 44 | einfo " Adding $sf..." |
49 | einfo " Adding $(basename $sf)..." |
| 45 | # Great for debugging, too noisy and slow for users though |
50 | # Great for debugging, too noisy and slow for users though |
| 46 | # echo "(message \"Loading $sf...\")" >>${SITELISP}/site-start.el |
51 | # echo "(message \"Loading $sf...\")" >>${SITELISP}/site-start.el |
| 47 | cat $sf >>${SITELISP}/site-start.el |
52 | cat $sf >>${SITELISP}/site-gentoo.el |
| 48 | done |
53 | done |
| 49 | einfo "" |
54 | while read line; do einfo "${line}"; done <<EOF |
|
|
55 | |
|
|
56 | All site initialization for Gentoo-installed packages is now added to |
|
|
57 | /usr/share/emacs/site-lisp/site-gentoo.el; site-start.el is no longer |
|
|
58 | managed by Gentoo. You may want to remove the generated |
|
|
59 | site-start.el. |
|
|
60 | |
|
|
61 | In order for this site initialization to be loaded for all users |
|
|
62 | automatically, as was done previously, you can add a line like this: |
|
|
63 | |
|
|
64 | (load "/usr/share/emacs/site-lisp/site-gentoo") |
|
|
65 | |
|
|
66 | to /usr/share/emacs/site-lisp/site-start.el. Alternatively, that line |
|
|
67 | can be added by individual users to their initialization files, or for |
|
|
68 | greater flexibility, users can select which of the package-specific |
|
|
69 | initialization files in /usr/share/emacs/site-lisp to load. |
|
|
70 | EOF |
|
|
71 | echo |
|
|
72 | } |
|
|
73 | |
|
|
74 | # The following Emacs Lisp compilation routine is taken from GNU |
|
|
75 | # autotools. |
|
|
76 | |
|
|
77 | elisp-comp() { |
|
|
78 | # Copyright 1995 Free Software Foundation, Inc. |
|
|
79 | # François Pinard <pinard@iro.umontreal.ca>, 1995. |
|
|
80 | # |
|
|
81 | # This program is free software; you can redistribute it and/or modify |
|
|
82 | # it under the terms of the GNU General Public License as published by |
|
|
83 | # the Free Software Foundation; either version 2, or (at your option) |
|
|
84 | # any later version. |
|
|
85 | # |
|
|
86 | # This program is distributed in the hope that it will be useful, |
|
|
87 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
88 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
89 | # GNU General Public License for more details. |
|
|
90 | # |
|
|
91 | # You should have received a copy of the GNU General Public License |
|
|
92 | # along with this program; if not, write to the Free Software |
|
|
93 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
|
94 | |
|
|
95 | # As a special exception to the GNU General Public License, if you |
|
|
96 | # distribute this file as part of a program that contains a |
|
|
97 | # configuration script generated by Autoconf, you may include it under |
|
|
98 | # the same distribution terms that you use for the rest of that program. |
|
|
99 | |
|
|
100 | # This script byte-compiles all `.el' files which are part of its |
|
|
101 | # arguments, using GNU Emacs, and put the resulting `.elc' files into |
|
|
102 | # the current directory, so disregarding the original directories used |
|
|
103 | # in `.el' arguments. |
|
|
104 | # |
|
|
105 | # This script manages in such a way that all Emacs LISP files to |
|
|
106 | # be compiled are made visible between themselves, in the event |
|
|
107 | # they require or load-library one another. |
|
|
108 | |
|
|
109 | if test $# = 0; then |
|
|
110 | echo 1>&2 "No files given to $0" |
|
|
111 | exit 1 |
|
|
112 | else |
|
|
113 | if test -z "$EMACS" || test "$EMACS" = "t"; then |
|
|
114 | # Value of "t" means we are running in a shell under Emacs. |
|
|
115 | # Just assume Emacs is called "emacs". |
|
|
116 | EMACS=emacs |
|
|
117 | fi |
|
|
118 | |
|
|
119 | tempdir=elc.$$ |
|
|
120 | mkdir $tempdir |
|
|
121 | cp $* $tempdir |
|
|
122 | cd $tempdir |
|
|
123 | |
|
|
124 | echo "(add-to-list 'load-path \"../\")" > script |
|
|
125 | $EMACS -batch -q --no-site-file --no-init-file -l script -f batch-byte-compile *.el |
|
|
126 | mv *.elc .. |
|
|
127 | |
|
|
128 | cd .. |
|
|
129 | rm -fr $tempdir |
|
|
130 | fi |
| 50 | } |
131 | } |
| 51 | |
132 | |
| 52 | # Local Variables: *** |
133 | # Local Variables: *** |
| 53 | # mode: shell-script *** |
134 | # mode: shell-script *** |
| 54 | # tab-width: 4 *** |
135 | # tab-width: 4 *** |
| 55 | # indent-tabs-mode: t *** |
136 | # indent-tabs-mode: t *** |
| 56 | # End: *** |
137 | # End: *** |
|
|
138 | |