elisp-comp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/sh
  2. # Copyright (C) 1995-2012 Free Software Foundation, Inc.
  3. scriptversion=2010-02-06.18; # UTC
  4. # Franc,ois Pinard <pinard@iro.umontreal.ca>, 1995.
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. # As a special exception to the GNU General Public License, if you
  19. # distribute this file as part of a program that contains a
  20. # configuration script generated by Autoconf, you may include it under
  21. # the same distribution terms that you use for the rest of that program.
  22. # This file is maintained in Automake, please report
  23. # bugs to <bug-automake@gnu.org> or send patches to
  24. # <automake-patches@gnu.org>.
  25. case $1 in
  26. '')
  27. echo "$0: No files. Try '$0 --help' for more information." 1>&2
  28. exit 1;
  29. ;;
  30. -h | --h*)
  31. cat <<\EOF
  32. Usage: elisp-comp [--help] [--version] FILES...
  33. This script byte-compiles all '.el' files listed as FILES using GNU
  34. Emacs, and put the resulting '.elc' files into the current directory,
  35. so disregarding the original directories used in '.el' arguments.
  36. This script manages in such a way that all Emacs LISP files to
  37. be compiled are made visible between themselves, in the event
  38. they require or load-library one another.
  39. Report bugs to <bug-automake@gnu.org>.
  40. EOF
  41. exit $?
  42. ;;
  43. -v | --v*)
  44. echo "elisp-comp $scriptversion"
  45. exit $?
  46. ;;
  47. esac
  48. if test -z "$EMACS" || test "$EMACS" = "t"; then
  49. # Value of "t" means we are running in a shell under Emacs.
  50. # Just assume Emacs is called "emacs".
  51. EMACS=emacs
  52. fi
  53. tempdir=elc.$$
  54. # Cleanup the temporary directory on exit.
  55. trap 'ret=$?; rm -rf "$tempdir" && exit $ret' 0
  56. do_exit='(exit $ret); exit $ret'
  57. trap "ret=129; $do_exit" 1
  58. trap "ret=130; $do_exit" 2
  59. trap "ret=141; $do_exit" 13
  60. trap "ret=143; $do_exit" 15
  61. mkdir $tempdir
  62. cp "$@" $tempdir
  63. (
  64. cd $tempdir
  65. echo "(setq load-path (cons nil load-path))" > script
  66. $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $?
  67. mv *.elc ..
  68. ) || exit $?
  69. (exit 0); exit 0
  70. # Local Variables:
  71. # mode: shell-script
  72. # sh-indentation: 2
  73. # eval: (add-hook 'write-file-hooks 'time-stamp)
  74. # time-stamp-start: "scriptversion="
  75. # time-stamp-format: "%:y-%02m-%02d.%02H"
  76. # time-stamp-time-zone: "UTC"
  77. # time-stamp-end: "; # UTC"
  78. # End: