mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-02-03 01:50:25 +01:00
Don't let build tools dependencies seep into environments
This commit is contained in:
parent
8b3eb7b45d
commit
18df8d13d1
@ -48,11 +48,18 @@ build settings' bp = do
|
|||||||
|
|
||||||
-- First install build tools so they can be used below.
|
-- First install build tools so they can be used below.
|
||||||
let installBuildTool tool = do
|
let installBuildTool tool = do
|
||||||
|
let toolsDir = packageDir settings ++ "-tools"
|
||||||
|
rm_r toolsDir
|
||||||
|
ecInit <- rawSystem "ghc-pkg" ["init", toolsDir]
|
||||||
|
unless (ecInit == ExitSuccess) $ do
|
||||||
|
putStrLn "Unable to create package database via ghc-pkg init"
|
||||||
|
exitWith ecInit
|
||||||
|
|
||||||
putStrLn $ "Installing build tool: " ++ tool
|
putStrLn $ "Installing build tool: " ++ tool
|
||||||
ec <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
|
ec <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
|
||||||
hSetBuffering handle NoBuffering
|
hSetBuffering handle NoBuffering
|
||||||
|
|
||||||
let args = addCabalArgs settings BSBuild
|
let args = addCabalArgs settings BSTools
|
||||||
$ "install"
|
$ "install"
|
||||||
: ("--cabal-lib-version=" ++ libVersion)
|
: ("--cabal-lib-version=" ++ libVersion)
|
||||||
: "--build-log=logs-tools/$pkg.log"
|
: "--build-log=logs-tools/$pkg.log"
|
||||||
@ -69,6 +76,7 @@ build settings' bp = do
|
|||||||
]
|
]
|
||||||
exitWith ec
|
exitWith ec
|
||||||
putStrLn $ tool ++ " built"
|
putStrLn $ tool ++ " built"
|
||||||
|
rm_r toolsDir
|
||||||
mapM_ installBuildTool $ bpTools bp
|
mapM_ installBuildTool $ bpTools bp
|
||||||
|
|
||||||
putStrLn "Beginning Stackage build"
|
putStrLn "Beginning Stackage build"
|
||||||
|
|||||||
@ -122,7 +122,7 @@ data SelectSettings = SelectSettings
|
|||||||
, selectGhcVersion :: GhcMajorVersion
|
, selectGhcVersion :: GhcMajorVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
data BuildStage = BSBuild | BSTest
|
data BuildStage = BSTools | BSBuild | BSTest
|
||||||
|
|
||||||
data BuildSettings = BuildSettings
|
data BuildSettings = BuildSettings
|
||||||
{ sandboxRoot :: FilePath
|
{ sandboxRoot :: FilePath
|
||||||
|
|||||||
@ -115,12 +115,17 @@ addCabalArgsOnlyGlobal rest
|
|||||||
addCabalArgs :: BuildSettings -> BuildStage -> [String] -> [String]
|
addCabalArgs :: BuildSettings -> BuildStage -> [String] -> [String]
|
||||||
addCabalArgs settings bs rest
|
addCabalArgs settings bs rest
|
||||||
= addCabalArgsOnlyGlobal
|
= addCabalArgsOnlyGlobal
|
||||||
$ ("--package-db=" ++ packageDir settings)
|
$ ("--package-db=" ++ packageDir settings ++ toolsSuffix)
|
||||||
: ("--libdir=" ++ libDir settings)
|
: ("--libdir=" ++ libDir settings ++ toolsSuffix)
|
||||||
: ("--bindir=" ++ binDir settings)
|
: ("--bindir=" ++ binDir settings)
|
||||||
: ("--datadir=" ++ dataDir settings)
|
: ("--datadir=" ++ dataDir settings)
|
||||||
: ("--docdir=" ++ docDir settings)
|
: ("--docdir=" ++ docDir settings ++ toolsSuffix)
|
||||||
: extraArgs settings bs ++ rest
|
: extraArgs settings bs ++ rest
|
||||||
|
where
|
||||||
|
toolsSuffix =
|
||||||
|
case bs of
|
||||||
|
BSTools -> "-tools"
|
||||||
|
_ -> ""
|
||||||
|
|
||||||
-- | Modified environment that adds our sandboxed bin folder to PATH.
|
-- | Modified environment that adds our sandboxed bin folder to PATH.
|
||||||
getModifiedEnv :: BuildSettings -> IO [(String, String)]
|
getModifiedEnv :: BuildSettings -> IO [(String, String)]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user