2 # update-elc.sh --- recompile all missing or out-of-date .elc files
4 # Author: Jamie Zawinski, Ben Wing, Martin Buchholz
5 # Maintainer: Martin Buchholz
6 # Keywords: recompile byte-compile .el .elc
8 # This file is part of XEmacs.
10 # XEmacs is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2, or (at your option)
15 # XEmacs is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with XEmacs; see the file COPYING. If not, write to
22 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 # Boston, MA 02111-1307, USA.
26 ## Recompile all .elc files that need recompilation. Requires a
27 ## working version of "xemacs". Correctly handles the case where the
28 ## .elc files are missing; thus you can execute "rm lisp/*/*.elc"
29 ## before running this script. Run this from the parent of the
30 ## "lisp" directory, or another nearby directory.
34 # Try to find the lisp directory in several places.
35 # (Sun workspaces have an "editor" directory)
36 for dir in . .. ../.. editor ../editor ; do
37 if test -d $dir/lisp/. ; then cd $dir ; break ; fi
40 if test ! -d lisp/. ; then
41 echo "$0: Cannot find the \"lisp\" directory."
45 if test -z "$EMACS"; then EMACS="./src/xemacs"; fi
48 echo " (using $EMACS)"
50 # fuckin' sysv, man...
51 if [ "`uname -r | sed 's/[^0-9]*\([0-9]*\).*/\1/'`" -gt 4 ]; then
63 REAL=`cd \`dirname $EMACS\` ; pwd | sed 's|^/tmp_mnt||'`/`basename $EMACS`
64 BYTECOMP="$REAL -batch -vanilla "
65 echo "Recompiling in `pwd|sed 's|^/tmp_mnt||'`"
68 $EMACS -batch -vanilla -l `pwd`/lisp/cleantree -f batch-remove-old-elc lisp
70 prune_vc="( -name '.*' -o -name SCCS -o -name RCS -o -name CVS ) -prune -o"
72 # $els is a list of all .el files
73 # $elcs is a list of all .elc files
74 els=/tmp/update-elc-1.$$ elcs=/tmp/update-elc-2.$$
76 trap "rm -f $els $elcs" 0 1 2 3 15
77 find lisp/. $prune_vc -name '*.el' -print | sort > $els
78 find lisp/. $prune_vc -name '*.elc' -print | sed 's/elc$/el/' | sort > $elcs
81 echon "Deleting .elc files without .el files..."
82 comm -13 $els $elcs | sed -e '\!/vm.el!d' -e 's/el$/elc/' | \
83 while read file ; do echo rm "$file" ; rm "$file" ; done
87 # Compute patterns to ignore when searching for files
91 # Only use Mule XEmacs to compile Mule-specific elisp dirs
92 echon "Checking for Mule support..."
93 lisp_prog='(princ (featurep (quote mule)))'
94 mule_p="`$EMACS -batch -vanilla -eval \"$lisp_prog\"`"
95 if test "$mule_p" = nil ; then
97 ignore_dirs="$ignore_dirs its egg mule language leim skk"
98 ignore_pattern='\!/tl/char-table.el$!d
99 \!/tl/chartblxmas.el$!d
100 \!/mu/latex-math-symbol.el$!d
106 # first recompile the byte-compiler, so that the other compiles take place
107 # with the latest version (assuming we're compiling the lisp dir of the emacs
108 # we're running, which might not be the case, but often is.)
109 #echo "Checking the byte compiler..."
110 #$BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp
112 # Prepare for byte-compiling directories with directory-specific instructions
113 # Not necessary any more, but I want to keep the text current to cut & paste
114 # into the package lisp maintenance tree.
115 #make_special_commands=''
118 # ignore_dirs="$ignore_dirs $dir"
119 # make_special_commands="$make_special_commands \
120 #echo \"Compiling in lisp/$dir\"; \
121 #(cd \"lisp/$dir\" && ${MAKE:-make} EMACS=$REAL ${1+$*}); \
122 #echo \"lisp/$dir done.\";"
125 #if test "$mule_p" != nil; then
126 # make_special skk all
129 ## AUCTeX is a package now
130 # if test "$mule_p" = nil ; then
131 # make_special auctex some
133 # make_special auctex some MULE_ELC=tex-jp.elc
135 #make_special cc-mode all
136 # EFS is now packaged
137 # make_special efs x20
138 #make_special eos -k # not strictly necessary...
139 ## make_special gnus some # Now this is a package.
140 # hyperbole is now packaged
141 # make_special hyperbole elc
142 # We're not ready for the following, yet.
143 #make_special ilisp XEmacsELC=custom-load.elc elc
144 # ilisp is now packaged
145 # make_special ilisp elc
146 # oobr is now packaged
147 # make_special oobr HYPB_ELC='' elc
148 ## W3 is a package now.
149 #make_special w3 xemacs-w3
151 for dir in $ignore_dirs ; do
152 ignore_pattern="${ignore_pattern}/\\/$dir\\//d
157 # Other special-case filenames that don't get byte-compiled
158 ignore_pattern="$ignore_pattern"'
165 \!/make-docfile.el$!d
170 \!/very-early-lisp.el$!d
171 \!/Installation.el$!d
174 echo "Compiling files without .elc..."
175 NUMTOCOMPILE=20 # compile this many files with each invocation
176 comm -23 $els $elcs | \
177 sed "$ignore_pattern" | \
178 xargs -t -n$NUMTOCOMPILE $BYTECOMP -f batch-byte-compile
179 echo "Compiling files without .elc... Done"
181 #if test "$mule_p" != nil; then
182 # eval "$make_special_commands"