about summary refs log tree commit diff
path: root/Config
diff options
context:
space:
mode:
Diffstat (limited to 'Config')
-rw-r--r--Config/funcinst.mk47
-rwxr-xr-xConfig/installfns.sh48
-rwxr-xr-xConfig/uninstallfns.sh59
3 files changed, 46 insertions, 108 deletions
diff --git a/Config/funcinst.mk b/Config/funcinst.mk
deleted file mode 100644
index e473eb351..000000000
--- a/Config/funcinst.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Makefile definitions for installing shell functions
-#
-# Copyright (c) 1999 Peter Stephenson
-# All rights reserved.
-#
-# Permission is hereby granted, without written agreement and without
-# license or royalty fees, to use, copy, modify, and distribute this
-# software and to distribute modified versions of this software for any
-# purpose, provided that the above copyright notice and the following
-# two paragraphs appear in all copies of this software.
-#
-# In no event shall Peter Stephenson or the Zsh Development Group be liable
-# to any party for direct, indirect, special, incidental, or consequential
-# damages arising out of the use of this software and its documentation,
-# even if Peter Stephenson and the Zsh Development Group have been advised of
-# the possibility of such damage.
-#
-# Peter Stephenson and the Zsh Development Group specifically disclaim any
-# warranties, including, but not limited to, the implied warranties of
-# merchantability and fitness for a particular purpose.  The software
-# provided hereunder is on an "as is" basis, and Peter Stephenson and the
-# Zsh Development Group have no obligation to provide maintenance,
-# support, updates, enhancements, or modifications.
-#
-
-# install functions, including those in subdirectories, creating
-# install directory if necessary
-
-install.fns:
-	if test x$(fndir) != x && test x$(fndir) != xno; then \
-	  sdir_top="$(sdir_top)" fndir="$(fndir)" sdir="$(sdir)" \
-	  FUNCTIONS_INSTALL="$(FUNCTIONS_INSTALL)" \
-	  FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \
-	  INSTALL_DATA="$(INSTALL_DATA)" \
-	  $(SHELL) $(sdir_top)/Config/installfns.sh || exit 1; \
-	fi; \
-	exit 0
-
-uninstall.fns:
-	if test x$(fndir) != x && test x$(fndir) != xno; then \
-	  fndir="$(fndir)" sdir="$(sdir)" \
-	  FUNCTIONS_INSTALL="$(FUNCTIONS_INSTALL)" \
-	  FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \
-	  $(SHELL) $(sdir_top)/Config/uninstallfns.sh || exit 1; \
-	fi; \
-	exit 0
diff --git a/Config/installfns.sh b/Config/installfns.sh
index de7a52bce..eb552b76d 100755
--- a/Config/installfns.sh
+++ b/Config/installfns.sh
@@ -1,48 +1,26 @@
 #!/bin/sh
 
-if test -d $fndir.old; then
-  add_old=1
-fi
+fndir=$DESTDIR$fndir
 
 $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=//'`"
+
+allfuncs="`cd $sdir_top; echo ${allfuncs}`"
 
-for file in $install; do
-  if test -f $sdir/$file; then
+# 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%/[^/]*$%%'`"
-      olddir="$fndir.old/$subdir"
+      subdir="`echo $file | sed -e 's%/[^/]*$%%' \
+		-e s%^Functions/%% -e s%^Completion/%%`"
       instdir="$fndir/$subdir"
     else
-      subfile="`echo $file | sed -e 's%^.*/%%'`"
-      olddir="$fndir.old"
       instdir="$fndir"
     fi
-    if test -f $fndir/$subfile; then
-      if cmp $fndir/$subfile $sdir/$file >/dev/null; then :; else
-	$sdir_top/mkinstalldirs $olddir
-        mv $fndir/$subfile $olddir
-        : ${add_old:=1}
-      fi
-    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
-
-if test x$add_old != x1; then
-  rm -rf $fndir.old
-fi
-
-exit 0
diff --git a/Config/uninstallfns.sh b/Config/uninstallfns.sh
index ae1b4fef5..963daad66 100755
--- a/Config/uninstallfns.sh
+++ b/Config/uninstallfns.sh
@@ -1,31 +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
 
-for file in $install; do
-  if test -f $sdir/$file; then
-    if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then
-      rm -f $fndir/$file;
-      if test -f $fndir.old/$file; then
-	mv $fndir.old/$file $fndir/$file
-      fi
-    else
-      bfile="`echo $file | sed -e 's%^.*/%%'`"
-      rm -f "$fndir/$bfile"; \
-      if test -f $fndir.old/$bfile; then
-        mv $fndir.old/$bfile $fndir/$bfile
-      fi
-    fi
-  fi
-done
+allfuncs="`grep ' functions=' ${dir_top}/config.modules |
+  sed -e '/^#/d' -e '/ link=no/d' -e 's/^.* functions=//'`"
+
+allfuncs="`cd ${sdir_top}; echo ${allfuncs}`"
+
+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
+     done
+     ;;
+esac
 
 exit 0