annotate lib-src/update-elc.sh @ 72:b9518feda344 r20-0b31

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