]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
For Debian Bug #185388:
authorAlexandre Duret-Lutz <adl@gnu.org>
Thu, 20 Mar 2003 22:44:34 +0000 (22:44 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Thu, 20 Mar 2003 22:44:34 +0000 (22:44 +0000)
* automake.texi (Extending): Augment the install-exec-hook
discussion with an example how to symlink a versioned binary.
* tests/insthook.test: Rewrite to test the above example.
Report from James R. Van Zandt.

ChangeLog
THANKS
automake.texi
stamp-vti
tests/insthook.test
version.texi

index 1e19cf1e29062475d26cca882bb682fa7b31ac62..451746b440189e1d67f9f5b19bd747b5e4c093f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-03-20  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       For Debian Bug #185388:
+       * automake.texi (Extending): Augment the install-exec-hook
+       discussion with an example how to symlink a versioned binary.
+       * tests/insthook.test: Rewrite to test the above example.
+       Report from James R. Van Zandt.
+
 2003-03-19  Alexandre Duret-Lutz  <adl@gnu.org>
 
        * Makefile.am (maintainer-check): Allow `automake:' tokens,
diff --git a/THANKS b/THANKS
index 425fcfba3d595daf2205b51e10234ea8b45a499a..441eee16f274601eca806c9201ebed6bc8faa4c8 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -80,6 +80,7 @@ Ian Lance Taylor      ian@cygnus.com
 Imacat                 imacat@mail.imacat.idv.tw
 Inoue                  inoue@ainet.or.jp
 James Henstridge       james@daa.com.au
+James R. Van Zandt     jrv@vanzandt.mv.com
 James Youngman         jay@gnu.org
 Janos Farkas           chexum@shadow.banki.hu
 Jared Davis            abiword@aiksaurus.com
index 9643d0001ae37364309a314ba39e65bb3b17a5a1..e7559861ff003ef7632abc88b84555b76d5cc39a 100644 (file)
@@ -5325,9 +5325,36 @@ For instance, here is how to create a hard link to an installed program:
 
 @example
 install-exec-hook:
-        ln $(DESTDIR)$(bindir)/program $(DESTDIR)$(bindir)/proglink
+        ln $(DESTDIR)$(bindir)/program$(EXEEXT) \
+           $(DESTDIR)$(bindir)/proglink$(EXEEXT)
 @end example
 
+Although cheaper and more portable than symbolic links, hard links
+will not work everywhere (for instance OS/2 does not have
+@command{ln}).  Ideally you should fall back to @code{cp -p} when
+@code{ln} does not work.  An easy way, if symbolic links are
+acceptable to you, is to add @code{AC_PROG_LN_S} to
+@file{configure.in} (@pxref{Particular Programs, , Particular Program
+Checks, autoconf, The Autoconf Manual}) and use @code{$(LN_S)} in
+@file{Makefile.am}.
+
+@cindex versioned binaries, installing
+@cindex installing versioned binaries
+@cindex LN_S example
+For instance, here is how you could install a versioned copy of a
+program using @code{$(LN_S)}:
+
+@example
+install-exec-hook:
+        cd $(DESTDIR)$(bindir) && \
+          mv -f prog$(EXEEXT) prog-$(VERSION)$(EXEEXT) && \
+          $(LN_S) prog-$(VERSION)$(EXEEXT) prog$(EXEEXT)
+@end example
+
+Note that we rename the program so that a new version will erase the
+symbolic link, not the real binary.  Also we @code{cd} into the
+destination directory in order to create relative links.
+
 @c FIXME should include discussion of variables you can use in these
 @c rules
 
index 349d6bb467a6a54ed84a0d88e14464ee50d4a52e..7013658eaddb8208dfe291bd848e9425a76a5a87 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 5 March 2003
+@set UPDATED 20 March 2003
 @set UPDATED-MONTH March 2003
 @set EDITION 1.7a
 @set VERSION 1.7a
index e65b8b6f655fac8db8bea221139fe1e5383fc693..0883b29a72b91ece15f184857bb19b702c89b3ae 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-# Test to make sure install-exec-hook works.
-# Report from Tim Goodwin.
+# Make sure the install-exec-hook example we give in the manual works.
 
 . ./defs || exit 1
 
-cat > Makefile.am << 'END'
+set -e
+
+cat >>configure.in <<'EOF'
+AC_PROG_LN_S
+AC_OUTPUT
+EOF
+
+cat >Makefile.am <<'END'
+dist_bin_SCRIPTS = foo
+
 install-exec-hook:
-       @echo nothing
+       cd $(DESTDIR)$(bindir) && \
+       mv -f foo foo-$(VERSION) && \
+       $(LN_S) foo-$(VERSION) foo
+
+installcheck-local:
+       test -f $(bindir)/foo
+       test -f $(bindir)/foo-$(VERSION)
+       : > $(top_srcdir)/../ok
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+echo 1 > foo
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE distcheck
+# Sanity check to make sure installcheck-local was run.
+test -f ok
 
-test "`grep install-exec-hook Makefile.in | wc -l`" -gt 1 || exit 1
-# install-exec-hook must appear in the install-exec-am rule.
-sed -n '/^install-exec-am:/,/^[^       ]/p' Makefile.in | \
-  grep install-exec-hook
+# Make sure that installing a second version doesn't erase the first
+# one.  (This is error prone since `foo' symlinks to `foo-1.0' and the
+# second version will overwrite `foo'.   Hopefully `install' and `install-sh'
+# are smart enough to erase the `foo' symlink before installing the new
+# version.)
+./configure --bindir=`pwd`/bin
+$MAKE install
+echo 2 > foo
+VERSION=2.0 make -e install
+grep 1 bin/foo-1.0
+grep 2 bin/foo-2.0
+grep 2 bin/foo
index 349d6bb467a6a54ed84a0d88e14464ee50d4a52e..7013658eaddb8208dfe291bd848e9425a76a5a87 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 5 March 2003
+@set UPDATED 20 March 2003
 @set UPDATED-MONTH March 2003
 @set EDITION 1.7a
 @set VERSION 1.7a