Mercurial > hg > xemacs-beta
diff 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 |
line wrap: on
line diff
--- a/lib-src/update-elc.sh Mon Aug 13 09:00:04 2007 +0200 +++ b/lib-src/update-elc.sh Mon Aug 13 09:02:59 2007 +0200 @@ -1,111 +1,108 @@ #!/bin/sh -### update-elc.sh --- recompile all missing or out-or-date .elc files +# update-elc.sh --- recompile all missing or out-or-date .elc files -# Author: Jamie Zawinski <jwz@lucid.com> -# Maintainer: Steve Baur <steve@altair.xemacs.org> -# Created: ? -# Version: 1.0 +# Author: Jamie Zawinski, Ben Wing, Martin Buchholz +# Maintainer: Martin Buchholz # Keywords: recompile .el .elc ### Commentary: -## Recompile all .elc files that need recompilation. Requires a working -## version of 'xemacs'. Correctly handles the case where the .elc files -## are missing; thus you can execute 'rm lisp/*/*.elc' before running -## this script. Run this from the parent directory of 'src', 'lisp', -## and 'etc'. (If this is a Sun workspace, you can run it from -## 'era-specific' instead.) +## Recompile all .elc files that need recompilation. Requires a +## working version of 'xemacs'. Correctly handles the case where the +## .elc files are missing; thus you can execute 'rm lisp/*/*.elc' +## before running this script. Run this from the parent of the +## `lisp' directory, or another nearby directory. -set -e +set -eu -# This means we're running in a Sun workspace -if [ -d ../era-specific ]; then - cd ../editor -fi +# Try to find the lisp directory in several places. +# (Sun workspaces have an `editor' directory) +for dir in . .. ../.. editor ../editor ; do + if test -d $dir ; then cd $dir ; break ; fi +done -# get to the right directory -if [ ! -d ./lisp ]; then - if [ -d ../lisp ]; then - cd .. - else - echo $0: neither ./lisp/ nor ../lisp/ exist - exit 1 - fi +if test ! -d lisp/. ; then + echo "$0: Can't find the `lisp' directory." + exit 1 fi -EMACS="./src/xemacs" -export EMACS -echo " (using $EMACS)" +EMACS=${XEMACS:-./src/xemacs}; export EMACS +REAL=`cd \`dirname $EMACS\` ; pwd | sed 's:^/tmp_mnt::'`/`basename $EMACS` +echo "Recompiling in `pwd|sed 's:^/tmp_mnt::'`" +echo " with $REAL..." + -# fuckin' sysv, man... -if [ "`uname -r | sed 's/\(.\).*/\1/'`" -gt 4 ]; then - echon() - { - /bin/echo $* '\c' - } -else - echon() - { - echo -n $* - } -fi +# $els is a list of all .el files +# $elcs is a list of all .elc files +els=/tmp/rcl1.$$ ; elcs=/tmp/rcl2.$$ +rm -f $els $elcs +trap "rm -f $els $elcs" 0 1 2 3 15 +find lisp/. -name SCCS -prune -o -name '*.el' -print | sort > $els +find lisp/. -name SCCS -prune -o -name '*.elc' -print | sed 's/elc$/el/' | sort > $elcs + -REAL=`cd \`dirname $EMACS\` ; pwd | sed 's|^/tmp_mnt||'`/`basename $EMACS` -BYTECOMP="$REAL -batch -q -no-site-file " -echo "Recompiling in `pwd|sed 's|^/tmp_mnt||'`" -echo " with $REAL..." +echo "Deleting .elc files without .el files..." +comm -13 $els $elcs | sed -e '\!/vm.el!d' -e '\!/w3.el!d' -e 's/el$/elc/' | \ + while read file ; do echo rm "$file" ; rm "$file" ; done +echo "Deleting .elc files without .el files... Done" -$EMACS -batch -q -l `pwd`/lisp/prim/cleantree -f batch-remove-old-elc lisp -prune_vc="( -name SCCS -o -name RCS -o -name CVS ) -prune -o" +# Compute patterns to ignore when searching for files +ignore_dirs="egg its quail" # ### Not ported yet... -tmp1=/tmp/rcl1.$$ -tmp2=/tmp/rcl2.$$ -rm -f $tmp1 $tmp2 - -# tmp1 is a list of all .el files -# tmp2 is a list of all .elc files -find lisp/. $prune_vc -name '*.el' -print | sort > $tmp1 -find lisp/. $prune_vc -name '*.elc' -print | sed 's/elc$/el/' | sort > $tmp2 - -echon "Deleting .elc files without .el files... " -# (except for vm/vm.elc) -comm -13 $tmp1 $tmp2 | sed 's/\(.*\)\.el$/echo \1.elc ; rm \1.elc/' | sh -echo done. +# Only use Mule XEmacs to compile Mule-specific elisp dirs +echo "Checking for Mule support..." +# You cannot just use 'test -n' here because it will fail on a null +# return value (null != null string) +mule_check=`$REAL -batch -no-site-file \ + -eval "(when (featurep 'mule) (message \"yes\"))" 2>&1` +if [ -z "$mule_check" ]; then + ignore_dirs="$ignore_dirs mule" +fi # first recompile the byte-compiler, so that the other compiles take place # with the latest version (assuming we're compiling the lisp dir of the emacs # we're running, which might not be the case, but often is.) -# -echon "Checking the byte compiler... " -$BYTECOMP -f batch-byte-recompile-directory lisp/bytecomp +echo "Checking the byte compiler... " +$REAL -batch -q -no-site-file -f batch-byte-recompile-directory lisp/bytecomp -# vm is hard, and must be done first ... -# -echon "Compiling VM... " -( cd lisp/vm ; ${MAKE:-make} EMACS=$REAL autoload) -echo done. +# Prepare for byte-compiling directories with directory-specific instructions +make_special_commands='' +make_special () { + dir="$1"; shift; + ignore_dirs="$ignore_dirs $dir" + make_special_commands="$make_special_commands \ +echo \"Compiling in lisp/$dir\"; \ +(cd \"lisp/$dir\"; \ +${MAKE:-make} EMACS=$REAL ${1+$*}); \ +echo \"lisp/$dir done.\";" +} -echo Compiling files without .elc... - -# Isn't it wonderful the number of different ways you can -# iterate over a list of files? +make_special vm +make_special ediff elc +make_special viper elc +make_special gnus some +make_special w3 +make_special url # really part of w3 +make_special hyperbole elc +make_special oobr HYPB_ELC= elc +make_special eos -k # not stricly necessary... +make_special ilisp compile -f Makefile -# -# Second compile all files which don't have a .elc version, except for these: -# +ignore_pattern='' +for dir in $ignore_dirs ; do + ignore_pattern="${ignore_pattern}/\\/$dir\\//d +/\\/$dir\$/d +" +done -NUMTOCOMPILE=20 # compile up to 20 files with each invocation - -comm -23 $tmp1 $tmp2 | sed ' +# Other special-case filenames that don't get byte-compiled +ignore_pattern="$ignore_pattern"' \!/,!d \!/edebug/edebug-test.el$!d +\!/emulators/edt.el$!d \!/energize/energize-load.el$!d \!/energize/write-file.el$!d -\!/eos/!d -\!/gnus/!d -\!/efs/!d -\!/ilisp/!d \!/paths.el$!d \!/prim/loadup.el$!d \!/prim/loadup-el.el$!d @@ -115,72 +112,19 @@ \!/site-init.el$!d \!/version.el$!d \!/sunpro/sunpro-load.el$!d -\!/vm/!d -\!/w3/!d -\!/hyperbole/!d -\!/auctex/!d -\!/oobr/!d -\!/egg/!d -\!/its/!d -\!/mule/!d -\!/quail/!d -' | xargs -t -n$NUMTOCOMPILE $BYTECOMP -f batch-byte-compile - -rm -f $tmp1 $tmp2 -echo Done. +' -if [ -d lisp/ediff ]; then - echo Compiling EDIFF... - ( cd lisp/ediff ; ${MAKE:-make} EMACS=$REAL elc ) - echo EDIFF done. -fi - -if [ -d lisp/viper ]; then - echo Compiling Viper... - ( cd lisp/viper ; ${MAKE:-make} EMACS=$REAL elc ) - echo Viper done. -fi - -if [ -d lisp/efs ]; then - echo Compiling efs... - ( cd lisp/efs ; ${MAKE:-make} EMACS=$REAL ) - echo efs done. -fi +echo "Compiling files without .elc..." +NUMTOCOMPILE=20 # compile this many files with each invocation +comm -23 $els $elcs | sed "$ignore_pattern" | \ + xargs -t -n$NUMTOCOMPILE $REAL -batch -q -no-site-file -f batch-byte-compile +echo "Compiling files without .elc... Done" -# Gnus now has a makefile... -echo Compiling Gnus... -( cd lisp/gnus ; ${MAKE:-make} EMACS=$REAL some ) -echo Gnus done. - -# and gee w3 has its own makefile as well -# (no especial need to use it, though) -echo Compiling W3... -( cd lisp/w3 ; ${MAKE:-make} EMACS=$REAL xemacs-w3 ) -echo W3 done. - -# Hyperbole has to be different as well. What is it with these big packages? -echo Compiling Hyperbole... -( cd lisp/hyperbole ; ${MAKE:-make} EMACS=$REAL elc ) -echo Hyperbole done. -# OO-Browser too -echo Compiling OO-Browser... -( cd lisp/oobr ; ${MAKE:-make} EMACS=$REAL HYPB_ELC='' elc ) -echo OO-Browser done. - -# this is not strictly necessary but there are some special dependencies -echo Compiling EOS... -( cd lisp/eos ; ${MAKE:-make} -k EMACS=$REAL ) -echo EOS done. +echo "Compiling files with out-of-date .elc..." +find lisp/. -name SCCS -prune -o -type d -print | sed "$ignore_pattern" | \ + xargs -t $REAL -batch -q -no-site-file -f batch-byte-recompile-directory +echo "Compiling files with out-of-date .elc... Done" -# ilisp would seem to take a little extra now as well -# previously this was up top, but it requires that comint.elc exists. -echo Compiling Ilisp... -( cd lisp/ilisp ; ${MAKE:-make} elc -f Makefile EMACS=$REAL ) -echo Ilisp done. - -# AUC TeX requires special treatment -echo Compiling AUC TeX... -( cd lisp/auctex ; ${MAKE:-make} some -f Makefile EMACS=$REAL ) -echo AUC TeX done. +eval "$make_special_commands"