comparison lib-src/update-elc.sh @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents a145efe76779
children fe104dbd9147
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
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-of-date .elc files
3 3
4 # Author: Jamie Zawinski, Ben Wing, Martin Buchholz 4 # Author: Jamie Zawinski, Ben Wing, Martin Buchholz
5 # Maintainer: Martin Buchholz 5 # Maintainer: Martin Buchholz
6 # Keywords: recompile .el .elc 6 # Keywords: recompile byte-compile .el .elc
7 7
8 ### Commentary: 8 ### Commentary:
9 ## Recompile all .elc files that need recompilation. Requires a 9 ## Recompile all .elc files that need recompilation. Requires a
10 ## working version of 'xemacs'. Correctly handles the case where the 10 ## working version of "xemacs". Correctly handles the case where the
11 ## .elc files are missing; thus you can execute 'rm lisp/*/*.elc' 11 ## .elc files are missing; thus you can execute "rm lisp/*/*.elc"
12 ## before running this script. Run this from the parent of the 12 ## before running this script. Run this from the parent of the
13 ## `lisp' directory, or another nearby directory. 13 ## "lisp" directory, or another nearby directory.
14 14
15 set -eu 15 set -e
16 16
17 # Try to find the lisp directory in several places. 17 # Try to find the lisp directory in several places.
18 # (Sun workspaces have an `editor' directory) 18 # (Sun workspaces have an "editor" directory)
19 for dir in . .. ../.. editor ../editor ; do 19 for dir in . .. ../.. editor ../editor ; do
20 if test -d $dir ; then cd $dir ; break ; fi 20 if test -d $dir/lisp/. ; then cd $dir ; break ; fi
21 done 21 done
22 22
23 if test ! -d lisp/. ; then 23 if test ! -d lisp/. ; then
24 echo "$0: Cannot find the \`lisp' directory." 24 echo "$0: Cannot find the \"lisp\" directory."
25 exit 1 25 exit 1
26 fi 26 fi
27 27
28 # Determine xemacs executable to use for compilation.
29 if test -n "$XEMACS" ; then
30 EMACS="$XEMACS"
31 elif test -x ./src/xemacs ; then
32 EMACS="./src/xemacs"
33 elif test -x "$EMACS" ; then
34 :
35 else
36 EMACS=xemacs
37 fi
38 case "$EMACS" in
39 */* ) : ;; # Pathname specified
40 *) # Need to find executable on PATH
41 for dir in `echo $PATH | sed 's/:/ /g'` ; do
42 if test -x "dir/xemacs" ; then
43 EMACS="$dir/$EMACS"
44 break
45 fi
46 done ;;
47 esac
48 # Canonicalize
49 EMACS=`cd \`dirname $EMACS\` ; pwd | sed 's:^/tmp_mnt::'`/`basename $EMACS`
50 export EMACS
28 51
29 EMACS=${XEMACS:-./src/xemacs}; export EMACS
30 REAL=`cd \`dirname $EMACS\` ; pwd | sed 's:^/tmp_mnt::'`/`basename $EMACS`
31 BYTECOMP="$REAL -batch -q -no-site-file -l bytecomp"
32 echo "Recompiling in `pwd|sed 's:^/tmp_mnt::'`" 52 echo "Recompiling in `pwd|sed 's:^/tmp_mnt::'`"
33 echo " with $REAL..." 53 echo " with $EMACS..."
34 54
35 prune_vc="( -name SCCS -o -name RCS -o -name CVS ) -prune -o" 55 prune_vc="( -name SCCS -o -name RCS -o -name CVS ) -prune -o"
36 56
57 $EMACS -batch -q -no-site-file -l cleantree -f batch-remove-old-elc lisp
58
37 # $els is a list of all .el files 59 # $els is a list of all .el files
38 # $elcs is a list of all .elc files 60 # $elcs is a list of all .elc files
39 els=/tmp/rcl1.$$ ; elcs=/tmp/rcl2.$$ 61 els=/tmp/update-elc-1.$$ elcs=/tmp/update-elc-2.$$
40 rm -f $els $elcs 62 rm -f $els $elcs
41 trap "rm -f $els $elcs" 0 1 2 3 15 63 trap "rm -f $els $elcs" 0 1 2 3 15
42 find lisp/. $prune_vc -name '*.el' -print | sort > $els 64 find lisp/. $prune_vc -name '*.el' -print | sort > $els
43 find lisp/. $prune_vc -name '*.elc' -print | sed 's/elc$/el/' | sort > $elcs 65 find lisp/. $prune_vc -name '*.elc' -print | sed 's/elc$/el/' | sort > $elcs
44 66
45 67
46 echo "Deleting .elc files without .el files..." 68 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/' | \ 69 comm -13 $els $elcs | sed -e '\!/vm.el!d' -e 's/el$/elc/' | \
48 while read file ; do echo rm "$file" ; rm "$file" ; done 70 while read file ; do echo rm "$file" ; rm "$file" ; done
49 echo "Deleting .elc files without .el files... Done" 71 echo "Deleting .elc files without .el files... Done"
50 72
51 73
52 # Compute patterns to ignore when searching for files 74 # Compute patterns to ignore when searching for files
53 ignore_dirs="its quail" # ### Not ported yet... 75 ignore_dirs="its quail" # ### Not ported yet...
54 76
55 # Only use Mule XEmacs to compile Mule-specific elisp dirs 77 # Only use Mule XEmacs to compile Mule-specific elisp dirs
56 echo "Checking for Mule support..." 78 echo "Checking for Mule support..."
57 lisp_prog='(princ (featurep (quote mule)))' 79 lisp_prog='(princ (featurep (quote mule)))'
58 mule_p="`$REAL -batch -no-site-file -eval \"$lisp_prog\"`" 80 mule_p="`$EMACS -batch -no-site-file -eval \"$lisp_prog\"`"
59 if test "$mule_p" = nil ; then 81 if test "$mule_p" = nil ; then
60 echo No 82 echo No
61 ignore_dirs="$ignore_dirs mule" 83 ignore_dirs="$ignore_dirs mule"
62 elif test "$mule_p" = t; then 84 elif test "$mule_p" = t; then
63 echo Yes 85 echo Yes
68 90
69 # first recompile the byte-compiler, so that the other compiles take place 91 # 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 92 # 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.) 93 # we're running, which might not be the case, but often is.)
72 echo "Checking the byte compiler..." 94 echo "Checking the byte compiler..."
95 BYTECOMP="$EMACS -batch -q -no-site-file -l bytecomp"
73 $BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp 96 $BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp
97
98 # Byte-compile VM first, because other packages depend on it,
99 # but it depends on nothing (Kyle is like that).
100 ignore_dirs="$ignore_dirs vm"
101 echo "Compiling in lisp/vm";
102 (cd lisp/vm && ${MAKE:-make} EMACS=$EMACS)
103 echo "lisp/vm done."
74 104
75 # Prepare for byte-compiling directories with directory-specific instructions 105 # Prepare for byte-compiling directories with directory-specific instructions
76 make_special_commands='' 106 make_special_commands=''
77 make_special () { 107 make_special () {
78 dir="$1"; shift; 108 dir="$1"; shift;
79 ignore_dirs="$ignore_dirs $dir" 109 ignore_dirs="$ignore_dirs $dir"
80 make_special_commands="$make_special_commands \ 110 make_special_commands="$make_special_commands \
81 echo \"Compiling in lisp/$dir\"; \ 111 echo \"Compiling in lisp/$dir\"; \
82 (cd \"lisp/$dir\"; \ 112 (cd \"lisp/$dir\" && ${MAKE:-make} EMACS=$EMACS ${1+$*}); \
83 ${MAKE:-make} EMACS=$REAL ${1+$*}); \
84 echo \"lisp/$dir done.\";" 113 echo \"lisp/$dir done.\";"
85 } 114 }
86 115
87 make_special vm 116 #make_special vm
88 make_special efs
89 #make_special ediff elc 117 #make_special ediff elc
90 #make_special viper elc 118 #make_special viper elc
119 make_special efs
91 make_special gnus some 120 make_special gnus some
92 make_special w3 121 make_special w3
93 make_special hyperbole elc 122 make_special hyperbole elc
94 make_special oobr HYPB_ELC='' elc 123 make_special oobr HYPB_ELC='' elc
95 make_special eos -k # not stricly necessary... 124 make_special eos -k # not stricly necessary...
132 find lisp/* $prune_vc -type d -print | \ 161 find lisp/* $prune_vc -type d -print | \
133 sed "$ignore_pattern" | \ 162 sed "$ignore_pattern" | \
134 xargs -t $BYTECOMP -f batch-byte-recompile-directory 163 xargs -t $BYTECOMP -f batch-byte-recompile-directory
135 echo "Compiling files with out-of-date .elc... Done" 164 echo "Compiling files with out-of-date .elc... Done"
136 165
137
138 eval "$make_special_commands" 166 eval "$make_special_commands"