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