automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: bugfix for nobase_ + $(transform)


From: Alexandre Duret-Lutz
Subject: FYI: bugfix for nobase_ + $(transform)
Date: 20 Jul 2002 17:04:38 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

While making a test case for another bug (next patch I'll send),
I've found this one: $(transform) is meant to be applied on the
basename of the file, still we never compute the basename of a
nobase_ file...  So intalling `nobase_SCRIPTS = foo/bar' with
`--program-prefix=gnu-' will create `gnu-foo/bar'.

I'm installing this on HEAD and branch-1-6.

2002-07-20  Alexandre Duret-Lutz  <address@hidden>

        * lib/am/progs.am (install-%DIR%PROGRAMS, uninstall-%DIR%PROGRAMS):
        Always strip the directory part before applying $(transform),
        even for nobase_ targets.
        * lib/am/scripts.am (install-%DIR%SCRIPTS, uninstall-%DIR%SCRIPTS):
        Likewise.
        * tests/nobase.test: Use --program-prefix while testing nobase
        support.

Index: Makefile.in
===================================================================
RCS file: /cvs/automake/automake/Makefile.in,v
retrieving revision 1.366.2.14
diff -u -r1.366.2.14 Makefile.in
--- Makefile.in 27 Jun 2002 08:46:59 -0000      1.366.2.14
+++ Makefile.in 20 Jul 2002 15:06:29 -0000
@@ -148,9 +148,8 @@
        $(mkinstalldirs) $(DESTDIR)$(bindir)
        @list='$(bin_SCRIPTS)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         f="`echo $$p | sed -e 's|^.*/||'`"; \
          if test -f $$d$$p; then \
-           f="`echo $$f|sed '$(transform)'`"; \
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
            echo " $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f"; \
            $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f; \
          else :; fi; \
@@ -159,8 +158,7 @@
 uninstall-binSCRIPTS:
        @$(NORMAL_UNINSTALL)
        @list='$(bin_SCRIPTS)'; for p in $$list; do \
-         f="`echo $$p | sed -e 's|^.*/||'`"; \
-         f="`echo $$f|sed '$(transform)'`"; \
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
          rm -f $(DESTDIR)$(bindir)/$$f; \
        done
Index: lib/am/progs.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/progs.am,v
retrieving revision 1.33.2.1
diff -u -r1.33.2.1 progs.am
--- lib/am/progs.am     8 May 2002 08:57:13 -0000       1.33.2.1
+++ lib/am/progs.am     20 Jul 2002 15:06:30 -0000
@@ -43,8 +43,11 @@
 ## Compute basename of source file.  Unless this is a nobase_ target, we
 ## want to install 'python/foo.py' as '$(DESTDIR)$(%NDIR%dir)/foo.yo',
 ## not '$(DESTDIR)$(%NDIR%dir)/python/foo.yo'.
-?BASE?     p1=`echo "$$p1" | sed -e 's,^.*/,,'`; \
-           f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \
+## However in all cases $(transform) applies only to the basename,
+## so we have to strip the directory part.
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+## Prepend the directory part if nobase_ is used.
+?!BASE?            f=`echo "$$p1" | sed 's|[^/]*$$||'`"$$f"; \
 ## Note that we explicitly set the libtool mode.  This avoids any
 ## lossage if the install program doesn't have a name that libtool
 ## expects.
@@ -66,8 +69,10 @@
 uninstall-%DIR%PROGRAMS:
        @$(NORMAL_UNINSTALL)
        @list='$(%DIR%_PROGRAMS)'; for p in $$list; do \
-         f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-?BASE?   f=`echo "$$f" | sed -e 's,^.*/,,'`; \
+## Remove any leading directory before applying $(transform).
+         f=`echo "$$p" | sed 
's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+## Prepend the directory part if nobase_ is used.
+?!BASE?          f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
          echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f"; \
          rm -f $(DESTDIR)$(%NDIR%dir)/$$f; \
        done
Index: lib/am/scripts.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/scripts.am,v
retrieving revision 1.42.4.1
diff -u -r1.42.4.1 scripts.am
--- lib/am/scripts.am   9 Jun 2002 11:12:56 -0000       1.42.4.1
+++ lib/am/scripts.am   20 Jul 2002 15:06:30 -0000
@@ -36,13 +36,15 @@
        @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
 ## A file can be in the source directory or the build directory.
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f $$d$$p; then \
 ## If the _SCRIPTS variable has an entry like foo/bar, install it as
 ## $(destdir)/bar, not $(destdir)/foo/bar.  The user can make a
 ## new dir variable or use a nobase_ target for the latter case.
-?BASE?   f="`echo $$p | sed -e 's|^.*/||'`"; \
-?!BASE?          f="$$p"; \
-         if test -f $$d$$p; then \
-           f="`echo $$f|sed '$(transform)'`"; \
+## However in all cases $(transform) applies only to the basename,
+## so we have to strip the directory part.
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+## Prepend the directory part if nobase_ is used.
+?!BASE?            f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
            echo " $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
            $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f; \
          else :; fi; \
@@ -59,9 +61,10 @@
 uninstall-%DIR%SCRIPTS:
        @$(NORMAL_UNINSTALL)
        @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
-?BASE?   f="`echo $$p | sed -e 's|^.*/||'`"; \
-?!BASE?          f="$$p"; \
-         f="`echo $$f|sed '$(transform)'`"; \
+## Remove any leading directory before applying $(transform).
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+## Prepend the directory part if nobase_ is used.
+?!BASE?          f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
          echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f"; \
          rm -f $(DESTDIR)$(%NDIR%dir)/$$f; \
        done
Index: tests/nobase.test
===================================================================
RCS file: /cvs/automake/automake/tests/nobase.test,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 nobase.test
--- tests/nobase.test   6 Jul 2002 13:06:30 -0000       1.5.2.2
+++ tests/nobase.test   20 Jul 2002 15:06:31 -0000
@@ -47,22 +47,22 @@
        test   -f inst/foo/sub/nobase.dat
        test ! -f inst/foo/nobase.dat
        test   -f inst/foo/base.dat
-       test ! -f inst/foo/sub/nobase.sh
-       test ! -f inst/foo/base.sh
-       test ! -f inst/foo/sub/nobase$(EXEEXT)
-       test ! -f inst/foo/base$(EXEEXT)
+       test ! -f inst/foo/sub/pnobase.sh
+       test ! -f inst/foo/pbase.sh
+       test ! -f inst/foo/sub/pnobase$(EXEEXT)
+       test ! -f inst/foo/pbase$(EXEEXT)
        test ! -f inst/foo/sub/libnobase.a
        test ! -f inst/foo/libbase.a
        test ! -f inst/foo/sub/libnobase.la
        test ! -f inst/foo/libbase.la
 
 test-install-exec: install-exec
-       test   -f inst/foo/sub/nobase.sh
-       test ! -f inst/foo/nobase.sh
-       test   -f inst/foo/base.sh
-       test   -f inst/foo/sub/nobase$(EXEEXT)
-       test ! -f inst/foo/nobase$(EXEEXT)
-       test   -f inst/foo/base$(EXEEXT)
+       test   -f inst/foo/sub/pnobase.sh
+       test ! -f inst/foo/pnobase.sh
+       test   -f inst/foo/pbase.sh
+       test   -f inst/foo/sub/pnobase$(EXEEXT)
+       test ! -f inst/foo/pnobase$(EXEEXT)
+       test   -f inst/foo/pbase$(EXEEXT)
        test   -f inst/foo/sub/libnobase.a
        test ! -f inst/foo/libnobase.a
        test   -f inst/foo/libbase.a
@@ -93,7 +93,7 @@
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-./configure --prefix `pwd`/inst
+./configure --prefix `pwd`/inst --program-prefix=p
 
 $MAKE
 $MAKE test-install-data
-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]