diff options
author | Nicolas Trangez <ikke@nicolast.be> | 2016-02-29 11:56:33 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-02-29 13:42:52 +0100 |
commit | 16e97c16851ccb74e9137d71f9a5c9d5971baf77 (patch) | |
tree | ccc32ab444916f5b86c66574ddd25c0fd392a300 | |
parent | f72bdbd2fd4204975eb8699cacc4310090134a9f (diff) | |
download | haskell-16e97c16851ccb74e9137d71f9a5c9d5971baf77.tar.gz |
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
-rw-r--r-- | libraries/integer-gmp/gmp/ghc.mk | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libraries/integer-gmp/gmp/ghc.mk b/libraries/integer-gmp/gmp/ghc.mk index 33fab0bfa5..8e52574268 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/ |