diff --git a/.gitignore b/.gitignore
index bb69e916f4496049ddbee136960d097f9c805823..0455251c3a834bddcc14e8afbf00da5cc971c33d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -125,7 +125,9 @@ _darcs/
 /libraries/doc-index*.html
 /libraries/frames.html
 /libraries/ghc-boot/GNUmakefile
+/libraries/ghc-boot/ghc-boot.cabal
 /libraries/ghc-boot/ghc.mk
+/libraries/ghci/ghci.cabal
 /libraries/ghci/ghc.mk
 /libraries/haddock-util.js
 /libraries/hslogo-16.png
diff --git a/aclocal.m4 b/aclocal.m4
index 45c94f784b5ea2bab8367a5639297360fe2f3625..e823f34fcc0cb1466e561f58558be6bf7f0ccd83 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1532,8 +1532,22 @@ AC_SUBST([ProjectPatchLevel2])
 ProjectPatchLevel=`echo $ProjectPatchLevel | sed 's/\.//'`
 
 AC_SUBST([ProjectPatchLevel])
-])# FP_SETUP_PROJECT_VERSION
 
+# The version of the GHC package changes every day, since the
+# patchlevel is the current date.  We don't want to force
+# recompilation of the entire compiler when this happens, so for
+# GHC HEAD we omit the patchlevel from the package version number.
+#
+# The ProjectPatchLevel1 > 20000000 iff GHC HEAD. If it's for a stable
+# release like 7.10.1 or for a release candidate such as 7.10.1.20141224
+# then we don't omit the patchlevel components.
+
+ProjectVersionMunged="$ProjectVersion"
+if test "$ProjectPatchLevel1" -gt 20000000; then
+  ProjectVersionMunged="${VERSION_MAJOR}.${VERSION_MINOR}"
+fi
+AC_SUBST([ProjectVersionMunged])
+])# FP_SETUP_PROJECT_VERSION
 
 # Check for a working timer_create().  We need a pretty detailed check
 # here, because there exist partially-working implementations of
diff --git a/boot b/boot
index 2ce7acbb06f4a3513acb2b1ce71315541383bd95..18d43aabda01db6c4c65e5eabfb92e651189289e 100755
--- a/boot
+++ b/boot
@@ -144,7 +144,10 @@ sub boot_pkgs {
 
     for $package (@library_dirs) {
         my $dir = &basename($package);
-        my @cabals = glob("$package/*.cabal");
+        my @cabals = glob("$package/*.cabal.in");
+        if ($#cabals < 0) {
+            @cabals = glob("$package/*.cabal");
+        }
         if ($#cabals > 0) {
             die "Too many .cabal file in $package\n";
         }
@@ -155,6 +158,7 @@ sub boot_pkgs {
             if (-f $cabal) {
                 $pkg = $cabal;
                 $pkg =~ s#.*/##;
+                $pkg =~ s/\.cabal.in$//;
                 $pkg =~ s/\.cabal$//;
                 $top = $package;
                 $top =~ s#[^/]+#..#g;
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index da8fce2109ceeae7bed33cb87d83bf2a910df611..4264b667e72733783c88b961a0d848a462a4669f 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -2,7 +2,7 @@
 -- ./configure.  Make sure you are editing ghc.cabal.in, not ghc.cabal.
 
 Name: ghc
-Version: @ProjectVersion@
+Version: @ProjectVersionMunged@
 License: BSD3
 License-File: ../LICENSE
 Author: The GHC Team
@@ -53,19 +53,19 @@ Library
                    containers >= 0.5 && < 0.6,
                    array      >= 0.1 && < 0.6,
                    filepath   >= 1   && < 1.5,
-                   template-haskell,
-                   hpc,
-                   transformers,
-                   ghc-boot,
-                   hoopl
+                   template-haskell == 2.11.*,
+                   hpc        == 0.6.*,
+                   transformers == 0.5.*,
+                   ghc-boot   == @ProjectVersionMunged@,
+                   hoopl      >= 3.10.2 && < 3.11
 
     if os(windows)
-        Build-Depends: Win32
+        Build-Depends: Win32  == 2.3.*
     else
-        Build-Depends: unix
+        Build-Depends: unix   == 2.7.*
 
     if flag(ghci)
-        Build-Depends: ghci
+        Build-Depends: ghci == @ProjectVersionMunged@
 
     GHC-Options: -Wall -fno-warn-name-shadowing
 
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 9148c790302725eab976932e5ab541e4288541b3..49c6971dd02019fb7e6c2c14e5aefae6e9bf96a4 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -437,42 +437,6 @@ compiler/stage3/package-data.mk : compiler/ghc.mk
 
 compiler_PACKAGE = ghc
 
-# Note [fiddle-stage1-version]
-# The version of the GHC package changes every day, since the
-# patchlevel is the current date.  We don't want to force
-# recompilation of the entire compiler when this happens, so for stage
-# 1 we omit the patchlevel from the version number.  For stage 2 we
-# have to include the patchlevel since this is the package we install,
-# however.
-#
-# Note: we also have to tweak the version number of the package itself
-# when it gets registered; see Note [munge-stage1-package-config]
-# below.
-# The ProjectPatchLevel > 20000000 iff it's a date. If it's e.g. 6.12.1
-# then we don't want to remove it
-ifneq "$(CLEANING)" "YES"
-ifeq "$(shell [ $(ProjectPatchLevel) -gt 20000000 ] && echo YES)" "YES"
-compiler_stage1_VERSION_MUNGED = YES
-endif
-endif
-
-ifeq "$(compiler_stage1_VERSION_MUNGED)" "YES"
-compiler_stage1_MUNGED_VERSION = $(subst .$(ProjectPatchLevel),,$(ProjectVersion))
-define compiler_PACKAGE_MAGIC
-compiler_stage1_VERSION = $(compiler_stage1_MUNGED_VERSION)
-compiler_stage1_COMPONENT_ID = $(subst .$(ProjectPatchLevel),,$(compiler_stage1_COMPONENT_ID))
-endef
-
-# NB: the COMPONENT_ID munging has no effect for new-style unit ids
-# (which indeed, have nothing version like in them, but are important for
-# old-style unit ids which do.)  The subst operation is idempotent, so
-# as long as we do it at least once we should be good.
-
-# Don't register the non-munged package
-compiler_stage1_REGISTER_PACKAGE = NO
-
-endif
-
 # Don't do splitting for the GHC package, it takes too long and
 # there's not much benefit.
 compiler_stage1_SplitObjs = NO
@@ -708,21 +672,4 @@ ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES"
 compiler/utils/Util_HC_OPTS += -DDYNAMIC_GHC_PROGRAMS
 endif
 
-# Note [munge-stage1-package-config]
-# Strip the date/patchlevel from the version of stage1.  See Note
-# [fiddle-stage1-version] above.
-# NB: The sed expression for hs-libraries is a bit weird to be POSIX-compliant.
-ifeq "$(compiler_stage1_VERSION_MUNGED)" "YES"
-compiler/stage1/inplace-pkg-config-munged: compiler/stage1/inplace-pkg-config
-	sed -e 's/^\(version: .*\)\.$(ProjectPatchLevel)$$/\1/' \
-	    -e 's/^\(id: .*\)\.$(ProjectPatchLevel)$$/\1/' \
-	    -e 's/^\(hs-libraries: HSghc-.*\)\.$(ProjectPatchLevel)\(-[A-Za-z0-9][A-Za-z0-9]*\)*$$/\1\2/' \
-	  < $< > $@
-	"$(compiler_stage1_GHC_PKG)" update --force $(compiler_stage1_GHC_PKG_OPTS) $@
-
-# We need to make sure the munged config is in the database before we
-# try to configure ghc-bin
-ghc/stage1/package-data.mk : compiler/stage1/inplace-pkg-config-munged
-endif
-
 endif
diff --git a/configure.ac b/configure.ac
index 69cdd2b7e476318adcdac18614a9d1898b028fb4..f5d624db267a3b5eea21292adab485cad331cbd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1103,7 +1103,7 @@ if test -e shake-build/cfg/system.config.in; then
     AC_CONFIG_FILES([shake-build/cfg/system.config])
 fi
 
-AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
+AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghci/ghci.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
 AC_OUTPUT
 
 # We got caught by
diff --git a/ghc.mk b/ghc.mk
index 1bd54154bdd2652745038b525ae63058e541fe3c..ba708a1f595459bdd1b36e4ab65fb11e635e974f 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -1349,6 +1349,7 @@ distclean : clean
 	$(call removeFiles,mk/project.mk)
 	$(call removeFiles,compiler/ghc.cabal)
 	$(call removeFiles,ghc/ghc-bin.cabal)
+	$(call removeFiles,libraries/ghci/ghci.cabal)
 	$(call removeFiles,utils/runghc/runghc.cabal)
 	$(call removeFiles,settings)
 	$(call removeFiles,docs/users_guide/ug-book.xml)
diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in
index adf81b3890ff1aa3ec892aab41db7f9494dab517..afb3939fc9761ac7f0da45d47bbffc7464be51f0 100644
--- a/ghc/ghc-bin.cabal.in
+++ b/ghc/ghc-bin.cabal.in
@@ -27,14 +27,14 @@ Executable ghc
     Default-Language: Haskell2010
 
     Main-Is: Main.hs
-    Build-Depends: base       >= 3   && < 5,
+    Build-Depends: base       >= 4   && < 5,
                    array      >= 0.1 && < 0.6,
                    bytestring >= 0.9 && < 0.11,
                    directory  >= 1   && < 1.3,
                    process    >= 1   && < 1.5,
                    filepath   >= 1   && < 1.5,
-                   ghc-boot   == 0.0.*,
-                   ghc
+                   ghc-boot   == @ProjectVersionMunged@,
+                   ghc        == @ProjectVersionMunged@
 
     if os(windows)
         Build-Depends: Win32  == 2.3.*
@@ -49,7 +49,7 @@ Executable ghc
         Build-depends:
             containers     == 0.5.*,
             deepseq        == 1.4.*,
-            ghci,
+            ghci           == @ProjectVersionMunged@,
             haskeline      == 0.7.*,
             time           == 1.6.*,
             transformers   == 0.5.*
diff --git a/ghc/ghc.mk b/ghc/ghc.mk
index f8c6b09e3f9cde5de14f1d70e260f34e717e9a87..c0c78bdef6011145dfbfbf6e978d7010cede1b5b 100644
--- a/ghc/ghc.mk
+++ b/ghc/ghc.mk
@@ -22,15 +22,6 @@ ghc_stage2_CONFIGURE_OPTS += --flags=ghci
 ghc_stage3_CONFIGURE_OPTS += --flags=ghci
 endif
 
-ifeq "$(compiler_stage1_VERSION_MUNGED)" "YES"
-# If we munge the stage1 version, and we're using a devel snapshot for
-# stage0, then stage1 may actually have an earlier version than stage0
-# (e.g. boot with ghc-7.5.20120316, building ghc-7.5). We therefore
-# need to tell Cabal to use version 7.5 of the ghc package when building
-# in ghc/stage1
-ghc_stage1_CONFIGURE_OPTS += --constraint "ghc == $(compiler_stage1_MUNGED_VERSION)"
-endif
-
 # This package doesn't pass the Cabal checks because data-dir
 # points outside the source directory. This isn't a real problem, so
 # we just skip the check.
diff --git a/iserv/iserv-bin.cabal b/iserv/iserv-bin.cabal
index 9dac158ebfe6c27746e1487fabca73c41bb291ac..d4f0eed2634f76ddb6bbba07e21e0dc89b55f7cb 100644
--- a/iserv/iserv-bin.cabal
+++ b/iserv/iserv-bin.cabal
@@ -23,4 +23,4 @@ Executable iserv
                    bytestring >= 0.10 && < 0.11,
                    containers >= 0.5 && < 0.6,
                    deepseq    >= 1.4 && < 1.5,
-                   ghci
+                   ghci       == 7.11.*
diff --git a/libraries/ghc-boot/ghc-boot.cabal b/libraries/ghc-boot/ghc-boot.cabal.in
similarity index 88%
rename from libraries/ghc-boot/ghc-boot.cabal
rename to libraries/ghc-boot/ghc-boot.cabal.in
index f9516b6060c6c37d1580e9c7243856386e375918..b7d3955190d3123733d7f4cca938dbc7c1795389 100644
--- a/libraries/ghc-boot/ghc-boot.cabal
+++ b/libraries/ghc-boot/ghc-boot.cabal.in
@@ -1,5 +1,9 @@
+-- WARNING: ghc-boot.cabal is automatically generated from ghc-boot.cabal.in by
+-- ../../configure.  Make sure you are editing ghc-boot.cabal.in, not
+-- ghc-boot.cabal.
+
 name:           ghc-boot
-version:        0.0.0.0
+version:        @ProjectVersionMunged@
 license:        BSD3
 license-file:   LICENSE
 category:       GHC
diff --git a/libraries/ghci/ghci.cabal b/libraries/ghci/ghci.cabal.in
similarity index 72%
rename from libraries/ghci/ghci.cabal
rename to libraries/ghci/ghci.cabal.in
index 39eb7dacf969bbabd3a7cccfefa97e02a289434b..e9ceb4660844fc85ed73120a2157e3a8cee5f228 100644
--- a/libraries/ghci/ghci.cabal
+++ b/libraries/ghci/ghci.cabal.in
@@ -1,5 +1,8 @@
+-- WARNING: ghci.cabal is automatically generated from ghci.cabal.in by
+-- ../../configure.  Make sure you are editing ghci.cabal.in, not ghci.cabal.
+
 name:           ghci
-version:        0
+version:        @ProjectVersionMunged@
 license:        BSD3
 license-file:   LICENSE
 category:       GHC
@@ -37,17 +40,17 @@ library
         UnboxedTuples
 
     exposed-modules:
-        GHCi.Message,
-        GHCi.ResolvedBCO,
-        GHCi.RemoteTypes,
-        GHCi.ObjLink,
-        GHCi.CreateBCO,
-        GHCi.FFI,
-        GHCi.InfoTable,
-        GHCi.Run,
-        GHCi.Signals,
-        GHCi.TH,
-        GHCi.TH.Binary,
+        GHCi.Message
+        GHCi.ResolvedBCO
+        GHCi.RemoteTypes
+        GHCi.ObjLink
+        GHCi.CreateBCO
+        GHCi.FFI
+        GHCi.InfoTable
+        GHCi.Run
+        GHCi.Signals
+        GHCi.TH
+        GHCi.TH.Binary
         SizedSeq
 
     Build-Depends:
@@ -58,7 +61,7 @@ library
         containers       == 0.5.*,
         deepseq          == 1.4.*,
         filepath         == 1.4.*,
-        ghc-boot         == 0.0.*,
+        ghc-boot         == @ProjectVersionMunged@,
         template-haskell == 2.11.*,
         transformers     == 0.5.*
 
diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal
index ad51144d68885541176b0ef6c96e991e36cd6b86..ff9fe05367777256455cca30ea5e1fdbab9db884 100644
--- a/libraries/template-haskell/template-haskell.cabal
+++ b/libraries/template-haskell/template-haskell.cabal
@@ -48,7 +48,7 @@ Library
 
     build-depends:
         base       >= 4.6 && < 4.10,
-        ghc-boot,
+        ghc-boot   >= 7.11 && < 8.1,
         pretty     == 1.1.*
 
     -- We need to set the unit ID to template-haskell (without a
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 17b87e021ec641565c1de720f0af53ecea74863b..e46ecd6d6159ed90511a8549e9deb226cf0b36e1 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -134,10 +134,8 @@ endif
 endif
 	"$$(ghc-cabal_INPLACE)" configure $1 $2 "$$($1_$2_dll0_MODULES)" --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS)
 ifeq "$$($1_$2_PROG)" ""
-ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO"
 	$$(call cmd,$1_$2_GHC_PKG) update --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config
 endif
-endif
 endif # NO_GENERATED_MAKEFILE_RULES
 endif # BINDIST
 
diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk
index 1a91cd9d7792ae7724dda68a9c17900d36f46adf..1f44c9ec5f2c4495152957fe1f7fa9cc8252ac6e 100644
--- a/rules/foreachLibrary.mk
+++ b/rules/foreachLibrary.mk
@@ -38,6 +38,7 @@ define foreachLibrary
 # $1 = function to call for each library
 # We will give it the package path and the tag as arguments
 $$(foreach hashline,libraries/ghc-boot#-#no-remote-repo#no-vcs        \
+                    libraries/ghci#-#no-remote-repo#no-vcs                  \
                     libraries/base#-#no-remote-repo#no-vcs                  \
                     libraries/ghc-prim#-#no-remote-repo#no-vcs              \
                     libraries/integer-gmp#-#no-remote-repo#no-vcs           \
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index fb429bcbd5988e19b47b87bd7c38c6e534633483..549737b8267d5cd72cd1247a35fa27e2f737be36 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -284,8 +284,9 @@ test('T8028',
      ['T8028', '-v0 ' + config.ghc_th_way_flags])
 
 test('TH_Roles1', normal, compile_fail, ['-v0'])
-test('TH_Roles2', normalise_version('array', 'base', 'deepseq', 'ghc-prim',
-                                    'integer-gmp', 'pretty', 'template-haskell'
+test('TH_Roles2', normalise_version('array', 'base', 'deepseq', 'ghc-prim', 'ghc-boot',
+                                    'integer-gmp', 'pretty', 'template-haskell',
+                                    'binary', 'bytestring', 'containers'
                                     ), compile, ['-v0 -ddump-tc'])
 test('TH_Roles3', normal, compile, ['-v0 -dsuppress-uniques'])
 test('TH_Roles4', normal, compile, ['-v0'])