[commit: ghc] ghc-8.0: Build system: Correctly pass `TARGETPLATFORM` as host (8c04585)

git at git.haskell.org git at git.haskell.org
Mon Feb 29 13:49:53 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/8c04585babd0db54fdbbc91497d7ffcb0e0924a1/ghc

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

commit 8c04585babd0db54fdbbc91497d7ffcb0e0924a1
Author: Nicolas Trangez <ikke at nicolast.be>
Date:   Mon Feb 29 11:56:33 2016 +0100

    Build system: Correctly pass `TARGETPLATFORM` as host
    
    When building the bundled GMP sources, the `HOSTPLATFORM` value was
    passed to the `--host` flag of the `./configure` call. This is
    incorrect: when building a cross-compiler, e.g. a compiler targeting
    ARM but running on X86, the host on which GMP will run is ARM, i.e.
    the target platform of the compiler, and the host platform (i.e. the
    platform on which the compiler will run) is X86.
    
    See e.g. [1] for more information about the meaning of and relation
    between build, host and target.
    
    [1] https://www.gnu.org/software/autoconf/manual/
        autoconf-2.65/html_node/Specifying-Target-Triplets.html
    
    Test Plan: Building ARM cross-compiler with `integer-gmp`
    
    Reviewers: thomie, gracjan, austin, erikd, Phyx, hvr, bgamari
    
    Reviewed By: erikd, bgamari
    
    Subscribers: erikd, gracjan
    
    Differential Revision: https://phabricator.haskell.org/D1960
    
    (cherry picked from commit 16e97c16851ccb74e9137d71f9a5c9d5971baf77)


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

8c04585babd0db54fdbbc91497d7ffcb0e0924a1
 libraries/integer-gmp/gmp/ghc.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libraries/integer-gmp/gmp/ghc.mk b/libraries/integer-gmp/gmp/ghc.mk
index 33fab0b..8e52574 100644
--- a/libraries/integer-gmp/gmp/ghc.mk
+++ b/libraries/integer-gmp/gmp/ghc.mk
@@ -122,13 +122,16 @@ libraries/integer-gmp/gmp/libgmp.a libraries/integer-gmp/gmp/gmp.h:
 	cat libraries/integer-gmp/gmp/tarball/gmp-5.0.4.patch | { cd libraries/integer-gmp/gmp/gmpbuild && $(PATCH_CMD) -p1 ; }
 	chmod +x libraries/integer-gmp/gmp/ln
 
+	# Note: We must pass `TARGETPLATFORM` to the `--host` argument of GMP's
+	#       `./configure`, not `HOSTPLATFORM`: the 'host' on which GMP will
+	#       run is the 'target' platform of the compiler we're building.
 	cd libraries/integer-gmp/gmp; (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
 	    PATH=`pwd`:$$PATH; \
 	    export PATH; \
 	    cd gmpbuild && \
 	    CC=$(CCX) NM=$(NM) AR=$(AR_STAGE1) ./configure \
 	          --enable-shared=no \
-	          --host=$(HOSTPLATFORM) --build=$(BUILDPLATFORM)
+	          --host=$(TARGETPLATFORM) --build=$(BUILDPLATFORM)
 	$(MAKE) -C libraries/integer-gmp/gmp/gmpbuild MAKEFLAGS=
 	$(CP) libraries/integer-gmp/gmp/gmpbuild/gmp.h libraries/integer-gmp/gmp/
 	$(CP) libraries/integer-gmp/gmp/gmpbuild/.libs/libgmp.a libraries/integer-gmp/gmp/



More information about the ghc-commits mailing list