"ghc-cabal install" now needs to know where GHC is, to get the ABI hash
authorIan Lynagh <igloo@earth.li>
Wed, 26 Aug 2009 13:33:59 +0000 (13:33 +0000)
committerIan Lynagh <igloo@earth.li>
Wed, 26 Aug 2009 13:33:59 +0000 (13:33 +0000)
ghc.mk
utils/ghc-cabal/ghc-cabal.hs

diff --git a/ghc.mk b/ghc.mk
index 0f479e1..9ce17a3 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -777,8 +777,10 @@ INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf
 # Install packages in the right order, so that ghc-pkg doesn't complain.
 # Also, install ghc-pkg first.
 ifeq "$(Windows)" "NO"
+INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/ghc-stage2
 INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/ghc-pkg
 else
+INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc-stage2.exe
 INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
 endif
 
@@ -792,13 +794,15 @@ install_packages: libffi/package.conf.install rts/package.conf.install
        "$(INSTALLED_GHC_PKG_REAL)" --force --global-conf $(INSTALLED_PACKAGE_CONF) update rts/package.conf.install
        $(foreach p, $(PACKAGES) $(PACKAGES_STAGE2),\
            "$(GHC_CABAL_INPLACE)" install \
+                $(INSTALLED_GHC_REAL) \
                 $(INSTALLED_GHC_PKG_REAL) \
-                $(INSTALLED_PACKAGE_CONF) \
+                $(DESTDIR)$(topdir) \
                 libraries/$p dist-install \
                 '$(DESTDIR)' '$(prefix)' '$(ghclibdir)' '$(docdir)/html/libraries' &&) true
        "$(GHC_CABAL_INPLACE)" install \
+                $(INSTALLED_GHC_REAL) \
                 $(INSTALLED_GHC_PKG_REAL) \
-                $(INSTALLED_PACKAGE_CONF) \
+                $(DESTDIR)$(topdir) \
                 compiler stage2 \
                 '$(DESTDIR)' '$(prefix)' '$(ghclibdir)' '$(docdir)/html/libraries'
 
index 8ee1304..d113ec3 100644 (file)
@@ -34,9 +34,9 @@ main = do args <- getArgs
                   runHaddock distDir dir args'
               "check" : dir : [] ->
                   doCheck dir
-              "install" : ghcpkg : ghcpkgconfig : directory : distDir
+              "install" : ghc : ghcpkg : topdir : directory : distDir
                         : myDestDir : myPrefix : myLibdir : myDocdir : args' ->
-                  doInstall ghcpkg ghcpkgconfig directory distDir
+                  doInstall ghc ghcpkg topdir directory distDir
                             myDestDir myPrefix myLibdir myDocdir args'
               "configure" : args' -> case break (== "--") args' of
                    (config_args, "--" : distdir : directories) ->
@@ -111,8 +111,9 @@ runHaddock distdir directory args
           = f pd lbi us flags
 
 doInstall :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath
-          -> FilePath -> FilePath -> FilePath -> [String] -> IO ()
-doInstall ghcpkg ghcpkgconf directory distDir myDestDir myPrefix myLibdir myDocdir args
+          -> FilePath -> FilePath -> FilePath -> FilePath -> [String]
+          -> IO ()
+doInstall ghc ghcpkg topdir directory distDir myDestDir myPrefix myLibdir myDocdir args
  = withCurrentDirectory directory $ do
      defaultMainWithHooksArgs hooks (["copy", "--builddir", distDir]
                                      ++ (if null myDestDir then []
@@ -146,16 +147,25 @@ doInstall ghcpkg ghcpkgconf directory distDir myDestDir myPrefix myLibdir myDocd
                                    docdir    = toPathTemplate (myDocdir </> "$pkg"),
                                    htmldir   = toPathTemplate "$docdir" }
                     progs = withPrograms lbi
-                    prog = ConfiguredProgram {
-                               programId = programName ghcPkgProgram,
-                               programVersion = Nothing,
-                               programArgs = ["--global-conf", ghcpkgconf]
-                                             ++ if not (null myDestDir)
-                                                then ["--force"]
-                                                else [],
-                               programLocation = UserSpecified ghcpkg
-                           }
-                    progs' = updateProgram prog progs
+                    ghcProg = ConfiguredProgram {
+                                  programId = programName ghcProgram,
+                                  programVersion = Nothing,
+                                  programArgs = ["-B" ++ topdir],
+                                  programLocation = UserSpecified ghc
+                              }
+                    ghcpkgconf = topdir </> "package.conf"
+                    ghcPkgProg = ConfiguredProgram {
+                                     programId = programName ghcPkgProgram,
+                                     programVersion = Nothing,
+                                     programArgs = ["--global-conf",
+                                                    ghcpkgconf]
+                                                   ++ if not (null myDestDir)
+                                                      then ["--force"]
+                                                      else [],
+                                     programLocation = UserSpecified ghcpkg
+                                 }
+                    progs' = updateProgram ghcProg
+                           $ updateProgram ghcPkgProg progs
                     lbi' = lbi {
                                    installDirTemplates = idts',
                                    withPrograms = progs'