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