0
|
1 #!/bin/sh
|
108
|
2 # update-elc.sh --- recompile all missing or out-of-date .elc files
|
0
|
3
|
70
|
4 # Author: Jamie Zawinski, Ben Wing, Martin Buchholz
|
|
5 # Maintainer: Martin Buchholz
|
108
|
6 # Keywords: recompile byte-compile .el .elc
|
0
|
7
|
181
|
8 # This file is part of XEmacs.
|
|
9
|
|
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)
|
|
13 # any later version.
|
|
14
|
|
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.
|
|
19
|
|
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.
|
|
24
|
0
|
25 ### Commentary:
|
70
|
26 ## Recompile all .elc files that need recompilation. Requires a
|
108
|
27 ## working version of "xemacs". Correctly handles the case where the
|
|
28 ## .elc files are missing; thus you can execute "rm lisp/*/*.elc"
|
70
|
29 ## before running this script. Run this from the parent of the
|
108
|
30 ## "lisp" directory, or another nearby directory.
|
0
|
31
|
108
|
32 set -e
|
0
|
33
|
70
|
34 # Try to find the lisp directory in several places.
|
108
|
35 # (Sun workspaces have an "editor" directory)
|
70
|
36 for dir in . .. ../.. editor ../editor ; do
|
108
|
37 if test -d $dir/lisp/. ; then cd $dir ; break ; fi
|
70
|
38 done
|
0
|
39
|
70
|
40 if test ! -d lisp/. ; then
|
108
|
41 echo "$0: Cannot find the \"lisp\" directory."
|
70
|
42 exit 1
|
0
|
43 fi
|
|
44
|
114
|
45 EMACS="./src/xemacs"
|
108
|
46 export EMACS
|
36
|
47
|
114
|
48 echo " (using $EMACS)"
|
|
49
|
|
50 # fuckin' sysv, man...
|
|
51 if [ "`uname -r | sed 's/\(.\).*/\1/'`" -gt 4 ]; then
|
|
52 echon()
|
|
53 {
|
|
54 /bin/echo $* '\c'
|
|
55 }
|
|
56 else
|
|
57 echon()
|
|
58 {
|
|
59 echo -n $*
|
|
60 }
|
|
61 fi
|
|
62
|
|
63 REAL=`cd \`dirname $EMACS\` ; pwd | sed 's|^/tmp_mnt||'`/`basename $EMACS`
|
207
|
64 BYTECOMP="$REAL -batch -vanilla "
|
114
|
65 echo "Recompiling in `pwd|sed 's|^/tmp_mnt||'`"
|
|
66 echo " with $REAL..."
|
|
67
|
207
|
68 $EMACS -batch -vanilla -l `pwd`/lisp/prim/cleantree -f batch-remove-old-elc lisp
|
70
|
69
|
78
|
70 prune_vc="( -name SCCS -o -name RCS -o -name CVS ) -prune -o"
|
0
|
71
|
70
|
72 # $els is a list of all .el files
|
|
73 # $elcs is a list of all .elc files
|
108
|
74 els=/tmp/update-elc-1.$$ elcs=/tmp/update-elc-2.$$
|
70
|
75 rm -f $els $elcs
|
|
76 trap "rm -f $els $elcs" 0 1 2 3 15
|
80
|
77 find lisp/. $prune_vc -name '*.el' -print | sort > $els
|
|
78 find lisp/. $prune_vc -name '*.elc' -print | sed 's/elc$/el/' | sort > $elcs
|
70
|
79
|
0
|
80
|
114
|
81 echon "Deleting .elc files without .el files..."
|
108
|
82 comm -13 $els $elcs | sed -e '\!/vm.el!d' -e 's/el$/elc/' | \
|
70
|
83 while read file ; do echo rm "$file" ; rm "$file" ; done
|
114
|
84 echo done.
|
0
|
85
|
30
|
86
|
70
|
87 # Compute patterns to ignore when searching for files
|
155
|
88 ignore_dirs=""
|
177
|
89 ignore_pattern=''
|
0
|
90
|
70
|
91 # Only use Mule XEmacs to compile Mule-specific elisp dirs
|
114
|
92 echon "Checking for Mule support..."
|
84
|
93 lisp_prog='(princ (featurep (quote mule)))'
|
207
|
94 mule_p="`$EMACS -batch -vanilla -eval \"$lisp_prog\"`"
|
84
|
95 if test "$mule_p" = nil ; then
|
177
|
96 echo No
|
|
97 ignore_dirs="$ignore_dirs its egg mule language leim"
|
|
98 ignore_pattern='\!/tl/char-table.el$!d
|
|
99 \!/tl/chartblxmas.el$!d
|
197
|
100 \!/mu/latex-math-symbol.el$!d
|
177
|
101 '
|
140
|
102 else
|
84
|
103 echo Yes
|
70
|
104 fi
|
0
|
105
|
|
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.)
|
209
|
109 #echo "Checking the byte compiler..."
|
|
110 #$BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp
|
0
|
111
|
70
|
112 # Prepare for byte-compiling directories with directory-specific instructions
|
|
113 make_special_commands=''
|
|
114 make_special () {
|
|
115 dir="$1"; shift;
|
|
116 ignore_dirs="$ignore_dirs $dir"
|
|
117 make_special_commands="$make_special_commands \
|
|
118 echo \"Compiling in lisp/$dir\"; \
|
114
|
119 (cd \"lisp/$dir\" && ${MAKE:-make} EMACS=$REAL ${1+$*}); \
|
70
|
120 echo \"lisp/$dir done.\";"
|
|
121 }
|
30
|
122
|
177
|
123 ## AUCTeX is a package now
|
|
124 # if test "$mule_p" = nil ; then
|
|
125 # make_special auctex some
|
|
126 # else
|
|
127 # make_special auctex some MULE_ELC=tex-jp.elc
|
|
128 # fi
|
171
|
129 #make_special cc-mode all
|
207
|
130 # EFS is now packaged
|
|
131 # make_special efs x20
|
165
|
132 make_special eos -k # not strictly necessary...
|
177
|
133 ## make_special gnus some # Now this is a package.
|
209
|
134 # hyperbole is now packaged
|
|
135 # make_special hyperbole elc
|
169
|
136 # We're not ready for the following, yet.
|
|
137 #make_special ilisp XEmacsELC=custom-load.elc elc
|
209
|
138 # ilisp is now packaged
|
|
139 # make_special ilisp elc
|
|
140 # oobr is now packaged
|
|
141 # make_special oobr HYPB_ELC='' elc
|
201
|
142 ## W3 is a package now.
|
|
143 #make_special w3 xemacs-w3
|
0
|
144
|
70
|
145 for dir in $ignore_dirs ; do
|
|
146 ignore_pattern="${ignore_pattern}/\\/$dir\\//d
|
|
147 /\\/$dir\$/d
|
|
148 "
|
|
149 done
|
0
|
150
|
70
|
151 # Other special-case filenames that don't get byte-compiled
|
|
152 ignore_pattern="$ignore_pattern"'
|
0
|
153 \!/,!d
|
|
154 \!/edebug/edebug-test.el$!d
|
|
155 \!/paths.el$!d
|
|
156 \!/prim/loadup.el$!d
|
|
157 \!/prim/loadup-el.el$!d
|
|
158 \!/prim/update-elc.el$!d
|
163
|
159 \!/prim/list-autoloads.el$!d
|
|
160 \!/prim/dumped-lisp.el$!d
|
|
161 \!/prim/make-docfile.el$!d
|
0
|
162 \!/site-start.el$!d
|
|
163 \!/site-load.el$!d
|
|
164 \!/site-init.el$!d
|
|
165 \!/version.el$!d
|
163
|
166 \!/mule/mule-load.el$!d
|
0
|
167 \!/sunpro/sunpro-load.el$!d
|
163
|
168 \!/tooltalk/tooltalk-load.el$!d
|
161
|
169 \!/language/devanagari.el$!d
|
|
170 \!/language/indian.el$!d
|
|
171 \!/language/lao-util.el$!d
|
|
172 \!/language/lao.el$!d
|
|
173 \!/language/tibetan.el$!d
|
197
|
174 \!/language/tibet-util.el$!d
|
161
|
175 \!/language/vietnamese.el$!d
|
|
176 \!/leim/quail/devanagari.el$!d
|
|
177 \!/leim/quail/ethiopic.el$!d
|
|
178 \!/leim/quail/japanese.el$!d
|
|
179 \!/leim/quail/lao.el$!d
|
|
180 \!/leim/quail/lrt.el$!d
|
|
181 \!/leim/quail/thai.el$!d
|
197
|
182 \!/leim/quail/tibetan.el$!d
|
161
|
183 \!/leim/quail/viqr.el$!d
|
70
|
184 '
|
0
|
185
|
70
|
186 echo "Compiling files without .elc..."
|
|
187 NUMTOCOMPILE=20 # compile this many files with each invocation
|
78
|
188 comm -23 $els $elcs | \
|
|
189 sed "$ignore_pattern" | \
|
|
190 xargs -t -n$NUMTOCOMPILE $BYTECOMP -f batch-byte-compile
|
70
|
191 echo "Compiling files without .elc... Done"
|
22
|
192
|
70
|
193 eval "$make_special_commands"
|