Fix the build when the bootstrapping compiler has a newer Cabal than us
authorIan Lynagh <igloo@earth.li>
Wed, 15 Oct 2008 14:40:23 +0000 (14:40 +0000)
committerIan Lynagh <igloo@earth.li>
Wed, 15 Oct 2008 14:40:23 +0000 (14:40 +0000)
We need to forcibly use the in-tree Cabal, or we get version mismatch errors

libraries/Makefile
mk/cabal-flags.mk
utils/installPackage/Makefile

index ce28841..b0179ca 100644 (file)
@@ -120,9 +120,6 @@ ifeq "$(ghc_ge_605)" "NO"
 CABAL_GHC_FLAGS += -cpp
 endif
 
-# Euch, hideous hack:
-CABAL_VERSION = $(shell grep "^Version:" Cabal/Cabal.cabal | sed -e "s/^Version: //" -e 's/\./,/g')
-
 BOOTSTRAPPING_FLAGS = $(CABAL_GHC_FLAGS) -DCABAL_VERSION=$(CABAL_VERSION) -odir $(HERE_ABS)/bootstrapping -hidir $(HERE_ABS)/bootstrapping -i$(HERE_ABS)/Cabal -i$(HERE_ABS)/filepath -i$(HERE_ABS)/hpc
 
 .PHONY: boot
index 7a137ce..bfa11a8 100644 (file)
@@ -1,6 +1,7 @@
 
 nothing=
 space=$(nothing) $(nothing)
+comma=,
 
 GHC_PKG_INSTALL_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/dist-install/build/ghc-pkg/ghc-pkg
 
@@ -11,6 +12,11 @@ INSTALL_PACKAGE = \
     $(UTILS_ABS)/installPackage/install-inplace/bin/installPackage
 STAGE3_PACKAGE_CONF = $(FPTOOLS_TOP_ABS)/stage3.package.conf
 
+# Euch, hideous hack:
+CABAL_DOTTED_VERSION = $(shell grep "^Version:" $(LIBRARIES_ABS)/Cabal/Cabal.cabal | sed "s/^Version: //")
+CABAL_VERSION = $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
+CABAL_CONSTRAINT = --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
+
 # We rely on all the CONFIGURE_ARGS being quoted with '...', and there
 # being no 's inside the values.
 FLAGGED_CONFIGURE_ARGS = $(subst $(space)',\
index e963060..758442d 100644 (file)
@@ -3,7 +3,11 @@ TOP=../..
 include $(TOP)/mk/boilerplate.mk
 include $(TOP)/mk/cabal.mk
 
-# We should stop installPackage being installed itself, but we do need
-# to build it with the stage2 compiler as we need to use it when
-# installing.
+# If the bootstrapping compiler already has a newer version of Cabal
+# than the in-tree Cabal, then we need to forcibly use the in-tree one.
+# Otherwise we use one Cabal for some things and the other Cabal for
+# other things, and Cabal (rightly) complains about the version
+# mismatch.
+EXTRA_INPLACE_CONFIGURE_FLAGS += $(CABAL_CONSTRAINT)
+EXTRA_STAGE2_CONFIGURE_FLAGS  += $(CABAL_CONSTRAINT)