Fix the build when the bootstrapping compiler has a newer Cabal than us
[ghc-hetmet.git] / mk / cabal-flags.mk
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)',\