annotate lib-src/update-elc.sh @ 80:1ce6082ce73f r20-0b90

Import from CVS: tag r20-0b90
author cvs
date Mon, 13 Aug 2007 09:06:37 +0200
parents c7528f8e288d
children ac0620f6398e
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
2 # update-elc.sh --- recompile all missing or out-or-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
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 # Keywords: recompile .el .elc
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
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
10 ## working version of 'xemacs'. Correctly handles the case where the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
11 ## .elc files are missing; thus you can execute 'rm lisp/*/*.elc'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
12 ## before running this script. Run this from the parent of the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
13 ## `lisp' directory, or another nearby directory.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
15 set -eu
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.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
18 # (Sun workspaces have an `editor' directory)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
19 for dir in . .. ../.. editor ../editor ; do
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
20 if test -d $dir ; then cd $dir ; break ; fi
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
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
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
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 34
diff changeset
28
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
29 EMACS=${XEMACS:-./src/xemacs}; export EMACS
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
30 REAL=`cd \`dirname $EMACS\` ; pwd | sed 's:^/tmp_mnt::'`/`basename $EMACS`
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
31 BYTECOMP="$REAL -batch -q -no-site-file -l bytecomp"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
32 echo "Recompiling in `pwd|sed 's:^/tmp_mnt::'`"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
33 echo " with $REAL..."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
34
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
35 prune_vc="( -name SCCS -o -name RCS -o -name CVS ) -prune -o"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
37 # $els is a list of all .el files
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
38 # $elcs is a list of all .elc files
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
39 els=/tmp/rcl1.$$ ; elcs=/tmp/rcl2.$$
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
40 rm -f $els $elcs
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
41 trap "rm -f $els $elcs" 0 1 2 3 15
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
42 find lisp/. $prune_vc -name '*.el' -print | sort > $els
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
43 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
44
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
46 echo "Deleting .elc files without .el files..."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
47 comm -13 $els $elcs | sed -e '\!/vm.el!d' -e '\!/w3.el!d' -e 's/el$/elc/' | \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
48 while read file ; do echo rm "$file" ; rm "$file" ; done
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
49 echo "Deleting .elc files without .el files... Done"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
51
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
52 # Compute patterns to ignore when searching for files
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
53 ignore_dirs="egg its quail" # ### Not ported yet...
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 # Only use Mule XEmacs to compile Mule-specific elisp dirs
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
56 echo "Checking for Mule support..."
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
57 lisp_prog='(when (featurep (quote mule)) (message "yes"))'
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
58 if test -z `$REAL -batch -no-site-file -eval "$lisp_prog" 2>&1` ; then
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
59 ignore_dirs="$ignore_dirs mule"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
60 fi
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 # first recompile the byte-compiler, so that the other compiles take place
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 # 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
64 # 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
65 echo "Checking the byte compiler..."
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
66 $BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
68 # Prepare for byte-compiling directories with directory-specific instructions
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
69 make_special_commands=''
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
70 make_special () {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
71 dir="$1"; shift;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
72 ignore_dirs="$ignore_dirs $dir"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
73 make_special_commands="$make_special_commands \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
74 echo \"Compiling in lisp/$dir\"; \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
75 (cd \"lisp/$dir\"; \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
76 ${MAKE:-make} EMACS=$REAL ${1+$*}); \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
77 echo \"lisp/$dir done.\";"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
78 }
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
79
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
80 make_special vm
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
81 #make_special ediff elc
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
82 #make_special viper elc
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
83 make_special gnus some
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
84 make_special w3
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
85 make_special hyperbole elc
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
86 make_special oobr HYPB_ELC='' elc
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
87 make_special eos -k # not stricly necessary...
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
88 make_special ilisp elc
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
90 ignore_pattern=''
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
91 for dir in $ignore_dirs ; do
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
92 ignore_pattern="${ignore_pattern}/\\/$dir\\//d
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
93 /\\/$dir\$/d
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
94 "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
95 done
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
97 # Other special-case filenames that don't get byte-compiled
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
98 ignore_pattern="$ignore_pattern"'
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 \!/,!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 \!/edebug/edebug-test.el$!d
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
101 \!/emulators/edt.el$!d
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 \!/energize/energize-load.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 \!/energize/write-file.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 \!/paths.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 \!/prim/loadup.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 \!/prim/loadup-el.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 \!/prim/update-elc.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 \!/site-start.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 \!/site-load.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 \!/site-init.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 \!/version.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 \!/sunpro/sunpro-load.el$!d
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
113 '
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
115 echo "Compiling files without .elc..."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
116 NUMTOCOMPILE=20 # compile this many files with each invocation
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
117 comm -23 $els $elcs | \
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
118 sed "$ignore_pattern" | \
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
119 xargs -t -n$NUMTOCOMPILE $BYTECOMP -f batch-byte-compile
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
120 echo "Compiling files without .elc... Done"
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
121
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
123 echo "Compiling files with out-of-date .elc..."
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
124 find lisp/* $prune_vc -type d -print | \
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
125 sed "$ignore_pattern" | \
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
126 xargs -t $BYTECOMP -f batch-byte-recompile-directory
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
127 echo "Compiling files with out-of-date .elc... Done"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
130 eval "$make_special_commands"