Mercurial > hg > xemacs-beta
comparison lib-src/update-elc.sh @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 1a767b41a199 |
children | b9518feda344 |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 ### update-elc.sh --- recompile all missing or out-or-date .elc files | 2 # update-elc.sh --- recompile all missing or out-or-date .elc files |
3 | 3 |
4 # Author: Jamie Zawinski <jwz@lucid.com> | 4 # Author: Jamie Zawinski, Ben Wing, Martin Buchholz |
5 # Maintainer: Steve Baur <steve@altair.xemacs.org> | 5 # Maintainer: Martin Buchholz |
6 # Created: ? | |
7 # Version: 1.0 | |
8 # Keywords: recompile .el .elc | 6 # Keywords: recompile .el .elc |
9 | 7 |
10 ### Commentary: | 8 ### Commentary: |
11 ## Recompile all .elc files that need recompilation. Requires a working | 9 ## Recompile all .elc files that need recompilation. Requires a |
12 ## version of 'xemacs'. Correctly handles the case where the .elc files | 10 ## working version of 'xemacs'. Correctly handles the case where the |
13 ## are missing; thus you can execute 'rm lisp/*/*.elc' before running | 11 ## .elc files are missing; thus you can execute 'rm lisp/*/*.elc' |
14 ## this script. Run this from the parent directory of 'src', 'lisp', | 12 ## before running this script. Run this from the parent of the |
15 ## and 'etc'. (If this is a Sun workspace, you can run it from | 13 ## `lisp' directory, or another nearby directory. |
16 ## 'era-specific' instead.) | |
17 | 14 |
18 set -e | 15 set -eu |
19 | 16 |
20 # This means we're running in a Sun workspace | 17 # Try to find the lisp directory in several places. |
21 if [ -d ../era-specific ]; then | 18 # (Sun workspaces have an `editor' directory) |
22 cd ../editor | 19 for dir in . .. ../.. editor ../editor ; do |
20 if test -d $dir ; then cd $dir ; break ; fi | |
21 done | |
22 | |
23 if test ! -d lisp/. ; then | |
24 echo "$0: Can't find the `lisp' directory." | |
25 exit 1 | |
23 fi | 26 fi |
24 | 27 |
25 # get to the right directory | 28 |
26 if [ ! -d ./lisp ]; then | 29 EMACS=${XEMACS:-./src/xemacs}; export EMACS |
27 if [ -d ../lisp ]; then | 30 REAL=`cd \`dirname $EMACS\` ; pwd | sed 's:^/tmp_mnt::'`/`basename $EMACS` |
28 cd .. | 31 echo "Recompiling in `pwd|sed 's:^/tmp_mnt::'`" |
29 else | 32 echo " with $REAL..." |
30 echo $0: neither ./lisp/ nor ../lisp/ exist | 33 |
31 exit 1 | 34 |
32 fi | 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 | |
43 | |
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" | |
48 | |
49 | |
50 # Compute patterns to ignore when searching for files | |
51 ignore_dirs="egg its quail" # ### Not ported yet... | |
52 | |
53 # Only use Mule XEmacs to compile Mule-specific elisp dirs | |
54 echo "Checking for Mule support..." | |
55 # You cannot just use 'test -n' here because it will fail on a null | |
56 # return value (null != null string) | |
57 mule_check=`$REAL -batch -no-site-file \ | |
58 -eval "(when (featurep 'mule) (message \"yes\"))" 2>&1` | |
59 if [ -z "$mule_check" ]; then | |
60 ignore_dirs="$ignore_dirs mule" | |
33 fi | 61 fi |
34 | |
35 EMACS="./src/xemacs" | |
36 export EMACS | |
37 | |
38 echo " (using $EMACS)" | |
39 | |
40 # fuckin' sysv, man... | |
41 if [ "`uname -r | sed 's/\(.\).*/\1/'`" -gt 4 ]; then | |
42 echon() | |
43 { | |
44 /bin/echo $* '\c' | |
45 } | |
46 else | |
47 echon() | |
48 { | |
49 echo -n $* | |
50 } | |
51 fi | |
52 | |
53 REAL=`cd \`dirname $EMACS\` ; pwd | sed 's|^/tmp_mnt||'`/`basename $EMACS` | |
54 BYTECOMP="$REAL -batch -q -no-site-file " | |
55 echo "Recompiling in `pwd|sed 's|^/tmp_mnt||'`" | |
56 echo " with $REAL..." | |
57 | |
58 $EMACS -batch -q -l `pwd`/lisp/prim/cleantree -f batch-remove-old-elc lisp | |
59 | |
60 prune_vc="( -name SCCS -o -name RCS -o -name CVS ) -prune -o" | |
61 | |
62 tmp1=/tmp/rcl1.$$ | |
63 tmp2=/tmp/rcl2.$$ | |
64 rm -f $tmp1 $tmp2 | |
65 | |
66 # tmp1 is a list of all .el files | |
67 # tmp2 is a list of all .elc files | |
68 find lisp/. $prune_vc -name '*.el' -print | sort > $tmp1 | |
69 find lisp/. $prune_vc -name '*.elc' -print | sed 's/elc$/el/' | sort > $tmp2 | |
70 | |
71 echon "Deleting .elc files without .el files... " | |
72 # (except for vm/vm.elc) | |
73 comm -13 $tmp1 $tmp2 | sed 's/\(.*\)\.el$/echo \1.elc ; rm \1.elc/' | sh | |
74 echo done. | |
75 | 62 |
76 # first recompile the byte-compiler, so that the other compiles take place | 63 # first recompile the byte-compiler, so that the other compiles take place |
77 # with the latest version (assuming we're compiling the lisp dir of the emacs | 64 # with the latest version (assuming we're compiling the lisp dir of the emacs |
78 # we're running, which might not be the case, but often is.) | 65 # we're running, which might not be the case, but often is.) |
79 # | 66 echo "Checking the byte compiler... " |
80 echon "Checking the byte compiler... " | 67 $REAL -batch -q -no-site-file -f batch-byte-recompile-directory lisp/bytecomp |
81 $BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp | |
82 | 68 |
83 # vm is hard, and must be done first ... | 69 # Prepare for byte-compiling directories with directory-specific instructions |
84 # | 70 make_special_commands='' |
85 echon "Compiling VM... " | 71 make_special () { |
86 ( cd lisp/vm ; ${MAKE:-make} EMACS=$REAL autoload) | 72 dir="$1"; shift; |
87 echo done. | 73 ignore_dirs="$ignore_dirs $dir" |
74 make_special_commands="$make_special_commands \ | |
75 echo \"Compiling in lisp/$dir\"; \ | |
76 (cd \"lisp/$dir\"; \ | |
77 ${MAKE:-make} EMACS=$REAL ${1+$*}); \ | |
78 echo \"lisp/$dir done.\";" | |
79 } | |
88 | 80 |
89 echo Compiling files without .elc... | 81 make_special vm |
82 make_special ediff elc | |
83 make_special viper elc | |
84 make_special gnus some | |
85 make_special w3 | |
86 make_special url # really part of w3 | |
87 make_special hyperbole elc | |
88 make_special oobr HYPB_ELC= elc | |
89 make_special eos -k # not stricly necessary... | |
90 make_special ilisp compile -f Makefile | |
90 | 91 |
91 # Isn't it wonderful the number of different ways you can | 92 ignore_pattern='' |
92 # iterate over a list of files? | 93 for dir in $ignore_dirs ; do |
94 ignore_pattern="${ignore_pattern}/\\/$dir\\//d | |
95 /\\/$dir\$/d | |
96 " | |
97 done | |
93 | 98 |
94 # | 99 # Other special-case filenames that don't get byte-compiled |
95 # Second compile all files which don't have a .elc version, except for these: | 100 ignore_pattern="$ignore_pattern"' |
96 # | |
97 | |
98 NUMTOCOMPILE=20 # compile up to 20 files with each invocation | |
99 | |
100 comm -23 $tmp1 $tmp2 | sed ' | |
101 \!/,!d | 101 \!/,!d |
102 \!/edebug/edebug-test.el$!d | 102 \!/edebug/edebug-test.el$!d |
103 \!/emulators/edt.el$!d | |
103 \!/energize/energize-load.el$!d | 104 \!/energize/energize-load.el$!d |
104 \!/energize/write-file.el$!d | 105 \!/energize/write-file.el$!d |
105 \!/eos/!d | |
106 \!/gnus/!d | |
107 \!/efs/!d | |
108 \!/ilisp/!d | |
109 \!/paths.el$!d | 106 \!/paths.el$!d |
110 \!/prim/loadup.el$!d | 107 \!/prim/loadup.el$!d |
111 \!/prim/loadup-el.el$!d | 108 \!/prim/loadup-el.el$!d |
112 \!/prim/update-elc.el$!d | 109 \!/prim/update-elc.el$!d |
113 \!/site-start.el$!d | 110 \!/site-start.el$!d |
114 \!/site-load.el$!d | 111 \!/site-load.el$!d |
115 \!/site-init.el$!d | 112 \!/site-init.el$!d |
116 \!/version.el$!d | 113 \!/version.el$!d |
117 \!/sunpro/sunpro-load.el$!d | 114 \!/sunpro/sunpro-load.el$!d |
118 \!/vm/!d | 115 ' |
119 \!/w3/!d | |
120 \!/hyperbole/!d | |
121 \!/auctex/!d | |
122 \!/oobr/!d | |
123 \!/egg/!d | |
124 \!/its/!d | |
125 \!/mule/!d | |
126 \!/quail/!d | |
127 ' | xargs -t -n$NUMTOCOMPILE $BYTECOMP -f batch-byte-compile | |
128 | 116 |
129 rm -f $tmp1 $tmp2 | 117 echo "Compiling files without .elc..." |
130 echo Done. | 118 NUMTOCOMPILE=20 # compile this many files with each invocation |
119 comm -23 $els $elcs | sed "$ignore_pattern" | \ | |
120 xargs -t -n$NUMTOCOMPILE $REAL -batch -q -no-site-file -f batch-byte-compile | |
121 echo "Compiling files without .elc... Done" | |
131 | 122 |
132 if [ -d lisp/ediff ]; then | |
133 echo Compiling EDIFF... | |
134 ( cd lisp/ediff ; ${MAKE:-make} EMACS=$REAL elc ) | |
135 echo EDIFF done. | |
136 fi | |
137 | 123 |
138 if [ -d lisp/viper ]; then | 124 echo "Compiling files with out-of-date .elc..." |
139 echo Compiling Viper... | 125 find lisp/. -name SCCS -prune -o -type d -print | sed "$ignore_pattern" | \ |
140 ( cd lisp/viper ; ${MAKE:-make} EMACS=$REAL elc ) | 126 xargs -t $REAL -batch -q -no-site-file -f batch-byte-recompile-directory |
141 echo Viper done. | 127 echo "Compiling files with out-of-date .elc... Done" |
142 fi | |
143 | 128 |
144 if [ -d lisp/efs ]; then | |
145 echo Compiling efs... | |
146 ( cd lisp/efs ; ${MAKE:-make} EMACS=$REAL ) | |
147 echo efs done. | |
148 fi | |
149 | 129 |
150 # Gnus now has a makefile... | 130 eval "$make_special_commands" |
151 echo Compiling Gnus... | |
152 ( cd lisp/gnus ; ${MAKE:-make} EMACS=$REAL some ) | |
153 echo Gnus done. | |
154 | |
155 # and gee w3 has its own makefile as well | |
156 # (no especial need to use it, though) | |
157 echo Compiling W3... | |
158 ( cd lisp/w3 ; ${MAKE:-make} EMACS=$REAL xemacs-w3 ) | |
159 echo W3 done. | |
160 | |
161 # Hyperbole has to be different as well. What is it with these big packages? | |
162 echo Compiling Hyperbole... | |
163 ( cd lisp/hyperbole ; ${MAKE:-make} EMACS=$REAL elc ) | |
164 echo Hyperbole done. | |
165 | |
166 # OO-Browser too | |
167 echo Compiling OO-Browser... | |
168 ( cd lisp/oobr ; ${MAKE:-make} EMACS=$REAL HYPB_ELC='' elc ) | |
169 echo OO-Browser done. | |
170 | |
171 # this is not strictly necessary but there are some special dependencies | |
172 echo Compiling EOS... | |
173 ( cd lisp/eos ; ${MAKE:-make} -k EMACS=$REAL ) | |
174 echo EOS done. | |
175 | |
176 # ilisp would seem to take a little extra now as well | |
177 # previously this was up top, but it requires that comint.elc exists. | |
178 | |
179 echo Compiling Ilisp... | |
180 ( cd lisp/ilisp ; ${MAKE:-make} elc -f Makefile EMACS=$REAL ) | |
181 echo Ilisp done. | |
182 | |
183 # AUC TeX requires special treatment | |
184 echo Compiling AUC TeX... | |
185 ( cd lisp/auctex ; ${MAKE:-make} some -f Makefile EMACS=$REAL ) | |
186 echo AUC TeX done. |