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
|
282
|
45 if test -z "$EMACS"; then EMACS="./src/xemacs"; fi
|
108
|
46 export EMACS
|
36
|
47
|
114
|
48 echo " (using $EMACS)"
|
|
49
|
|
50 # fuckin' sysv, man...
|
278
|
51 if [ "`uname -r | sed 's/[^0-9]*\([0-9]*\).*/\1/'`" -gt 4 ]; then
|
114
|
52 echon()
|
|
53 {
|
|
54 /bin/echo $* '\c'
|
|
55 }
|
|
56 else
|
|
57 echon()
|
|
58 {
|
|
59 echo -n $*
|
|
60 }
|
|
61 fi
|
|
62
|
333
|
63 EMACS_DIR=`cd \`dirname $EMACS\` && pwd`;
|
|
64 CANON_PWD=`pwd`
|
|
65 # Account for various system automounter configurations
|
|
66 if test -d "/net"; then
|
|
67 if test -d "/tmp_mnt/net"; then tdir="/tmp_mnt/net"; else tdir="/tmp_mnt"; fi
|
|
68 EMACS_DIR=`echo "$EMACS_DIR" | \
|
|
69 sed -e "s|^${tdir}/|/net/|" -e "s|^/a/|/net/|" -e "s|^/amd/|/net/|"`
|
|
70 CANON_PWD=`echo "$CANON_PWD" | \
|
|
71 sed -e "s|^${tdir}/|/net/|" -e "s|^/a/|/net/|" -e "s|^/amd/|/net/|"`
|
|
72 fi
|
|
73 REAL="$EMACS_DIR/`basename $EMACS`"
|
|
74
|
|
75 echo "Recompiling in $CANON_PWD"
|
114
|
76 echo " with $REAL..."
|
|
77
|
333
|
78 BYTECOMP="$REAL -batch -vanilla "
|
|
79
|
|
80 $EMACS -batch -vanilla -l $CANON_PWD/lisp/cleantree -f batch-remove-old-elc lisp
|
70
|
81
|
215
|
82 prune_vc="( -name '.*' -o -name SCCS -o -name RCS -o -name CVS ) -prune -o"
|
0
|
83
|
70
|
84 # $els is a list of all .el files
|
|
85 # $elcs is a list of all .elc files
|
108
|
86 els=/tmp/update-elc-1.$$ elcs=/tmp/update-elc-2.$$
|
70
|
87 rm -f $els $elcs
|
|
88 trap "rm -f $els $elcs" 0 1 2 3 15
|
80
|
89 find lisp/. $prune_vc -name '*.el' -print | sort > $els
|
|
90 find lisp/. $prune_vc -name '*.elc' -print | sed 's/elc$/el/' | sort > $elcs
|
70
|
91
|
0
|
92
|
114
|
93 echon "Deleting .elc files without .el files..."
|
108
|
94 comm -13 $els $elcs | sed -e '\!/vm.el!d' -e 's/el$/elc/' | \
|
70
|
95 while read file ; do echo rm "$file" ; rm "$file" ; done
|
114
|
96 echo done.
|
0
|
97
|
30
|
98
|
70
|
99 # Compute patterns to ignore when searching for files
|
155
|
100 ignore_dirs=""
|
177
|
101 ignore_pattern=''
|
0
|
102
|
70
|
103 # Only use Mule XEmacs to compile Mule-specific elisp dirs
|
114
|
104 echon "Checking for Mule support..."
|
84
|
105 lisp_prog='(princ (featurep (quote mule)))'
|
263
|
106 mule_p="`$EMACS -batch -vanilla -eval \"$lisp_prog\"`"
|
84
|
107 if test "$mule_p" = nil ; then
|
177
|
108 echo No
|
347
|
109 ignore_dirs="$ignore_dirs mule"
|
140
|
110 else
|
84
|
111 echo Yes
|
70
|
112 fi
|
0
|
113
|
|
114 # first recompile the byte-compiler, so that the other compiles take place
|
|
115 # with the latest version (assuming we're compiling the lisp dir of the emacs
|
|
116 # we're running, which might not be the case, but often is.)
|
209
|
117 #echo "Checking the byte compiler..."
|
|
118 #$BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp
|
0
|
119
|
70
|
120 # Prepare for byte-compiling directories with directory-specific instructions
|
217
|
121 # Not necessary any more, but I want to keep the text current to cut & paste
|
|
122 # into the package lisp maintenance tree.
|
227
|
123 #make_special_commands=''
|
|
124 #make_special () {
|
|
125 # dir="$1"; shift;
|
|
126 # ignore_dirs="$ignore_dirs $dir"
|
|
127 # make_special_commands="$make_special_commands \
|
|
128 #echo \"Compiling in lisp/$dir\"; \
|
|
129 #(cd \"lisp/$dir\" && ${MAKE:-make} EMACS=$REAL ${1+$*}); \
|
|
130 #echo \"lisp/$dir done.\";"
|
|
131 #}
|
219
|
132
|
227
|
133 #if test "$mule_p" != nil; then
|
|
134 # make_special skk all
|
|
135 #fi
|
30
|
136
|
177
|
137 ## AUCTeX is a package now
|
|
138 # if test "$mule_p" = nil ; then
|
|
139 # make_special auctex some
|
|
140 # else
|
|
141 # make_special auctex some MULE_ELC=tex-jp.elc
|
|
142 # fi
|
171
|
143 #make_special cc-mode all
|
207
|
144 # EFS is now packaged
|
|
145 # make_special efs x20
|
217
|
146 #make_special eos -k # not strictly necessary...
|
177
|
147 ## make_special gnus some # Now this is a package.
|
209
|
148 # hyperbole is now packaged
|
|
149 # make_special hyperbole elc
|
169
|
150 # We're not ready for the following, yet.
|
|
151 #make_special ilisp XEmacsELC=custom-load.elc elc
|
209
|
152 # ilisp is now packaged
|
|
153 # make_special ilisp elc
|
|
154 # oobr is now packaged
|
|
155 # make_special oobr HYPB_ELC='' elc
|
201
|
156 ## W3 is a package now.
|
|
157 #make_special w3 xemacs-w3
|
0
|
158
|
70
|
159 for dir in $ignore_dirs ; do
|
|
160 ignore_pattern="${ignore_pattern}/\\/$dir\\//d
|
|
161 /\\/$dir\$/d
|
|
162 "
|
|
163 done
|
0
|
164
|
70
|
165 # Other special-case filenames that don't get byte-compiled
|
|
166 ignore_pattern="$ignore_pattern"'
|
0
|
167 \!/,!d
|
|
168 \!/paths.el$!d
|
223
|
169 \!/loadup.el$!d
|
|
170 \!/loadup-el.el$!d
|
|
171 \!/update-elc.el$!d
|
|
172 \!/dumped-lisp.el$!d
|
|
173 \!/make-docfile.el$!d
|
0
|
174 \!/site-start.el$!d
|
|
175 \!/site-load.el$!d
|
|
176 \!/site-init.el$!d
|
|
177 \!/version.el$!d
|
304
|
178 \!/very-early-lisp.el$!d
|
261
|
179 \!/Installation.el$!d
|
70
|
180 '
|
0
|
181
|
70
|
182 echo "Compiling files without .elc..."
|
|
183 NUMTOCOMPILE=20 # compile this many files with each invocation
|
78
|
184 comm -23 $els $elcs | \
|
|
185 sed "$ignore_pattern" | \
|
|
186 xargs -t -n$NUMTOCOMPILE $BYTECOMP -f batch-byte-compile
|
70
|
187 echo "Compiling files without .elc... Done"
|
22
|
188
|
227
|
189 #if test "$mule_p" != nil; then
|
|
190 # eval "$make_special_commands"
|
|
191 #fi
|