From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27381 invoked from network); 30 Nov 2000 18:28:54 -0000 Received: from sunsite.dk (HELO sunsite.auc.dk) (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Nov 2000 18:28:54 -0000 Received: (qmail 14566 invoked by alias); 30 Nov 2000 18:28:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13209 Received: (qmail 14558 invoked from network); 30 Nov 2000 18:28:42 -0000 Date: Thu, 30 Nov 2000 18:28:15 +0000 From: Peter Stephenson Subject: PATCH: function install To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Message-id: <0G4U00A1GON2KB@la-la.cambridgesiliconradio.com> Content-transfer-encoding: 7BIT It seems like the config.modules patch was uncontroversial. This is the part that sets the functions to install in the same file. Thus if you explicitly enable zftp for static loading, the functions will automatically be installed. You can edit the list of functions; all are there by default. This replaces the mechanism using the configure command line. I haven't tested this with FUNCTIONS_SUBDIRS enabled, because it's too painful to reconfigure. This is the last change I think is really necessary before zsh 4.0 (translation: the last major change I had any chance of getting round to any time soon). Index: Makefile.in =================================================================== RCS file: /cvsroot/zsh/zsh/Makefile.in,v retrieving revision 1.4 diff -u -r1.4 Makefile.in --- Makefile.in 2000/05/15 12:13:29 1.4 +++ Makefile.in 2000/11/30 15:39:49 @@ -77,14 +77,25 @@ # install/uninstall just the shell functions install.fns: - test x$(sitefndir) != xno && $(sdir_top)/mkinstalldirs $(DESTDIR)$(sitefndir) - @cd Completion && $(MAKE) $(MAKEDEFS) $@ - @cd Functions && $(MAKE) $(MAKEDEFS) $@ + if test x$(fndir) != x && test x$(fndir) != xno; then \ + test x$(sitefndir) != xno && \ + $(sdir_top)/mkinstalldirs $(DESTDIR)$(sitefndir); \ + sdir_top="$(sdir_top)" fndir="$(fndir)" dir_top="$(dir_top)" \ + FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \ + INSTALL_DATA="$(INSTALL_DATA)" \ + DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \ + $(SHELL) $(sdir_top)/Config/installfns.sh || exit 1; \ + fi; \ + exit 0 uninstall.fns: - # never attempt to remove $(sitefndir) - @cd Completion && $(MAKE) $(MAKEDEFS) $@ - @cd Functions && $(MAKE) $(MAKEDEFS) $@ + if test x$(fndir) != x && test x$(fndir) != xno; then \ + fndir="$(fndir)" dir_top="$(dir_top)" \ + FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \ + DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \ + $(SHELL) $(sdir_top)/Config/uninstallfns.sh || exit 1; \ + fi; \ + exit 0 # install/uninstall just the info pages install.info uninstall.info: Index: configure.in =================================================================== RCS file: /cvsroot/zsh/zsh/configure.in,v retrieving revision 1.34 diff -u -r1.34 configure.in --- configure.in 2000/11/27 11:26:14 1.34 +++ configure.in 2000/11/30 15:39:50 @@ -1733,15 +1733,19 @@ echo "# \`yes'. If you set it by hand to \`no', the line will be retained" echo "# when the file is regenerated in future." echo "#" +echo "# Note that the \`functions' entry extends to the end of the line." +echo "# It should not be quoted; it is used verbatim to find files to install." +echo "#" echo "# You will need to run \`config.status --recheck' if you add a new" echo "# module." echo "#" echo "# You should not change the values for the pseudo-module zsh/main," -echo "# which is the main shell." +echo "# which is the main shell (apart from the functions entry)." for modfile in `cd ${srcdir}; echo */*.mdd */*/*.mdd`; do name= link= load= + functions= . ${srcdir}/$modfile if test x$name != x -a x"$link" != x; then case "$userlist" in @@ -1758,26 +1762,32 @@ *) load=" load=no" ;; esac + if test "x$functions" != x; then + # N.B. no additional quotes + f=" functions=$functions" + else + f= + fi case "$link" in - static) echo "name=$name modfile=$modfile link=static auto=yes${load}" + static) echo "name=$name modfile=$modfile link=static auto=yes${load}$f" ;; dynamic) if test $dynamic != no; then echo "name=$name modfile=$modfile link=dynamic\ - auto=yes${load}" + auto=yes${load}$f" else echo "name=$name modfile=$modfile link=no\ - auto=yes load=no" + auto=yes load=no$f" fi ;; either) if test $dynamic != no; then echo "name=$name modfile=$modfile link=dynamic\ - auto=yes${load}" + auto=yes${load}$f" else echo "name=$name modfile=$modfile link=static\ - auto=yes${load}" + auto=yes${load}$f" fi ;; - *) echo "name=$name modfile=$modfile link=no auto=yes load=no" + *) echo "name=$name modfile=$modfile link=no auto=yes load=no$f" ;; esac ;; @@ -1803,7 +1813,7 @@ no_create=yes AC_OUTPUT(Config/defs.mk Makefile Doc/Makefile Etc/Makefile Src/Makefile \ -Test/Makefile Completion/Makefile Functions/Makefile, \ +Test/Makefile, \ [test -z "$CONFIG_HEADERS" || echo > stamp-h]) dnl The standard config.status is missing some essential features. Index: Config/funcinst.mk =================================================================== RCS file: /cvsroot/zsh/zsh/Config/funcinst.mk,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 funcinst.mk --- Config/funcinst.mk 2000/01/14 19:14:47 1.1.1.5 +++ Config/funcinst.mk 2000/11/30 15:39:50 @@ -29,8 +29,7 @@ install.fns: if test x$(fndir) != x && test x$(fndir) != xno; then \ - sdir_top="$(sdir_top)" fndir="$(fndir)" sdir="$(sdir)" \ - FUNCTIONS_INSTALL="$(FUNCTIONS_INSTALL)" \ + sdir_top="$(sdir_top)" fndir="$(fndir)" dir_top="$(dir_top)" \ FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \ INSTALL_DATA="$(INSTALL_DATA)" \ DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \ @@ -40,8 +39,7 @@ uninstall.fns: if test x$(fndir) != x && test x$(fndir) != xno; then \ - fndir="$(fndir)" sdir="$(sdir)" \ - FUNCTIONS_INSTALL="$(FUNCTIONS_INSTALL)" \ + fndir="$(fndir)" dir_top="$(dir_top)" \ FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \ DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \ $(SHELL) $(sdir_top)/Config/uninstallfns.sh || exit 1; \ Index: Config/installfns.sh =================================================================== RCS file: /cvsroot/zsh/zsh/Config/installfns.sh,v retrieving revision 1.1.1.9 diff -u -r1.1.1.9 installfns.sh --- Config/installfns.sh 2000/01/14 19:14:47 1.1.1.9 +++ Config/installfns.sh 2000/11/30 15:39:50 @@ -4,30 +4,23 @@ $sdir_top/mkinstalldirs $fndir || exit 1; -# If the source directory is somewhere else, we need to force -# the shell to expand it in that directory, then strip it off. -install= -for file in $FUNCTIONS_INSTALL; do - if test -f "$sdir/$file"; then - install="$install $file" - else - install="$install `echo '' $sdir/$file | sed -e \"s% $sdir/% %g\"`" - fi -done +allfuncs="`grep ' functions=' ${dir_top}/config.modules | + sed -e '/^#/d' -e '/ link=no/d' -e 's/^.* functions=//'`" -for file in $install; do - if test -f $sdir/$file; then +allfuncs="`cd $sdir_top; echo ${allfuncs}`" + +# We now have a list of files, but we need to use `test -f' to check +# (1) the glob got expanded (2) we are not looking at directories. +for file in $allfuncs; do + if test -f $sdir_top/$file; then if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then - subfile="$file" - subdir="`echo $file | sed -e 's%/[^/]*$%%'`" + subdir="`echo $file | sed -e 's%/[^/]*$%%' \ + -e s%^Functions/%% -e s%^Completion/%%`" instdir="$fndir/$subdir" else - subfile="`echo $file | sed -e 's%^.*/%%'`" instdir="$fndir" fi - $sdir_top/mkinstalldirs $instdir || exit 1 - $INSTALL_DATA $sdir/$file $instdir || exit 1 + test -d $instdir || $sdir_top/mkinstalldirs $instdir || exit 1 + $INSTALL_DATA $sdir_top/$file $instdir || exit 1 fi done - -exit 0 Index: Config/uninstallfns.sh =================================================================== RCS file: /cvsroot/zsh/zsh/Config/uninstallfns.sh,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 uninstallfns.sh --- Config/uninstallfns.sh 2000/01/14 19:14:47 1.1.1.5 +++ Config/uninstallfns.sh 2000/11/30 15:39:50 @@ -1,39 +1,38 @@ #!/bin/sh -# If the source directory is somewhere else, we need to force -# the shell to expand it in that directory, then strip it off. -install= -for file in $FUNCTIONS_INSTALL; do - if test -f "$sdir/$file"; then - install="$install $file" - else - install="$install `echo '' $sdir/$file | sed -e \"s% $sdir/% %g\"`" - fi -done - fndir=$DESTDIR$fndir + +allfuncs="`grep ' functions=' ${dir_top}/config.modules | + sed -e '/^#/d' -e '/ link=no/d' -e 's/^.* functions=//'`" + +allfuncs="`cd ${sdir_top}; echo ${allfuncs}`" -for file in $install; do - case $fndir in - *$VERSION*) - # Version specific function directory, safe to remove completely. - # However, we don't remove the top-level version directory since - # it could have other things than functions in it. We could - # do that instead in the top-level Makefile on a full uninstall, - # if we wanted. - rm -rf $fndir - ;; - *) - if test -f $sdir/$file; then +case $fndir in + *$VERSION*) + # Version specific function directory, safe to remove completely. + # However, we don't remove the top-level version directory since + # it could have other things than functions in it. We could + # do that instead in the top-level Makefile on a full uninstall, + # if we wanted. + rm -rf $fndir + ;; + *) # The following will only apply with a custom install directory + # with no version information. This is rather undesirable. + # But let's try and do the best we can. + # We now have a list of files, but we need to use `test -f' to check + # (1) the glob got expanded (2) we are not looking at directories. + for file in $allfuncs; do + if test -f $sdir_top/$file; then if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then + file=`echo $file | sed -e 's%%^Completion/%' -e 's%%^Functions%'` rm -f $fndir/$file; else bfile="`echo $file | sed -e 's%^.*/%%'`" rm -f "$fndir/$bfile"; \ fi fi - ;; - esac -done + done + ;; +esac exit 0 Index: Src/signals.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/signals.c,v retrieving revision 1.13 diff -u -r1.13 signals.c --- Src/signals.c 2000/11/11 19:50:29 1.13 +++ Src/signals.c 2000/11/30 15:39:50 @@ -1010,12 +1010,12 @@ { int sig, ota = trapsallowed; - trapsallowed = 1; + trapsallowed = 0; while (trapqused) { trapqused--; sig = *trapqueue; memcpy(trapqueue, trapqueue + 1, trapqused * sizeof(int)); - dotrap(sig, -1); + dotrap(sig, 1); } trapsallowed = ota; } Index: Src/zsh.mdd =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.mdd,v retrieving revision 1.4 diff -u -r1.4 zsh.mdd --- Src/zsh.mdd 2000/11/26 20:01:03 1.4 +++ Src/zsh.mdd 2000/11/30 15:39:50 @@ -2,6 +2,7 @@ link=static load=yes # load=static should replace use of alwayslink +functions='Functions/Misc/* Functions/Prompts/*' nozshdep=1 alwayslink=1 Index: Src/Modules/zftp.mdd =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/zftp.mdd,v retrieving revision 1.2 diff -u -r1.2 zftp.mdd --- Src/Modules/zftp.mdd 2000/11/26 20:01:03 1.2 +++ Src/Modules/zftp.mdd 2000/11/30 15:39:50 @@ -1,6 +1,7 @@ name=zsh/zftp link=dynamic load=no +functions='Functions/Zftp/*' autobins="zftp" Index: Src/Zle/complete.mdd =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.mdd,v retrieving revision 1.3 diff -u -r1.3 complete.mdd --- Src/Zle/complete.mdd 2000/11/26 20:01:03 1.3 +++ Src/Zle/complete.mdd 2000/11/30 15:39:50 @@ -1,6 +1,7 @@ name=zsh/complete link=either load=yes +functions='Completion/Core/* Completion/Base/* Completion/Builtins/* Completion/User/* Completion/Commands/* Completion/Debian/* Completion/Linux/* Completion/Bsd/* Completion/AIX/* Completion/X/*' moddeps="zsh/zle" Index: Src/Zle/zle.mdd =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle.mdd,v retrieving revision 1.2 diff -u -r1.2 zle.mdd --- Src/Zle/zle.mdd 2000/11/26 20:01:03 1.2 +++ Src/Zle/zle.mdd 2000/11/30 15:39:50 @@ -1,6 +1,7 @@ name=zsh/zle link=either load=yes +functions='Functions/Zle/*' autobins="bindkey vared zle" -- Peter Stephenson Software Engineer Cambridge Silicon Radio, Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070