mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-15 00:38:29 +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.
|
||||
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
|
||||
ec <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
|
||||
hSetBuffering handle NoBuffering
|
||||
|
||||
let args = addCabalArgs settings BSBuild
|
||||
let args = addCabalArgs settings BSTools
|
||||
$ "install"
|
||||
: ("--cabal-lib-version=" ++ libVersion)
|
||||
: "--build-log=logs-tools/$pkg.log"
|
||||
@ -69,6 +76,7 @@ build settings' bp = do
|
||||
]
|
||||
exitWith ec
|
||||
putStrLn $ tool ++ " built"
|
||||
rm_r toolsDir
|
||||
mapM_ installBuildTool $ bpTools bp
|
||||
|
||||
putStrLn "Beginning Stackage build"
|
||||
|
||||
@ -122,7 +122,7 @@ data SelectSettings = SelectSettings
|
||||
, selectGhcVersion :: GhcMajorVersion
|
||||
}
|
||||
|
||||
data BuildStage = BSBuild | BSTest
|
||||
data BuildStage = BSTools | BSBuild | BSTest
|
||||
|
||||
data BuildSettings = BuildSettings
|
||||
{ sandboxRoot :: FilePath
|
||||
|
||||
@ -115,12 +115,17 @@ addCabalArgsOnlyGlobal rest
|
||||
addCabalArgs :: BuildSettings -> BuildStage -> [String] -> [String]
|
||||
addCabalArgs settings bs rest
|
||||
= addCabalArgsOnlyGlobal
|
||||
$ ("--package-db=" ++ packageDir settings)
|
||||
: ("--libdir=" ++ libDir settings)
|
||||
$ ("--package-db=" ++ packageDir settings ++ toolsSuffix)
|
||||
: ("--libdir=" ++ libDir settings ++ toolsSuffix)
|
||||
: ("--bindir=" ++ binDir settings)
|
||||
: ("--datadir=" ++ dataDir settings)
|
||||
: ("--docdir=" ++ docDir settings)
|
||||
: ("--docdir=" ++ docDir settings ++ toolsSuffix)
|
||||
: extraArgs settings bs ++ rest
|
||||
where
|
||||
toolsSuffix =
|
||||
case bs of
|
||||
BSTools -> "-tools"
|
||||
_ -> ""
|
||||
|
||||
-- | Modified environment that adds our sandboxed bin folder to PATH.
|
||||
getModifiedEnv :: BuildSettings -> IO [(String, String)]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user