summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2016-02-16 22:41:29 +0100
committerBen Gamari <ben@smart-cactus.org>2016-02-16 22:41:45 +0100
commit525a304f8c010ce73f1456e507aca668eb4917ac (patch)
treecd61aec9db1311bb20d2ae084175f5c37e69b8f1
parentc8df3f1e708c57fd1e3846a5a34464cec4ddc891 (diff)
downloadhaskell-525a304f8c010ce73f1456e507aca668eb4917ac.tar.gz
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
-rw-r--r--utils/ghc-cabal/cabal_macros_boot.h4
-rw-r--r--utils/ghc-cabal/ghc.mk16
2 files changed, 19 insertions, 1 deletions
diff --git a/utils/ghc-cabal/cabal_macros_boot.h b/utils/ghc-cabal/cabal_macros_boot.h
index a2da63a3de..3b130e844c 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 49a2ba3f0a..c06a011297 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 \