summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-08-21 23:12:37 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-14 17:17:04 -0400
commit6515c32b6616645918e7ea95db59b0467df12bfb (patch)
treef3f8e0ec6afdd6fed2122851e94805cd4c076a74 /hadrian
parentb42cedbefb296437014d0768348b740b960943c0 (diff)
downloadhaskell-6515c32b6616645918e7ea95db59b0467df12bfb.tar.gz
hadrian: Add some more packages to multi-cradle
The main improvement here is to pass `-this-unit-id` for executables so that they can be added to the multi-cradle if desired as well as normal library packages.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Rules/ToolArgs.hs17
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs6
2 files changed, 12 insertions, 11 deletions
diff --git a/hadrian/src/Rules/ToolArgs.hs b/hadrian/src/Rules/ToolArgs.hs
index e07d5743c4..6bcdafdcdf 100644
--- a/hadrian/src/Rules/ToolArgs.hs
+++ b/hadrian/src/Rules/ToolArgs.hs
@@ -79,8 +79,6 @@ multiSetup pkg_s = do
(Ghc ToolArgs stage0InTree) [] ["ignored"]
arg_list <- interpret fake_target getArgs
let c = Context stage0InTree p (if windowsHost then vanilla else dynamic) Inplace -- Critical use of Inplace, one of the main motivations!
- -- readContextData has the effect of configuring the package so all
- -- dependent packages will also be built.
cd <- readContextData c
srcs <- hsSources c
gens <- interpretInContext c generatedDependencies
@@ -128,7 +126,6 @@ mkToolTarget es p = do
let fake_target = target context
(Ghc ToolArgs stage0InTree) [] ["ignored"]
-- Generate any source files for this target
- cd <- readContextData context
srcs <- hsSources context
gens <- interpretInContext context generatedDependencies
@@ -154,17 +151,17 @@ toolTargets = [ binary
, directory
, process
, exceptions
--- , ghc # depends on ghc library
--- , runGhc # depends on ghc library
+ -- , ghc -- # depends on ghc library
+ -- , runGhc -- # depends on ghc library
, ghcBoot
, ghcBootTh
, ghcHeap
, ghci
--- , ghcPkg # executable
--- , haddock # depends on ghc library
--- , hsc2hs # executable
+ , ghcPkg -- # executable
+ -- , haddock -- # depends on ghc library
+ , hsc2hs -- # executable
, hpc
--- , hpcBin # executable
+ , hpcBin -- # executable
, mtl
, parsec
, time
@@ -172,7 +169,7 @@ toolTargets = [ binary
, text
, terminfo
, transformers
--- , unlit # executable
+ , unlit -- # executable
] ++ if windowsHost then [ win32 ] else [ unix ]
-- | Create a mapping from files to which component it belongs to.
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index 04e6d160d7..88bd26bd62 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -13,6 +13,7 @@ import qualified Context as Context
import Rules.Libffi (libffiName)
import qualified Data.Set as Set
import System.Directory
+import Data.Version.Extra
ghcBuilderArgs :: Args
ghcBuilderArgs = mconcat
@@ -245,12 +246,15 @@ wayGhcArgs = do
packageGhcArgs :: Args
packageGhcArgs = do
package <- getPackage
+ ghc_ver <- readVersion <$> (expr . ghcVersionStage =<< getStage)
pkgId <- expr $ pkgIdentifier package
mconcat [ arg "-hide-all-packages"
, arg "-no-user-package-db"
, arg "-package-env -"
, packageDatabaseArgs
- , libraryPackage ? arg ("-this-unit-id " ++ pkgId)
+ -- We want to pass -this-unit-id for executables as well for multi-repl to
+ -- work with executable packages but this is buggy on GHC-9.0.2
+ , (isLibrary package || (ghc_ver >= makeVersion [9,2,1])) ? arg ("-this-unit-id " ++ pkgId)
, map ("-package-id " ++) <$> getContextData depIds ]
includeGhcArgs :: Args