Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keepCAFsForGHCi -> ghc_lib_parser_keepCAFsForGHCi #564

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ghc-lib-gen/src/Ghclibgen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,17 @@ mangleCSymbols ghcFlavor = do
let initGenSym = "initGenSym"
let enableTimingStats = "enableTimingStats"
let setHeapSize = "setHeapSize"
let keepCAFsForGHCi = "keepCAFsForGHCi"
keepCAFsForCHCiExists <- doesFileExist "compiler/cbits/keepCAFsForGHCi.c"
when keepCAFsForCHCiExists $ do
let file = "compiler/cbits/keepCAFsForGHCi.c"
in writeFile file
. prefixSymbol keepCAFsForGHCi
=<< readFile' file
let file = "compiler/GHC.hs"
in writeFile file
. prefixForeignImport keepCAFsForGHCi
=<< readFile' file
let file = "compiler/cbits/genSym.c"
in writeFile file
. prefixSymbol genSym
Expand Down Expand Up @@ -1410,6 +1421,7 @@ generateGhcLibParserCabal ghcFlavor customCppOpts = do
(lib, _bin, parserModules, _) <- libBinParserLibModules ghcFlavor
let hsSrcDirs = replace ["libraries/ghc-boot-th/../ghc-internal/src"] ["libraries/ghc-internal/src"] (ghcLibParserHsSrcDirs False ghcFlavor lib)
let includeDirs = replace ["libraries/ghc-internal/include"] [] (ghcLibParserIncludeDirs ghcFlavor)
keepCAFsForCHCiExists <- doesFileExist "compiler/cbits/keepCAFsForGHCi.c"
writeFile "ghc-lib-parser.cabal" . unlines . map trimEnd . join $
[ [ "cabal-version: 3.0",
"build-type: Simple",
Expand Down Expand Up @@ -1482,7 +1494,7 @@ generateGhcLibParserCabal ghcFlavor customCppOpts = do
indent2 ["compiler/cbits/genSym.c"],
indent2 ["compiler/cbits/cutils.c" | ghcSeries ghcFlavor >= GHC_9_0],
indent2 ["compiler/parser/cutils.c" | ghcSeries ghcFlavor < GHC_9_0],
indent2 ["compiler/cbits/keepCAFsForGHCi.c" | ghcFlavor `elem` [Ghc926, Ghc927, Ghc928, Ghc945, Ghc946, Ghc947, Ghc948] || ghcSeries ghcFlavor >= GHC_9_6],
indent2 ["compiler/cbits/keepCAFsForGHCi.c" | keepCAFsForCHCiExists],
[" hs-source-dirs:"],
indent2 hsSrcDirs,
[" autogen-modules:"],
Expand Down
Loading