annotate lib-src/update-elc.sh @ 177:6075d714658b r20-3b15

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