GhcCabal.hs 1.58 KB
Newer Older
1
2
3
4
module Settings.Packages.GhcCabal (ghcCabalPackageArgs) where

import Base
import Expression
5
6
import GHC
import Oracles.Config.Setting
7
8
9
10
11
12
13
14
15
16
17
18
19
import Predicates (builderGhc, package, stage0)
import Settings

ghcCabalPackageArgs :: Args
ghcCabalPackageArgs = package ghcCabal ? mconcat
    [ builderGhc ?
      mconcat [ ghcCabalBootArgs
              , remove ["-no-auto-link-packages"] ] ]

-- Boostrapping ghcCabal
-- TODO: do we need -DCABAL_VERSION=$(CABAL_VERSION)?
ghcCabalBootArgs :: Args
ghcCabalBootArgs = stage0 ? do
20
21
    path <- getBuildPath
    let cabalMacros     = path -/- "autogen/cabal_macros.h"
22
        cabalMacrosBoot = pkgPath ghcCabal -/- "cabal_macros_boot.h"
Andrey Mokhov's avatar
Andrey Mokhov committed
23
24
25
    -- Note: We could have computed 'cabalDeps' instead of hard-coding it
    -- but this doesn't worth the effort, since we plan to drop ghc-cabal
    -- altogether at some point. See #18.
26
27
28
29
30
    cabalDeps <- fromDiffExpr $ mconcat
        [ append [ array, base, bytestring, containers, deepseq, directory
                 , pretty, process, time ]
        , notM windowsHost ? append [unix]
        , windowsHost ? append [win32] ]
31
    mconcat
32
        [ append [ "-package " ++ pkgNameString pkg | pkg <- cabalDeps ]
33
34
        , removePair "-optP-include" $ "-optP" ++ cabalMacros
        , arg "--make"
35
        , arg "-j"
36
37
38
39
40
41
42
43
44
        , arg "-DBOOTSTRAPPING"
        , arg "-DMIN_VERSION_binary_0_8_0"
        , arg "-DGENERICS"
        , arg "-optP-include"
        , arg $ "-optP" ++ cabalMacrosBoot
        , arg "-ilibraries/Cabal/Cabal"
        , arg "-ilibraries/binary/src"
        , arg "-ilibraries/filepath"
        , arg "-ilibraries/hpc" ]