Mercurial > hg > xemacs-beta
comparison lib-src/update-elc.sh-STEVE @ 72:b9518feda344 r20-0b31
Import from CVS: tag r20-0b31
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:03:46 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
71:bae944334fa4 | 72:b9518feda344 |
---|---|
1 #!/bin/sh | |
2 # update-elc.sh --- recompile all missing or out-or-date .elc files | |
3 | |
4 # Author: Jamie Zawinski, Ben Wing, Martin Buchholz | |
5 # Maintainer: Martin Buchholz | |
6 # Keywords: recompile .el .elc | |
7 | |
8 ### Commentary: | |
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. | |
14 | |
15 set -eu | |
16 | |
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 | |
22 | |
23 if test ! -d lisp/. ; then | |
24 echo "$0: Can't find the \`lisp' directory." | |
25 exit 1 | |
26 fi | |
27 | |
28 | |
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 | |
34 | |
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" | |
61 fi | |
62 | |
63 # first recompile the byte-compiler, so that the other compiles take place | |
64 # with the latest version (assuming we're compiling the lisp dir of the emacs | |
65 # we're running, which might not be the case, but often is.) | |
66 echo "Checking the byte compiler... " | |
67 $REAL -batch -q -no-site-file -f batch-byte-recompile-directory lisp/bytecomp | |
68 | |
69 # Prepare for byte-compiling directories with directory-specific instructions | |
70 make_special_commands='' | |
71 make_special () { | |
72 dir="$1"; shift; | |
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 } | |
80 | |
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 | |
91 | |
92 ignore_pattern='' | |
93 for dir in $ignore_dirs ; do | |
94 ignore_pattern="${ignore_pattern}/\\/$dir\\//d | |
95 /\\/$dir\$/d | |
96 " | |
97 done | |
98 | |
99 # Other special-case filenames that don't get byte-compiled | |
100 ignore_pattern="$ignore_pattern"' | |
101 \!/,!d | |
102 \!/edebug/edebug-test.el$!d | |
103 \!/emulators/edt.el$!d | |
104 \!/energize/energize-load.el$!d | |
105 \!/energize/write-file.el$!d | |
106 \!/paths.el$!d | |
107 \!/prim/loadup.el$!d | |
108 \!/prim/loadup-el.el$!d | |
109 \!/prim/update-elc.el$!d | |
110 \!/site-start.el$!d | |
111 \!/site-load.el$!d | |
112 \!/site-init.el$!d | |
113 \!/version.el$!d | |
114 \!/sunpro/sunpro-load.el$!d | |
115 ' | |
116 | |
117 echo "Compiling files without .elc..." | |
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" | |
122 | |
123 | |
124 echo "Compiling files with out-of-date .elc..." | |
125 find lisp/. -name SCCS -prune -o -type d -print | sed "$ignore_pattern" | \ | |
126 xargs -t $REAL -batch -q -no-site-file -f batch-byte-recompile-directory | |
127 echo "Compiling files with out-of-date .elc... Done" | |
128 | |
129 | |
130 eval "$make_special_commands" |