Fix bindist creation
authorIan Lynagh <igloo@earth.li>
Wed, 26 Aug 2009 12:29:53 +0000 (12:29 +0000)
committerIan Lynagh <igloo@earth.li>
Wed, 26 Aug 2009 12:29:53 +0000 (12:29 +0000)
We were running into problems like:
    for f in  LICENSE configure config.sub config.guess [...]
    make[2]: execvp: /bin/sh: Argument list too long
This patch moves the loop into make, rather than the shell.

ghc.mk
rules/bindist.mk

diff --git a/ghc.mk b/ghc.mk
index 066d1b6..0f479e1 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -805,8 +805,7 @@ install_packages: libffi/package.conf.install rts/package.conf.install
 # -----------------------------------------------------------------------------
 # Binary distributions
 
-# This is split in 2 because of the shell argument limit
-$(eval $(call bindist,root1,\
+$(eval $(call bindist,.,\
     LICENSE \
     configure config.sub config.guess install-sh \
     extra-gcc-opts.in \
@@ -827,8 +826,6 @@ $(eval $(call bindist,root1,\
     $(INSTALL_BINS) \
     $(INSTALL_DOCS) \
     $(INSTALL_LIBRARY_DOCS) \
- ))
-$(eval $(call bindist,root2,\
     $(addsuffix /*,$(INSTALL_HTML_DOC_DIRS)) \
        docs/index.html \
        $(wildcard libraries/*/dist-install/doc/) \
index 4762023..56192a5 100644 (file)
@@ -23,6 +23,14 @@ define bindist
 bindist: bindist_$1
 
 bindist_$1:
-       for f in $2; do echo $(BIN_DIST_NAME)/$$$$f >> $(BIN_DIST_LIST); done
+$(foreach i,$2,$(call bindist_item,$i))
+endef
+
+define bindist_item
+
+# $1 = the line
+# The formatting of this definition (e.g. the blank line above) is
+# important, in order to get make to generate the right makefile code.
+       for f in $(BIN_DIST_NAME)/$1; do echo $$$$f >> $(BIN_DIST_LIST); done
 endef