0
|
1 #!/bin/sh
|
70
|
2 # update-elc.sh --- recompile all missing or out-or-date .elc files
|
0
|
3
|
70
|
4 # Author: Jamie Zawinski, Ben Wing, Martin Buchholz
|
|
5 # Maintainer: Martin Buchholz
|
0
|
6 # Keywords: recompile .el .elc
|
|
7
|
|
8 ### Commentary:
|
70
|
9 ## Recompile all .elc files that need recompilation. Requires a
|
|
10 ## working version of 'xemacs'. Correctly handles the case where the
|
|
11 ## .elc files are missing; thus you can execute 'rm lisp/*/*.elc'
|
|
12 ## before running this script. Run this from the parent of the
|
|
13 ## `lisp' directory, or another nearby directory.
|
0
|
14
|
70
|
15 set -eu
|
0
|
16
|
70
|
17 # Try to find the lisp directory in several places.
|
|
18 # (Sun workspaces have an `editor' directory)
|
|
19 for dir in . .. ../.. editor ../editor ; do
|
|
20 if test -d $dir ; then cd $dir ; break ; fi
|
|
21 done
|
0
|
22
|
70
|
23 if test ! -d lisp/. ; then
|
72
|
24 echo "$0: Can't find the \`lisp' directory."
|
70
|
25 exit 1
|
0
|
26 fi
|
|
27
|
36
|
28
|
70
|
29 EMACS=${XEMACS:-./src/xemacs}; export EMACS
|
|
30 REAL=`cd \`dirname $EMACS\` ; pwd | sed 's:^/tmp_mnt::'`/`basename $EMACS`
|
|
31 echo "Recompiling in `pwd|sed 's:^/tmp_mnt::'`"
|
|
32 echo " with $REAL..."
|
|
33
|
0
|
34
|
70
|
35 # $els is a list of all .el files
|
|
36 # $elcs is a list of all .elc files
|
|
37 els=/tmp/rcl1.$$ ; elcs=/tmp/rcl2.$$
|
|
38 rm -f $els $elcs
|
|
39 trap "rm -f $els $elcs" 0 1 2 3 15
|
|
40 find lisp/. -name SCCS -prune -o -name '*.el' -print | sort > $els
|
|
41 find lisp/. -name SCCS -prune -o -name '*.elc' -print | sed 's/elc$/el/' | sort > $elcs
|
|
42
|
0
|
43
|
70
|
44 echo "Deleting .elc files without .el files..."
|
|
45 comm -13 $els $elcs | sed -e '\!/vm.el!d' -e '\!/w3.el!d' -e 's/el$/elc/' | \
|
|
46 while read file ; do echo rm "$file" ; rm "$file" ; done
|
|
47 echo "Deleting .elc files without .el files... Done"
|
0
|
48
|
30
|
49
|
70
|
50 # Compute patterns to ignore when searching for files
|
|
51 ignore_dirs="egg its quail" # ### Not ported yet...
|
0
|
52
|
70
|
53 # Only use Mule XEmacs to compile Mule-specific elisp dirs
|
|
54 echo "Checking for Mule support..."
|
72
|
55 lisp_prog='(when (featurep (quote mule)) (message "yes"))'
|
|
56 if test -z `$REAL -batch -no-site-file -eval "$lisp_prog" 2>&1` ; then
|
70
|
57 ignore_dirs="$ignore_dirs mule"
|
|
58 fi
|
0
|
59
|
|
60 # first recompile the byte-compiler, so that the other compiles take place
|
|
61 # with the latest version (assuming we're compiling the lisp dir of the emacs
|
|
62 # we're running, which might not be the case, but often is.)
|
70
|
63 echo "Checking the byte compiler... "
|
|
64 $REAL -batch -q -no-site-file -f batch-byte-recompile-directory lisp/bytecomp
|
0
|
65
|
70
|
66 # Prepare for byte-compiling directories with directory-specific instructions
|
|
67 make_special_commands=''
|
|
68 make_special () {
|
|
69 dir="$1"; shift;
|
|
70 ignore_dirs="$ignore_dirs $dir"
|
|
71 make_special_commands="$make_special_commands \
|
|
72 echo \"Compiling in lisp/$dir\"; \
|
|
73 (cd \"lisp/$dir\"; \
|
|
74 ${MAKE:-make} EMACS=$REAL ${1+$*}); \
|
|
75 echo \"lisp/$dir done.\";"
|
|
76 }
|
30
|
77
|
70
|
78 make_special vm
|
|
79 make_special ediff elc
|
|
80 make_special viper elc
|
|
81 make_special gnus some
|
|
82 make_special w3
|
|
83 make_special url # really part of w3
|
|
84 make_special hyperbole elc
|
|
85 make_special oobr HYPB_ELC= elc
|
|
86 make_special eos -k # not stricly necessary...
|
|
87 make_special ilisp compile -f Makefile
|
0
|
88
|
70
|
89 ignore_pattern=''
|
|
90 for dir in $ignore_dirs ; do
|
|
91 ignore_pattern="${ignore_pattern}/\\/$dir\\//d
|
|
92 /\\/$dir\$/d
|
|
93 "
|
|
94 done
|
0
|
95
|
70
|
96 # Other special-case filenames that don't get byte-compiled
|
|
97 ignore_pattern="$ignore_pattern"'
|
0
|
98 \!/,!d
|
|
99 \!/edebug/edebug-test.el$!d
|
70
|
100 \!/emulators/edt.el$!d
|
0
|
101 \!/energize/energize-load.el$!d
|
|
102 \!/energize/write-file.el$!d
|
|
103 \!/paths.el$!d
|
|
104 \!/prim/loadup.el$!d
|
|
105 \!/prim/loadup-el.el$!d
|
|
106 \!/prim/update-elc.el$!d
|
|
107 \!/site-start.el$!d
|
|
108 \!/site-load.el$!d
|
|
109 \!/site-init.el$!d
|
|
110 \!/version.el$!d
|
|
111 \!/sunpro/sunpro-load.el$!d
|
70
|
112 '
|
0
|
113
|
70
|
114 echo "Compiling files without .elc..."
|
|
115 NUMTOCOMPILE=20 # compile this many files with each invocation
|
|
116 comm -23 $els $elcs | sed "$ignore_pattern" | \
|
|
117 xargs -t -n$NUMTOCOMPILE $REAL -batch -q -no-site-file -f batch-byte-compile
|
|
118 echo "Compiling files without .elc... Done"
|
22
|
119
|
0
|
120
|
70
|
121 echo "Compiling files with out-of-date .elc..."
|
|
122 find lisp/. -name SCCS -prune -o -type d -print | sed "$ignore_pattern" | \
|
|
123 xargs -t $REAL -batch -q -no-site-file -f batch-byte-recompile-directory
|
|
124 echo "Compiling files with out-of-date .elc... Done"
|
0
|
125
|
|
126
|
70
|
127 eval "$make_special_commands"
|