From 7c9b541f7f321839ef06f22ebc24b53adc1cea7a Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 15 Oct 2008 14:40:23 +0000 Subject: [PATCH] Fix the build when the bootstrapping compiler has a newer Cabal than us We need to forcibly use the in-tree Cabal, or we get version mismatch errors --- libraries/Makefile | 3 --- mk/cabal-flags.mk | 6 ++++++ utils/installPackage/Makefile | 10 +++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/libraries/Makefile b/libraries/Makefile index ce28841..b0179ca 100644 --- a/libraries/Makefile +++ b/libraries/Makefile @@ -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 diff --git a/mk/cabal-flags.mk b/mk/cabal-flags.mk index 7a137ce..bfa11a8 100644 --- a/mk/cabal-flags.mk +++ b/mk/cabal-flags.mk @@ -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)',\ diff --git a/utils/installPackage/Makefile b/utils/installPackage/Makefile index e963060..758442d 100644 --- a/utils/installPackage/Makefile +++ b/utils/installPackage/Makefile @@ -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) -- 1.7.10.4