Cabal-2.2.0.1: A framework for packaging Haskell software

CopyrightIsaac Jones 2003-2005
LicenseBSD3
Maintainercabal-devel@haskell.org
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Distribution.Simple

Contents

Description

This is the command line front end to the Simple build system. When given the parsed command-line args and package information, is able to perform basic commands like configure, build, install, register, etc.

This module exports the main functions that Setup.hs scripts use. It re-exports the UserHooks type, the standard entry points like defaultMain and defaultMainWithHooks and the predefined sets of UserHooks that custom Setup.hs scripts can extend to add their own behaviour.

This module isn't called "Simple" because it's simple. Far from it. It's called "Simple" because it does complicated things to simple software.

The original idea was that there could be different build systems that all presented the same compatible command line interfaces. There is still a Distribution.Make system but in practice no packages use it.

Synopsis

Documentation

data AbiTag Source #

Constructors

NoAbiTag 
AbiTag String 
Instances
Eq AbiTag # 
Instance details

Defined in Distribution.Compiler

Methods

(==) :: AbiTag -> AbiTag -> Bool #

(/=) :: AbiTag -> AbiTag -> Bool #

Read AbiTag # 
Instance details

Defined in Distribution.Compiler

Show AbiTag # 
Instance details

Defined in Distribution.Compiler

Generic AbiTag # 
Instance details

Defined in Distribution.Compiler

Associated Types

type Rep AbiTag :: * -> * Source #

Binary AbiTag # 
Instance details

Defined in Distribution.Compiler

Text AbiTag # 
Instance details

Defined in Distribution.Compiler

type Rep AbiTag # 
Instance details

Defined in Distribution.Compiler

type Rep AbiTag = D1 (MetaData "AbiTag" "Distribution.Compiler" "Cabal-2.2.0.1" False) (C1 (MetaCons "NoAbiTag" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "AbiTag" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))

data CompilerInfo Source #

Compiler information used for resolving configurations. Some fields can be set to Nothing to indicate that the information is unknown.

Constructors

CompilerInfo 

Fields

Instances
Read CompilerInfo # 
Instance details

Defined in Distribution.Compiler

Show CompilerInfo # 
Instance details

Defined in Distribution.Compiler

Generic CompilerInfo # 
Instance details

Defined in Distribution.Compiler

Associated Types

type Rep CompilerInfo :: * -> * Source #

Binary CompilerInfo # 
Instance details

Defined in Distribution.Compiler

type Rep CompilerInfo # 
Instance details

Defined in Distribution.Compiler

data CompilerId Source #

Instances
Eq CompilerId # 
Instance details

Defined in Distribution.Compiler

Ord CompilerId # 
Instance details

Defined in Distribution.Compiler

Read CompilerId # 
Instance details

Defined in Distribution.Compiler

Show CompilerId # 
Instance details

Defined in Distribution.Compiler

Generic CompilerId # 
Instance details

Defined in Distribution.Compiler

Associated Types

type Rep CompilerId :: * -> * Source #

NFData CompilerId # 
Instance details

Defined in Distribution.Compiler

Methods

rnf :: CompilerId -> () Source #

Binary CompilerId # 
Instance details

Defined in Distribution.Compiler

Text CompilerId # 
Instance details

Defined in Distribution.Compiler

type Rep CompilerId # 
Instance details

Defined in Distribution.Compiler

data CompilerFlavor Source #

Instances
Eq CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Data CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CompilerFlavor -> c CompilerFlavor Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CompilerFlavor Source #

toConstr :: CompilerFlavor -> Constr Source #

dataTypeOf :: CompilerFlavor -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CompilerFlavor) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompilerFlavor) Source #

gmapT :: (forall b. Data b => b -> b) -> CompilerFlavor -> CompilerFlavor Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CompilerFlavor -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CompilerFlavor -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CompilerFlavor -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CompilerFlavor -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CompilerFlavor -> m CompilerFlavor Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CompilerFlavor -> m CompilerFlavor Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CompilerFlavor -> m CompilerFlavor Source #

Ord CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Read CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Show CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Generic CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Associated Types

type Rep CompilerFlavor :: * -> * Source #

NFData CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Methods

rnf :: CompilerFlavor -> () Source #

Binary CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Pretty CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Parsec CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Text CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Newtype TestedWith (CompilerFlavor, VersionRange) # 
Instance details

Defined in Distribution.Parsec.Newtypes

type Rep CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

type Rep CompilerFlavor = D1 (MetaData "CompilerFlavor" "Distribution.Compiler" "Cabal-2.2.0.1" False) (((C1 (MetaCons "GHC" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "GHCJS" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "NHC" PrefixI False) (U1 :: * -> *))) :+: (C1 (MetaCons "YHC" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "Hugs" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "HBC" PrefixI False) (U1 :: * -> *)))) :+: ((C1 (MetaCons "Helium" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "JHC" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "LHC" PrefixI False) (U1 :: * -> *))) :+: (C1 (MetaCons "UHC" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "HaskellSuite" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) :+: C1 (MetaCons "OtherCompiler" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))))))

parseCompilerFlavorCompat :: ReadP r CompilerFlavor Source #

Like classifyCompilerFlavor but compatible with the old ReadS parser.

It is compatible in the sense that it accepts only the same strings, eg GHC but not "ghc". However other strings get mapped to OtherCompiler. The point of this is that we do not allow extra valid values that would upset older Cabal versions that had a stricter parser however we cope with new values more gracefully so that we'll be able to introduce new value in future without breaking things so much.

defaultCompilerFlavor :: Maybe CompilerFlavor Source #

The default compiler flavour to pick when compiling stuff. This defaults to the compiler used to build the Cabal lib.

However if it's not a recognised compiler then it's Nothing and the user will have to specify which compiler they want.

unknownCompilerInfo :: CompilerId -> AbiTag -> CompilerInfo Source #

Make a CompilerInfo of which only the known information is its CompilerId, its AbiTag and that it does not claim to be compatible with other compiler id's.

data ProfDetailLevel Source #

Some compilers (notably GHC) support profiling and can instrument programs so the system can account costs to different functions. There are different levels of detail that can be used for this accounting. For compilers that do not support this notion or the particular detail levels, this is either ignored or just capped to some similar level they do support.

Instances
Eq ProfDetailLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Read ProfDetailLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Show ProfDetailLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Generic ProfDetailLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep ProfDetailLevel :: * -> * Source #

Binary ProfDetailLevel # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep ProfDetailLevel # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep ProfDetailLevel = D1 (MetaData "ProfDetailLevel" "Distribution.Simple.Compiler" "Cabal-2.2.0.1" False) ((C1 (MetaCons "ProfDetailNone" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "ProfDetailDefault" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "ProfDetailExportedFunctions" PrefixI False) (U1 :: * -> *))) :+: (C1 (MetaCons "ProfDetailToplevelFunctions" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "ProfDetailAllFunctions" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "ProfDetailOther" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))))

data DebugInfoLevel Source #

Some compilers support emitting debug info. Some have different levels. For compilers that do not the level is just capped to the level they do support.

Instances
Bounded DebugInfoLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Enum DebugInfoLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Eq DebugInfoLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Read DebugInfoLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Show DebugInfoLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Generic DebugInfoLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep DebugInfoLevel :: * -> * Source #

Binary DebugInfoLevel # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep DebugInfoLevel # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep DebugInfoLevel = D1 (MetaData "DebugInfoLevel" "Distribution.Simple.Compiler" "Cabal-2.2.0.1" False) ((C1 (MetaCons "NoDebugInfo" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "MinimalDebugInfo" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "NormalDebugInfo" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "MaximalDebugInfo" PrefixI False) (U1 :: * -> *)))

data OptimisationLevel Source #

Some compilers support optimising. Some have different levels. For compilers that do not the level is just capped to the level they do support.

Instances
Bounded OptimisationLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Enum OptimisationLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Eq OptimisationLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Read OptimisationLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Show OptimisationLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Generic OptimisationLevel # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep OptimisationLevel :: * -> * Source #

Binary OptimisationLevel # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep OptimisationLevel # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep OptimisationLevel = D1 (MetaData "OptimisationLevel" "Distribution.Simple.Compiler" "Cabal-2.2.0.1" False) (C1 (MetaCons "NoOptimisation" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "NormalOptimisation" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "MaximumOptimisation" PrefixI False) (U1 :: * -> *)))

type PackageDBStack = [PackageDB] Source #

We typically get packages from several databases, and stack them together. This type lets us be explicit about that stacking. For example typical stacks include:

[GlobalPackageDB]
[GlobalPackageDB, UserPackageDB]
[GlobalPackageDB, SpecificPackageDB "package.conf.inplace"]

Note that the GlobalPackageDB is invariably at the bottom since it contains the rts, base and other special compiler-specific packages.

We are not restricted to using just the above combinations. In particular we can use several custom package dbs and the user package db together.

When it comes to writing, the top most (last) package is used.

data PackageDB Source #

Some compilers have a notion of a database of available packages. For some there is just one global db of packages, other compilers support a per-user or an arbitrary db specified at some location in the file system. This can be used to build isloated environments of packages, for example to build a collection of related packages without installing them globally.

Instances
Eq PackageDB # 
Instance details

Defined in Distribution.Simple.Compiler

Ord PackageDB # 
Instance details

Defined in Distribution.Simple.Compiler

Read PackageDB # 
Instance details

Defined in Distribution.Simple.Compiler

Show PackageDB # 
Instance details

Defined in Distribution.Simple.Compiler

Generic PackageDB # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep PackageDB :: * -> * Source #

Binary PackageDB # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep PackageDB # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep PackageDB = D1 (MetaData "PackageDB" "Distribution.Simple.Compiler" "Cabal-2.2.0.1" False) (C1 (MetaCons "GlobalPackageDB" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "UserPackageDB" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "SpecificPackageDB" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FilePath))))

data Compiler Source #

Constructors

Compiler 

Fields

Instances
Eq Compiler # 
Instance details

Defined in Distribution.Simple.Compiler

Read Compiler # 
Instance details

Defined in Distribution.Simple.Compiler

Show Compiler # 
Instance details

Defined in Distribution.Simple.Compiler

Generic Compiler # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep Compiler :: * -> * Source #

Binary Compiler # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep Compiler # 
Instance details

Defined in Distribution.Simple.Compiler

compilerCompatFlavor :: CompilerFlavor -> Compiler -> Bool Source #

Is this compiler compatible with the compiler flavour we're interested in?

For example this checks if the compiler is actually GHC or is another compiler that claims to be compatible with some version of GHC, e.g. GHCJS.

if compilerCompatFlavor GHC compiler then ... else ...

compilerCompatVersion :: CompilerFlavor -> Compiler -> Maybe Version Source #

Is this compiler compatible with the compiler flavour we're interested in, and if so what version does it claim to be compatible with.

For example this checks if the compiler is actually GHC-7.x or is another compiler that claims to be compatible with some GHC-7.x version.

case compilerCompatVersion GHC compiler of
  Just (Version (7:_)) -> ...
  _                    -> ...

registrationPackageDB :: PackageDBStack -> PackageDB Source #

Return the package that we should register into. This is the package db at the top of the stack.

unsupportedExtensions :: Compiler -> [Extension] -> [Extension] Source #

For the given compiler, return the extensions it does not support.

extensionsToFlags :: Compiler -> [Extension] -> [Flag] Source #

For the given compiler, return the flags for the supported extensions.

parmakeSupported :: Compiler -> Bool Source #

Does this compiler support parallel --make mode?

reexportedModulesSupported :: Compiler -> Bool Source #

Does this compiler support reexported-modules?

renamingPackageFlagsSupported :: Compiler -> Bool Source #

Does this compiler support thinning/renaming on package flags?

unifiedIPIDRequired :: Compiler -> Bool Source #

Does this compiler have unified IPIDs (so no package keys)

packageKeySupported :: Compiler -> Bool Source #

Does this compiler support package keys?

unitIdSupported :: Compiler -> Bool Source #

Does this compiler support unit IDs?

backpackSupported :: Compiler -> Bool Source #

Does this compiler support Backpack?

libraryDynDirSupported :: Compiler -> Bool Source #

Does this compiler support a package database entry with: "dynamic-library-dirs"?

arResponseFilesSupported :: Compiler -> Bool Source #

Does this compiler's "ar" command supports response file arguments (i.e. @file-style arguments).

coverageSupported :: Compiler -> Bool Source #

Does this compiler support Haskell program coverage?

profilingSupported :: Compiler -> Bool Source #

Does this compiler support profiling?

Simple interface

defaultMain :: IO () Source #

A simple implementation of main for a Cabal setup script. It reads the package description file using IO, and performs the action specified on the command line.

defaultMainNoRead :: GenericPackageDescription -> IO () Source #

Like defaultMain, but accepts the package description as input rather than using IO to read it.

defaultMainArgs :: [String] -> IO () Source #

A version of defaultMain that is passed the command line arguments, rather than getting them from the environment.

Customization

data UserHooks Source #

Hooks allow authors to add specific functionality before and after a command is run, and also to specify additional preprocessors.

  • WARNING: The hooks interface is under rather constant flux as we try to understand users needs. Setup files that depend on this interface may break in future releases.

Constructors

UserHooks 

Fields

type Args = [String] Source #

defaultMainWithHooks :: UserHooks -> IO () Source #

A customizable version of defaultMain.

defaultMainWithHooksArgs :: UserHooks -> [String] -> IO () Source #

A customizable version of defaultMain that also takes the command line arguments.

defaultMainWithHooksNoReadArgs :: UserHooks -> GenericPackageDescription -> [String] -> IO () Source #

A customizable version of defaultMainNoRead that also takes the command line arguments.

Since: Cabal-2.2.0.0

Standard sets of hooks

simpleUserHooks :: UserHooks Source #

Hooks that correspond to a plain instantiation of the "simple" build system

defaultUserHooks :: UserHooks Source #

Deprecated: Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2 compatibility in which case you must stick with defaultUserHooks

Basic autoconf UserHooks:

Thus configure can use local system information to generate package.buildinfo and possibly other files.

emptyUserHooks :: UserHooks Source #

Empty UserHooks which do nothing.

Utils

defaultHookedPackageDesc :: IO (Maybe FilePath) Source #

Deprecated: Use findHookedPackageDesc with the proper base directory instead

Optional auxiliary package information file (pkgname.buildinfo)