Skip to content

Commit

Permalink
Try fixing addInternalBuildTools
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini committed Apr 10, 2024
1 parent 51da23d commit f16371a
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions Cabal/src/Distribution/Simple/Build.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE NamedFieldPuns #-}

-----------------------------------------------------------------------------

Expand Down Expand Up @@ -75,7 +76,6 @@ import Distribution.Simple.PreProcess
import Distribution.Simple.Program
import Distribution.Simple.Program.Builtin (haskellSuiteProgram)
import qualified Distribution.Simple.Program.GHC as GHC
import Distribution.Simple.Program.Types
import Distribution.Simple.Register
import Distribution.Simple.Setup.Build
import Distribution.Simple.Setup.Config
Expand Down Expand Up @@ -586,17 +586,15 @@ generateCode codeGens nm pdesc bi lbi clbi verbosity = do
nm' = unUnqualComponentName nm
tgtDir = buildDir lbi </> nm' </> nm' ++ "-gen"
go :: String -> IO [ModuleName.ModuleName]
go codeGenProg =
fmap fromString . lines
<$> getDbProgramOutput
verbosity
(simpleProgram codeGenProg)
(withPrograms lbi)
go codeGenProg = do
(confProg, _progdb) <- requireProgram verbosity (simpleProgram codeGenProg) (withPrograms lbi)
output <- getProgramOutput verbosity confProg
( (tgtDir : map getSymbolicPath srcDirs)
++ ( "--"
: GHC.renderGhcOptions (compiler lbi) (hostPlatform lbi) (GHC.componentGhcOptions verbosity lbi bi clbi tgtDir)
)
)
return $ fmap fromString $ lines output

-- | Add extra C sources generated by preprocessing to build
-- information.
Expand Down Expand Up @@ -933,14 +931,11 @@ addInternalBuildTools
-> BuildInfo
-> ProgramDb
-> ProgramDb
addInternalBuildTools pkg lbi bi progs =
foldr updateProgram progs internalBuildTools
where
internalBuildTools =
[ simpleConfiguredProgram toolName' (FoundOnSystem toolLocation)
addInternalBuildTools pkg lbi bi =
addKnownPrograms
[ simpleProgram toolName'
| toolName <- getAllInternalToolDependencies pkg bi
, let toolName' = unUnqualComponentName toolName
, let toolLocation = buildDir lbi </> toolName' </> toolName' <.> exeExtension (hostPlatform lbi)
]

-- TODO: build separate libs in separate dirs so that we can build
Expand Down

0 comments on commit f16371a

Please sign in to comment.