automake-patches
[Top][All Lists]
Advanced

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

FYI: nobase_ support for _SCRIPTS (PR/318)


From: Alexandre Duret-Lutz
Subject: FYI: nobase_ support for _SCRIPTS (PR/318)
Date: Sun, 09 Jun 2002 13:12:19 +0200
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-debian-linux-gnu)

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

2002-06-09  Alexandre Duret-Lutz  <address@hidden>

        For PR automake/318:
        * tests/nobase.test: Rewrite to test _HEADERS, _DATA, _SCRIPTS,
        _PROGRAMS, _LIBRARIES, and _LTLIBRARIES.
        * lib/am/scripts.am (install-%DIR%SCRIPTS,
        uninstall-%DIR%SCRIPTS): Honor nobase_; strip the directory by
        default.
        (?%DIR%SCRIPT_INSTALL): New variable.
        * lib/am/header-vars.am (install_sh_SCRIPT): New variable.
        Reported by Eric Siegerman.

Index: lib/am/header-vars.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/header-vars.am,v
retrieving revision 1.43
diff -u -r1.43 header-vars.am
--- lib/am/header-vars.am       5 Mar 2002 21:34:14 -0000       1.43
+++ lib/am/header-vars.am       9 Jun 2002 10:52:23 -0000
@@ -66,6 +66,7 @@
 INSTALL_DATA = @INSTALL_DATA@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_HEADER = $(INSTALL_DATA)
 transform = @program_transform_name@
Index: lib/am/scripts.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/scripts.am,v
retrieving revision 1.42
diff -u -r1.42 scripts.am
--- lib/am/scripts.am   9 Apr 2001 14:23:09 -0000       1.42
+++ lib/am/scripts.am   9 Jun 2002 10:52:23 -0000
@@ -24,6 +24,8 @@
 if %?INSTALL%
 ## if doesn't work properly for Automake variables yet.
 _am_installdirs += $(DESTDIR)$(%NDIR%dir)
+?BASE?%DIR%SCRIPT_INSTALL = $(INSTALL_SCRIPT)
+?!BASE?%DIR%SCRIPT_INSTALL = $(install_sh_SCRIPT)
 ?EXEC?.PHONY install-exec-am: install-%DIR%SCRIPTS
 ?!EXEC?.PHONY install-data-am: install-%DIR%SCRIPTS
 install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
@@ -32,13 +34,17 @@
 ## Funny invocation because Makefile variable can be empty, leading to
 ## a syntax error in sh.
        @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
-         f="`echo $$p|sed '$(transform)'`"; \
-         if test -f $$p; then \
-           echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
-           $(INSTALL_SCRIPT) $$p $(DESTDIR)$(%NDIR%dir)/$$f; \
-         elif test -f $(srcdir)/$$p; then \
-           echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(%NDIR%dir)/$$f"; 
\
-           $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(%NDIR%dir)/$$f; \
+## A file can be in the source directory or the build directory.
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+## 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)'`"; \
+           echo " $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
+           $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f; \
          else :; fi; \
        done
 endif %?INSTALL%
@@ -53,7 +59,9 @@
 uninstall-%DIR%SCRIPTS:
        @$(NORMAL_UNINSTALL)
        @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
-         f="`echo $$p|sed '$(transform)'`"; \
+?BASE?   f="`echo $$p | sed -e 's|^.*/||'`"; \
+?!BASE?          f="$$p"; \
+         f="`echo $$f|sed '$(transform)'`"; \
          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
diff -u -r1.5 nobase.test
--- tests/nobase.test   21 Mar 2002 09:11:56 -0000      1.5
+++ tests/nobase.test   9 Jun 2002 10:52:23 -0000
@@ -1,25 +1,110 @@
 #! /bin/sh
-# Test to make sure nobase_*_HEADERS work.
+# Make sure nobase_* works.
 
+required=libtoolize
 . $srcdir/defs || exit 1
 
+set -e
+
 cat >> configure.in <<'EOF'
+AC_PROG_CC
+AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
 
 cat > Makefile.am << 'EOF'
 foodir = $(prefix)/foo
-nobase_foo_HEADERS = bar/baz.h
+fooexecdir = $(prefix)/foo
+
+foo_HEADERS = sub/base.h
+nobase_foo_HEADERS = sub/nobase.h
+
+foo_DATA = sub/base.dat
+nobase_foo_DATA = sub/nobase.dat
+
+fooexec_SCRIPTS = sub/base.sh
+nobase_fooexec_SCRIPTS = sub/nobase.sh
+
+fooexec_PROGRAMS = sub/base
+nobase_fooexec_PROGRAMS = sub/nobase
+sub_base_SOURCES = source.c
+sub_nobase_SOURCES = source.c
+
+fooexec_LIBRARIES = sub/libbase.a
+nobase_fooexec_LIBRARIES = sub/libnobase.a
+sub_libbase_a_SOURCES = source.c
+sub_libnobase_a_SOURCES = source.c
+
+fooexec_LTLIBRARIES = sub/libbase.la
+nobase_fooexec_LTLIBRARIES = sub/libnobase.la
+sub_libbase_la_SOURCES = source2.c
+sub_libnobase_la_SOURCES = source2.c
 EOF
 
-mkdir bar
-: > bar/baz.h
+mkdir sub
 
-set -e
+: > sub/base.h
+: > sub/nobase.h
+: > sub/base.dat
+: > sub/nobase.dat
+: > sub/base.sh
+: > sub/nobase.sh
+
+cat >source.c <<'EOF'
+int
+main (int argc, char *argv[])
+{
+  return 0;
+}
+EOF
+cp source.c source2.c
 
+libtoolize
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-./configure --prefix `pwd`/install
+./configure --prefix `pwd`/inst
+
+$MAKE
 $MAKE install-data
-test -f install/foo/bar/baz.h
+
+test   -f inst/foo/sub/nobase.h
+test ! -f inst/foo/nobase.h
+test   -f inst/foo/base.h
+
+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
+test ! -f inst/foo/base
+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
+
+$MAKE 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
+test ! -f inst/foo/nobase
+test   -f inst/foo/base
+
+test   -f inst/foo/sub/libnobase.a
+test ! -f inst/foo/libnobase.a
+test   -f inst/foo/libbase.a
+
+test   -f inst/foo/sub/libnobase.la
+test ! -f inst/foo/libnobase.la
+test   -f inst/foo/libbase.la
+
+$MAKE uninstall
+
+test `find inst/foo -type f -print | wc -l` = 0
+
+$MAKE install-strip

-- 
Alexandre Duret-Lutz




reply via email to

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