about summary refs log tree commit diff
path: root/Config
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-07-12 17:02:52 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-07-12 17:02:52 +0000
commit59c3d242d546059cad473f1155ad0e350fe45260 (patch)
treeaea57772a784915c5cd8e7bd485948f28842976a /Config
parentb346c4796b3abdadd31cb0999d2f099ce9aa79af (diff)
downloadzsh-59c3d242d546059cad473f1155ad0e350fe45260.tar.gz
zsh-59c3d242d546059cad473f1155ad0e350fe45260.tar.xz
zsh-59c3d242d546059cad473f1155ad0e350fe45260.zip
Initial revision
Diffstat (limited to 'Config')
-rw-r--r--Config/funcinst.mk47
-rwxr-xr-xConfig/installfns.sh48
-rwxr-xr-xConfig/uninstallfns.sh31
3 files changed, 126 insertions, 0 deletions
diff --git a/Config/funcinst.mk b/Config/funcinst.mk
new file mode 100644
index 000000000..e473eb351
--- /dev/null
+++ b/Config/funcinst.mk
@@ -0,0 +1,47 @@
+#
+# 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
new file mode 100755
index 000000000..de7a52bce
--- /dev/null
+++ b/Config/installfns.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+if test -d $fndir.old; then
+  add_old=1
+fi
+
+$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
+
+for file in $install; do
+  if test -f $sdir/$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"
+      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
+  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
new file mode 100755
index 000000000..ae1b4fef5
--- /dev/null
+++ b/Config/uninstallfns.sh
@@ -0,0 +1,31 @@
+#!/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
+
+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
+
+exit 0