Cabal-1.24.2.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell98

Distribution.Simple.Program.GHC

Synopsis

- data GhcOptions = GhcOptions {
  - ghcOptMode :: Flag GhcMode
  - ghcOptExtra :: NubListR String
  - ghcOptExtraDefault :: NubListR String
  - ghcOptInputFiles :: NubListR FilePath
  - ghcOptInputModules :: NubListR ModuleName
  - ghcOptOutputFile :: Flag FilePath
  - ghcOptOutputDynFile :: Flag FilePath
  - ghcOptSourcePathClear :: Flag Bool
  - ghcOptSourcePath :: NubListR FilePath
  - ghcOptThisUnitId :: Flag String
  - ghcOptPackageDBs :: PackageDBStack
  - ghcOptPackages :: NubListR (UnitId, PackageId, ModuleRenaming)
  - ghcOptHideAllPackages :: Flag Bool
  - ghcOptNoAutoLinkPackages :: Flag Bool
  - ghcOptLinkLibs :: NubListR FilePath
  - ghcOptLinkLibPath :: NubListR FilePath
  - ghcOptLinkOptions :: NubListR String
  - ghcOptLinkFrameworks :: NubListR String
  - ghcOptLinkFrameworkDirs :: NubListR String
  - ghcOptNoLink :: Flag Bool
  - ghcOptLinkNoHsMain :: Flag Bool
  - ghcOptCcOptions :: NubListR String
  - ghcOptCppOptions :: NubListR String
  - ghcOptCppIncludePath :: NubListR FilePath
  - ghcOptCppIncludes :: NubListR FilePath
  - ghcOptFfiIncludes :: NubListR FilePath
  - ghcOptLanguage :: Flag Language
  - ghcOptExtensions :: NubListR Extension
  - ghcOptExtensionMap :: Map Extension String
  - ghcOptOptimisation :: Flag GhcOptimisation
  - ghcOptDebugInfo :: Flag Bool
  - ghcOptProfilingMode :: Flag Bool
  - ghcOptProfilingAuto :: Flag GhcProfAuto
  - ghcOptSplitObjs :: Flag Bool
  - ghcOptNumJobs :: Flag (Maybe Int)
  - ghcOptHPCDir :: Flag FilePath
  - ghcOptGHCiScripts :: NubListR FilePath
  - ghcOptHiSuffix :: Flag String
  - ghcOptObjSuffix :: Flag String
  - ghcOptDynHiSuffix :: Flag String
  - ghcOptDynObjSuffix :: Flag String
  - ghcOptHiDir :: Flag FilePath
  - ghcOptObjDir :: Flag FilePath
  - ghcOptOutputDir :: Flag FilePath
  - ghcOptStubDir :: Flag FilePath
  - ghcOptDynLinkMode :: Flag GhcDynLinkMode
  - ghcOptShared :: Flag Bool
  - ghcOptFPic :: Flag Bool
  - ghcOptDylibName :: Flag String
  - ghcOptRPaths :: NubListR FilePath
  - ghcOptVerbosity :: Flag Verbosity
  - ghcOptCabal :: Flag Bool
  }
- data GhcMode
  - = GhcModeCompile
  - | GhcModeLink
  - | GhcModeMake
  - | GhcModeInteractive
  - | GhcModeAbiHash
- data GhcOptimisation
  - = GhcNoOptimisation
  - | GhcNormalOptimisation
  - | GhcMaximumOptimisation
  - | GhcSpecialOptimisation String
- data GhcDynLinkMode
  - = GhcStaticOnly
  - | GhcDynamicOnly
  - | GhcStaticAndDynamic
- data GhcProfAuto
  - = GhcProfAutoAll
  - | GhcProfAutoToplevel
  - | GhcProfAutoExported
- ghcInvocation :: ConfiguredProgram -> Compiler -> Platform -> GhcOptions -> ProgramInvocation
- renderGhcOptions :: Compiler -> Platform -> GhcOptions -> [String]
- runGHC :: Verbosity -> ConfiguredProgram -> Compiler -> Platform -> GhcOptions -> IO ()

# Documentation

data GhcOptions Source #

A structured set of GHC options/flags

Constructors

GhcOptions |
Fields ghcOptMode :: Flag GhcMode The major mode for the ghc invocation. ghcOptExtra :: NubListR String Any extra options to pass directly to ghc. These go at the end and hence override other stuff. ghcOptExtraDefault :: NubListR String Extra default flags to pass directly to ghc. These go at the beginning and so can be overridden by other stuff. ghcOptInputFiles :: NubListR FilePath The main input files; could be .hs, .hi, .c, .o, depending on mode. ghcOptInputModules :: NubListR ModuleName The names of input Haskell modules, mainly for `--make` mode. ghcOptOutputFile :: Flag FilePath Location for output file; the `ghc -o` flag. ghcOptOutputDynFile :: Flag FilePath Location for dynamic output file in `GhcStaticAndDynamic` mode; the `ghc -dyno` flag. ghcOptSourcePathClear :: Flag Bool Start with an empty search path for Haskell source files; the `ghc -i` flag (`-i` on it's own with no path argument). ghcOptSourcePath :: NubListR FilePath Search path for Haskell source files; the `ghc -i` flag. ghcOptThisUnitId :: Flag String The unit ID the modules will belong to; the `ghc -this-unit-id` flag (or `-this-package-key` or `-package-name` on older versions of GHC). This is a `String` because we assume you've already figured out what the correct format for this string is (we need to handle backwards compatibility.) ghcOptPackageDBs :: PackageDBStack GHC package databases to use, the `ghc -package-conf` flag. ghcOptPackages :: NubListR (UnitId, PackageId, ModuleRenaming) The GHC packages to use. For compatability with old and new ghc, this requires both the short and long form of the package id; the `ghc -package` or `ghc -package-id` flags. ghcOptHideAllPackages :: Flag Bool Start with a clean package set; the `ghc -hide-all-packages` flag ghcOptNoAutoLinkPackages :: Flag Bool Don't automatically link in Haskell98 etc; the `ghc -no-auto-link-packages` flag. ghcOptLinkLibs :: NubListR FilePath Names of libraries to link in; the `ghc -l` flag. ghcOptLinkLibPath :: NubListR FilePath Search path for libraries to link in; the `ghc -L` flag. ghcOptLinkOptions :: NubListR String Options to pass through to the linker; the `ghc -optl` flag. ghcOptLinkFrameworks :: NubListR String OSX only: frameworks to link in; the `ghc -framework` flag. ghcOptLinkFrameworkDirs :: NubListR String OSX only: Search path for frameworks to link in; the `ghc -framework-path` flag. ghcOptNoLink :: Flag Bool Don't do the link step, useful in make mode; the `ghc -no-link` flag. ghcOptLinkNoHsMain :: Flag Bool Don't link in the normal RTS `main` entry point; the `ghc -no-hs-main` flag. ghcOptCcOptions :: NubListR String Options to pass through to the C compiler; the `ghc -optc` flag. ghcOptCppOptions :: NubListR String Options to pass through to CPP; the `ghc -optP` flag. ghcOptCppIncludePath :: NubListR FilePath Search path for CPP includes like header files; the `ghc -I` flag. ghcOptCppIncludes :: NubListR FilePath Extra header files to include at CPP stage; the `ghc -optP-include` flag. ghcOptFfiIncludes :: NubListR FilePath Extra header files to include for old-style FFI; the `ghc -#include` flag. ghcOptLanguage :: Flag Language The base language; the `ghc -XHaskell98` or `-XHaskell2010` flag. ghcOptExtensions :: NubListR Extension The language extensions; the `ghc -X` flag. ghcOptExtensionMap :: Map Extension String A GHC version-dependent mapping of extensions to flags. This must be set to be able to make use of the `ghcOptExtensions`. ghcOptOptimisation :: Flag GhcOptimisation What optimisation level to use; the `ghc -O` flag. ghcOptDebugInfo :: Flag Bool Emit debug info; the `ghc -g` flag. ghcOptProfilingMode :: Flag Bool Compile in profiling mode; the `ghc -prof` flag. ghcOptProfilingAuto :: Flag GhcProfAuto Automatically add profiling cost centers; the `ghc -fprof-auto*` flags. ghcOptSplitObjs :: Flag Bool Use the "split object files" feature; the `ghc -split-objs` flag. ghcOptNumJobs :: Flag (Maybe Int) Run N jobs simultaneously (if possible). ghcOptHPCDir :: Flag FilePath Enable coverage analysis; the `ghc -fhpc -hpcdir` flags. ghcOptGHCiScripts :: NubListR FilePath Extra GHCi startup scripts; the `-ghci-script` flag ghcOptHiSuffix :: Flag String ghcOptObjSuffix :: Flag String ghcOptDynHiSuffix :: Flag String only in `GhcStaticAndDynamic` mode ghcOptDynObjSuffix :: Flag String only in `GhcStaticAndDynamic` mode ghcOptHiDir :: Flag FilePath ghcOptObjDir :: Flag FilePath ghcOptOutputDir :: Flag FilePath ghcOptStubDir :: Flag FilePath ghcOptDynLinkMode :: Flag GhcDynLinkMode ghcOptShared :: Flag Bool ghcOptFPic :: Flag Bool ghcOptDylibName :: Flag String ghcOptRPaths :: NubListR FilePath ghcOptVerbosity :: Flag Verbosity Get GHC to be quiet or verbose with what it's doing; the `ghc -v` flag. ghcOptCabal :: Flag Bool Let GHC know that it is Cabal that's calling it. Modifies some of the GHC error messages.

Instances

Show GhcOptions # |
Methods showsPrec :: Int -> GhcOptions -> ShowS Source # show :: GhcOptions -> String Source # showList :: [GhcOptions] -> ShowS Source #
Generic GhcOptions # |
Associated Types type Rep GhcOptions :: * -> * Source # Methods from :: GhcOptions -> Rep GhcOptions x Source # to :: Rep GhcOptions x -> GhcOptions Source #
Semigroup GhcOptions # |
Methods (<>) :: GhcOptions -> GhcOptions -> GhcOptions Source # sconcat :: NonEmpty GhcOptions -> GhcOptions Source # stimes :: Integral b => b -> GhcOptions -> GhcOptions Source #
Monoid GhcOptions # |
Methods mempty :: GhcOptions Source # mappend :: GhcOptions -> GhcOptions -> GhcOptions Source # mconcat :: [GhcOptions] -> GhcOptions Source #
type Rep GhcOptions # |
type Rep GhcOptions = D1 (MetaData "GhcOptions" "Distribution.Simple.Program.GHC" "Cabal-1.24.2.0" False) (C1 (MetaCons "GhcOptions" PrefixI True) ((:*:) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptMode") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag GhcMode))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptExtra") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR String))) (S1 (MetaSel (Just Symbol "ghcOptExtraDefault") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR String))))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptInputFiles") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptInputModules") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR ModuleName))) (S1 (MetaSel (Just Symbol "ghcOptOutputFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptOutputDynFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptSourcePathClear") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "ghcOptSourcePath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptThisUnitId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag String))) (S1 (MetaSel (Just Symbol "ghcOptPackageDBs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageDBStack))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptPackages") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR (UnitId, PackageId, ModuleRenaming)))) (S1 (MetaSel (Just Symbol "ghcOptHideAllPackages") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptNoAutoLinkPackages") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptLinkLibs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath))) (S1 (MetaSel (Just Symbol "ghcOptLinkLibPath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath))))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptLinkOptions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR String))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptLinkFrameworks") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR String))) (S1 (MetaSel (Just Symbol "ghcOptLinkFrameworkDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR String)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptNoLink") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptLinkNoHsMain") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "ghcOptCcOptions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR String))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptCppOptions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR String))) (S1 (MetaSel (Just Symbol "ghcOptCppIncludePath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath)))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptCppIncludes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath))) (S1 (MetaSel (Just Symbol "ghcOptFfiIncludes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath)))))))) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptLanguage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Language))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptExtensions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR Extension))) (S1 (MetaSel (Just Symbol "ghcOptExtensionMap") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map Extension String))))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptOptimisation") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag GhcOptimisation))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptDebugInfo") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "ghcOptProfilingMode") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptProfilingAuto") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag GhcProfAuto))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptSplitObjs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "ghcOptNumJobs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag (Maybe Int)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptHPCDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath))) (S1 (MetaSel (Just Symbol "ghcOptGHCiScripts") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath)))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptHiSuffix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag String))) (S1 (MetaSel (Just Symbol "ghcOptObjSuffix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag String))))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptDynHiSuffix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag String))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptDynObjSuffix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag String))) (S1 (MetaSel (Just Symbol "ghcOptHiDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath))))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptObjDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptOutputDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath))) (S1 (MetaSel (Just Symbol "ghcOptStubDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptDynLinkMode") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag GhcDynLinkMode))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptShared") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "ghcOptFPic") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptDylibName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag String))) (S1 (MetaSel (Just Symbol "ghcOptRPaths") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubListR FilePath)))) ((:*:) (S1 (MetaSel (Just Symbol "ghcOptVerbosity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Verbosity))) (S1 (MetaSel (Just Symbol "ghcOptCabal") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))))))))))

data GhcMode Source #

Constructors

GhcModeCompile |
    ghc -c
GhcModeLink |
    ghc
GhcModeMake |
    ghc --make
GhcModeInteractive | `ghci` / `ghc --interactive`
GhcModeAbiHash | `ghc --abi-hash` | GhcModeDepAnalysis -- ^ `ghc -M` | GhcModeEvaluate -- ^ `ghc -e`

Instances

Eq GhcMode # |
Methods (==) :: GhcMode -> GhcMode -> Bool # (/=) :: GhcMode -> GhcMode -> Bool #
Show GhcMode # |
Methods showsPrec :: Int -> GhcMode -> ShowS Source # show :: GhcMode -> String Source # showList :: [GhcMode] -> ShowS Source #

data GhcOptimisation Source #

Constructors

GhcNoOptimisation |
    -O0
GhcNormalOptimisation |
    -O
GhcMaximumOptimisation |
    -O2
GhcSpecialOptimisation String | e.g. `-Odph`

Instances

Eq GhcOptimisation # |
Methods (==) :: GhcOptimisation -> GhcOptimisation -> Bool # (/=) :: GhcOptimisation -> GhcOptimisation -> Bool #
Show GhcOptimisation # |
Methods showsPrec :: Int -> GhcOptimisation -> ShowS Source # show :: GhcOptimisation -> String Source # showList :: [GhcOptimisation] -> ShowS Source #

data GhcDynLinkMode Source #

Constructors

GhcStaticOnly |
    -static
GhcDynamicOnly |
    -dynamic
GhcStaticAndDynamic |
    -static -dynamic-too

Instances

Eq GhcDynLinkMode # |
Methods (==) :: GhcDynLinkMode -> GhcDynLinkMode -> Bool # (/=) :: GhcDynLinkMode -> GhcDynLinkMode -> Bool #
Show GhcDynLinkMode # |
Methods showsPrec :: Int -> GhcDynLinkMode -> ShowS Source # show :: GhcDynLinkMode -> String Source # showList :: [GhcDynLinkMode] -> ShowS Source #

data GhcProfAuto Source #

Constructors

GhcProfAutoAll |
    -fprof-auto
GhcProfAutoToplevel |
    -fprof-auto-top
GhcProfAutoExported |
    -fprof-auto-exported

Instances

Eq GhcProfAuto # |
Methods (==) :: GhcProfAuto -> GhcProfAuto -> Bool # (/=) :: GhcProfAuto -> GhcProfAuto -> Bool #
Show GhcProfAuto # |
Methods showsPrec :: Int -> GhcProfAuto -> ShowS Source # show :: GhcProfAuto -> String Source # showList :: [GhcProfAuto] -> ShowS Source #

ghcInvocation :: ConfiguredProgram -> Compiler -> Platform -> GhcOptions -> ProgramInvocation Source #

renderGhcOptions :: Compiler -> Platform -> GhcOptions -> [String] Source #

runGHC :: Verbosity -> ConfiguredProgram -> Compiler -> Platform -> GhcOptions -> IO () Source #