David Eichmann pushed to branch wip/davide/ghc-internal-def at Glasgow Haskell Compiler / GHC
Commits:
-
9e751925
by David Eichmann at 2026-05-19T17:15:50+01:00
5 changed files:
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/Library.hs
- hadrian/src/Rules/Rts.hs
- rts/.gitignore
- rts/win32/libHSghc-internal.def.in
Changes:
| ... | ... | @@ -377,7 +377,6 @@ templateRules = do |
| 377 | 377 | , interpolateSetting "ProjectPatchLevel1" ProjectPatchLevel1
|
| 378 | 378 | , interpolateSetting "ProjectPatchLevel2" ProjectPatchLevel2
|
| 379 | 379 | ]
|
| 380 | - templateRule "rts/win32/libHSghc-internal.def" projectVersion
|
|
| 381 | 380 | templateRule "docs/index.html" $ packageUnitIds Stage1
|
| 382 | 381 | templateRule "docs/users_guide/ghc_config.py" $ mconcat
|
| 383 | 382 | [ projectVersion
|
| ... | ... | @@ -20,6 +20,7 @@ import Utilities |
| 20 | 20 | import Data.Time.Clock
|
| 21 | 21 | import Rules.Generate (generatedDependencies)
|
| 22 | 22 | import Oracles.Flag
|
| 23 | +import Oracles.Setting (setting, Setting (ProjectVersionForLib, ProjectVersion))
|
|
| 23 | 24 | |
| 24 | 25 | |
| 25 | 26 | -- * Library 'Rules'
|
| ... | ... | @@ -203,10 +204,20 @@ extraObjects context |
| 203 | 204 | |
| 204 | 205 | | package context == rts = do
|
| 205 | 206 | target <- interpretInContext context getStagedTarget
|
| 206 | - builddir <- buildPath context
|
|
| 207 | - return [ builddir -/- "libHSghc-internal.dll.a"
|
|
| 208 | - | archOS_OS (tgtArchOs target) == OSMinGW32
|
|
| 209 | - , Dynamic `wayUnit` way context ]
|
|
| 207 | + if not (archOS_OS (tgtArchOs target) == OSMinGW32
|
|
| 208 | + && Dynamic `wayUnit` way context)
|
|
| 209 | + then return []
|
|
| 210 | + else do
|
|
| 211 | + -- Find the ghc-internal library file name
|
|
| 212 | + ghcInternalDllName <- takeFileName <$> pkgLibraryFile (Context {
|
|
| 213 | + stage = stage context,
|
|
| 214 | + way = way context,
|
|
| 215 | + iplace = iplace context,
|
|
| 216 | + package = ghcInternal
|
|
| 217 | + })
|
|
| 218 | + |
|
| 219 | + builddir <- buildPath context
|
|
| 220 | + return [ builddir -/- ghcInternalDllName <> ".a"]
|
|
| 210 | 221 | |
| 211 | 222 | | otherwise = return []
|
| 212 | 223 |
| ... | ... | @@ -29,11 +29,19 @@ rtsRules = priority 3 $ do |
| 29 | 29 | -- to be linked into the rts dll.
|
| 30 | 30 | forM_ [Stage1, Stage2, Stage3 ] $ \ stage -> do
|
| 31 | 31 | let buildPath = root -/- buildDir (rtsContext stage)
|
| 32 | - buildPath -/- "libHSghc-internal.dll.a" %> buildGhcInternalImportLib
|
|
| 32 | + buildPath -/- "libHSghc-internal-*.def" %> buildGhcInternalImportDef
|
|
| 33 | + buildPath -/- "libHSghc-internal-*.dll.a" %> buildGhcInternalImportLib
|
|
| 34 | + |
|
| 35 | +buildGhcInternalImportDef :: FilePath -> Action ()
|
|
| 36 | +buildGhcInternalImportDef target = do
|
|
| 37 | + templateIn <- readFile' "rts/win32/libHSghc-internal.def.in"
|
|
| 38 | + let dllName = (dropExtension (takeFileName target)) <.> "dll"
|
|
| 39 | + templateOut = replace "@GhcInternalDll@" dllName templateIn
|
|
| 40 | + writeFile' target templateOut
|
|
| 33 | 41 | |
| 34 | 42 | buildGhcInternalImportLib :: FilePath -> Action ()
|
| 35 | 43 | buildGhcInternalImportLib target = do
|
| 36 | - let input = "rts/win32/libHSghc-internal.def"
|
|
| 44 | + let input = (dropExtension (dropExtension target)) <.> "def" -- the .def file
|
|
| 37 | 45 | output = target -- the .dll.a import lib
|
| 38 | 46 | need [input]
|
| 39 | 47 | runBuilder Dlltool ["-d", input, "-l", output] [input] [output]
|
| ... | ... | @@ -20,4 +20,3 @@ |
| 20 | 20 | /ghcautoconf.h.autoconf.in
|
| 21 | 21 | /ghcautoconf.h.autoconf
|
| 22 | 22 | /include/ghcautoconf.h |
| 23 | -/win32/libHSghc-internal.def |
| 1 | -LIBRARY libHSghc-internal-@ProjectVersionForLib@.0-ghc@ProjectVersion@.dll
|
|
| 1 | +LIBRARY @GhcInternalDll@
|
|
| 2 | 2 | |
| 3 | 3 | EXPORTS
|
| 4 | 4 | init_ghc_hs_iface |