| 1 | #!/bin/sh
|
|---|
| 2 | # Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc.
|
|---|
| 3 | # Franc,ois Pinard <[email protected]>, 1995.
|
|---|
| 4 | #
|
|---|
| 5 | # This program is free software; you can redistribute it and/or modify
|
|---|
| 6 | # it under the terms of the GNU General Public License as published by
|
|---|
| 7 | # the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 8 | # any later version.
|
|---|
| 9 | #
|
|---|
| 10 | # This program is distributed in the hope that it will be useful,
|
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | # GNU General Public License for more details.
|
|---|
| 14 | #
|
|---|
| 15 | # You should have received a copy of the GNU General Public License
|
|---|
| 16 | # along with this program; if not, write to the Free Software
|
|---|
| 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 18 |
|
|---|
| 19 | # As a special exception to the GNU General Public License, if you
|
|---|
| 20 | # distribute this file as part of a program that contains a
|
|---|
| 21 | # configuration script generated by Autoconf, you may include it under
|
|---|
| 22 | # the same distribution terms that you use for the rest of that program.
|
|---|
| 23 |
|
|---|
| 24 | # This script byte-compiles all `.el' files which are part of its
|
|---|
| 25 | # arguments, using GNU Emacs, and put the resulting `.elc' files into
|
|---|
| 26 | # the current directory, so disregarding the original directories used
|
|---|
| 27 | # in `.el' arguments.
|
|---|
| 28 | #
|
|---|
| 29 | # This script manages in such a way that all Emacs LISP files to
|
|---|
| 30 | # be compiled are made visible between themselves, in the event
|
|---|
| 31 | # they require or load-library one another.
|
|---|
| 32 |
|
|---|
| 33 | if test $# = 0; then
|
|---|
| 34 | echo 1>&2 "No files given to $0"
|
|---|
| 35 | exit 1
|
|---|
| 36 | fi
|
|---|
| 37 |
|
|---|
| 38 | if test -z "$EMACS" || test "$EMACS" = "t"; then
|
|---|
| 39 | # Value of "t" means we are running in a shell under Emacs.
|
|---|
| 40 | # Just assume Emacs is called "emacs".
|
|---|
| 41 | EMACS=emacs
|
|---|
| 42 | fi
|
|---|
| 43 |
|
|---|
| 44 | tempdir=elc.$$
|
|---|
| 45 |
|
|---|
| 46 | # Cleanup the temporary directory on exit.
|
|---|
| 47 | trap 'status=$?; rm -rf "$tempdir" && exit $status' 0
|
|---|
| 48 | trap '(exit $?); exit' 1 2 13 15
|
|---|
| 49 |
|
|---|
| 50 | mkdir $tempdir
|
|---|
| 51 | cp "$@" $tempdir
|
|---|
| 52 |
|
|---|
| 53 | (
|
|---|
| 54 | cd $tempdir
|
|---|
| 55 | echo "(setq load-path (cons nil load-path))" > script
|
|---|
| 56 | $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $?
|
|---|
| 57 | mv *.elc ..
|
|---|
| 58 | ) || exit $?
|
|---|
| 59 |
|
|---|
| 60 | (exit 0); exit
|
|---|