Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Clean up remaining bits related to ghc-cabal #658

Merged
merged 11 commits into from
Aug 26, 2018
Next Next commit
Drop ghcCabal package
snowleopard committed Aug 25, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit be11f66dacebec05f48473a15e01fd1940166284
1 change: 0 additions & 1 deletion src/Builder.hs
Original file line number Diff line number Diff line change
@@ -155,7 +155,6 @@ builderProvenance = \case
GenPrimopCode -> context Stage0 genprimopcode
Ghc _ Stage0 -> Nothing
Ghc _ stage -> context (pred stage) ghc
GhcCabal _ _ -> context Stage1 ghcCabal
GhcPkg _ Stage0 -> Nothing
GhcPkg _ _ -> context Stage0 ghcPkg
Haddock _ -> context Stage1 haddock
23 changes: 10 additions & 13 deletions src/GHC.hs
Original file line number Diff line number Diff line change
@@ -3,12 +3,12 @@ module GHC (
-- * GHC packages
array, base, binary, bytestring, cabal, checkApiAnnotations, checkPpr,
compareSizes, compiler, containers, deepseq, deriveConstants, directory,
filepath, genapply, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCabal,
ghcCompact, ghcHeap, ghci, ghcPkg, ghcPrim, ghcTags, ghcSplit, haddock,
haskeline, hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv,
libffi, libiserv, mtl, parsec, parallel, pretty, primitive, process, rts,
runGhc, stm, templateHaskell, terminfo, text, time, touchy, transformers,
unlit, unix, win32, xhtml, ghcPackages, isGhcPackage, defaultPackages,
filepath, genapply, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCompact,
ghcHeap, ghci, ghcPkg, ghcPrim, ghcTags, ghcSplit, haddock, haskeline,
hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, libffi,
libiserv, mtl, parsec, parallel, pretty, primitive, process, rts, runGhc,
stm, templateHaskell, terminfo, text, time, touchy, transformers, unlit,
unix, win32, xhtml, ghcPackages, isGhcPackage, defaultPackages,
testsuitePackages,

-- * Package information
@@ -157,14 +157,11 @@ programPath context@Context {..} = do
pgm <- programName context
return $ path -/- pgm <.> exe

-- | Some contexts are special: their packages do not have @.cabal@ metadata or
-- we cannot run @ghc-cabal@ on them, e.g. because the latter hasn't been built
-- yet (this is the case with the 'ghcCabal' package in 'Stage0').
-- TODO: This is no longer true -- both @hp2ps@ and @touchy@ appear to have been
-- Cabal-ised, so we need to drop these special cases.
-- | Some contexts are special: their packages do not have @.cabal@ metadata.
nonCabalContext :: Context -> Bool
nonCabalContext Context {..} = (package `elem` [ hp2ps
, touchy
])
|| package == ghcCabal && stage == Stage0
nonCabalContext Context {..} = (package `elem` [hp2ps, touchy])

-- | Some program packages should not be linked with Haskell main function.
nonHsMainPackage :: Package -> Bool
1 change: 0 additions & 1 deletion src/GHC/Packages.hs
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ genprimopcode = hsUtil "genprimopcode"
ghc = hsPrg "ghc-bin" `setPath` "ghc"
ghcBoot = hsLib "ghc-boot"
ghcBootTh = hsLib "ghc-boot-th"
ghcCabal = hsUtil "ghc-cabal"
ghcCompact = hsLib "ghc-compact"
ghcHeap = hsLib "ghc-heap"
ghci = hsLib "ghci"
19 changes: 8 additions & 11 deletions src/Rules/Program.hs
Original file line number Diff line number Diff line change
@@ -58,17 +58,14 @@ buildProgram rs = do

buildBinary :: [(Resource, Int)] -> FilePath -> Context -> Action ()
buildBinary rs bin context@Context {..} = do
binDeps <- if stage == Stage0 && package == ghcCabal
then hsSources context
else do
needLibrary =<< contextDependencies context
when (stage > Stage0) $ do
ways <- interpretInContext context (getLibraryWays <> getRtsWays)
needLibrary [ rtsContext { way = w } | w <- ways ]
cSrcs <- interpretInContext context (getPackageData PD.cSrcs)
cObjs <- mapM (objectPath context) cSrcs
hsObjs <- hsObjects context
return $ cObjs ++ hsObjs
needLibrary =<< contextDependencies context
when (stage > Stage0) $ do
ways <- interpretInContext context (getLibraryWays <> getRtsWays)
needLibrary [ rtsContext { way = w } | w <- ways ]
cSrcs <- interpretInContext context (getPackageData PD.cSrcs)
cObjs <- mapM (objectPath context) cSrcs
hsObjs <- hsObjects context
let binDeps = cObjs ++ hsObjs
need binDeps
buildWithResources rs $ target context (Ghc LinkHs stage) binDeps [bin]
synopsis <- pkgSynopsis context