/[gentoo-x86]/eclass/elisp-common.eclass
Gentoo

Contents of /eclass/elisp-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Tue May 3 09:20:13 2005 UTC (9 years, 6 months ago) by usata
Branch: MAIN
Changes since 1.9: +2 -2 lines
added 'die' to elisp-site-file-install(). thanks to Tobias C. rittweiler <tcr@freebits.de>; bug #86704.

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.9 2004/10/19 19:51:12 vapier Exp $
4 #
5 # Copyright 2002-2003 Matthew Kennedy <mkennedy@gentoo.org>
6 # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
7 #
8 # This is not an eclass, but it does provide emacs-related
9 # installation utilities.
10
11 ECLASS=elisp-common
12 INHERITED="$INHERITED $ECLASS"
13
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 }
19
20 elisp-install() {
21 local subdir=$1
22 dodir ${SITELISP}/${subdir}
23 insinto ${SITELISP}/${subdir}
24 shift
25 doins $@
26 }
27
28 elisp-site-file-install() {
29 local sitefile=$1 my_pn=${2:-${PN}}
30 pushd ${S}
31 cp ${sitefile} ${T}
32 sed -i "s:@SITELISP@:${SITELISP}/${my_pn}:g" ${T}/$(basename ${sitefile})
33 insinto ${SITELISP}
34 doins ${T}/$(basename ${sitefile}) || die "failed to install site file"
35 popd
36 }
37
38 elisp-site-regen() {
39 einfo "Regenerating ${SITELISP}/site-gentoo.el ..."
40 einfo ""
41 cat <<EOF >${SITELISP}/site-gentoo.el
42 ;;; DO NOT EDIT THIS FILE -- IT IS GENERATED AUTOMATICALLY BY PORTAGE
43 ;;; -----------------------------------------------------------------
44
45 EOF
46 ls ${SITELISP}/[0-9][0-9]*-gentoo.el |sort -n | \
47 while read sf
48 do
49 einfo " Adding $(basename $sf) ..."
50 # Great for debugging, too noisy and slow for users though
51 # echo "(message \"Loading $sf ...\")" >>${SITELISP}/site-start.el
52 cat $sf >>${SITELISP}/site-gentoo.el
53 done
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 are responsible for all maintenance of
59 site-start.el if there is such a file.
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
131 }
132
133 # Local Variables: ***
134 # mode: shell-script ***
135 # tab-width: 4 ***
136 # indent-tabs-mode: t ***
137 # End: ***

  ViewVC Help
Powered by ViewVC 1.1.20