[commit: ghc] master: Fix the transformers-building code, and move it from validate to ghc.mk (86e2479)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/86e247968f6b29fd482f9991b0e3a6ec1cc2e265

>---------------------------------------------------------------

commit 86e247968f6b29fd482f9991b0e3a6ec1cc2e265
Author: Ian Lynagh <[email protected]>
Date:   Thu Oct 25 14:55:23 2012 +0100

    Fix the transformers-building code, and move it from validate to ghc.mk
    
    This makes life easier, as ghc.mk has access to HADDOCK_DOCS
    and DYNAMIC_BY_DEFAULT, so knows the right way to build it.

>---------------------------------------------------------------

 ghc.mk   |   24 ++++++++++++++++++++++++
 validate |   23 +----------------------
 2 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/ghc.mk b/ghc.mk
index cdf3069..3f8d971 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -1306,6 +1306,30 @@ bootstrapping-files: $(libffi_HEADERS)
 .DELETE_ON_ERROR:
 
 # -----------------------------------------------------------------------------
+
+ifeq "$(HADDOCK_DOCS)" "YES"
+BINDIST_HADDOCK_FLAG = --with-haddock="$(BINDIST_PREFIX)/bin/haddock"
+endif
+ifeq "$(DYNAMIC_BY_DEFAULT)" "YES"
+BINDIST_LIBRARY_FLAGS = --enable-shared --disable-library-vanilla
+else
+BINDIST_LIBRARY_FLAGS = --enable-library-vanilla --disable-shared
+endif
+BINDIST_LIBRARY_FLAGS += --disable-library-prof
+
+.PHONY: validate_build_transformers
+validate_build_transformers:
+	cd libraries/transformers && "$(BINDIST_PREFIX)/bin/ghc" --make Setup
+	cd libraries/transformers && ./Setup configure --with-ghc="$(BINDIST_PREFIX)/bin/ghc" $(BINDIST_HADDOCK_FLAG) $(BINDIST_LIBRARY_FLAGS) --global --builddir=dist-bindist --prefix="$(BINDIST_PREFIX)"
+	cd libraries/transformers && ./Setup build   --builddir=dist-bindist
+ifeq "$(HADDOCK_DOCS)" "YES"
+	cd libraries/transformers && ./Setup haddock --builddir=dist-bindist
+endif
+	cd libraries/transformers && ./Setup install --builddir=dist-bindist
+	cd libraries/transformers && ./Setup clean   --builddir=dist-bindist
+	cd libraries/transformers && rm -f Setup Setup.exe Setup.hi Setup.o
+
+# -----------------------------------------------------------------------------
 # Numbered phase targets
 
 .PHONY: phase_0_builds
diff --git a/validate b/validate
index cc53df9..931c901 100755
--- a/validate
+++ b/validate
@@ -115,28 +115,7 @@ if [ $speed != "FAST" ]; then
     #
     bindistdir="bindisttest/install   dir"
 
-    # This is a hack to make
-    #     HADDOCK_DOCS = NO
-    # work when validating.
-    if grep -q "^HADDOCK_DOCS.*=.*NO" mk/validate.mk
-    then
-        unset WITH_HADDOCK
-        DO_HADDOCK=NO
-    else
-        WITH_HADDOCK=--with-haddock="$thisdir/$bindistdir/bin/haddock"
-        DO_HADDOCK=YES
-    fi
-
-    cd libraries/transformers
-    "$thisdir/$bindistdir/bin/ghc" --make Setup
-
-    ./Setup configure --with-ghc="$thisdir/$bindistdir/bin/ghc" ${WITH_HADDOCK+"$WITH_HADDOCK"} --global --builddir=dist-bindist --prefix="$thisdir/$bindistdir"
-    ./Setup build   --builddir=dist-bindist
-    [ "$DO_HADDOCK" = "YES" ] && ./Setup haddock --builddir=dist-bindist
-    ./Setup install --builddir=dist-bindist
-    ./Setup clean   --builddir=dist-bindist
-    rm -f Setup Setup.exe Setup.hi Setup.o
-    cd $thisdir
+    $make validate_build_transformers BINDIST_PREFIX="$thisdir/$bindistdir"
 fi
 
 fi # testsuite-only
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.