Skip to content

Commit

Permalink
worries.. about vanilla vs static
Browse files Browse the repository at this point in the history
Fix one more bug

Vanilla being different from Static is kind of problematic
  • Loading branch information
alt-romes committed Jan 15, 2024
1 parent 5e3def7 commit 4880c19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cabal/src/Distribution/Simple/GHC/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ build numJobs pkg_descr = do

let
-- wantVanilla is underspecified, maybe we could deprecated it? (TODO)
-- wantVanilla vs wantStatic??
wantVanilla = if isLib then withVanillaLib lbi else False
wantStatic = if isLib then withStaticLib lbi else withFullyStaticExe lbi
wantDynamic = if isLib then withSharedLib lbi else withDynExe lbi
Expand Down
4 changes: 3 additions & 1 deletion Cabal/src/Distribution/Simple/GHC/Build/Link.hs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ linkExecutable (linkerOpts, rpaths) (wantedWays, buildOpts) targetDir targetName
let baseOpts = buildOpts way
linkOpts =
(baseOpts `mappend` linkerOpts)
{ ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty)
-- If there are no input Haskell files we pass -no-hs-main, and
-- assume there is a main function in another non-haskell object
{ ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty && ghcOptInputScripts baseOpts == mempty)
}
& (if withDynExe lbi then \x -> x{ghcOptRPaths = rpaths} else id)
comp = compiler lbi
Expand Down
7 changes: 4 additions & 3 deletions Cabal/src/Distribution/Simple/GHC/Build/Modules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays = do
[buildStaticAndDynamicToo]
++ (runGhcProg . buildOpts <$> Set.toList neededWays \\ [StaticWay, VanillaWay, DynWay])
-- Otherwise, we need to ensure the defaultGhcWay is built first.
-- VanillaWay first otherwise (fromEnum lists vanilla first)
| otherwise =
runGhcProg . buildOpts <$> sortOn (\w -> if w == defaultGhcWay then 0 else 1 :: Int) (Set.toList neededWays)
runGhcProg . buildOpts <$> sortOn (\w -> if w == defaultGhcWay then 0 else fromEnum w + 1) (Set.toList neededWays)

buildStaticAndDynamicToo = do
runGhcProg dynTooOpts
Expand All @@ -275,8 +276,8 @@ buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays = do
sequence_ orderedBuilds
return buildOpts

data BuildWay = StaticWay | DynWay | ProfWay | VanillaWay
deriving (Eq, Ord, Show)
data BuildWay = VanillaWay | StaticWay | DynWay | ProfWay
deriving (Eq, Ord, Show, Enum)

-- | Returns the object/interface extension prefix for the given build way (e.g. "dyn_" for 'DynWay')
buildWayPrefix :: BuildWay -> String
Expand Down

0 comments on commit 4880c19

Please sign in to comment.