annotate lib-src/update-elc.sh @ 153:25f70ba0133c r20-3b3

Import from CVS: tag r20-3b3
author cvs
date Mon, 13 Aug 2007 09:38:25 +0200
parents 585fb297b004
children 43dd3413c7c7
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
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
71 ignore_dirs="quail" # ### Not ported yet...
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
73 # Only use Mule XEmacs to compile Mule-specific elisp dirs
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
74 echon "Checking for Mule support..."
84
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
75 lisp_prog='(princ (featurep (quote mule)))'
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
76 mule_p="`$EMACS -batch -no-site-file -eval \"$lisp_prog\"`"
84
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
77 if test "$mule_p" = nil ; then
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
78 echo No
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
79 ignore_dirs="$ignore_dirs its egg mule"
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 116
diff changeset
80 else
84
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
81 echo Yes
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
82 fi
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 # first recompile the byte-compiler, so that the other compiles take place
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 # 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
86 # 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
87 echo "Checking the byte compiler..."
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
88 $BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
90 # Byte-compile VM first, because other packages depend on it,
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
91 # but it depends on nothing (Kyle is like that).
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
92 ignore_dirs="$ignore_dirs vm"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
93 echo "Compiling in lisp/vm";
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
94 (cd lisp/vm && ${MAKE:-make} EMACS=$REAL autoload)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
95 echo "lisp/vm done."
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
96
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
97 # Prepare for byte-compiling directories with directory-specific instructions
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
98 make_special_commands=''
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
99 make_special () {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
100 dir="$1"; shift;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
101 ignore_dirs="$ignore_dirs $dir"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
102 make_special_commands="$make_special_commands \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
103 echo \"Compiling in lisp/$dir\"; \
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
104 (cd \"lisp/$dir\" && ${MAKE:-make} EMACS=$REAL ${1+$*}); \
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
105 echo \"lisp/$dir done.\";"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
106 }
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
107
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
108 #make_special vm
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
109 #make_special ediff elc
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
110 #make_special viper elc
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
111 make_special efs x20
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
112 make_special gnus some
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
113 make_special w3 xemacs-w3
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
114 make_special hyperbole elc
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
115 make_special oobr HYPB_ELC='' elc
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
116 make_special eos -k # not stricly necessary...
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
117 make_special ilisp elc
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 100
diff changeset
118 make_special auctex some
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
120 ignore_pattern=''
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
121 for dir in $ignore_dirs ; do
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
122 ignore_pattern="${ignore_pattern}/\\/$dir\\//d
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
123 /\\/$dir\$/d
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
124 "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
125 done
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
127 # Other special-case filenames that don't get byte-compiled
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
128 ignore_pattern="$ignore_pattern"'
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 \!/,!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 \!/edebug/edebug-test.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 \!/paths.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 \!/prim/loadup.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 \!/prim/loadup-el.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 \!/prim/update-elc.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 \!/site-start.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 \!/site-load.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 \!/site-init.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 \!/version.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 \!/sunpro/sunpro-load.el$!d
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
140 '
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
142 echo "Compiling files without .elc..."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
143 NUMTOCOMPILE=20 # compile this many files with each invocation
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
144 comm -23 $els $elcs | \
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
145 sed "$ignore_pattern" | \
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
146 xargs -t -n$NUMTOCOMPILE $BYTECOMP -f batch-byte-compile
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
147 echo "Compiling files without .elc... Done"
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
148
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
149 eval "$make_special_commands"