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