[commit: ghc] wip/angerman/llvmng: Build utilities with the bootstrap compiler when cross compiling (a1cfec3)
git at git.haskell.org
git at git.haskell.org
Tue Oct 3 01:23:42 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/angerman/llvmng
Link : http://ghc.haskell.org/trac/ghc/changeset/a1cfec3a3bd9ae0f9f5412f7035d1f68101d66ed/ghc
>---------------------------------------------------------------
commit a1cfec3a3bd9ae0f9f5412f7035d1f68101d66ed
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date: Fri Sep 29 14:45:44 2017 +0800
Build utilities with the bootstrap compiler when cross compiling
Summary:
This should fix Trac #14297. When building a cross compiler, we have rather little use
of utilities that do not run on the host, where the compiler runs. As such we should
build the utilities with the bootstrap (stage 0) compiler rather than witht he
in-tree (stage 1) compiler when CrossCompiling.
This used to results in the utilities we ship in the binary distribution to be built for
the wrong host. This diff tries to rectify the situation and allow the binary distribution
to contain the utilities for the host when CrossCompiling.
Reviewers: bgamari, trofi, hvr, austin
Subscribers: rwbarton, thomie
GHC Trac Issues: #14297
Differential Revision: https://phabricator.haskell.org/D4048
>---------------------------------------------------------------
a1cfec3a3bd9ae0f9f5412f7035d1f68101d66ed
ghc.mk | 15 +++++++++++++--
utils/compare_sizes/ghc.mk | 4 +++-
utils/hpc/ghc.mk | 18 +++++++++++++++++-
utils/hsc2hs | 2 +-
4 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/ghc.mk b/ghc.mk
index c3edc5e..f397f7c 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -1056,6 +1056,17 @@ ifneq "$(CLEANING)" "YES"
# This rule seems to hold some files open on Windows which prevents
# cleaning, perhaps due to the $(wildcard).
+# when building stage1only (a cross-compiler), we need to put the
+# stage0 compiled ghc-cabal into the binary distribution. As the
+# stage1 compiled ghc-cabal is built for the target, however
+# ghc-cabal is used during 'make install' on the host, when
+# installing the binary distribution.
+ifeq "$(Stage1Only)" "YES"
+DIST_GHC_CABAL=utils/ghc-cabal/dist/build/tmp/ghc-cabal
+else
+DIST_GHC_CABAL=utils/ghc-cabal/dist-install/build/tmp/ghc-cabal
+endif
+
$(eval $(call bindist-list,.,\
LICENSE \
README \
@@ -1067,7 +1078,7 @@ $(eval $(call bindist-list,.,\
Makefile \
mk/config.mk.in \
$(INPLACE_BIN)/mkdirhier \
- utils/ghc-cabal/dist-install/build/tmp/ghc-cabal \
+ $(DIST_GHC_CABAL) \
$(BINDIST_WRAPPERS) \
$(BINDIST_PERL_SOURCES) \
$(BINDIST_LIBS) \
@@ -1127,7 +1138,7 @@ unix-binary-dist-prep:
echo "BUILD_SPHINX_HTML = $(BUILD_SPHINX_HTML)" >> $(BIN_DIST_MK)
echo "BUILD_SPHINX_PDF = $(BUILD_SPHINX_PDF)" >> $(BIN_DIST_MK)
echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK)
- echo "override ghc-cabal_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" >> $(BIN_DIST_MK)
+ echo "override ghc-cabal_INPLACE = $(DIST_GHC_CABAL)" >> $(BIN_DIST_MK)
echo "UseSystemLibFFI = $(UseSystemLibFFI)" >> $(BIN_DIST_MK)
# See Note [Persist CrossCompiling in binary distributions]
echo "CrossCompiling = $(CrossCompiling)" >> $(BIN_DIST_MK)
diff --git a/utils/compare_sizes/ghc.mk b/utils/compare_sizes/ghc.mk
index d659a5e..1e601a3 100644
--- a/utils/compare_sizes/ghc.mk
+++ b/utils/compare_sizes/ghc.mk
@@ -5,5 +5,7 @@ utils/compare_sizes_MODULES = Main
utils/compare_sizes_dist-install_PROGNAME = compareSizes
utils/compare_sizes_dist-install_INSTALL_INPLACE = NO
+# build compare_sizes only if not Stage1Only or not CrossCompiling.
+ifeq "$(Stage1Only) $(CrossCompiling)" "NO NO"
$(eval $(call build-prog,utils/compare_sizes,dist-install,1))
-
+endif
diff --git a/utils/hpc/ghc.mk b/utils/hpc/ghc.mk
index f70be94..697e795 100644
--- a/utils/hpc/ghc.mk
+++ b/utils/hpc/ghc.mk
@@ -12,10 +12,26 @@
utils/hpc_USES_CABAL = YES
utils/hpc_PACKAGE = hpc-bin
-utils/hpc_dist-install_INSTALL = YES
+
+# built by ghc-stage0
+utils/hpc_dist_INSTALL_INPLACE = NO
+utils/hpc_dist_PROGNAME = hpc
+utils/hpc_dist_SHELL_WRAPPER = YES
+utils/hpc_dist_INSTALL_SHELL_WRAPPER_NAME = hpc
+
+# built by ghc-stage1
utils/hpc_dist-install_INSTALL_INPLACE = YES
utils/hpc_dist-install_PROGNAME = hpc
utils/hpc_dist-install_SHELL_WRAPPER = YES
utils/hpc_dist-install_INSTALL_SHELL_WRAPPER_NAME = hpc
+ifeq "$(Stage1Only)" "YES"
+utils/hpc_dist_INSTALL = YES
+utils/hpc_dist-install_INSTALL = NO
+else
+utils/hpc_dist_INSTALL = NO
+utils/hpc_dist-install_INSTALL = YES
+endif
+
+$(eval $(call build-prog,utils/hpc,dist,0))
$(eval $(call build-prog,utils/hpc,dist-install,1))
diff --git a/utils/hsc2hs b/utils/hsc2hs
index 936b088..94af7d9 160000
--- a/utils/hsc2hs
+++ b/utils/hsc2hs
@@ -1 +1 @@
-Subproject commit 936b0885ee794db83dc8473e17e153936e56d62f
+Subproject commit 94af7d9a27307f40a8b18da0f8e0fd9e9d77e818
More information about the ghc-commits
mailing list