annotate lib-src/update-elc.sh @ 102:a145efe76779 r20-1b3

Import from CVS: tag r20-1b3
author cvs
date Mon, 13 Aug 2007 09:15:49 +0200
parents 4be1180a9e89
children 360340f9fd5f
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
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
53 ignore_dirs="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..."
84
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
57 lisp_prog='(princ (featurep (quote mule)))'
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
58 mule_p="`$REAL -batch -no-site-file -eval \"$lisp_prog\"`"
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
59 if test "$mule_p" = nil ; then
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
60 echo No
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
61 ignore_dirs="$ignore_dirs mule"
84
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
62 elif test "$mule_p" = t; then
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
63 echo Yes
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
64 else
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
65 echo "Error determining presence of mule support"
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 80
diff changeset
66 exit 1;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
67 fi
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 # first recompile the byte-compiler, so that the other compiles take place
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 # 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
71 # 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
72 echo "Checking the byte compiler..."
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
73 $BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
75 # Prepare for byte-compiling directories with directory-specific instructions
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
76 make_special_commands=''
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
77 make_special () {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
78 dir="$1"; shift;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
79 ignore_dirs="$ignore_dirs $dir"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
80 make_special_commands="$make_special_commands \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
81 echo \"Compiling in lisp/$dir\"; \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
82 (cd \"lisp/$dir\"; \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
83 ${MAKE:-make} EMACS=$REAL ${1+$*}); \
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
84 echo \"lisp/$dir done.\";"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
85 }
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
86
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
87 make_special vm
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 84
diff changeset
88 make_special efs
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
89 #make_special ediff elc
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
90 #make_special viper elc
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
91 make_special gnus some
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
92 make_special w3
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
93 make_special hyperbole elc
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
94 make_special oobr HYPB_ELC='' elc
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
95 make_special eos -k # not stricly necessary...
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
96 make_special ilisp elc
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 100
diff changeset
97 make_special auctex some
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
99 ignore_pattern=''
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
100 for dir in $ignore_dirs ; do
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
101 ignore_pattern="${ignore_pattern}/\\/$dir\\//d
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
102 /\\/$dir\$/d
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
103 "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
104 done
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
106 # Other special-case filenames that don't get byte-compiled
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
107 ignore_pattern="$ignore_pattern"'
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 \!/,!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 \!/edebug/edebug-test.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 \!/energize/energize-load.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 \!/energize/write-file.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 \!/paths.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 \!/prim/loadup.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 \!/prim/loadup-el.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 \!/prim/update-elc.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 \!/site-start.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 \!/site-load.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 \!/site-init.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 \!/version.el$!d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 \!/sunpro/sunpro-load.el$!d
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
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 without .elc..."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
124 NUMTOCOMPILE=20 # compile this many files with each invocation
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
125 comm -23 $els $elcs | \
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
126 sed "$ignore_pattern" | \
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
127 xargs -t -n$NUMTOCOMPILE $BYTECOMP -f batch-byte-compile
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
128 echo "Compiling files without .elc... Done"
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
129
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
131 echo "Compiling files with out-of-date .elc..."
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
132 find lisp/* $prune_vc -type d -print | \
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
133 sed "$ignore_pattern" | \
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
134 xargs -t $BYTECOMP -f batch-byte-recompile-directory
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
135 echo "Compiling files with out-of-date .elc... Done"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
138 eval "$make_special_commands"