From: Alexandre Duret-Lutz Date: Thu, 20 Mar 2003 22:44:34 +0000 (+0000) Subject: For Debian Bug #185388: X-Git-Tag: Release-1-7-3b~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7f1a07bc41bd76bc2545652dae688e69575ee62;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 1e19cf1e2..451746b44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-03-20 Alexandre Duret-Lutz + + 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 * Makefile.am (maintainer-check): Allow `automake:' tokens, diff --git a/THANKS b/THANKS index 425fcfba3..441eee16f 100644 --- 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 diff --git a/automake.texi b/automake.texi index 9643d0001..e7559861f 100644 --- a/automake.texi +++ b/automake.texi @@ -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 diff --git a/stamp-vti b/stamp-vti index 349d6bb46..7013658ea 100644 --- 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 diff --git a/tests/insthook.test b/tests/insthook.test index e65b8b6f6..0883b29a7 100755 --- a/tests/insthook.test +++ b/tests/insthook.test @@ -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. # @@ -18,20 +18,51 @@ # 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 diff --git a/version.texi b/version.texi index 349d6bb46..7013658ea 100644 --- a/version.texi +++ b/version.texi @@ -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