Commit cf07c9d1 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Merge pull request #1390 from 23Skidoo/install-dirs-fix

Pass '--libdir' etc to 'setup configure' when installing.
parents 28b8ea72 a808b4c1
......@@ -24,6 +24,7 @@ module Distribution.Client.Config (
defaultCacheDir,
defaultCompiler,
defaultLogsDir,
defaultUserInstall,
baseSavedConfig,
commentSavedConfig,
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment