Skip to content
Browse files

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.
  • Loading branch information...
1 parent 69af83e commit 7a0941c88a010dda66ad55c70eea5c33a4b25cef @lukexi lukexi committed Feb 28, 2013
View
3 Cabal/Distribution/Simple/Bench.hs
@@ -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)]
View
37 Cabal/Distribution/Simple/Configure.hs
@@ -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
View
9 Cabal/Distribution/Simple/GHC.hs
@@ -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
View
1 Cabal/Distribution/Simple/Haddock.hs
@@ -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
View
6 Cabal/Distribution/Simple/Hugs.hs
@@ -118,14 +118,15 @@ 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
-- -----------------------------------------------------------------------------
-- 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 }
View
21 Cabal/Distribution/Simple/InstallDirs.hs
@@ -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,18 +306,18 @@ 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)
. appendSubdirs (</>)
. 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 =
View
6 Cabal/Distribution/Simple/JHC.hs
@@ -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, "")]
View
6 Cabal/Distribution/Simple/LHC.hs
@@ -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
--
View
8 Cabal/Distribution/Simple/LocalBuildInfo.hs
@@ -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)
View
6 Cabal/Distribution/Simple/NHC.hs
@@ -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")]
View
5 Cabal/Distribution/Simple/Test.hs
@@ -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'.
View
12 Cabal/Distribution/Simple/UHC.hs
@@ -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, "")]
View
15 Cabal/Distribution/System.hs
@@ -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
+
View
5 cabal-install/Distribution/Client/BuildReports/Storage.hs
@@ -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)
View
12 cabal-install/Distribution/Client/Configure.hs
@@ -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
View
20 cabal-install/Distribution/Client/Install.hs
@@ -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
View
4 cabal-install/Distribution/Client/InstallSymlink.hs
@@ -147,12 +147,12 @@ symlinkBinaries configFlags installFlags plan =
defaultDirs (configInstallDirs configFlags)
absoluteDirs = InstallDirs.absoluteInstallDirs
(packageId pkg) compilerId InstallDirs.NoCopyDest
- templateDirs
+ platform templateDirs
canonicalizePath (InstallDirs.bindir absoluteDirs)
substTemplate pkgid = InstallDirs.fromPathTemplate
. InstallDirs.substPathTemplate env
- where env = InstallDirs.initialPathTemplateEnv pkgid compilerId
+ where env = InstallDirs.initialPathTemplateEnv pkgid compilerId platform
fromFlagTemplate = fromFlagOrDefault (InstallDirs.toPathTemplate "")
prefixTemplate = fromFlagTemplate (configProgPrefix configFlags)
View
11 cabal-install/Distribution/Client/Sandbox.hs
@@ -59,6 +59,7 @@ import Distribution.Simple.Utils ( die, debug, notice, info
, createDirectoryIfMissingVerbose )
import Distribution.Verbosity ( Verbosity, lessVerbose )
import Distribution.Compat.Env ( lookupEnv, setEnv )
+import Distribution.System ( Platform )
import qualified Distribution.Client.Index as Index
import qualified Distribution.Simple.Register as Register
import Control.Exception ( bracket_ )
@@ -155,7 +156,7 @@ sandboxInit verbosity sandboxFlags globalFlags = do
-- Determine which compiler to use (using the value from ~/.cabal/config).
userConfig <- loadConfig verbosity (globalConfigFile globalFlags) NoFlag
- (comp, conf) <- configCompilerAux (savedConfigureFlags userConfig)
+ (comp, _, conf) <- configCompilerAux (savedConfigureFlags userConfig)
-- Create the package environment file.
pkgEnvDir <- getCurrentDirectory
@@ -208,7 +209,7 @@ sandboxConfigure verbosity
configFlags' = savedConfigureFlags config `mappend` configFlags
configExFlags' = savedConfigureExFlags config `mappend` configExFlags
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.
@@ -218,7 +219,7 @@ sandboxConfigure verbosity
withSandboxBinDirOnSearchPath sandboxDir $
configure verbosity
(configPackageDB' configFlags'') (globalRepos globalFlags')
- comp conf configFlags'' configExFlags' extraArgs
+ comp platform conf configFlags'' configExFlags' extraArgs
-- | Entry point for the 'cabal sandbox-build' command.
sandboxBuild :: Verbosity -> SandboxFlags -> BuildFlags -> [String] -> IO ()
@@ -281,7 +282,7 @@ sandboxInstall verbosity _sandboxFlags configFlags configExFlags
installFlags' = defaultInstallFlags `mappend`
savedInstallFlags config `mappend` installFlags
globalFlags' = savedGlobalFlags config `mappend` globalFlags
- (comp, conf) <- configCompilerAux' configFlags'
+ (comp, _, conf) <- configCompilerAux' configFlags'
-- If the user has set the -w option, we may need to create the package DB for
-- this compiler.
@@ -323,7 +324,7 @@ configPackageDB' cfg =
interpretPackageDbFlags {- userInstall = -} False (configPackageDBs cfg)
configCompilerAux' :: ConfigFlags
- -> IO (Compiler, ProgramConfiguration)
+ -> IO (Compiler, Platform, ProgramConfiguration)
configCompilerAux' configFlags =
configCompilerAux configFlags
--FIXME: make configCompilerAux use a sensible verbosity
View
5 cabal-install/Distribution/Client/SetupWrapper.hs
@@ -261,8 +261,9 @@ externalSetupMethod verbosity options pkg bt mkargs = do
configureCompiler options' = do
(comp, conf) <- case useCompiler options' of
Just comp -> return (comp, useProgramConfig options')
- Nothing -> configCompiler (Just GHC) Nothing Nothing
- (useProgramConfig options') verbosity
+ Nothing -> do (comp, _, conf) <- configCompiler (Just GHC) Nothing Nothing
+ (useProgramConfig options') verbosity
+ return (comp, conf)
return (comp, conf, options' { useCompiler = Just comp,
useProgramConfig = conf })
View
17 cabal-install/src/Main.hs
@@ -89,6 +89,7 @@ import Distribution.Simple.Configure
( checkPersistBuildConfigOutdated, configCompilerAux
, interpretPackageDbFlags, maybeGetPersistBuildConfig )
import qualified Distribution.Simple.LocalBuildInfo as LBI
+import Distribution.System ( Platform )
import Distribution.Simple.Utils
( cabalVersion, die, notice, topHandler )
import Distribution.Text
@@ -225,10 +226,10 @@ configureAction (configFlags, configExFlags) extraArgs globalFlags = do
let configFlags' = savedConfigureFlags config `mappend` configFlags
configExFlags' = savedConfigureExFlags config `mappend` configExFlags
globalFlags' = savedGlobalFlags config `mappend` globalFlags
- (comp, conf) <- configCompilerAux configFlags'
+ (comp, platform, conf) <- configCompilerAux configFlags'
configure verbosity
(configPackageDB' configFlags') (globalRepos globalFlags')
- comp conf configFlags' configExFlags' extraArgs
+ comp platform conf configFlags' configExFlags' extraArgs
buildAction :: BuildFlags -> [String] -> GlobalFlags -> IO ()
buildAction buildFlags extraArgs globalFlags = do
@@ -395,7 +396,7 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
installFlags' = defaultInstallFlags `mappend`
savedInstallFlags config `mappend` installFlags
globalFlags' = savedGlobalFlags config `mappend` globalFlags
- (comp, conf) <- configCompilerAux' configFlags'
+ (comp, _, conf) <- configCompilerAux' configFlags'
install verbosity
(configPackageDB' configFlags') (globalRepos globalFlags')
comp conf globalFlags' configFlags' configExFlags' installFlags' haddockFlags
@@ -441,7 +442,7 @@ listAction listFlags extraArgs globalFlags = do
config <- loadConfig verbosity (globalConfigFile globalFlags) mempty
let configFlags = savedConfigureFlags config
globalFlags' = savedGlobalFlags config `mappend` globalFlags
- (comp, conf) <- configCompilerAux' configFlags
+ (comp, _, conf) <- configCompilerAux' configFlags
list verbosity
(configPackageDB' configFlags)
(globalRepos globalFlags')
@@ -457,7 +458,7 @@ infoAction infoFlags extraArgs globalFlags = do
config <- loadConfig verbosity (globalConfigFile globalFlags) mempty
let configFlags = savedConfigureFlags config
globalFlags' = savedGlobalFlags config `mappend` globalFlags
- (comp, conf) <- configCompilerAux configFlags
+ (comp, _, conf) <- configCompilerAux configFlags
info verbosity
(configPackageDB' configFlags)
(globalRepos globalFlags')
@@ -498,7 +499,7 @@ fetchAction fetchFlags extraArgs globalFlags = do
config <- loadConfig verbosity (globalConfigFile globalFlags) mempty
let configFlags = savedConfigureFlags config
globalFlags' = savedGlobalFlags config `mappend` globalFlags
- (comp, conf) <- configCompilerAux' configFlags
+ (comp, _, conf) <- configCompilerAux' configFlags
fetch verbosity
(configPackageDB' configFlags) (globalRepos globalFlags')
comp conf globalFlags' fetchFlags
@@ -600,7 +601,7 @@ initAction initFlags _extraArgs globalFlags = do
let verbosity = fromFlag (initVerbosity initFlags)
config <- loadConfig verbosity (globalConfigFile globalFlags) mempty
let configFlags = savedConfigureFlags config
- (comp, conf) <- configCompilerAux' configFlags
+ (comp, _, conf) <- configCompilerAux' configFlags
initCabal verbosity
(configPackageDB' configFlags)
comp
@@ -689,7 +690,7 @@ configPackageDB' cfg =
userInstall = fromFlagOrDefault True (configUserInstall cfg)
configCompilerAux' :: ConfigFlags
- -> IO (Compiler, ProgramConfiguration)
+ -> IO (Compiler, Platform, ProgramConfiguration)
configCompilerAux' configFlags =
configCompilerAux configFlags
--FIXME: make configCompilerAux use a sensible verbosity

0 comments on commit 7a0941c

Please sign in to comment.
Something went wrong with that request. Please try again.