Commit 7a0941c8 authored by lukexi's avatar lukexi

Return Maybe Platform as part of compiler configure, and place it in...

Return Maybe Platform as part of compiler configure, and place it in LocalBuildInfo as hostPlatform.
GHC infers the platform form ghc --info using new 'platformFromTriple' function. Other compilers return Nothing, which triggers fallback to old behavior of using buildPlatform. hostPlatform is then threaded through to initialPathTemplateEnv.
parent 69af83ec
......@@ -152,5 +152,6 @@ benchOption pkg_descr lbi bm template =
fromPathTemplate $ substPathTemplate env template
where
env = initialPathTemplateEnv
(PD.package pkg_descr) (compilerId $ LBI.compiler lbi) ++
(PD.package pkg_descr) (compilerId $ LBI.compiler lbi)
(LBI.hostPlatform lbi) ++
[(BenchmarkNameVar, toPathTemplate $ PD.benchmarkName bm)]
......@@ -115,7 +115,7 @@ import Distribution.Simple.Utils
, withFileContents, writeFileAtomic
, withTempFile )
import Distribution.System
( OS(..), buildOS, Arch(..), buildArch, buildPlatform )
( OS(..), buildOS, Arch(..), Platform(..), buildPlatform )
import Distribution.Version
( Version(..), anyVersion, orLaterVersion, withinRange, isAnyVersion )
import Distribution.Verbosity
......@@ -137,7 +137,7 @@ import Control.Monad
import Data.List
( nub, partition, isPrefixOf, inits )
import Data.Maybe
( isNothing, catMaybes )
( isNothing, catMaybes, fromMaybe )
import Data.Monoid
( Monoid(..) )
import System.Directory
......@@ -287,7 +287,7 @@ configure (pkg_descr0, pbi) cfg
(configPackageDBs cfg)
-- detect compiler
(comp, programsConfig') <- configCompiler
(comp, compPlatform, programsConfig') <- configCompiler
(flagToMaybe $ configHcFlavor cfg)
(flagToMaybe $ configHcPath cfg) (flagToMaybe $ configHcPkg cfg)
programsConfig (lessVerbose verbosity)
......@@ -340,7 +340,7 @@ configure (pkg_descr0, pbi) cfg
case finalizePackageDescription
(configConfigurationsFlags cfg)
dependencySatisfiable
Distribution.System.buildPlatform
compPlatform
(compilerId comp)
(configConstraints cfg)
pkg_descr0''
......@@ -492,6 +492,7 @@ configure (pkg_descr0, pbi) cfg
-- did they would go here.
installDirTemplates = installDirs,
compiler = comp,
hostPlatform = compPlatform,
buildDir = buildDir',
scratchDir = fromFlagOrDefault
(distPref </> "scratch")
......@@ -792,7 +793,7 @@ ccLdOptionsBuildInfo cflags ldflags =
-- -----------------------------------------------------------------------------
-- Determining the compiler details
configCompilerAux :: ConfigFlags -> IO (Compiler, ProgramConfiguration)
configCompilerAux :: ConfigFlags -> IO (Compiler, Platform, ProgramConfiguration)
configCompilerAux cfg = configCompiler (flagToMaybe $ configHcFlavor cfg)
(flagToMaybe $ configHcPath cfg)
(flagToMaybe $ configHcPkg cfg)
......@@ -805,18 +806,19 @@ configCompilerAux cfg = configCompiler (flagToMaybe $ configHcFlavor cfg)
configCompiler :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> Verbosity
-> IO (Compiler, ProgramConfiguration)
-> IO (Compiler, Platform, ProgramConfiguration)
configCompiler Nothing _ _ _ _ = die "Unknown compiler"
configCompiler (Just hcFlavor) hcPath hcPkg conf verbosity = do
case hcFlavor of
GHC -> GHC.configure verbosity hcPath hcPkg conf
JHC -> JHC.configure verbosity hcPath hcPkg conf
LHC -> do (_,ghcConf) <- GHC.configure verbosity Nothing hcPkg conf
LHC.configure verbosity hcPath Nothing ghcConf
Hugs -> Hugs.configure verbosity hcPath hcPkg conf
NHC -> NHC.configure verbosity hcPath hcPkg conf
UHC -> UHC.configure verbosity hcPath hcPkg conf
_ -> die "Unknown compiler"
(comp, maybePlatform, programsConfig) <- case hcFlavor of
GHC -> GHC.configure verbosity hcPath hcPkg conf
JHC -> JHC.configure verbosity hcPath hcPkg conf
LHC -> do (_, _, ghcConf) <- GHC.configure verbosity Nothing hcPkg conf
LHC.configure verbosity hcPath Nothing ghcConf
Hugs -> Hugs.configure verbosity hcPath hcPkg conf
NHC -> NHC.configure verbosity hcPath hcPkg conf
UHC -> UHC.configure verbosity hcPath hcPkg conf
_ -> die "Unknown compiler"
return (comp, fromMaybe buildPlatform maybePlatform, programsConfig)
-- -----------------------------------------------------------------------------
......@@ -1030,7 +1032,7 @@ checkForeignDeps pkg lbi verbosity = do
hcDefines comp =
case compilerFlavor comp of
GHC ->
let ghcOS = case buildOS of
let ghcOS = case hostOS of
Linux -> ["linux"]
Windows -> ["mingw32"]
OSX -> ["darwin"]
......@@ -1044,7 +1046,7 @@ checkForeignDeps pkg lbi verbosity = do
HaLVM -> []
IOS -> ["ios"]
OtherOS _ -> []
ghcArch = case buildArch of
ghcArch = case hostArch of
I386 -> ["i386"]
X86_64 -> ["x86_64"]
PPC -> ["powerpc"]
......@@ -1069,6 +1071,7 @@ checkForeignDeps pkg lbi verbosity = do
Hugs -> ["-D__HUGS__"]
_ -> []
where
Platform hostArch hostOS = hostPlatform lbi
version = compilerVersion comp
-- TODO: move this into the compiler abstraction
-- FIXME: this forces GHC's crazy 4.8.2 -> 408 convention on all
......
......@@ -138,6 +138,7 @@ import System.FilePath ( (</>), (<.>), takeExtension,
import System.IO (hClose, hPutStrLn)
import System.Environment (getEnv)
import Distribution.Compat.Exception (catchExit, catchIO)
import Distribution.System (Platform, buildPlatform, platformFromTriple)
getGhcInfo :: Verbosity -> ConfiguredProgram -> IO [(String, String)]
getGhcInfo verbosity ghcProg =
......@@ -158,7 +159,7 @@ getGhcInfo verbosity ghcProg =
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, ProgramConfiguration)
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
configure verbosity hcPath hcPkgPath conf0 = do
(ghcProg, ghcVersion, conf1) <-
......@@ -196,8 +197,12 @@ configure verbosity hcPath hcPkgPath conf0 = do
compilerLanguages = languages,
compilerExtensions = extensions
}
compPlatform = targetPlatform ghcInfo
conf4 = configureToolchain ghcProg ghcInfo conf3 -- configure gcc and ld
return (comp, conf4)
return (comp, compPlatform, conf4)
targetPlatform :: [(String, String)] -> Maybe Platform
targetPlatform ghcInfo = platformFromTriple =<< lookup "Target platform" ghcInfo
-- | Given something like /usr/local/bin/ghc-6.6.1(.exe) we try and find
-- the corresponding tool; e.g. if the tool is ghc-pkg, we try looking
......
......@@ -530,6 +530,7 @@ haddockPackageFlags lbi clbi htmlTemplate = do
haddockTemplateEnv :: LocalBuildInfo -> PackageIdentifier -> PathTemplateEnv
haddockTemplateEnv lbi pkg_id = (PrefixVar, prefix (installDirTemplates lbi))
: initialPathTemplateEnv pkg_id (compilerId (compiler lbi))
(hostPlatform lbi)
-- --------------------------------------------------------------------------
-- hscolour support
......
......@@ -118,6 +118,7 @@ import System.Directory
import System.Exit
( ExitCode(ExitSuccess) )
import Distribution.Compat.Exception
import Distribution.System ( Platform )
import qualified Data.ByteString.Lazy.Char8 as BS.Char8
......@@ -125,7 +126,7 @@ import qualified Data.ByteString.Lazy.Char8 as BS.Char8
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, ProgramConfiguration)
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
configure verbosity hcPath _hcPkgPath conf = do
(_ffihugsProg, conf') <- requireProgram verbosity ffihugsProgram
......@@ -139,7 +140,8 @@ configure verbosity hcPath _hcPkgPath conf = do
compilerLanguages = hugsLanguages,
compilerExtensions = hugsLanguageExtensions
}
return (comp, conf'')
compPlatform = Nothing
return (comp, compPlatform, conf'')
where
hugsProgram' = hugsProgram { programFindVersion = getVersion }
......
......@@ -80,7 +80,7 @@ import System.FilePath (dropDrive)
import Distribution.Package
( PackageIdentifier, packageName, packageVersion )
import Distribution.System
( OS(..), buildOS, Platform(..), buildPlatform )
( OS(..), buildOS, Platform(..) )
import Distribution.Compiler
( CompilerId, CompilerFlavor(..) )
import Distribution.Text
......@@ -306,10 +306,10 @@ substituteInstallDirTemplates env dirs = dirs'
-- | Convert from abstract install directories to actual absolute ones by
-- substituting for all the variables in the abstract paths, to get real
-- absolute path.
absoluteInstallDirs :: PackageIdentifier -> CompilerId -> CopyDest
absoluteInstallDirs :: PackageIdentifier -> CompilerId -> CopyDest -> Platform
-> InstallDirs PathTemplate
-> InstallDirs FilePath
absoluteInstallDirs pkgId compilerId copydest dirs =
absoluteInstallDirs pkgId compilerId copydest platform dirs =
(case copydest of
CopyTo destdir -> fmap ((destdir </>) . dropDrive)
_ -> id)
......@@ -317,7 +317,7 @@ absoluteInstallDirs pkgId compilerId copydest dirs =
. fmap fromPathTemplate
$ substituteInstallDirTemplates env dirs
where
env = initialPathTemplateEnv pkgId compilerId
env = initialPathTemplateEnv pkgId compilerId platform
-- |The location prefix for the /copy/ command.
......@@ -332,10 +332,10 @@ data CopyDest
-- prevents us from making a relocatable package (also known as a \"prefix
-- independent\" package).
--
prefixRelativeInstallDirs :: PackageIdentifier -> CompilerId
prefixRelativeInstallDirs :: PackageIdentifier -> CompilerId -> Platform
-> InstallDirTemplates
-> InstallDirs (Maybe FilePath)
prefixRelativeInstallDirs pkgId compilerId dirs =
prefixRelativeInstallDirs pkgId compilerId platform dirs =
fmap relative
. appendSubdirs combinePathTemplate
$ -- substitute the path template into each other, except that we map
......@@ -345,7 +345,7 @@ prefixRelativeInstallDirs pkgId compilerId dirs =
prefix = PathTemplate [Variable PrefixVar]
}
where
env = initialPathTemplateEnv pkgId compilerId
env = initialPathTemplateEnv pkgId compilerId platform
-- If it starts with $prefix then it's relative and produce the relative
-- path by stripping off $prefix/ or $prefix
......@@ -417,12 +417,11 @@ substPathTemplate environment (PathTemplate template) =
Nothing -> [component]
-- | The initial environment has all the static stuff but no paths
initialPathTemplateEnv :: PackageIdentifier -> CompilerId -> PathTemplateEnv
initialPathTemplateEnv pkgId compilerId =
initialPathTemplateEnv :: PackageIdentifier -> CompilerId -> Platform -> PathTemplateEnv
initialPathTemplateEnv pkgId compilerId platform =
packageTemplateEnv pkgId
++ compilerTemplateEnv compilerId
++ platformTemplateEnv buildPlatform -- platform should be param if we want
-- to do cross-platform configuation
++ platformTemplateEnv platform
packageTemplateEnv :: PackageIdentifier -> PathTemplateEnv
packageTemplateEnv pkgId =
......
......@@ -84,6 +84,7 @@ import Distribution.Text
( Text(parse), display )
import Distribution.Compat.ReadP
( readP_to_S, string, skipSpaces )
import Distribution.System ( Platform )
import Data.List ( nub )
import Data.Char ( isSpace )
......@@ -96,7 +97,7 @@ import qualified Data.ByteString.Lazy.Char8 as BS.Char8
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, ProgramConfiguration)
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
configure verbosity hcPath _hcPkgPath conf = do
(jhcProg, _, conf') <- requireProgramVersion verbosity
......@@ -109,7 +110,8 @@ configure verbosity hcPath _hcPkgPath conf = do
compilerLanguages = jhcLanguages,
compilerExtensions = jhcLanguageExtensions
}
return (comp, conf')
compPlatform = Nothing
return (comp, compPlatform, conf')
jhcLanguages :: [(Language, Flag)]
jhcLanguages = [(Haskell98, "")]
......
......@@ -123,12 +123,13 @@ import System.FilePath ( (</>), (<.>), takeExtension,
takeDirectory, replaceExtension )
import System.IO (hClose, hPutStrLn)
import Distribution.Compat.Exception (catchExit, catchIO)
import Distribution.System ( Platform )
-- -----------------------------------------------------------------------------
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, ProgramConfiguration)
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
configure verbosity hcPath hcPkgPath conf = do
(lhcProg, lhcVersion, conf') <-
......@@ -155,7 +156,8 @@ configure verbosity hcPath hcPkgPath conf = do
compilerExtensions = extensions
}
conf''' = configureToolchain lhcProg conf'' -- configure gcc and ld
return (comp, conf''')
compPlatform = Nothing
return (comp, compPlatform, conf''')
-- | Adjust the way we find and configure gcc and ld
--
......
......@@ -102,7 +102,8 @@ import Distribution.Simple.Setup
( ConfigFlags )
import Distribution.Text
( display )
import Distribution.System
( Platform )
import Data.List (nub, find)
import Data.Graph
import Data.Tree (flatten)
......@@ -124,6 +125,8 @@ data LocalBuildInfo = LocalBuildInfo {
--TODO: inplaceDirTemplates :: InstallDirs FilePath
compiler :: Compiler,
-- ^ The compiler we're building with
hostPlatform :: Platform,
-- ^ The platform we're building for
buildDir :: FilePath,
-- ^ Where to build the package.
--TODO: eliminate hugs's scratchDir, use builddir
......@@ -400,6 +403,7 @@ absoluteInstallDirs pkg lbi copydest =
(packageId pkg)
(compilerId (compiler lbi))
copydest
(hostPlatform lbi)
(installDirTemplates lbi)
-- |See 'InstallDirs.prefixRelativeInstallDirs'
......@@ -409,6 +413,7 @@ prefixRelativeInstallDirs pkg_descr lbi =
InstallDirs.prefixRelativeInstallDirs
(packageId pkg_descr)
(compilerId (compiler lbi))
(hostPlatform lbi)
(installDirTemplates lbi)
substPathTemplate :: PackageId -> LocalBuildInfo
......@@ -418,3 +423,4 @@ substPathTemplate pkgid lbi = fromPathTemplate
where env = initialPathTemplateEnv
pkgid
(compilerId (compiler lbi))
(hostPlatform lbi)
......@@ -104,12 +104,13 @@ import Data.Maybe ( catMaybes )
import Data.Monoid ( Monoid(..) )
import Control.Monad ( when, unless )
import Distribution.Compat.Exception
import Distribution.System ( Platform )
-- -----------------------------------------------------------------------------
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, ProgramConfiguration)
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
configure verbosity hcPath _hcPkgPath conf = do
(_nhcProg, nhcVersion, conf') <-
......@@ -134,7 +135,8 @@ configure verbosity hcPath _hcPkgPath conf = do
compilerLanguages = nhcLanguages,
compilerExtensions = nhcLanguageExtensions
}
return (comp, conf'''')
compPlatform = Nothing
return (comp, compPlatform, conf'''')
nhcLanguages :: [(Language, Flag)]
nhcLanguages = [(Haskell98, "-98")]
......
......@@ -430,6 +430,7 @@ testSuiteLogPath template pkg_descr lbi testLog =
where
env = initialPathTemplateEnv
(PD.package pkg_descr) (compilerId $ LBI.compiler lbi)
(LBI.hostPlatform lbi)
++ [ (TestSuiteNameVar, toPathTemplate $ testSuiteName testLog)
, (TestSuiteResultVar, result)
]
......@@ -446,7 +447,8 @@ testOption pkg_descr lbi suite template =
fromPathTemplate $ substPathTemplate env template
where
env = initialPathTemplateEnv
(PD.package pkg_descr) (compilerId $ LBI.compiler lbi) ++
(PD.package pkg_descr) (compilerId $ LBI.compiler lbi)
(LBI.hostPlatform lbi) ++
[(TestSuiteNameVar, toPathTemplate $ PD.testName suite)]
packageLogPath :: PathTemplate
......@@ -458,6 +460,7 @@ packageLogPath template pkg_descr lbi =
where
env = initialPathTemplateEnv
(PD.package pkg_descr) (compilerId $ LBI.compiler lbi)
(LBI.hostPlatform lbi)
-- | The filename of the source file for the stub executable associated with a
-- library 'TestSuite'.
......
......@@ -69,12 +69,13 @@ import Distribution.Version
import Language.Haskell.Extension
import System.Directory
import System.FilePath
import Distribution.System ( Platform )
-- -----------------------------------------------------------------------------
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, ProgramConfiguration)
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
configure verbosity hcPath _hcPkgPath conf = do
(_uhcProg, uhcVersion, conf') <-
......@@ -83,11 +84,12 @@ configure verbosity hcPath _hcPkgPath conf = do
(userMaybeSpecifyPath "uhc" hcPath conf)
let comp = Compiler {
compilerId = CompilerId UHC uhcVersion,
compilerLanguages = uhcLanguages,
compilerExtensions = uhcLanguageExtensions
compilerId = CompilerId UHC uhcVersion,
compilerLanguages = uhcLanguages,
compilerExtensions = uhcLanguageExtensions
}
return (comp, conf')
compPlatform = Nothing
return (comp, compPlatform, conf')
uhcLanguages :: [(Language, C.Flag)]
uhcLanguages = [(Haskell98, "")]
......
......@@ -25,12 +25,13 @@ module Distribution.System (
-- * Platform is a pair of arch and OS
Platform(..),
buildPlatform,
platformFromTriple
) where
import qualified System.Info (os, arch)
import qualified Data.Char as Char (toLower, isAlphaNum)
import Data.Maybe (fromMaybe)
import Data.Maybe (fromMaybe, listToMaybe)
import Distribution.Text (Text(..), display)
import qualified Distribution.Compat.ReadP as Parse
import qualified Text.PrettyPrint as Disp
......@@ -177,3 +178,15 @@ ident = Parse.munch1 (\c -> Char.isAlphaNum c || c == '_' || c == '-')
lowercase :: String -> String
lowercase = map Char.toLower
platformFromTriple :: String -> Maybe Platform
platformFromTriple triple = fmap fst (listToMaybe $ Parse.readP_to_S parseTriple triple)
where parseWord = Parse.munch1 (\c -> Char.isAlphaNum c || c == '_')
parseTriple = do
arch <- fmap (classifyArch Strict) parseWord
_ <- Parse.char '-'
_ <- parseWord -- Skip vendor
_ <- Parse.char '-'
os <- fmap (classifyOS Compat) ident -- OS may have hyphens, like 'nto-qnx'
return $ Platform arch os
......@@ -74,8 +74,8 @@ storeAnonymous reports = sequence_
[ (report, repo, remoteRepo)
| (report, repo@Repo { repoKind = Left remoteRepo }) <- rs ]
storeLocal :: [PathTemplate] -> [(BuildReport, Repo)] -> IO ()
storeLocal templates reports = sequence_
storeLocal :: [PathTemplate] -> [(BuildReport, Repo)] -> Platform -> IO ()
storeLocal templates reports platform = sequence_
[ do createDirectoryIfMissing True (takeDirectory file)
appendFile file output
--TODO: make this concurrency safe, either lock the report file or make
......@@ -94,6 +94,7 @@ storeLocal templates reports = sequence_
where env = initialPathTemplateEnv
(BuildReport.package report)
(BuildReport.compiler report)
platform
groupByFileName = map (\grp@((filename,_):_) -> (filename, map snd grp))
. groupBy (equating fst)
......
......@@ -47,7 +47,7 @@ import Distribution.Version
import Distribution.Simple.Utils as Utils
( notice, info, debug, die )
import Distribution.System
( Platform, buildPlatform )
( Platform )
import Distribution.Verbosity as Verbosity
( Verbosity )
......@@ -58,18 +58,19 @@ configure :: Verbosity
-> PackageDBStack
-> [Repo]
-> Compiler
-> Platform
-> ProgramConfiguration
-> ConfigFlags
-> ConfigExFlags
-> [String]
-> IO ()
configure verbosity packageDBs repos comp conf
configure verbosity packageDBs repos comp platform conf
configFlags configExFlags extraArgs = do
installedPkgIndex <- getInstalledPackages verbosity comp packageDBs conf
sourcePkgDb <- getSourcePackages verbosity repos
progress <- planLocalPackage verbosity comp configFlags configExFlags
progress <- planLocalPackage verbosity comp platform configFlags configExFlags
installedPkgIndex sourcePkgDb
notice verbosity "Resolving dependencies..."
......@@ -125,11 +126,12 @@ configure verbosity packageDBs repos comp conf
-- and all its dependencies.
--
planLocalPackage :: Verbosity -> Compiler
-> Platform
-> ConfigFlags -> ConfigExFlags
-> PackageIndex
-> SourcePackageDb
-> IO (Progress String String InstallPlan)
planLocalPackage verbosity comp configFlags configExFlags installedPkgIndex
planLocalPackage verbosity comp platform configFlags configExFlags installedPkgIndex
(SourcePackageDb _ packagePrefs) = do
pkg <- readPackageDescription verbosity =<< defaultPackageDesc verbosity
solver <- chooseSolver verbosity (fromFlag $ configSolver configExFlags) (compilerId comp)
......@@ -177,7 +179,7 @@ planLocalPackage verbosity comp configFlags configExFlags installedPkgIndex
(SourcePackageDb mempty packagePrefs)
[SpecificSourcePackage localPkg]
return (resolveDependencies buildPlatform (compilerId comp) solver resolverParams)
return (resolveDependencies platform (compilerId comp) solver resolverParams)
-- | Call an installer for an 'SourcePackage' but override the configure
......
......@@ -604,7 +604,7 @@ postInstallActions verbosity
| UserTargetNamed dep <- targets ]
let buildReports = BuildReports.fromInstallPlan installPlan
BuildReports.storeLocal (installSummaryFile installFlags) buildReports
BuildReports.storeLocal (installSummaryFile installFlags) buildReports (InstallPlan.planPlatform installPlan)
when (reportingLevel >= AnonymousReports) $
BuildReports.storeAnonymous buildReports
when (reportingLevel == DetailedReports) $
......@@ -807,7 +807,7 @@ performInstallations verbosity
installUnpackedPackage verbosity buildLimit installLock numJobs
(setupScriptOptions installedPkgIndex cacheLock)
miscOptions configFlags' installFlags haddockFlags
compid pkg pkgoverride mpath useLogFile
compid platform pkg pkgoverride mpath useLogFile
where
platform = InstallPlan.planPlatform installPlan
......@@ -888,7 +888,7 @@ performInstallations verbosity
substLogFileName template pkg = fromPathTemplate
. substPathTemplate env
$ template
where env = initialPathTemplateEnv (packageId pkg) (compilerId comp)
where env = initialPathTemplateEnv (packageId pkg) (compilerId comp) platform
miscOptions = InstallMisc {
rootCmd = if fromFlag (configUserInstall configFlags)
......@@ -1072,6 +1072,7 @@ installUnpackedPackage
-> InstallFlags
-> HaddockFlags
-> CompilerId
-> Platform
-> PackageDescription
-> PackageDescriptionOverride
-> Maybe FilePath -- ^ Directory to change to before starting the installation.
......@@ -1080,7 +1081,7 @@ installUnpackedPackage
installUnpackedPackage verbosity buildLimit installLock numJobs
scriptOptions miscOptions
configFlags installConfigFlags haddockFlags
compid pkg pkgoverride workingDir useLogFile = do
compid platform pkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary
case pkgoverride of
......@@ -1123,7 +1124,7 @@ installUnpackedPackage verbosity buildLimit installLock numJobs
-- Install phase
onFailure InstallFailed $ criticalSection installLock $
withWin32SelfUpgrade verbosity configFlags compid pkg $ do
withWin32SelfUpgrade verbosity configFlags compid platform pkg $ do
case rootCmd miscOptions of
(Just cmd) -> reexec cmd
Nothing -> setup Cabal.installCommand installFlags
......@@ -1203,10 +1204,11 @@ onFailure result action =
withWin32SelfUpgrade :: Verbosity
-> ConfigFlags
-> CompilerId
-> Platform
-> PackageDescription
-> IO a -> IO a
withWin32SelfUpgrade _ _ _ _ action | buildOS /= Windows = action
withWin32SelfUpgrade verbosity configFlags compid pkg action = do
withWin32SelfUpgrade _ _ _ _ _ action | buildOS /= Windows = action
withWin32SelfUpgrade verbosity configFlags compid platform pkg action = do
defaultDirs <- InstallDirs.defaultInstallDirs
compFlavor
......@@ -1234,7 +1236,7 @@ withWin32SelfUpgrade verbosity configFlags compid pkg action = do
templateDirs = InstallDirs.combineInstallDirs fromFlagOrDefault
defaultDirs (configInstallDirs configFlags)
absoluteDirs = InstallDirs.absoluteInstallDirs
pkgid compid InstallDirs.NoCopyDest templateDirs
pkgid compid InstallDirs.NoCopyDest platform templateDirs
substTemplate = InstallDirs.fromPathTemplate
. InstallDirs.substPathTemplate env
where env = InstallDirs.initialPathTemplateEnv pkgid compid
where env = InstallDirs.initialPathTemplateEnv pkgid compid platform
......@@ -147,12 +147,12 @@ symlinkBinaries configFlags installFlags plan =
defaultDirs (configInstallDirs configFlags)
absoluteDirs = InstallDirs.absoluteInstallDirs
(packageId pkg) compilerId InstallDirs.NoCopyDest
templateDirs