[commit: ghc] ghc-8.0: Make bootstrapping more robust (287d083)

git at git.haskell.org git at git.haskell.org
Thu Feb 18 12:03:35 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/287d08343cc757b88f0abf6d42e8cea264dad706/ghc

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

commit 287d08343cc757b88f0abf6d42e8cea264dad706
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Tue Feb 16 22:41:29 2016 +0100

    Make bootstrapping more robust
    
    Starting with GHC 8.0 we rely on GHC's native cabal macro generation.
    
    As a side-effect, this limits the packages in scope when compiling
    `ghc-cabal` for all bootstrapping GHCs.
    
    Reviewers: ezyang, austin, thomie, bgamari
    
    Reviewed By: thomie, bgamari
    
    Differential Revision: https://phabricator.haskell.org/D1897
    
    GHC Trac Issues: #11413
    
    (cherry picked from commit 525a304f8c010ce73f1456e507aca668eb4917ac)


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

287d08343cc757b88f0abf6d42e8cea264dad706
 utils/ghc-cabal/cabal_macros_boot.h |  4 +++-
 utils/ghc-cabal/ghc.mk              | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/utils/ghc-cabal/cabal_macros_boot.h b/utils/ghc-cabal/cabal_macros_boot.h
index a2da63a..3b130e8 100644
--- a/utils/ghc-cabal/cabal_macros_boot.h
+++ b/utils/ghc-cabal/cabal_macros_boot.h
@@ -1,6 +1,8 @@
 /* defines a few MIN_VERSION_...() macros used by some of the bootstrap packages */
 
-#if __GLASGOW_HASKELL__ >= 711
+#if __GLASGOW_HASKELL__ >= 800
+/* macros are generated accurately by GHC on the fly */
+#elif __GLASGOW_HASKELL__ >= 711
 /* package base-4.9.0.0 */
 # define MIN_VERSION_base(major1,major2,minor) (\
   (major1) <  4 || \
diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk
index 49a2ba3..c06a011 100644
--- a/utils/ghc-cabal/ghc.mk
+++ b/utils/ghc-cabal/ghc.mk
@@ -18,6 +18,20 @@ CABAL_DOTTED_VERSION := $(shell grep "^version:" libraries/Cabal/Cabal/Cabal.cab
 CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
 CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
 
+# Starting with GHC 8.0 we make use of GHC's native ability to
+# generate MIN_VERSION_<pkgname>() CPP macros (rather than relying on
+# the fragile `cabal_macros_boot.h` hack). The generation of those
+# macros is triggered by `-hide-all-packages`, so we have to explicitly
+# enumerate all packages we need in scope. In order to simplify the logic,
+# we pass `-hide-all-packages` also to GHCs < 8, and we include
+# `cabal_macros_boot.h` also for GHC >= 8 (in which case it becomes a
+# dummy include that doesn't contribute any macro definitions).
+ifeq "$(Windows_Host)" "YES"
+CABAL_BUILD_DEPS := base array time containers bytestring deepseq process pretty directory Win32
+else
+CABAL_BUILD_DEPS := base array time containers bytestring deepseq process pretty directory unix
+endif
+
 ghc-cabal_DIST_BINARY_NAME = ghc-cabal$(exeext0)
 ghc-cabal_DIST_BINARY = utils/ghc-cabal/dist/build/tmp/$(ghc-cabal_DIST_BINARY_NAME)
 ghc-cabal_INPLACE = inplace/bin/$(ghc-cabal_DIST_BINARY_NAME)
@@ -34,6 +48,8 @@ $(ghc-cabal_DIST_BINARY): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. b
 	"$(GHC)" $(SRC_HC_OPTS) \
 	       $(addprefix -optc, $(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0)) \
 	       $(addprefix -optl, $(SRC_LD_OPTS) $(CONF_LD_OPTS_STAGE0)) \
+	       -hide-all-packages \
+	       $(addprefix -package , $(CABAL_BUILD_DEPS)) \
 	       --make utils/ghc-cabal/Main.hs -o $@ \
 	       -no-user-$(GHC_PACKAGE_DB_FLAG) \
 	       -Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \



More information about the ghc-commits mailing list