[commit: packages/Cabal] ghc-head: Pass '--libdir' etc to 'setup configure' when installing. (a808b4c)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:28:36 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=a808b4c1de87dfe0a278b1a4cf833a9956a4e9fd

>---------------------------------------------------------------

commit a808b4c1de87dfe0a278b1a4cf833a9956a4e9fd
Author: Mikhail Glushenkov <mikhail.glushenkov at gmail.com>
Date:   Wed Jul 17 19:06:05 2013 +0200

    Pass '--libdir' etc to 'setup configure' when installing.
    
    Otherwise libs with 'build-type: Custom' get installed under
    '$prefix/lib/$pkgname' instead of '$prefix/lib/$arch-$compiler-$os/$pkgname' if
    the setup script is compiled against Cabal < 1.17.


>---------------------------------------------------------------

a808b4c1de87dfe0a278b1a4cf833a9956a4e9fd
 cabal-install/Distribution/Client/Config.hs  |    1 +
 cabal-install/Distribution/Client/Install.hs |   27 ++++++++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/cabal-install/Distribution/Client/Config.hs b/cabal-install/Distribution/Client/Config.hs
index a14965a..88697d8 100644
--- a/cabal-install/Distribution/Client/Config.hs
+++ b/cabal-install/Distribution/Client/Config.hs
@@ -24,6 +24,7 @@ module Distribution.Client.Config (
     defaultCacheDir,
     defaultCompiler,
     defaultLogsDir,
+    defaultUserInstall,
 
     baseSavedConfig,
     commentSavedConfig,
diff --git a/cabal-install/Distribution/Client/Install.hs b/cabal-install/Distribution/Client/Install.hs
index 8ad1397..cfb2208 100644
--- a/cabal-install/Distribution/Client/Install.hs
+++ b/cabal-install/Distribution/Client/Install.hs
@@ -65,7 +65,7 @@ import Distribution.Client.Setup
          , ConfigFlags(..), configureCommand, filterConfigureFlags
          , ConfigExFlags(..), InstallFlags(..) )
 import Distribution.Client.Config
-         ( defaultCabalDir )
+         ( defaultCabalDir, defaultUserInstall )
 import Distribution.Client.Sandbox.Timestamp
          ( withUpdateTimestamps )
 import Distribution.Client.Sandbox.Types
@@ -1161,6 +1161,15 @@ installUnpackedPackage verbosity buildLimit installLock numJobs
                     ++ " with the latest revision from the index."
       writeFileAtomic descFilePath pkgtxt
 
+  -- Make sure that we pass --libsubdir etc to 'setup configure' (necessary if
+  -- the setup script was compiled against an old version of the Cabal lib).
+  configFlags' <- addDefaultInstallDirs configFlags
+  -- Filter out flags not supported by the old versions of the Cabal lib.
+  let configureFlags :: Version -> ConfigFlags
+      configureFlags  = filterConfigureFlags configFlags' {
+        configVerbosity = toFlag verbosity'
+      }
+
   -- Configure phase
   onFailure ConfigureFailed $ withJobLimit buildLimit $ do
     when (numJobs > 1) $ notice verbosity $
@@ -1199,9 +1208,6 @@ installUnpackedPackage verbosity buildLimit installLock numJobs
 
   where
     pkgid            = packageId pkg
-    configureFlags   = filterConfigureFlags configFlags {
-      configVerbosity = toFlag verbosity'
-    }
     buildCommand'    = buildCommand defaultProgramConfiguration
     buildFlags   _   = emptyBuildFlags {
       buildDistPref  = configDistPref configFlags,
@@ -1222,6 +1228,19 @@ installUnpackedPackage verbosity buildLimit installLock numJobs
     }
     verbosity' = maybe verbosity snd useLogFile
 
+    addDefaultInstallDirs :: ConfigFlags -> IO ConfigFlags
+    addDefaultInstallDirs configFlags' = do
+      defInstallDirs <- InstallDirs.defaultInstallDirs flavor userInstall False
+      return $ configFlags' {
+          configInstallDirs = InstallDirs.combineInstallDirs combine
+                              defInstallDirs (configInstallDirs configFlags)
+          }
+        where
+          CompilerId flavor _ = compid
+          combine     = \d f -> Cabal.Flag $ fromFlagOrDefault d f
+          userInstall = fromFlagOrDefault defaultUserInstall
+                        (configUserInstall configFlags')
+
     setup cmd flags  = do
       Exception.bracket
               (case useLogFile of





More information about the ghc-commits mailing list