automake-patches
[Top][All Lists]
Advanced

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

Fix multi-file installation for files in srcdir.


From: Ralf Wildenhues
Subject: Fix multi-file installation for files in srcdir.
Date: Sun, 7 Sep 2008 00:20:06 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

This patch lowers the limit to 40 files installed.  I figured 80 bytes
for `$(srcdir)/' plus relative file name were reasonable, plus maybe a
few hundred for `$(DESTDIR)$(foodir)', which brings us to roughly 3500.
Leaves 600 for the environment, to stay below the POSIX minimum limit of
4096.  Not much, but if you're on such a challenged system--dunno if any
of those are in use any more--you can still build in-tree.

In-tree is also the method of choice if the file lists have $(srcdir)/
already stuck in front of them (necessary in some Makefile.am's, and due
to VPATH rewriting of some vendor make versions).  The manual will
mention this (in a later patch).

Also, note that we have to stay within the record limit for sed (4000).
The command that generates the long lines only pipes into the shell,
which is safe.  Actually, if the definition of am__base_list should turn
out to be problematic, we can still replace it with an awk or sh script.

Applied to master.

FWIW, the GCC tree exceeds the above estimates (its longest relative
name from the top source dir is roughly 120 bytes), but nobody sane
would want to use libjava on a challenged system as above, and if,
there would be ways to use GNU sed, and get the kernel to increase the
limit.  We should still be safe for the 8K on MinGW, I hope.

Cheers,
Ralf

    Fix multi-file installation for files in srcdir.

    For files that can live in the build tree or the source tree,
    we have to expect that prepending `$(srcdir)/' to each name
    will let the install command line exceed length limitations.
    Thus use a new macro, $(am__base_list), to install in chunks
    of 40 files, similar to what we do for nobase_* files.  There,
    lower the limit to 40, too.

    * lib/am/inst-vars.am (am__install_max): Lower to 40.
    (am__base_list): New macro.
    * lib/am/data.am (install-%DIR%%PRIMARY%) [%?BASE%]: Use it.
    * lib/am/texinfos.am (install-dvi-am, install-html-am)
    (install-info-am, install-pdf-am, install-ps-am): Likewise.

diff --git a/lib/am/data.am b/lib/am/data.am
index 627301b..3536f94 100644
--- a/lib/am/data.am
+++ b/lib/am/data.am
@@ -33,17 +33,17 @@ install-%DIR%%PRIMARY%: $(%DIR%_%PRIMARY%)
 if %?BASE%
 ## Funny invocation because Makefile variable can be empty, leading to
 ## a syntax error in sh.
-       @list='$(%DIR%_%PRIMARY%)'; list2=; for p in $$list; do \
+       @list='$(%DIR%_%PRIMARY%)'; 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 the _%PRIMARY% 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.
-         list2="$$list2 $$d$$p"; \
-       done; \
-       test -z "$$list2" || { \
-         echo " $(%DIR%%PRIMARY%_INSTALL) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
-         $(%DIR%%PRIMARY%_INSTALL) $$list2 "$(DESTDIR)$(%NDIR%dir)"; }
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(%DIR%%PRIMARY%_INSTALL) $$files '$(DESTDIR)$(%NDIR%dir)'"; \
+         $(%DIR%%PRIMARY%_INSTALL) $$files "$(DESTDIR)$(%NDIR%dir)"; done
 else !%?BASE%
        @list='$(%DIR%_%PRIMARY%)'; $(am__nobase_list) | \
        while read dir files; do \
diff --git a/lib/am/inst-vars.am b/lib/am/inst-vars.am
index 8f89009..eb0bba1 100644
--- a/lib/am/inst-vars.am
+++ b/lib/am/inst-vars.am
@@ -26,7 +26,7 @@ am__vpath_adj = case $$p in \
 ## Strip all directories.
 am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
 ## Number of files to install concurrently.
-am__install_max = 50
+am__install_max = 40
 ## Take a $list of nobase files, collect them, indexed by their
 ## srcdir-stripped dirnames.  For up to am__install_max files, output
 ## a line containing the dirname and the files, space-separated.
@@ -42,4 +42,8 @@ am__nobase_list = \
     if (++n[$$2] == $(am__install_max)) \
       { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
     END { for (dir in files) print dir " " files[dir] }'
+## Collect up to 40 files per line from stdin.
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
 endif %?FIRST%
diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am
index 6bd65af..0f482a8 100644
--- a/lib/am/texinfos.am
+++ b/lib/am/texinfos.am
@@ -144,13 +144,13 @@ include inst-vars.am
 install-dvi-am: $(DVIS)
        @$(NORMAL_INSTALL)
        test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)"
-       @list='$(DVIS)'; list2=; for p in $$list; do \
+       @list='$(DVIS)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         list2="$$list2 $$d$$p"; \
-       done; \
-       test -z "$$list2" || { \
-         echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(dvidir)'"; \
-         $(INSTALL_DATA) $$list2 "$(DESTDIR)$(dvidir)"; }
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)"; done
 
 install-html-am: $(HTMLS)
        @$(NORMAL_INSTALL)
@@ -167,15 +167,16 @@ install-html-am: $(HTMLS)
            list2="$$list2 $$d$$p"; \
          fi; \
        done; \
-       test -z "$$list2" || { \
-           echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(htmldir)'"; \
-           $(INSTALL_DATA) $$list2 "$(DESTDIR)$(htmldir)"; }
+       test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)"; done; }
 
 install-info-am: $(INFO_DEPS)
        @$(NORMAL_INSTALL)
        test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)"
        @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-       list='$(INFO_DEPS)'; list2=; \
+       list='$(INFO_DEPS)'; \
        for file in $$list; do \
 ## Strip possible $(srcdir) prefix.
          case $$file in \
@@ -195,13 +196,13 @@ install-info-am: $(INFO_DEPS)
          for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
                        $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
            if test -f $$ifile; then \
-             list2="$$list2 $$ifile"; \
+             echo "$$ifile"; \
            else : ; fi; \
          done; \
-       done; \
-       test -z "$$list2" || { \
-         echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(infodir)'"; \
-         $(INSTALL_DATA) $$list2 "$(DESTDIR)$(infodir)"; }
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)"; done
        @$(POST_INSTALL)
 ## Only run this code if install-info actually exists, and it is not
 ## the Debian install-info.  FIXME: once Debian install-info goes
@@ -234,24 +235,24 @@ install-info-am: $(INFO_DEPS)
 install-pdf-am: $(PDFS)
        @$(NORMAL_INSTALL)
        test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)"
-       @list='$(PDFS)'; list2=; for p in $$list; do \
+       @list='$(PDFS)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         list2="$$list2 $$d$$p"; \
-       done; \
-       test -z "$$list2" || { \
-         echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(pdfdir)'"; \
-         $(INSTALL_DATA) $$list2 "$(DESTDIR)$(pdfdir)"; }
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)"; done
 
 install-ps-am: $(PSS)
        @$(NORMAL_INSTALL)
        test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)"
-       @list='$(PSS)'; list2=; for p in $$list; do \
+       @list='$(PSS)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         list2="$$list2 $$d$$p"; \
-       done; \
-       test -z "$$list2" || { \
-         echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(psdir)'"; \
-         $(INSTALL_DATA) $$list2 "$(DESTDIR)$(psdir)"; }
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)"; done
 
 else ! %?LOCAL-TEXIS%
 install-dvi-am:




reply via email to

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