Commit 9480aca6 authored by refold's avatar refold

Make hostPlatform available in D.C.SetupWrapper.

Removes the uses of buildPlatform from D.C.Install.
parent 70c9e86d
......@@ -98,6 +98,7 @@ configure verbosity packageDBs repos comp platform conf
useCabalVersion = maybe anyVersion thisVersion
(flagToMaybe (configCabalVersion configExFlags)),
useCompiler = Just comp,
usePlatform = Just platform,
usePackageDB = packageDBs',
usePackageIndex = index',
useProgramConfig = conf,
......
......@@ -122,7 +122,7 @@ import Distribution.Simple.Utils as Utils
import Distribution.Client.Utils
( numberOfProcessors, inDir, mergeBy, MergeResult(..) )
import Distribution.System
( Platform, buildPlatform, OS(Windows), buildOS )
( Platform, OS(Windows), buildOS )
import Distribution.Text
( display )
import Distribution.Verbosity as Verbosity
......@@ -152,6 +152,7 @@ install
-> PackageDBStack
-> [Repo]
-> Compiler
-> Platform
-> ProgramConfiguration
-> GlobalFlags
-> ConfigFlags
......@@ -160,7 +161,7 @@ install
-> HaddockFlags
-> [UserTarget]
-> IO ()
install verbosity packageDBs repos comp conf
install verbosity packageDBs repos comp platform conf
globalFlags configFlags configExFlags installFlags haddockFlags
userTargets0 = do
......@@ -171,7 +172,7 @@ install verbosity packageDBs repos comp conf
processInstallPlan verbosity args installContext installPlan
where
args :: InstallArgs
args = (packageDBs, repos, comp, conf,
args = (packageDBs, repos, comp, platform, conf,
globalFlags, configFlags, configExFlags, installFlags,
haddockFlags)
......@@ -188,6 +189,7 @@ type InstallContext = ( PackageIndex, SourcePackageDb
type InstallArgs = ( PackageDBStack
, [Repo]
, Compiler
, Platform
, ProgramConfiguration
, GlobalFlags
, ConfigFlags
......@@ -199,7 +201,7 @@ type InstallArgs = ( PackageDBStack
makeInstallContext :: Verbosity -> InstallArgs -> [UserTarget]
-> IO InstallContext
makeInstallContext verbosity
(packageDBs, repos, comp, conf,
(packageDBs, repos, comp, _, conf,
globalFlags, _, _, _, _) userTargets0 = do
installedPkgIndex <- getInstalledPackages verbosity comp packageDBs conf
......@@ -221,7 +223,7 @@ makeInstallContext verbosity
makeInstallPlan :: Verbosity -> InstallArgs -> InstallContext
-> IO (Progress String String InstallPlan)
makeInstallPlan verbosity
(_, _, comp, _,
(_, _, comp, platform, _,
_, configFlags, configExFlags, installFlags,
_)
(installedPkgIndex, sourcePkgDb,
......@@ -230,15 +232,15 @@ makeInstallPlan verbosity
solver <- chooseSolver verbosity (fromFlag (configSolver configExFlags))
(compilerId comp)
notice verbosity "Resolving dependencies..."
return $ planPackages comp solver configFlags configExFlags installFlags
installedPkgIndex sourcePkgDb pkgSpecifiers
return $ planPackages comp platform solver configFlags configExFlags
installFlags installedPkgIndex sourcePkgDb pkgSpecifiers
-- | Given an install plan, perform the actual installations.
processInstallPlan :: Verbosity -> InstallArgs -> InstallContext
-> InstallPlan
-> IO ()
processInstallPlan verbosity
args@(_, _, _, _, _, _, _, installFlags, _)
args@(_, _, _, _, _, _, _, _, installFlags, _)
(installedPkgIndex, sourcePkgDb,
userTargets, pkgSpecifiers) installPlan = do
checkPrintPlan verbosity installedPkgIndex installPlan sourcePkgDb
......@@ -256,6 +258,7 @@ processInstallPlan verbosity
-- ------------------------------------------------------------
planPackages :: Compiler
-> Platform
-> Solver
-> ConfigFlags
-> ConfigExFlags
......@@ -264,11 +267,11 @@ planPackages :: Compiler
-> SourcePackageDb
-> [PackageSpecifier SourcePackage]
-> Progress String String InstallPlan
planPackages comp solver configFlags configExFlags installFlags
planPackages comp platform solver configFlags configExFlags installFlags
installedPkgIndex sourcePkgDb pkgSpecifiers =
resolveDependencies
buildPlatform (compilerId comp)
platform (compilerId comp)
solver
resolverParams
......@@ -599,7 +602,8 @@ postInstallActions :: Verbosity
-> InstallPlan
-> IO ()
postInstallActions verbosity
(packageDBs, _, comp, conf, globalFlags, configFlags, _, installFlags, _)
(packageDBs, _, comp, platform, conf, globalFlags, configFlags
, _, installFlags, _)
targets installPlan = do
unless oneShot $
......@@ -616,7 +620,7 @@ postInstallActions verbosity
when (reportingLevel == DetailedReports) $
storeDetailedBuildReports verbosity logsDir buildReports
regenerateHaddockIndex verbosity packageDBs comp conf
regenerateHaddockIndex verbosity packageDBs comp platform conf
configFlags installFlags installPlan
symlinkBinaries verbosity configFlags installFlags installPlan
......@@ -665,12 +669,13 @@ storeDetailedBuildReports verbosity logsDir reports = sequence_
regenerateHaddockIndex :: Verbosity
-> [PackageDB]
-> Compiler
-> Platform
-> ProgramConfiguration
-> ConfigFlags
-> InstallFlags
-> InstallPlan
-> IO ()
regenerateHaddockIndex verbosity packageDBs comp conf
regenerateHaddockIndex verbosity packageDBs comp platform conf
configFlags installFlags installPlan
| haddockIndexFileIsRequested && shouldRegenerateHaddockIndex = do
......@@ -714,7 +719,7 @@ regenerateHaddockIndex verbosity packageDBs comp conf
where
env = env0 ++ installDirsTemplateEnv absoluteDirs
env0 = InstallDirs.compilerTemplateEnv (compilerId comp)
++ InstallDirs.platformTemplateEnv (buildPlatform)
++ InstallDirs.platformTemplateEnv platform
absoluteDirs = InstallDirs.substituteInstallDirTemplates
env0 templateDirs
templateDirs = InstallDirs.combineInstallDirs fromFlagOrDefault
......@@ -794,7 +799,7 @@ performInstallations :: Verbosity
-> InstallPlan
-> IO InstallPlan
performInstallations verbosity
(packageDBs, _, comp, conf,
(packageDBs, _, comp, _, conf,
globalFlags, configFlags, configExFlags, installFlags, haddockFlags)
installedPkgIndex installPlan = do
......@@ -829,6 +834,7 @@ performInstallations verbosity
setupScriptOptions index lock = SetupScriptOptions {
useCabalVersion = maybe anyVersion thisVersion (libVersion miscOptions),
useCompiler = Just comp,
usePlatform = Just platform,
-- Hack: we typically want to allow the UserPackageDB for finding the
-- Cabal lib when compiling any Setup.hs even if we're doing a global
-- install. However we also allow looking in a specific package db.
......
......@@ -292,7 +292,7 @@ sandboxInstall verbosity _sandboxFlags configFlags configExFlags
installFlags' = defaultInstallFlags `mappend`
savedInstallFlags config `mappend` installFlags
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, _, conf) <- configCompilerAux' configFlags'
(comp, platform, conf) <- configCompilerAux' configFlags'
-- If the user has set the -w option, we may need to create the package DB for
-- this compiler.
......@@ -300,7 +300,7 @@ sandboxInstall verbosity _sandboxFlags configFlags configExFlags
args :: InstallArgs
args = ((configPackageDB' configFlags''), (globalRepos globalFlags'),
comp, conf,
comp, platform, conf,
globalFlags', configFlags'', configExFlags', installFlags',
haddockFlags)
......
......@@ -63,6 +63,7 @@ import Distribution.Simple.Utils
, rewriteFile, intercalate )
import Distribution.Client.Utils
( moreRecentFile, inDir )
import Distribution.System (Platform(..))
import Distribution.Text
( display )
import Distribution.Verbosity
......@@ -83,6 +84,7 @@ import Data.Char ( isSpace )
data SetupScriptOptions = SetupScriptOptions {
useCabalVersion :: VersionRange,
useCompiler :: Maybe Compiler,
usePlatform :: Maybe Platform,
usePackageDB :: PackageDBStack,
usePackageIndex :: Maybe PackageIndex,
useProgramConfig :: ProgramConfiguration,
......@@ -100,6 +102,7 @@ defaultSetupScriptOptions :: SetupScriptOptions
defaultSetupScriptOptions = SetupScriptOptions {
useCabalVersion = anyVersion,
useCompiler = Nothing,
usePlatform = Nothing,
usePackageDB = [GlobalPackageDB, UserPackageDB],
usePackageIndex = Nothing,
useProgramConfig = emptyProgramConfiguration,
......@@ -261,7 +264,8 @@ externalSetupMethod verbosity options pkg bt mkargs = do
configureCompiler options' = do
(comp, conf) <- case useCompiler options' of
Just comp -> return (comp, useProgramConfig options')
Nothing -> do (comp, _, conf) <- configCompiler (Just GHC) Nothing Nothing
Nothing -> do (comp, _, conf) <-
configCompiler (Just GHC) Nothing Nothing
(useProgramConfig options') verbosity
return (comp, conf)
return (comp, conf, options' { useCompiler = Just comp,
......
......@@ -397,10 +397,10 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
installFlags' = defaultInstallFlags `mappend`
savedInstallFlags config `mappend` installFlags
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, _, conf) <- configCompilerAux' configFlags'
(comp, platform, conf) <- configCompilerAux' configFlags'
install verbosity
(configPackageDB' configFlags') (globalRepos globalFlags')
comp conf globalFlags' configFlags' configExFlags'
comp platform conf globalFlags' configFlags' configExFlags'
installFlags' haddockFlags
targets
......
Markdown is supported
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