[Git][ghc/ghc][wip/hadrian-cross-stage2] Correctly compute cross-prefix

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Wed Oct 4 09:14:52 UTC 2023



Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC


Commits:
5c0f83fe by Matthew Pickering at 2023-10-04T10:12:02+01:00
Correctly compute cross-prefix

- - - - -


3 changed files:

- hadrian/src/Oracles/TestSettings.hs
- hadrian/src/Settings/Builders/RunTest.hs
- testsuite/ghc-config/ghc-config.hs


Changes:

=====================================
hadrian/src/Oracles/TestSettings.hs
=====================================
@@ -43,6 +43,7 @@ data TestSetting = TestHostOS
                  | TestLeadingUnderscore
                  | TestGhcPackageDb
                  | TestGhcLibDir
+                 | TestCrossCompiling
                  deriving (Show)
 
 -- | Lookup a test setting in @ghcconfig@ file.
@@ -74,6 +75,7 @@ testSetting key = do
         TestLeadingUnderscore     -> "LeadingUnderscore"
         TestGhcPackageDb          -> "GhcGlobalPackageDb"
         TestGhcLibDir             -> "GhcLibdir"
+        TestCrossCompiling        -> "CrossCompiling"
 
 -- | Get the RTS ways of the test compiler
 testRTSSettings :: Action [String]


=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -322,14 +322,18 @@ runTestBuilderArgs = builder Testsuite ? do
 -- | Command line arguments for running GHC's test script.
 getTestArgs :: Args
 getTestArgs = do
-    stage <- getStage
     -- targets specified in the TEST env var
     testEnvTargets <- maybe [] words <$> expr (liftIO $ lookupEnv "TEST")
     args            <- expr $ userSetting defaultTestArgs
     bindir          <- expr $ getBinaryDirectory (testCompiler args)
     compiler        <- expr $ getCompilerPath (testCompiler args)
     globalVerbosity <- shakeVerbosity <$> expr getShakeOptions
-    cross_prefix    <- expr (crossPrefix (succStage stage))
+
+    -- MP: Is it better to compute cross_prefix from testCompiler?
+    cross <- expr $ getBooleanSetting TestCrossCompiling
+    test_target <- expr $ getTestSetting TestTARGETPLATFORM
+    let cross_prefix = if cross then test_target ++ "-" else ""
+
     -- the testsuite driver will itself tell us if we need to generate the docs target
     -- So we always pass the haddock path if the hadrian configuration allows us to build
     -- docs


=====================================
testsuite/ghc-config/ghc-config.hs
=====================================
@@ -28,6 +28,7 @@ main = do
   getGhcFieldOrFail fields "GhcRTSWays" "RTS ways"
   getGhcFieldOrFail fields "GhcLibdir" "LibDir"
   getGhcFieldOrFail fields "GhcGlobalPackageDb" "Global Package DB"
+  getGhcFieldOrFail fields "CrossCompiling" "cross compiling"
   getGhcFieldOrDefault fields "GhcDynamic" "GHC Dynamic" "NO"
   getGhcFieldOrDefault fields "GhcProfiled" "GHC Profiled" "NO"
   getGhcFieldOrDefault fields "LeadingUnderscore" "Leading underscore" "NO"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5c0f83feabafa09d4ec34897fb7012aa7bf8557c

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5c0f83feabafa09d4ec34897fb7012aa7bf8557c
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231004/79b9752e/attachment-0001.html>


More information about the ghc-commits mailing list