summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-04-01 11:28:04 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2022-06-20 11:35:30 +0100
commitcef1f2e797f004d3083758784249794abf591385 (patch)
tree4d687997d93299ee9c38863236f1640e8154e609
parenta2f693f524830c2ab1e8a6e9d729839ac8b468c5 (diff)
downloadhaskell-cef1f2e797f004d3083758784249794abf591385.tar.gz
hadrian: Don't try to build iserv-prof if we don't have profiled libraries
Workaround for #19624
-rw-r--r--hadrian/src/Rules/Test.hs25
1 files changed, 19 insertions, 6 deletions
diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs
index a7bc70863f..da47a00bc0 100644
--- a/hadrian/src/Rules/Test.hs
+++ b/hadrian/src/Rules/Test.hs
@@ -18,6 +18,7 @@ import Settings.Program (programContext)
import Target
import Utilities
import qualified System.Directory as IO
+import Context.Type
ghcConfigHsPath :: FilePath
ghcConfigHsPath = "testsuite/mk/ghc-config.hs"
@@ -223,12 +224,24 @@ needIservBins :: Action ()
needIservBins = do
testGhc <- testCompiler <$> userSetting defaultTestArgs
let stg = stageOf testGhc
- rtsways <- interpretInContext (vanillaContext stg ghc) getRtsWays
- need =<< traverse programPath
- [ Context stg iserv w
- | w <- [vanilla, profiling, dynamic]
- , w `elem` rtsways
- ]
+ ws = [vanilla, profiling, dynamic]
+ progs <- catMaybes <$> mapM (canBuild stg) ws
+ need progs
+ where
+ -- Only build iserv binaries if all dependencies are built the right
+ -- way already. In particular this fixes the case of no_profiled_libs
+ -- not working with the testsuite, see #19624
+ canBuild stg w = do
+ contextDeps <- contextDependencies (Context stg iserv w)
+ ws <- forM contextDeps $ \c ->
+ interpretInContext c (getLibraryWays <>
+ if Context.Type.package c == rts
+ then getRtsWays
+ else mempty)
+ if (all (w `elem`) ws)
+ then Just <$> programPath (Context stg iserv w)
+ else return Nothing
+
pkgFile :: Stage -> Package -> Action FilePath
pkgFile stage pkg