-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A framework for packaging Haskell software -- -- The Haskell Common Architecture for Building Applications and -- Libraries: a framework defining a common interface for authors to more -- easily build their Haskell applications in a portable way. -- -- The Haskell Cabal is part of a larger infrastructure for distributing, -- organizing, and cataloging Haskell libraries and tools. @package Cabal @version 1.6.0.1 -- | This is a library of parser combinators, originally written by Koen -- Claessen. It parses all alternatives in parallel, so it never keeps -- hold of the beginning of the input string, a common source of space -- leaks with other parsers. The '(+++)' choice combinator is genuinely -- commutative; it makes no difference which branch is "shorter". -- -- See also Koen's paper Parallel Parsing Processes -- (http://www.cs.chalmers.se/~koen/publications.html). -- -- This version of ReadP has been locally hacked to make it H98, by -- Martin Sjögren mailto:msjogren@gmail.com module Distribution.Compat.ReadP type ReadP r a = Parser r Char a -- | Consumes and returns the next character. Fails if there is no input -- left. get :: ReadP r Char -- | Look-ahead: returns the part of the input that is left, without -- consuming it. look :: ReadP r String -- | Symmetric choice. (+++) :: ReadP r a -> ReadP r a -> ReadP r a -- | Local, exclusive, left-biased choice: If left parser locally produces -- any result at all, then right parser is not used. (<++) :: ReadP a a -> ReadP r a -> ReadP r a -- | Transforms a parser into one that does the same, but in addition -- returns the exact characters read. IMPORTANT NOTE: gather gives -- a runtime error if its first argument is built using any occurrences -- of readS_to_P. gather :: ReadP (String -> P Char r) a -> ReadP r (String, a) -- | Always fails. pfail :: ReadP r a -- | Consumes and returns the next character, if it satisfies the specified -- predicate. satisfy :: (Char -> Bool) -> ReadP r Char -- | Parses and returns the specified character. char :: Char -> ReadP r Char -- | Parses and returns the specified string. string :: String -> ReadP r String -- | Parses the first zero or more characters satisfying the predicate. munch :: (Char -> Bool) -> ReadP r String -- | Parses the first one or more characters satisfying the predicate. munch1 :: (Char -> Bool) -> ReadP r String -- | Skips all whitespace. skipSpaces :: ReadP r () -- | Combines all parsers in the specified list. choice :: [ReadP r a] -> ReadP r a -- | count n p parses n occurrences of p in -- sequence. A list of results is returned. count :: Int -> ReadP r a -> ReadP r [a] -- | between open close p parses open, followed by -- p and finally close. Only the value of p is -- returned. between :: ReadP r open -> ReadP r close -> ReadP r a -> ReadP r a -- | option x p will either parse p or return x -- without consuming any input. option :: a -> ReadP r a -> ReadP r a -- | optional p optionally parses p and always returns -- (). optional :: ReadP r a -> ReadP r () -- | Parses zero or more occurrences of the given parser. many :: ReadP r a -> ReadP r [a] -- | Parses one or more occurrences of the given parser. many1 :: ReadP r a -> ReadP r [a] -- | Like many, but discards the result. skipMany :: ReadP r a -> ReadP r () -- | Like many1, but discards the result. skipMany1 :: ReadP r a -> ReadP r () -- | sepBy p sep parses zero or more occurrences of p, -- separated by sep. Returns a list of values returned by -- p. sepBy :: ReadP r a -> ReadP r sep -> ReadP r [a] -- | sepBy1 p sep parses one or more occurrences of p, -- separated by sep. Returns a list of values returned by -- p. sepBy1 :: ReadP r a -> ReadP r sep -> ReadP r [a] -- | endBy p sep parses zero or more occurrences of p, -- separated and ended by sep. endBy :: ReadP r a -> ReadP r sep -> ReadP r [a] -- | endBy p sep parses one or more occurrences of p, -- separated and ended by sep. endBy1 :: ReadP r a -> ReadP r sep -> ReadP r [a] -- | chainr p op x parses zero or more occurrences of p, -- separated by op. Returns a value produced by a right -- associative application of all functions returned by op. If -- there are no occurrences of p, x is returned. chainr :: ReadP r a -> ReadP r (a -> a -> a) -> a -> ReadP r a -- | chainl p op x parses zero or more occurrences of p, -- separated by op. Returns a value produced by a left -- associative application of all functions returned by op. If -- there are no occurrences of p, x is returned. chainl :: ReadP r a -> ReadP r (a -> a -> a) -> a -> ReadP r a -- | Like chainl, but parses one or more occurrences of p. chainl1 :: ReadP r a -> ReadP r (a -> a -> a) -> ReadP r a -- | Like chainr, but parses one or more occurrences of p. chainr1 :: ReadP r a -> ReadP r (a -> a -> a) -> ReadP r a -- | manyTill p end parses zero or more occurrences of p, -- until end succeeds. Returns a list of values returned by -- p. manyTill :: ReadP r a -> ReadP [a] end -> ReadP r [a] -- | Converts a parser into a Haskell ReadS-style function. This is the -- main way in which you can "run" a ReadP parser: the expanded -- type is readP_to_S :: ReadP a -> String -> [(a,String)] -- readP_to_S :: ReadP a a -> ReadS a -- | Converts a Haskell ReadS-style function into a parser. Warning: This -- introduces local backtracking in the resulting parser, and therefore a -- possible inefficiency. readS_to_P :: ReadS a -> ReadP r a instance Monad (Parser r s) instance Functor (Parser r s) instance MonadPlus (P s) instance Monad (P s) -- | This defines a Text class which is a bit like the Read -- and Show classes. The difference is that is uses a modern -- pretty printer and parser system and the format is not expected to be -- Haskell concrete syntax but rather the external human readable -- representation used by Cabal. module Distribution.Text class Text a disp :: (Text a) => a -> Doc parse :: (Text a) => ReadP r a display :: (Text a) => a -> String simpleParse :: (Text a) => String -> Maybe a instance Text Version instance Text Bool -- | Exports the Version type along with a parser and pretty -- printer. A version is something like "1.3.3". It also defines -- the VersionRange data types. Version ranges are like ">= -- 1.2 && < 2". module Distribution.Version data VersionRange AnyVersion :: VersionRange ThisVersion :: Version -> VersionRange LaterVersion :: Version -> VersionRange EarlierVersion :: Version -> VersionRange UnionVersionRanges :: VersionRange -> VersionRange -> VersionRange IntersectVersionRanges :: VersionRange -> VersionRange -> VersionRange notThisVersion :: Version -> VersionRange orLaterVersion :: Version -> VersionRange orEarlierVersion :: Version -> VersionRange betweenVersionsInclusive :: Version -> Version -> VersionRange -- | Does this version fall within the given range? withinRange :: Version -> VersionRange -> Bool isAnyVersion :: VersionRange -> Bool instance Show VersionRange instance Read VersionRange instance Eq VersionRange instance Text VersionWildcard instance Text VersionRange -- | Haskell language extensions module Language.Haskell.Extension -- | This represents language extensions beyond Haskell 98 that are -- supported by some implementations, usually in some special mode. data Extension OverlappingInstances :: Extension UndecidableInstances :: Extension IncoherentInstances :: Extension RecursiveDo :: Extension ParallelListComp :: Extension MultiParamTypeClasses :: Extension NoMonomorphismRestriction :: Extension FunctionalDependencies :: Extension Rank2Types :: Extension RankNTypes :: Extension PolymorphicComponents :: Extension ExistentialQuantification :: Extension ScopedTypeVariables :: Extension ImplicitParams :: Extension FlexibleContexts :: Extension FlexibleInstances :: Extension EmptyDataDecls :: Extension CPP :: Extension KindSignatures :: Extension BangPatterns :: Extension TypeSynonymInstances :: Extension TemplateHaskell :: Extension ForeignFunctionInterface :: Extension Arrows :: Extension Generics :: Extension NoImplicitPrelude :: Extension NamedFieldPuns :: Extension PatternGuards :: Extension GeneralizedNewtypeDeriving :: Extension ExtensibleRecords :: Extension RestrictedTypeSynonyms :: Extension HereDocuments :: Extension MagicHash :: Extension TypeFamilies :: Extension StandaloneDeriving :: Extension UnicodeSyntax :: Extension PatternSignatures :: Extension UnliftedFFITypes :: Extension LiberalTypeSynonyms :: Extension TypeOperators :: Extension RecordWildCards :: Extension RecordPuns :: Extension DisambiguateRecordFields :: Extension OverloadedStrings :: Extension GADTs :: Extension NoMonoPatBinds :: Extension RelaxedPolyRec :: Extension ExtendedDefaultRules :: Extension UnboxedTuples :: Extension DeriveDataTypeable :: Extension ConstrainedClassMethods :: Extension -- | Allow imports to be qualified by the package name that the module is -- intended to be imported from, e.g. -- --
-- import "network" Network.Socket --PackageImports :: Extension UnknownExtension :: String -> Extension knownExtensions :: [Extension] instance Show Extension instance Read Extension instance Eq Extension instance Text Extension -- | Cabal often needs to do slightly different things on specific -- platforms. You probably know about the os however using that is -- very inconvenient because it is a string and different Haskell -- implementations do not agree on using the same strings for the same -- platforms! (In particular see the controversy over windows vs -- ming32). So to make it more consistent and easy to use we have -- an OS enumeration. module Distribution.System data OS Linux :: OS Windows :: OS OSX :: OS FreeBSD :: OS OpenBSD :: OS NetBSD :: OS Solaris :: OS AIX :: OS HPUX :: OS IRIX :: OS OtherOS :: String -> OS buildOS :: OS data Arch I386 :: Arch X86_64 :: Arch PPC :: Arch PPC64 :: Arch Sparc :: Arch Arm :: Arch Mips :: Arch SH :: Arch IA64 :: Arch S390 :: Arch Alpha :: Arch Hppa :: Arch Rs6000 :: Arch M68k :: Arch Vax :: Arch OtherArch :: String -> Arch buildArch :: Arch data Platform Platform :: Arch -> OS -> Platform buildPlatform :: Platform instance Eq Platform instance Ord Platform instance Show Platform instance Read Platform instance Eq Arch instance Ord Arch instance Show Arch instance Read Arch instance Eq OS instance Ord OS instance Show OS instance Read OS instance Text Platform instance Text Arch instance Text OS -- | Remove the "literal" markups from a Haskell source file, including -- ">", "\begin{code}", "\end{code}", and -- "#" module Distribution.Simple.PreProcess.Unlit -- | unlit takes a filename (for error reports), and transforms the -- given string, to eliminate the literate comments from the program -- text. unlit :: FilePath -> String -> Either String String -- | No unliteration. plain :: String -> String -> String -- | Simple parsing with failure module Distribution.ReadE -- | Parser with simple error reporting newtype ReadE a ReadE :: (String -> Either ErrorMsg a) -> ReadE a runReadE :: ReadE a -> String -> Either ErrorMsg a succeedReadE :: (String -> a) -> ReadE a failReadE :: ErrorMsg -> ReadE a parseReadE :: ReadE a -> ReadP r a readEOrFail :: ReadE a -> (String -> a) readP_to_E :: (String -> ErrorMsg) -> ReadP a a -> ReadE a instance Functor ReadE -- | A simple Verbosity type with associated utilities. There are 4 -- standard verbosity levels from silent, normal, -- verbose up to deafening. This is used for deciding what -- logging messages to print. module Distribution.Verbosity data Verbosity silent :: Verbosity normal :: Verbosity verbose :: Verbosity deafening :: Verbosity moreVerbose :: Verbosity -> Verbosity lessVerbose :: Verbosity -> Verbosity intToVerbosity :: Int -> Maybe Verbosity flagToVerbosity :: ReadE Verbosity showForCabal :: Verbosity -> String showForGHC :: Verbosity -> String instance Show Verbosity instance Eq Verbosity instance Ord Verbosity instance Enum Verbosity instance Bounded Verbosity -- | Defines a package identifier along with a parser and pretty printer -- for it. PackageIdentifiers consist of a name and an exact -- version. It also defines a Dependency data type. A dependency -- is a package name and a version range, like "foo >= 1.2 -- && < 2". module Distribution.Package newtype PackageName PackageName :: String -> PackageName -- | The name and version of a package. data PackageIdentifier PackageIdentifier :: PackageName -> Version -> PackageIdentifier -- | The name of this package, eg. foo pkgName :: PackageIdentifier -> PackageName -- | the version of this package, eg 1.2 pkgVersion :: PackageIdentifier -> Version -- | Type alias so we can use the shorter name PackageId. type PackageId = PackageIdentifier data Dependency Dependency :: PackageName -> VersionRange -> Dependency thisPackageVersion :: PackageIdentifier -> Dependency notThisPackageVersion :: PackageIdentifier -> Dependency -- | Class of things that can be identified by a PackageIdentifier -- -- Types in this class are all notions of a package. This allows us to -- have different types for the different phases that packages go though, -- from simple name/id, package description, configured or installed -- packages. class Package pkg packageId :: (Package pkg) => pkg -> PackageIdentifier packageName :: (Package pkg) => pkg -> PackageName packageVersion :: (Package pkg) => pkg -> Version -- | Subclass of packages that have specific versioned dependencies. -- -- So for example a not-yet-configured package has dependencies on -- version ranges, not specific versions. A configured or an already -- installed package depends on exact versions. Some operations or data -- structures (like dependency graphs) only make sense on this subclass -- of package types. class (Package pkg) => PackageFixedDeps pkg depends :: (PackageFixedDeps pkg) => pkg -> [PackageIdentifier] instance Read Dependency instance Show Dependency instance Eq Dependency instance Read PackageIdentifier instance Show PackageIdentifier instance Eq PackageIdentifier instance Ord PackageIdentifier instance Read PackageName instance Show PackageName instance Eq PackageName instance Ord PackageName instance Package PackageIdentifier instance Text Dependency instance Text PackageIdentifier instance Text PackageName -- | Data type for Haskell module names. module Distribution.ModuleName data ModuleName simple :: String -> ModuleName components :: ModuleName -> [String] toFilePath :: ModuleName -> FilePath main :: ModuleName instance Eq ModuleName instance Ord ModuleName instance Read ModuleName instance Show ModuleName instance Text ModuleName -- | A large and somewhat miscellaneous collection of utility functions -- used throughout the rest of the Cabal lib and in other tools that use -- the Cabal lib like cabal-install. It has a very simple set of -- logging actions. It has low level functions for running programs, a -- bunch of wrappers for various directory and file functions that do -- extra logging. module Distribution.Simple.Utils cabalVersion :: Version cabalBootstrapping :: Bool die :: String -> IO a dieWithLocation :: FilePath -> Maybe Int -> String -> IO a -- | Non fatal conditions that may be indicative of an error or problem. -- -- We display these at the normal verbosity level. warn :: Verbosity -> String -> IO () -- | Useful status messages. -- -- We display these at the normal verbosity level. -- -- This is for the ordinary helpful status messages that users see. Just -- enough information to know that things are working but not floods of -- detail. notice :: Verbosity -> String -> IO () setupMessage :: Verbosity -> String -> PackageIdentifier -> IO () -- | More detail on the operation of some action. -- -- We display these messages when the verbosity level is verbose info :: Verbosity -> String -> IO () -- | Detailed internal debugging information -- -- We display these messages when the verbosity level is deafening debug :: Verbosity -> String -> IO () -- | Perform an IO action, catching any IO exceptions and printing an error -- if one occurs. chattyTry :: String -> IO () -> IO () rawSystemExit :: Verbosity -> FilePath -> [String] -> IO () -- | Run a command and return its output. -- -- The output is assumed to be encoded as UTF8. rawSystemStdout :: Verbosity -> FilePath -> [String] -> IO String rawSystemStdout' :: Verbosity -> FilePath -> [String] -> IO (String, ExitCode) maybeExit :: IO ExitCode -> IO () -- | Like the unix xargs program. Useful for when we've got very long -- command lines that might overflow an OS limit on command line length -- and so you need to invoke a command multiple times to get all the args -- in. -- -- Use it with either of the rawSystem variants above. For example: -- --
-- xargs (32*1024) (rawSystemExit verbosity) prog fixedArgs bigArgs --xargs :: Int -> ([String] -> IO ()) -> [String] -> [String] -> IO () -- | Copy the source files into the right directory. Looks in the build -- prefix for files that look like the input modules, based on the input -- search suffixes. It copies the files into the target directory. smartCopySources :: Verbosity -> [FilePath] -> FilePath -> [ModuleName] -> [String] -> IO () createDirectoryIfMissingVerbose :: Verbosity -> Bool -> FilePath -> IO () copyFileVerbose :: Verbosity -> FilePath -> FilePath -> IO () copyDirectoryRecursiveVerbose :: Verbosity -> FilePath -> FilePath -> IO () -- | Copies a bunch of files to a target directory, preserving the -- directory structure in the target location. The target directories are -- created if they do not exist. -- -- The files are identified by a pair of base directory and a path -- relative to that base. It is only the relative part that is preserved -- in the destination. -- -- For example: -- --
-- copyFiles normal "dist/src"
-- [("", "src/Foo.hs"), ("dist/build/", "src/Bar.hs")]
--
--
-- This would copy "src/Foo.hs" to "dist/src/src/Foo.hs" and copy
-- "dist/build/src/Bar.hs" to "dist/src/src/Bar.hs".
--
-- This operation is not atomic. Any IO failure during the copy
-- (including any missing source files) leaves the target in an unknown
-- state so it is best to use it with a freshly created directory so that
-- it can be simply deleted if anything goes wrong.
copyFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)] -> IO ()
-- | The path name that represents the current directory. In Unix, it's
-- ".", but this is system-specific. (E.g. AmigaOS uses the
-- empty string "" for the current directory.)
currentDir :: FilePath
findFile :: [FilePath] -> FilePath -> IO FilePath
findFileWithExtension :: [String] -> [FilePath] -> FilePath -> IO (Maybe FilePath)
findFileWithExtension' :: [String] -> [FilePath] -> FilePath -> IO (Maybe (FilePath, FilePath))
matchFileGlob :: FilePath -> IO [FilePath]
matchDirFileGlob :: FilePath -> FilePath -> IO [FilePath]
-- | Use a temporary filename that doesn't already exist.
withTempFile :: FilePath -> String -> (FilePath -> Handle -> IO a) -> IO a
-- | Use a temporary directory.
--
-- Use this exact given dir which must not already exist.
withTempDirectory :: Verbosity -> FilePath -> IO a -> IO a
-- | Package description file (pkgname.cabal)
defaultPackageDesc :: Verbosity -> IO FilePath
-- | Find a package description file in the given directory. Looks for
-- .cabal files.
findPackageDesc :: FilePath -> IO FilePath
-- | Optional auxiliary package information file
-- (pkgname.buildinfo)
defaultHookedPackageDesc :: IO (Maybe FilePath)
-- | Find auxiliary package information in the given directory. Looks for
-- .buildinfo files.
findHookedPackageDesc :: FilePath -> IO (Maybe FilePath)
-- | Gets the contents of a file, but guarantee that it gets closed.
--
-- The file is read lazily but if it is not fully consumed by the action
-- then the remaining input is truncated and the file is closed.
withFileContents :: FilePath -> (String -> IO a) -> IO a
-- | Writes a file atomically.
--
-- The file is either written sucessfully or an IO exception is raised
-- and the original file is left unchanged.
--
--
-- simpleProgram "foo" { programFindLocation = ... , programFindVersion ... }
--
simpleProgram :: String -> Program
-- | Look for a program on the path.
findProgramOnPath :: FilePath -> Verbosity -> IO (Maybe FilePath)
-- | Look for a program and try to find it's version number. It can accept
-- either an absolute path or the name of a program binary, in which case
-- we will look for the program on the path.
findProgramVersion :: ProgArg -> (String -> String) -> Verbosity -> FilePath -> IO (Maybe Version)
data ConfiguredProgram
ConfiguredProgram :: String -> Maybe Version -> [ProgArg] -> ProgramLocation -> ConfiguredProgram
-- | Just the name again
programId :: ConfiguredProgram -> String
-- | The version of this program, if it is known.
programVersion :: ConfiguredProgram -> Maybe Version
-- | Default command-line args for this program. These flags will appear
-- first on the command line, so they can be overridden by subsequent
-- flags.
programArgs :: ConfiguredProgram -> [ProgArg]
-- | Location of the program. eg. /usr/bin/ghc-6.4
programLocation :: ConfiguredProgram -> ProgramLocation
-- | The full path of a configured program.
programPath :: ConfiguredProgram -> FilePath
type ProgArg = String
-- | Where a program was found. Also tells us whether it's specifed by user
-- or not. This includes not just the path, but the program as well.
data ProgramLocation
-- | The user gave the path to this program, eg.
-- --ghc-path=/usr/bin/ghc-6.6
UserSpecified :: FilePath -> ProgramLocation
locationPath :: ProgramLocation -> FilePath
-- | The location of the program, as located by searching PATH.
FoundOnSystem :: FilePath -> ProgramLocation
locationPath :: ProgramLocation -> FilePath
-- | Runs the given configured program.
rawSystemProgram :: Verbosity -> ConfiguredProgram -> [ProgArg] -> IO ()
-- | Runs the given configured program and gets the output.
rawSystemProgramStdout :: Verbosity -> ConfiguredProgram -> [ProgArg] -> IO String
-- | The default list of programs. These programs are typically used
-- internally to Cabal.
builtinPrograms :: [Program]
-- | The configuration is a collection of information about programs. It
-- contains information both about configured programs and also about
-- programs that we are yet to configure.
--
-- The idea is that we start from a collection of unconfigured programs
-- and one by one we try to configure them at which point we move them
-- into the configured collection. For unconfigured programs we record
-- not just the Program but also any user-provided arguments and
-- location for the program.
data ProgramConfiguration
emptyProgramConfiguration :: ProgramConfiguration
defaultProgramConfiguration :: ProgramConfiguration
-- | The Read/Show instance does not preserve all the unconfigured Programs
-- because Program is not in Read/Show because it contains
-- functions. So to fully restore a deserialised
-- ProgramConfiguration use this function to add back all the
-- known Programs.
--
-- -- case compilerFlavor comp of -- GHC -> GHC.getInstalledPackages verbosity packageDb progconf -- JHC -> JHC.getInstalledPackages verbosity packageDb progconf ---- -- Obviously it would be better to use the proper Compiler abstraction -- because that would keep all the compiler-specific code together. -- Unfortunately we cannot make this change yet without breaking the -- UserHooks api, which would break all custom Setup.hs files, -- so for the moment we just have to live with this deficiency. If you're -- interested, see ticket #50. module Distribution.Compiler data CompilerFlavor GHC :: CompilerFlavor NHC :: CompilerFlavor YHC :: CompilerFlavor Hugs :: CompilerFlavor HBC :: CompilerFlavor Helium :: CompilerFlavor JHC :: CompilerFlavor OtherCompiler :: String -> CompilerFlavor buildCompilerFlavor :: CompilerFlavor -- | 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. defaultCompilerFlavor :: Maybe CompilerFlavor -- | 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. parseCompilerFlavorCompat :: ReadP r CompilerFlavor data CompilerId CompilerId :: CompilerFlavor -> Version -> CompilerId instance Eq CompilerId instance Ord CompilerId instance Read CompilerId instance Show CompilerId instance Show CompilerFlavor instance Read CompilerFlavor instance Eq CompilerFlavor instance Ord CompilerFlavor instance Text CompilerId instance Text CompilerFlavor -- | This defines the data structure for the .cabal file format. -- There are several parts to this structure. It has top level info and -- then Library and Executable sections each of which have -- associated BuildInfo data that's used to build the library or -- exe. To further complicate things there is both a -- PackageDescription and a GenericPackageDescription. This -- distinction relates to cabal configurations. When we initially read a -- .cabal file we get a GenericPackageDescription which -- has all the conditional sections. Before actually building a package -- we have to decide on each conditional. Once we've done that we get a -- PackageDescription. It was done this way initially to avoid -- breaking too much stuff when the feature was introduced. It could -- probably do with being rationalised at some point to make it simpler. module Distribution.PackageDescription -- | This data type is the internal representation of the file -- pkg.cabal. It contains two kinds of information about the -- package: information which is needed for all packages, such as the -- package name and version, and information which is needed for the -- simple build system only, such as the compiler options and library -- name. data PackageDescription PackageDescription :: PackageIdentifier -> License -> FilePath -> String -> String -> String -> String -> [(CompilerFlavor, VersionRange)] -> String -> String -> String -> [SourceRepo] -> String -> String -> String -> [(String, String)] -> [Dependency] -> VersionRange -> Maybe BuildType -> Maybe Library -> [Executable] -> [FilePath] -> FilePath -> [FilePath] -> [FilePath] -> PackageDescription package :: PackageDescription -> PackageIdentifier license :: PackageDescription -> License licenseFile :: PackageDescription -> FilePath copyright :: PackageDescription -> String maintainer :: PackageDescription -> String author :: PackageDescription -> String stability :: PackageDescription -> String testedWith :: PackageDescription -> [(CompilerFlavor, VersionRange)] homepage :: PackageDescription -> String pkgUrl :: PackageDescription -> String bugReports :: PackageDescription -> String sourceRepos :: PackageDescription -> [SourceRepo] -- | A one-line summary of this package synopsis :: PackageDescription -> String -- | A more verbose description of this package description :: PackageDescription -> String category :: PackageDescription -> String -- | Custom fields starting with x-, stored in a simple assoc-list. customFieldsPD :: PackageDescription -> [(String, String)] buildDepends :: PackageDescription -> [Dependency] -- | If this package depends on a specific version of Cabal, give that -- here. descCabalVersion :: PackageDescription -> VersionRange buildType :: PackageDescription -> Maybe BuildType library :: PackageDescription -> Maybe Library executables :: PackageDescription -> [Executable] dataFiles :: PackageDescription -> [FilePath] dataDir :: PackageDescription -> FilePath extraSrcFiles :: PackageDescription -> [FilePath] extraTmpFiles :: PackageDescription -> [FilePath] emptyPackageDescription :: PackageDescription -- | The type of build system used by this package. data BuildType -- | calls Distribution.Simple.defaultMain Simple :: BuildType -- | calls Distribution.Simple.defaultMainWithHooks -- defaultUserHooks, which invokes configure to generate -- additional build information used by later phases. Configure :: BuildType -- | calls Distribution.Make.defaultMain Make :: BuildType -- | uses user-supplied Setup.hs or Setup.lhs (default) Custom :: BuildType -- | a package that uses an unknown build type cannot actually be built. -- Doing it this way rather than just giving a parse error means we get -- better error messages and allows you to inspect the rest of the -- package description. UnknownBuildType :: String -> BuildType knownBuildTypes :: [BuildType] data Library Library :: [ModuleName] -> Bool -> BuildInfo -> Library exposedModules :: Library -> [ModuleName] -- | Is the lib to be exposed by default? libExposed :: Library -> Bool libBuildInfo :: Library -> BuildInfo emptyLibrary :: Library -- | If the package description has a library section, call the given -- function with the library build info as argument. withLib :: PackageDescription -> a -> (Library -> IO a) -> IO a -- | does this package have any libraries? hasLibs :: PackageDescription -> Bool -- | Get all the module names from the libraries in this package libModules :: PackageDescription -> [ModuleName] data Executable Executable :: String -> FilePath -> BuildInfo -> Executable exeName :: Executable -> String modulePath :: Executable -> FilePath buildInfo :: Executable -> BuildInfo emptyExecutable :: Executable -- | Perform the action on each buildable Executable in the package -- description. withExe :: PackageDescription -> (Executable -> IO a) -> IO () -- | does this package have any executables? hasExes :: PackageDescription -> Bool -- | Get all the module names from the exes in this package exeModules :: PackageDescription -> [ModuleName] data BuildInfo BuildInfo :: Bool -> [Dependency] -> [String] -> [String] -> [String] -> [Dependency] -> [String] -> [FilePath] -> [FilePath] -> [ModuleName] -> [Extension] -> [String] -> [String] -> [FilePath] -> [FilePath] -> [FilePath] -> [(CompilerFlavor, [String])] -> [String] -> [String] -> [(String, String)] -> BuildInfo -- | component is buildable here buildable :: BuildInfo -> Bool -- | tools needed to build this bit buildTools :: BuildInfo -> [Dependency] -- | options for pre-processing Haskell code cppOptions :: BuildInfo -> [String] -- | options for C compiler ccOptions :: BuildInfo -> [String] -- | options for linker ldOptions :: BuildInfo -> [String] -- | pkg-config packages that are used pkgconfigDepends :: BuildInfo -> [Dependency] -- | support frameworks for Mac OS X frameworks :: BuildInfo -> [String] cSources :: BuildInfo -> [FilePath] -- | where to look for the haskell module hierarchy hsSourceDirs :: BuildInfo -> [FilePath] -- | non-exposed or non-main modules otherModules :: BuildInfo -> [ModuleName] extensions :: BuildInfo -> [Extension] -- | what libraries to link with when compiling a program that uses your -- package extraLibs :: BuildInfo -> [String] extraLibDirs :: BuildInfo -> [String] -- | directories to find .h files includeDirs :: BuildInfo -> [FilePath] -- | The .h files to be found in includeDirs includes :: BuildInfo -> [FilePath] -- | .h files to install with the package installIncludes :: BuildInfo -> [FilePath] options :: BuildInfo -> [(CompilerFlavor, [String])] ghcProfOptions :: BuildInfo -> [String] ghcSharedOptions :: BuildInfo -> [String] -- | Custom fields starting with x-, stored in a simple assoc-list. customFieldsBI :: BuildInfo -> [(String, String)] emptyBuildInfo :: BuildInfo -- | The BuildInfo for the library (if there is one and it's -- buildable) and all the buildable executables. Useful for gathering -- dependencies. allBuildInfo :: PackageDescription -> [BuildInfo] -- | Select options for a particular Haskell compiler. hcOptions :: CompilerFlavor -> BuildInfo -> [String] type HookedBuildInfo = (Maybe BuildInfo, [(String, BuildInfo)]) emptyHookedBuildInfo :: HookedBuildInfo updatePackageDescription :: HookedBuildInfo -> PackageDescription -> PackageDescription data GenericPackageDescription GenericPackageDescription :: PackageDescription -> [Flag] -> Maybe (CondTree ConfVar [Dependency] Library) -> [(String, CondTree ConfVar [Dependency] Executable)] -> GenericPackageDescription packageDescription :: GenericPackageDescription -> PackageDescription genPackageFlags :: GenericPackageDescription -> [Flag] condLibrary :: GenericPackageDescription -> Maybe (CondTree ConfVar [Dependency] Library) condExecutables :: GenericPackageDescription -> [(String, CondTree ConfVar [Dependency] Executable)] -- | A flag can represent a feature to be included, or a way of linking a -- target against its dependencies, or in fact whatever you can think of. data Flag MkFlag :: FlagName -> String -> Bool -> Bool -> Flag flagName :: Flag -> FlagName flagDescription :: Flag -> String flagDefault :: Flag -> Bool flagManual :: Flag -> Bool -- | A FlagName is the name of a user-defined configuration flag newtype FlagName FlagName :: String -> FlagName -- | A FlagAssignment is a total or partial mapping of -- FlagNames to Bool flag values. It represents the flags -- chosen by the user or discovered during configuration. For example -- --flags=foo --flags=-bar becomes [(foo, True), -- (bar, False)] type FlagAssignment = [(FlagName, Bool)] data CondTree v c a CondNode :: a -> c -> [(Condition v, CondTree v c a, Maybe (CondTree v c a))] -> CondTree v c a condTreeData :: CondTree v c a -> a condTreeConstraints :: CondTree v c a -> c condTreeComponents :: CondTree v c a -> [(Condition v, CondTree v c a, Maybe (CondTree v c a))] -- | A ConfVar represents the variable type used. data ConfVar OS :: OS -> ConfVar Arch :: Arch -> ConfVar Flag :: FlagName -> ConfVar Impl :: CompilerFlavor -> VersionRange -> ConfVar -- | A boolean expression parameterized over the variable type used. data Condition c Var :: c -> Condition c Lit :: Bool -> Condition c CNot :: (Condition c) -> Condition c COr :: (Condition c) -> (Condition c) -> Condition c CAnd :: (Condition c) -> (Condition c) -> Condition c -- | Information about the source revision control system for a package. -- -- When specifying a repo it is useful to know the meaning or intention -- of the information as doing so enables automation. There are two -- obvious common purposes: one is to find the repo for the latest -- development version, the other is to find the repo for this specific -- release. The ReopKind specifies which one we mean (or another custom -- one). -- -- A package can specify one or the other kind or both. Most will specify -- just a head repo but some may want to specify a repo to reconstruct -- the sources for this package release. -- -- The required information is the RepoType which tells us if it's -- using Darcs, Git for example. The repoLocation -- and other details are interpreted according to the repo type. data SourceRepo SourceRepo :: RepoKind -> Maybe RepoType -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe FilePath -> SourceRepo -- | The kind of repo. This field is required. repoKind :: SourceRepo -> RepoKind -- | The type of the source repository system for this repo, eg -- Darcs or Git. This field is required. repoType :: SourceRepo -> Maybe RepoType -- | The location of the repository. For most RepoTypes this is a -- URL. This field is required. repoLocation :: SourceRepo -> Maybe String -- | CVS can put multiple "modules" on one server and requires a -- module name in addition to the location to identify a particular repo. -- Logically this is part of the location but unfortunately has to be -- specified separately. This field is required for the CVS -- RepoType and should not be given otherwise. repoModule :: SourceRepo -> Maybe String -- | The name or identifier of the branch, if any. Many source control -- systems have the notion of multiple branches in a repo that exist in -- the same location. For example Git and CVS use this -- while systems like Darcs use different locations for different -- branches. This field is optional but should be used if necessary to -- identify the sources, especially for the RepoThis repo kind. repoBranch :: SourceRepo -> Maybe String -- | The tag identify a particular state of the repository. This should be -- given for the RepoThis repo kind and not for RepoHead -- kind. repoTag :: SourceRepo -> Maybe String -- | Some repositories contain multiple projects in different -- subdirectories This field specifies the subdirectory where this -- packages sources can be found, eg the subdirectory containing the -- .cabal file. It is interpreted relative to the root of the -- repository. This field is optional. If not given the default is "." ie -- no subdirectory. repoSubdir :: SourceRepo -> Maybe FilePath -- | What this repo info is for, what it represents. data RepoKind -- | The repository for the "head" or development version of the project. -- This repo is where we should track the latest development activity or -- the usual repo people should get to contribute patches. RepoHead :: RepoKind -- | The repository containing the sources for this exact package version -- or release. For this kind of repo a tag should be given to give enough -- information to re-create the exact sources. RepoThis :: RepoKind RepoKindUnknown :: String -> RepoKind -- | An enumeration of common source control systems. The fields used in -- the SourceRepo depend on the type of repo. The tools and -- methods used to obtain and track the repo depend on the repo type. data RepoType Darcs :: RepoType Git :: RepoType SVN :: RepoType CVS :: RepoType Mercurial :: RepoType GnuArch :: RepoType Bazaar :: RepoType Monotone :: RepoType OtherRepoType :: String -> RepoType instance (Show v, Show c, Show a) => Show (CondTree v c a) instance (Eq v, Eq c, Eq a) => Eq (CondTree v c a) instance (Show c) => Show (Condition c) instance (Eq c) => Eq (Condition c) instance Eq ConfVar instance Show ConfVar instance Eq FlagName instance Ord FlagName instance Show FlagName instance Show Flag instance Eq Flag instance Show GenericPackageDescription instance Eq GenericPackageDescription instance Eq RepoType instance Ord RepoType instance Read RepoType instance Show RepoType instance Eq RepoKind instance Ord RepoKind instance Read RepoKind instance Show RepoKind instance Eq SourceRepo instance Read SourceRepo instance Show SourceRepo instance Show BuildInfo instance Read BuildInfo instance Eq BuildInfo instance Show Executable instance Read Executable instance Eq Executable instance Show Library instance Eq Library instance Read Library instance Show BuildType instance Read BuildType instance Eq BuildType instance Show PackageDescription instance Read PackageDescription instance Eq PackageDescription instance Package GenericPackageDescription instance Text RepoType instance Text RepoKind instance Monoid BuildInfo instance Monoid Executable instance Monoid Library instance Text BuildType instance Package PackageDescription -- | This is about the cabal configurations feature. It exports -- finalizePackageDescription and flattenPackageDescription -- which are functions for converting GenericPackageDescriptions -- down to PackageDescriptions. It has code for working with the -- tree of conditions and resolving or flattening conditions. module Distribution.PackageDescription.Configuration -- | Create a package description with all configurations resolved. -- -- This function takes a GenericPackageDescription and several -- environment parameters and tries to generate PackageDescription -- by finding a flag assignment that result in satisfiable dependencies. -- -- It takes as inputs a not necessarily complete specifications of flags -- assignments, an optional package index as well as platform parameters. -- If some flags are not assigned explicitly, this function will try to -- pick an assignment that causes this function to succeed. The package -- index is optional since on some platforms we cannot determine which -- packages have been installed before. When no package index is -- supplied, every dependency is assumed to be satisfiable, therefore all -- not explicitly assigned flags will get their default values. -- -- This function will fail if it cannot find a flag assignment that leads -- to satisfiable dependencies. (It will not try alternative assignments -- for explicitly specified flags.) In case of failure it will return a -- minimum number of dependencies that could not be satisfied. On -- success, it will return the package description and the full flag -- assignment chosen. finalizePackageDescription :: (Package pkg) => FlagAssignment -> Maybe (PackageIndex pkg) -> OS -> Arch -> CompilerId -> [Dependency] -> GenericPackageDescription -> Either [Dependency] (PackageDescription, FlagAssignment) -- | Flatten a generic package description by ignoring all conditions and -- just join the field descriptors into on package description. Note, -- however, that this may lead to inconsistent field values, since all -- values are joined into one field, which may not be possible in the -- original package description, due to the use of exclusive choices (if -- ... else ...). -- -- XXX: One particularly tricky case is defaulting. In the original -- package description, e.g., the source directory might either be the -- default or a certain, explicitly set path. Since defaults are filled -- in only after the package has been resolved and when no explicit value -- has been set, the default path will be missing from the package -- description returned by this function. flattenPackageDescription :: GenericPackageDescription -> PackageDescription -- | Parse a configuration condition from a string. parseCondition :: ReadP r (Condition ConfVar) freeVars :: CondTree ConfVar c a -> [FlagName] instance Show PDTagged instance Show DependencyMap instance Read DependencyMap instance Monoid PDTagged instance Monoid DependencyMap instance (Monoid d) => Monoid (DepTestRslt d) -- | This has code for checking for various problems in packages. There is -- one set of checks that just looks at a PackageDescription in -- isolation and another set of checks that also looks at files in the -- package. Some of the checks are basic sanity checks, others are -- portability standards that we'd like to encourage. There is a -- PackageCheck type that distinguishes the different kinds of -- check so we can see which ones are appropriate to report in different -- situations. This code gets uses when configuring a package when we -- consider only basic problems. The higher standard is uses when when -- preparing a source tarball and by hackage when uploading new packages. -- The reason for this is that we want to hold packages that are expected -- to be distributed to a higher standard than packages that are only -- ever expected to be used on the author's own environment. module Distribution.PackageDescription.Check -- | Results of some kind of failed package check. -- -- There are a range of severities, from merely dubious to totally -- insane. All of them come with a human readable explanation. In future -- we may augment them with more machine readable explanations, for -- example to help an IDE suggest automatic corrections. data PackageCheck -- | This package description is no good. There's no way it's going to -- build sensibly. This should give an error at configure time. PackageBuildImpossible :: String -> PackageCheck explanation :: PackageCheck -> String -- | A problem that is likely to affect building the package, or an issue -- that we'd like every package author to be aware of, even if the -- package is never distributed. PackageBuildWarning :: String -> PackageCheck explanation :: PackageCheck -> String -- | An issue that might not be a problem for the package author but might -- be annoying or determental when the package is distributed to users. -- We should encourage distributed packages to be free from these issues, -- but occasionally there are justifiable reasons so we cannot ban them -- entirely. PackageDistSuspicious :: String -> PackageCheck explanation :: PackageCheck -> String -- | An issue that is ok in the author's environment but is almost certain -- to be a portability problem for other environments. We can quite -- legitimately refuse to publicly distribute packages with these -- problems. PackageDistInexcusable :: String -> PackageCheck explanation :: PackageCheck -> String -- | Check for common mistakes and problems in package descriptions. -- -- This is the standard collection of checks covering all apsects except -- for checks that require looking at files within the package. For those -- see checkPackageFiles. -- -- It requires the GenericPackageDescription and optionally a -- particular configuration of that package. If you pass Nothing -- then we just check a version of the generic description using -- flattenPackageDescription. checkPackage :: GenericPackageDescription -> Maybe PackageDescription -> [PackageCheck] checkConfiguredPackage :: PackageDescription -> [PackageCheck] -- | Sanity check things that requires IO. It looks at the files in the -- package and expects to find the package unpacked in at the given -- filepath. checkPackageFiles :: PackageDescription -> FilePath -> IO [PackageCheck] -- | Sanity check things that requires looking at files in the package. -- This is a generalised version of checkPackageFiles that can -- work in any monad for which you can provide -- CheckPackageContentOps operations. -- -- The point of this extra generality is to allow doing checks in some -- virtual file system, for example a tarball in memory. checkPackageContent :: (Monad m) => CheckPackageContentOps m -> PackageDescription -> m [PackageCheck] -- | A record of operations needed to check the contents of packages. Used -- by checkPackageContent. data CheckPackageContentOps m CheckPackageContentOps :: (FilePath -> m Bool) -> (FilePath -> m Bool) -> CheckPackageContentOps m doesFileExist :: CheckPackageContentOps m -> FilePath -> m Bool doesDirectoryExist :: CheckPackageContentOps m -> FilePath -> m Bool -- | Check the names of all files in a package for portability problems. -- This should be done for example when creating or validating a package -- tarball. checkPackageFileNames :: [FilePath] -> [PackageCheck] instance Show PackageCheck -- | Utilities for parsing PackageDescription and InstalledPackageInfo. -- -- The .cabal file format is not trivial, especially with the -- introduction of configurations and the section syntax that goes with -- that. This module has a bunch of parsing functions that is used by the -- .cabal parser and a couple others. It has the parsing -- framework code and also little parsers for many of the formats we get -- in various .cabal file fields, like module names, comma -- separated lists etc. module Distribution.ParseUtils type LineNo = Int data PError AmbigousParse :: String -> LineNo -> PError NoParse :: String -> LineNo -> PError TabsError :: LineNo -> PError FromString :: String -> (Maybe LineNo) -> PError data PWarning PWarning :: String -> PWarning UTFWarning :: LineNo -> String -> PWarning locatedErrorMsg :: PError -> (Maybe LineNo, String) syntaxError :: LineNo -> String -> ParseResult a warning :: String -> ParseResult () runP :: LineNo -> String -> ReadP a a -> String -> ParseResult a runE :: LineNo -> String -> ReadE a -> String -> ParseResult a data ParseResult a ParseFailed :: PError -> ParseResult a ParseOk :: [PWarning] -> a -> ParseResult a catchParseError :: ParseResult a -> (PError -> ParseResult a) -> ParseResult a parseFail :: PError -> ParseResult a showPWarning :: FilePath -> PWarning -> String data Field -- | A regular property>: <value field F :: LineNo -> String -> String -> Field -- | A section with a name and possible parameter. The syntactic structure -- is: -- --
-- sectionname> <arg {
-- field*
-- }
--
Section :: LineNo -> String -> String -> [Field] -> Field
-- | A conditional block with an optional else branch:
--
--
-- if condition {
-- field*
-- } else {
-- field*
-- }
--
IfBlock :: LineNo -> String -> [Field] -> [Field] -> Field
fName :: Field -> String
lineNo :: Field -> LineNo
-- | Field descriptor. The parameter a parameterizes over where
-- the field's value is stored in.
data FieldDescr a
FieldDescr :: String -> (a -> Doc) -> (LineNo -> String -> a -> ParseResult a) -> FieldDescr a
fieldName :: FieldDescr a -> String
fieldGet :: FieldDescr a -> a -> Doc
-- | fieldSet n str x Parses the field value from the given input
-- string str and stores the result in x if the parse
-- was successful. Otherwise, reports an error on line number n.
fieldSet :: FieldDescr a -> LineNo -> String -> a -> ParseResult a
ppField :: String -> Doc -> Doc
ppFields :: [FieldDescr a] -> a -> Doc
readFields :: String -> ParseResult [Field]
showFields :: [FieldDescr a] -> a -> String
showSingleNamedField :: [FieldDescr a] -> String -> Maybe (a -> String)
parseFields :: [FieldDescr a] -> a -> String -> ParseResult a
parseFilePathQ :: ReadP r FilePath
parseTokenQ :: ReadP r String
parseTokenQ' :: ReadP r String
-- | parse a module name
parseModuleNameQ :: ReadP r ModuleName
parseBuildTool :: ReadP r Dependency
parsePkgconfigDependency :: ReadP r Dependency
parseOptVersion :: ReadP r Version
parsePackageNameQ :: ReadP r PackageName
parseVersionRangeQ :: ReadP r VersionRange
parseTestedWithQ :: ReadP r (CompilerFlavor, VersionRange)
parseLicenseQ :: ReadP r License
parseExtensionQ :: ReadP r Extension
parseSepList :: ReadP r b -> ReadP r a -> ReadP r [a]
parseCommaList :: ReadP r a -> ReadP r [a]
parseOptCommaList :: ReadP r a -> ReadP r [a]
showFilePath :: FilePath -> Doc
showToken :: String -> Doc
showTestedWith :: (CompilerFlavor, VersionRange) -> Doc
-- | Pretty-print free-format text, ensuring that it is vertically aligned,
-- and with blank lines replaced by dots for correct re-parsing.
showFreeText :: String -> Doc
parseFreeText :: ReadP s String
field :: String -> (a -> Doc) -> (ReadP a a) -> FieldDescr a
simpleField :: String -> (a -> Doc) -> (ReadP a a) -> (b -> a) -> (a -> b -> b) -> FieldDescr b
listField :: String -> (a -> Doc) -> (ReadP [a] a) -> (b -> [a]) -> ([a] -> b -> b) -> FieldDescr b
spaceListField :: String -> (a -> Doc) -> (ReadP [a] a) -> (b -> [a]) -> ([a] -> b -> b) -> FieldDescr b
commaListField :: String -> (a -> Doc) -> (ReadP [a] a) -> (b -> [a]) -> ([a] -> b -> b) -> FieldDescr b
optsField :: String -> CompilerFlavor -> (b -> [(CompilerFlavor, [String])]) -> ([(CompilerFlavor, [String])] -> b -> b) -> FieldDescr b
liftField :: (b -> a) -> (a -> b -> b) -> FieldDescr a -> FieldDescr b
boolField :: String -> (b -> Bool) -> (Bool -> b -> b) -> FieldDescr b
parseQuoted :: ReadP r a -> ReadP r a
-- | The type of a function which, given a name-value pair of an
-- unrecognized field, and the current structure being built, decides
-- whether to incorporate the unrecognized field (by returning Just x,
-- where x is a possibly modified version of the structure being built),
-- or not (by returning Nothing).
type UnrecFieldParser a = (String, String) -> a -> Maybe a
-- | A default unrecognized field parser which simply returns Nothing, i.e.
-- ignores all unrecognized fields, so warnings will be generated.
warnUnrec :: UnrecFieldParser a
-- | A default unrecognized field parser which silently (i.e. no warnings
-- will be generated) ignores unrecognized fields, by returning the
-- structure being built unmodified.
ignoreUnrec :: UnrecFieldParser a
instance Show Field
instance Eq Field
instance (Show a) => Show (ParseResult a)
instance Show PWarning
instance Show PError
instance Monad ParseResult
-- | This is the information about an installed package that is
-- communicated to the ghc-pkg program in order to register a
-- package. ghc-pkg now consumes this package format (as of
-- version 6.4). This is specific to GHC at the moment.
--
-- The .cabal file format is for describing a package that is
-- not yet installed. It has a lot of flexibility, like conditionals and
-- dependency ranges. As such, that format is not at all suitable for
-- describing a package that has already been built and installed. By the
-- time we get to that stage, we have resolved all conditionals and
-- resolved dependency version constraints to exact versions of dependent
-- packages. So, this module defines the InstalledPackageInfo data
-- structure that contains all the info we keep about an installed
-- package. There is a parser and pretty printer. The textual format is
-- rather simpler than the .cabal format: there are no sections,
-- for example.
module Distribution.InstalledPackageInfo
data InstalledPackageInfo_ m
InstalledPackageInfo :: PackageIdentifier -> License -> String -> String -> String -> String -> String -> String -> String -> String -> Bool -> [m] -> [m] -> [FilePath] -> [FilePath] -> [String] -> [String] -> [String] -> [FilePath] -> [String] -> [PackageIdentifier] -> [String] -> [String] -> [String] -> [FilePath] -> [String] -> [FilePath] -> [FilePath] -> InstalledPackageInfo_ m
package :: InstalledPackageInfo_ m -> PackageIdentifier
license :: InstalledPackageInfo_ m -> License
copyright :: InstalledPackageInfo_ m -> String
maintainer :: InstalledPackageInfo_ m -> String
author :: InstalledPackageInfo_ m -> String
stability :: InstalledPackageInfo_ m -> String
homepage :: InstalledPackageInfo_ m -> String
pkgUrl :: InstalledPackageInfo_ m -> String
description :: InstalledPackageInfo_ m -> String
category :: InstalledPackageInfo_ m -> String
exposed :: InstalledPackageInfo_ m -> Bool
exposedModules :: InstalledPackageInfo_ m -> [m]
hiddenModules :: InstalledPackageInfo_ m -> [m]
importDirs :: InstalledPackageInfo_ m -> [FilePath]
libraryDirs :: InstalledPackageInfo_ m -> [FilePath]
hsLibraries :: InstalledPackageInfo_ m -> [String]
extraLibraries :: InstalledPackageInfo_ m -> [String]
extraGHCiLibraries :: InstalledPackageInfo_ m -> [String]
includeDirs :: InstalledPackageInfo_ m -> [FilePath]
includes :: InstalledPackageInfo_ m -> [String]
depends :: InstalledPackageInfo_ m -> [PackageIdentifier]
hugsOptions :: InstalledPackageInfo_ m -> [String]
ccOptions :: InstalledPackageInfo_ m -> [String]
ldOptions :: InstalledPackageInfo_ m -> [String]
frameworkDirs :: InstalledPackageInfo_ m -> [FilePath]
frameworks :: InstalledPackageInfo_ m -> [String]
haddockInterfaces :: InstalledPackageInfo_ m -> [FilePath]
haddockHTMLs :: InstalledPackageInfo_ m -> [FilePath]
type InstalledPackageInfo = InstalledPackageInfo_ ModuleName
data ParseResult a
ParseFailed :: PError -> ParseResult a
ParseOk :: [PWarning] -> a -> ParseResult a
data PError
AmbigousParse :: String -> LineNo -> PError
NoParse :: String -> LineNo -> PError
TabsError :: LineNo -> PError
FromString :: String -> (Maybe LineNo) -> PError
data PWarning
emptyInstalledPackageInfo :: InstalledPackageInfo_ m
parseInstalledPackageInfo :: String -> ParseResult InstalledPackageInfo
showInstalledPackageInfo :: InstalledPackageInfo -> String
showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String)
instance (Read m) => Read (InstalledPackageInfo_ m)
instance (Show m) => Show (InstalledPackageInfo_ m)
instance PackageFixedDeps (InstalledPackageInfo_ str)
instance Package (InstalledPackageInfo_ str)
-- | This defined parsers and partial pretty printers for the
-- .cabal format. Some of the complexity in this module is due
-- to the fact that we have to be backwards compatible with old
-- .cabal files, so there's code to translate into the newer
-- structure.
module Distribution.PackageDescription.Parse
-- | Parse the given package file.
readPackageDescription :: Verbosity -> FilePath -> IO GenericPackageDescription
writePackageDescription :: FilePath -> PackageDescription -> IO ()
-- | Parses the given file into a GenericPackageDescription.
--
-- In Cabal 1.2 the syntax for package descriptions was changed to a
-- format with sections and possibly indented property descriptions.
parsePackageDescription :: String -> ParseResult GenericPackageDescription
showPackageDescription :: PackageDescription -> String
data ParseResult a
ParseFailed :: PError -> ParseResult a
ParseOk :: [PWarning] -> a -> ParseResult a
-- | Field descriptor. The parameter a parameterizes over where
-- the field's value is stored in.
data FieldDescr a
FieldDescr :: String -> (a -> Doc) -> (LineNo -> String -> a -> ParseResult a) -> FieldDescr a
fieldName :: FieldDescr a -> String
fieldGet :: FieldDescr a -> a -> Doc
-- | fieldSet n str x Parses the field value from the given input
-- string str and stores the result in x if the parse
-- was successful. Otherwise, reports an error on line number n.
fieldSet :: FieldDescr a -> LineNo -> String -> a -> ParseResult a
type LineNo = Int
readHookedBuildInfo :: Verbosity -> FilePath -> IO HookedBuildInfo
parseHookedBuildInfo :: String -> ParseResult HookedBuildInfo
writeHookedBuildInfo :: FilePath -> HookedBuildInfo -> IO ()
showHookedBuildInfo :: HookedBuildInfo -> String
instance (Monad m) => Monad (StT s m)
-- | This is to do with command line handling. The Cabal command line is
-- organised into a number of named sub-commands (much like darcs). The
-- CommandUI abstraction represents one of these sub-commands,
-- with a name, description, a set of flags. Commands can be associated
-- with actions and run. It handles some common stuff automatically, like
-- the --help and command line completion flags. It is designed
-- to allow other tools make derived commands. This feature is used
-- heavily in cabal-install.
module Distribution.Simple.Command
data CommandUI flags
CommandUI :: String -> String -> (String -> String) -> Maybe (String -> String) -> flags -> (ShowOrParseArgs -> [OptionField flags]) -> CommandUI flags
-- | The name of the command as it would be entered on the command line.
-- For example "build".
commandName :: CommandUI flags -> String
-- | A short, one line description of the command to use in help texts.
commandSynopsis :: CommandUI flags -> String
-- | The useage line summary for this command
commandUsage :: CommandUI flags -> String -> String
-- | Additional explanation of the command to use in help texts.
commandDescription :: CommandUI flags -> Maybe (String -> String)
-- | Initial / empty flags
commandDefaultFlags :: CommandUI flags -> flags
-- | All the Option fields for this command
commandOptions :: CommandUI flags -> ShowOrParseArgs -> [OptionField flags]
-- | Show flags in the standard long option command line format
commandShowOptions :: CommandUI flags -> flags -> [String]
data ShowOrParseArgs
ShowArgs :: ShowOrParseArgs
ParseArgs :: ShowOrParseArgs
-- | Make a Command from standard GetOpt options.
makeCommand :: String -> String -> Maybe (String -> String) -> flags -> (ShowOrParseArgs -> [OptionField flags]) -> CommandUI flags
data Command action
commandAddAction :: CommandUI flags -> (flags -> [String] -> action) -> Command action
-- | Utility function, many commands do not accept additional flags. This
-- action fails with a helpful error message if the user supplies any
-- extra.
noExtraFlags :: [String] -> IO ()
data CommandParse flags
CommandHelp :: (String -> String) -> CommandParse flags
CommandList :: [String] -> CommandParse flags
CommandErrors :: [String] -> CommandParse flags
CommandReadyToGo :: flags -> CommandParse flags
commandsRun :: CommandUI a -> [Command action] -> [String] -> CommandParse (a, CommandParse action)
-- | We usually have a datatype for storing configuration values, where
-- every field stores a configuration option, and the user sets the value
-- either via command line flags or a configuration file. An individual
-- OptionField models such a field, and we usually build a list of
-- options associated to a configuration datatype.
data OptionField a
OptionField :: Name -> [OptDescr a] -> OptionField a
optionName :: OptionField a -> Name
optionDescr :: OptionField a -> [OptDescr a]
type Name = String
-- | Create an option taking a single OptDescr. No explicit Name is given
-- for the Option, the name is the first LFlag given.
option :: SFlags -> LFlags -> Description -> get -> set -> MkOptDescr get set a -> OptionField a
-- | Create an option taking several OptDescrs. You will have to give the
-- flags and description individually to the OptDescr constructor.
multiOption :: Name -> get -> set -> [get -> set -> OptDescr a] -> OptionField a
liftOption :: (b -> a) -> (a -> (b -> b)) -> OptionField a -> OptionField b
-- | to view as a FieldDescr, we sort the list of interfaces (Req > Bool
-- > Choice > Opt) and consider only the first one.
viewAsFieldDescr :: OptionField a -> FieldDescr a
-- | An OptionField takes one or more OptDescrs, describing the command
-- line interface for the field.
data OptDescr a
ReqArg :: Description -> OptFlags -> ArgPlaceHolder -> (ReadE (a -> a)) -> (a -> [String]) -> OptDescr a
OptArg :: Description -> OptFlags -> ArgPlaceHolder -> (ReadE (a -> a)) -> (a -> a) -> (a -> [Maybe String]) -> OptDescr a
ChoiceOpt :: [(Description, OptFlags, a -> a, a -> Bool)] -> OptDescr a
BoolOpt :: Description -> OptFlags -> OptFlags -> (Bool -> a -> a) -> (a -> Maybe Bool) -> OptDescr a
type Description = String
-- | Short command line option strings
type SFlags = [Char]
-- | Long command line option strings
type LFlags = [String]
type OptFlags = (SFlags, LFlags)
type ArgPlaceHolder = String
type MkOptDescr get set a = SFlags -> LFlags -> Description -> get -> set -> OptDescr a
-- | Create a string-valued command line interface.
reqArg :: (Monoid b) => ArgPlaceHolder -> ReadE b -> (b -> [String]) -> MkOptDescr (a -> b) (b -> a -> a) a
-- | (String -> a) variant of reqArg
reqArg' :: (Monoid b) => ArgPlaceHolder -> (String -> b) -> (b -> [String]) -> MkOptDescr (a -> b) (b -> a -> a) a
-- | Create a string-valued command line interface with a default value.
optArg :: (Monoid b) => ArgPlaceHolder -> ReadE b -> b -> (b -> [Maybe String]) -> MkOptDescr (a -> b) (b -> a -> a) a
-- | (String -> a) variant of optArg
optArg' :: (Monoid b) => ArgPlaceHolder -> (Maybe String -> b) -> (b -> [Maybe String]) -> MkOptDescr (a -> b) (b -> a -> a) a
noArg :: (Eq b, Monoid b) => b -> MkOptDescr (a -> b) (b -> a -> a) a
boolOpt :: (b -> Maybe Bool) -> (Bool -> b) -> SFlags -> SFlags -> MkOptDescr (a -> b) (b -> a -> a) a
boolOpt' :: (b -> Maybe Bool) -> (Bool -> b) -> OptFlags -> OptFlags -> MkOptDescr (a -> b) (b -> a -> a) a
-- | create a Choice option
choiceOpt :: (Eq b) => [(b, OptFlags, Description)] -> MkOptDescr (a -> b) (b -> a -> a) a
-- | create a Choice option out of an enumeration type. As long flags, the
-- Show output is used. As short flags, the first character which does
-- not conflict with a previous one is used.
choiceOptFromEnum :: (Bounded b, Enum b, Show b, Eq b) => MkOptDescr (a -> b) (b -> a -> a) a
instance Functor CommandParse
-- | This should be a much more sophisticated abstraction than it is.
-- Currently it's just a bit of data about the compiler, like it's
-- flavour and name and version. The reason it's just data is because
-- currently it has to be in Read and Show so it can be
-- saved along with the LocalBuildInfo. The only interesting bit of info
-- it contains is a mapping between language extensions and compiler
-- command line flags. This module also defines a PackageDB type
-- which is used to refer to package databases. Most compilers only know
-- about a single global package collection but GHC has a global and
-- per-user one and it lets you create arbitrary other package databases.
-- We do not yet fully support this latter feature.
module Distribution.Simple.Compiler
data Compiler
Compiler :: CompilerId -> [(Extension, String)] -> Compiler
compilerId :: Compiler -> CompilerId
compilerExtensions :: Compiler -> [(Extension, String)]
showCompilerId :: Compiler -> String
compilerFlavor :: Compiler -> CompilerFlavor
compilerVersion :: Compiler -> Version
-- | 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.
data PackageDB
GlobalPackageDB :: PackageDB
UserPackageDB :: PackageDB
SpecificPackageDB :: FilePath -> PackageDB
-- | Some compilers support optimising. Some have different levels. For
-- compliers that do not the level is just capped to the level they do
-- support.
data OptimisationLevel
NoOptimisation :: OptimisationLevel
NormalOptimisation :: OptimisationLevel
MaximumOptimisation :: OptimisationLevel
flagToOptimisationLevel :: Maybe String -> OptimisationLevel
type Flag = String
-- | For the given compiler, return the flags for the supported extensions.
extensionsToFlags :: Compiler -> [Extension] -> [Flag]
-- | For the given compiler, return the extensions it does not support.
unsupportedExtensions :: Compiler -> [Extension] -> [Extension]
instance Eq OptimisationLevel
instance Show OptimisationLevel
instance Read OptimisationLevel
instance Enum OptimisationLevel
instance Bounded OptimisationLevel
instance Eq PackageDB
instance Show PackageDB
instance Read PackageDB
instance Show Compiler
instance Read Compiler
-- | This manages everything to do with where files get installed (though
-- does not get involved with actually doing any installation). It
-- provides an InstallDirs type which is a set of directories for
-- where to install things. It also handles the fact that we use
-- templates in these install dirs. For example most install dirs are
-- relative to some $prefix and by changing the prefix all other
-- dirs still end up changed appropriately. So it provides a
-- PathTemplate type and functions for substituting for these
-- templates.
module Distribution.Simple.InstallDirs
-- | The directories where we will install files for packages.
--
-- We have several different directories for different types of files
-- since many systems have conventions whereby different types of files
-- in a package are installed in different direcotries. This is
-- particularly the case on unix style systems.
data InstallDirs dir
InstallDirs :: dir -> dir -> dir -> dir -> dir -> dir -> dir -> dir -> dir -> dir -> dir -> dir -> dir -> dir -> InstallDirs dir
prefix :: InstallDirs dir -> dir
bindir :: InstallDirs dir -> dir
libdir :: InstallDirs dir -> dir
libsubdir :: InstallDirs dir -> dir
dynlibdir :: InstallDirs dir -> dir
libexecdir :: InstallDirs dir -> dir
progdir :: InstallDirs dir -> dir
includedir :: InstallDirs dir -> dir
datadir :: InstallDirs dir -> dir
datasubdir :: InstallDirs dir -> dir
docdir :: InstallDirs dir -> dir
mandir :: InstallDirs dir -> dir
htmldir :: InstallDirs dir -> dir
haddockdir :: InstallDirs dir -> dir
-- | The installation directories in terms of PathTemplates that
-- contain variables.
--
-- The defaults for most of the directories are relative to each other,
-- in particular they are all relative to a single prefix. This makes it
-- convenient for the user to override the default installation directory
-- by only having to specify --prefix=... rather than overriding each
-- individually. This is done by allowing $-style variables in the dirs.
-- These are expanded by textual substituion (see
-- substPathTemplate).
--
-- A few of these installation directories are split into two components,
-- the dir and subdir. The full installation path is formed by combining
-- the two together with /. The reason for this is compatibility
-- with other unix build systems which also support --libdir and
-- --datadir. We would like users to be able to configure
-- --libdir=/usr/lib64 for example but because by default we
-- want to support installing multiple versions of packages and building
-- the same package for multiple compilers we append the libsubdir to
-- get: /usr/lib64/$pkgid/$compiler.
--
-- An additional complication is the need to support relocatable packages
-- on systems which support such things, like Windows.
type InstallDirTemplates = InstallDirs PathTemplate
defaultInstallDirs :: CompilerFlavor -> Bool -> Bool -> IO InstallDirTemplates
combineInstallDirs :: (a -> b -> c) -> InstallDirs a -> InstallDirs b -> InstallDirs c
-- | Convert from abstract install directories to actual absolute ones by
-- substituting for all the variables in the abstract paths, to get real
-- absolute path.
absoluteInstallDirs :: PackageIdentifier -> CompilerId -> CopyDest -> InstallDirTemplates -> InstallDirs FilePath
-- | The location prefix for the copy command.
data CopyDest
NoCopyDest :: CopyDest
CopyTo :: FilePath -> CopyDest
CopyPrefix :: FilePath -> CopyDest
-- | Check which of the paths are relative to the installation $prefix.
--
-- If any of the paths are not relative, ie they are absolute paths, then
-- it prevents us from making a relocatable package (also known as a
-- "prefix independent" package).
prefixRelativeInstallDirs :: PackageIdentifier -> CompilerId -> InstallDirTemplates -> InstallDirs (Maybe FilePath)
-- | An abstract path, posibly containing variables that need to be
-- substituted for to get a real FilePath.
data PathTemplate
data PathTemplateVariable
-- | The $prefix path variable
PrefixVar :: PathTemplateVariable
-- | The $bindir path variable
BindirVar :: PathTemplateVariable
-- | The $libdir path variable
LibdirVar :: PathTemplateVariable
-- | The $libsubdir path variable
LibsubdirVar :: PathTemplateVariable
-- | The $datadir path variable
DatadirVar :: PathTemplateVariable
-- | The $datasubdir path variable
DatasubdirVar :: PathTemplateVariable
-- | The $docdir path variable
DocdirVar :: PathTemplateVariable
-- | The $htmldir path variable
HtmldirVar :: PathTemplateVariable
-- | The $pkg package name path variable
PkgNameVar :: PathTemplateVariable
-- | The $version package version path variable
PkgVerVar :: PathTemplateVariable
-- | The $pkgid package Id path variable, eg foo-1.0
PkgIdVar :: PathTemplateVariable
-- | The compiler name and version, eg ghc-6.6.1
CompilerVar :: PathTemplateVariable
-- | The operating system name, eg windows or linux
OSVar :: PathTemplateVariable
-- | The cpu architecture name, eg i386 or x86_64
ArchVar :: PathTemplateVariable
-- | The executable name; used in shell wrappers
ExecutableNameVar :: PathTemplateVariable
-- | Convert a FilePath to a PathTemplate including any
-- template vars.
toPathTemplate :: FilePath -> PathTemplate
-- | Convert back to a path, any remaining vars are included
fromPathTemplate :: PathTemplate -> FilePath
substPathTemplate :: [(PathTemplateVariable, PathTemplate)] -> PathTemplate -> PathTemplate
-- | The initial environment has all the static stuff but no paths
initialPathTemplateEnv :: PackageIdentifier -> CompilerId -> [(PathTemplateVariable, PathTemplate)]
fullPathTemplateEnv :: PackageIdentifier -> CompilerId -> InstallDirs FilePath -> [(PathTemplateVariable, PathTemplate)]
instance Eq PathTemplateVariable
instance Eq CopyDest
instance Show CopyDest
instance (Read dir) => Read (InstallDirs dir)
instance (Show dir) => Show (InstallDirs dir)
instance Read PathTemplate
instance Show PathTemplate
instance Read PathComponent
instance Show PathComponent
instance Read PathTemplateVariable
instance Show PathTemplateVariable
instance (Monoid dir) => Monoid (InstallDirs dir)
instance Functor InstallDirs
-- | This is a big module, but not very complicated. The code is very
-- regular and repetitive. It defines the command line interface for all
-- the Cabal commands. For each command (like configure,
-- build etc) it defines a type that holds all the flags, the
-- default set of flags and a CommandUI that maps command line
-- flags to and from the corresponding flags type.
--
-- All the flags types are instances of Monoid, see
-- http://www.haskell.org/pipermail/cabal-devel/2007-December/001509.html
-- for an explanation.
--
-- The types defined here get used in the front end and especially in
-- cabal-install which has to do quite a bit of manipulating
-- sets of command line flags.
--
-- This is actually relatively nice, it works quite well. The main change
-- it needs is to unify it with the code for managing sets of fields that
-- can be read and written from files. This would allow us to save
-- configure flags in config files.
module Distribution.Simple.Setup
-- | Flags that apply at the top level, not to any sub-command.
data GlobalFlags
GlobalFlags :: Flag Bool -> Flag Bool -> GlobalFlags
globalVersion :: GlobalFlags -> Flag Bool
globalNumericVersion :: GlobalFlags -> Flag Bool
emptyGlobalFlags :: GlobalFlags
defaultGlobalFlags :: GlobalFlags
globalCommand :: CommandUI GlobalFlags
-- | Flags to configure command
data ConfigFlags
ConfigFlags :: ProgramConfiguration -> [(String, FilePath)] -> [(String, [String])] -> Flag CompilerFlavor -> Flag FilePath -> Flag FilePath -> Flag Bool -> Flag Bool -> Flag Bool -> Flag Bool -> [String] -> Flag OptimisationLevel -> Flag PathTemplate -> Flag PathTemplate -> InstallDirs (Flag PathTemplate) -> Flag FilePath -> [FilePath] -> [FilePath] -> Flag FilePath -> Flag Verbosity -> Flag Bool -> Flag PackageDB -> Flag Bool -> Flag Bool -> Flag Bool -> [Dependency] -> FlagAssignment -> ConfigFlags
-- | All programs that cabal may run
configPrograms :: ConfigFlags -> ProgramConfiguration
-- | user specifed programs paths
configProgramPaths :: ConfigFlags -> [(String, FilePath)]
-- | user specifed programs args
configProgramArgs :: ConfigFlags -> [(String, [String])]
-- | The "flavor" of the compiler, sugh as GHC or Hugs.
configHcFlavor :: ConfigFlags -> Flag CompilerFlavor
-- | given compiler location
configHcPath :: ConfigFlags -> Flag FilePath
-- | given hc-pkg location
configHcPkg :: ConfigFlags -> Flag FilePath
-- | Enable vanilla library
configVanillaLib :: ConfigFlags -> Flag Bool
-- | Enable profiling in the library
configProfLib :: ConfigFlags -> Flag Bool
-- | Build shared library
configSharedLib :: ConfigFlags -> Flag Bool
-- | Enable profiling in the executables.
configProfExe :: ConfigFlags -> Flag Bool
-- | Extra arguments to configure
configConfigureArgs :: ConfigFlags -> [String]
-- | Enable optimization.
configOptimization :: ConfigFlags -> Flag OptimisationLevel
-- | Installed executable prefix.
configProgPrefix :: ConfigFlags -> Flag PathTemplate
-- | Installed executable suffix.
configProgSuffix :: ConfigFlags -> Flag PathTemplate
-- | Installation paths
configInstallDirs :: ConfigFlags -> InstallDirs (Flag PathTemplate)
configScratchDir :: ConfigFlags -> Flag FilePath
-- | path to search for extra libraries
configExtraLibDirs :: ConfigFlags -> [FilePath]
-- | path to search for header files
configExtraIncludeDirs :: ConfigFlags -> [FilePath]
-- | dist prefix
configDistPref :: ConfigFlags -> Flag FilePath
-- | verbosity level
configVerbosity :: ConfigFlags -> Flag Verbosity
-- | The --user/--global flag
configUserInstall :: ConfigFlags -> Flag Bool
-- | Which package DB to use
configPackageDB :: ConfigFlags -> Flag PackageDB
-- | Enable compiling library for GHCi
configGHCiLib :: ConfigFlags -> Flag Bool
-- | Enable -split-objs with GHC
configSplitObjs :: ConfigFlags -> Flag Bool
-- | Enable executable stripping
configStripExes :: ConfigFlags -> Flag Bool
-- | Additional constraints for dependencies
configConstraints :: ConfigFlags -> [Dependency]
configConfigurationsFlags :: ConfigFlags -> FlagAssignment
emptyConfigFlags :: ConfigFlags
defaultConfigFlags :: ProgramConfiguration -> ConfigFlags
configureCommand :: ProgramConfiguration -> CommandUI ConfigFlags
-- | Flags to copy: (destdir, copy-prefix (backwards compat),
-- verbosity)
data CopyFlags
CopyFlags :: Flag CopyDest -> Flag FilePath -> Flag Bool -> Flag Bool -> Flag Verbosity -> CopyFlags
copyDest :: CopyFlags -> Flag CopyDest
copyDistPref :: CopyFlags -> Flag FilePath
copyUseWrapper :: CopyFlags -> Flag Bool
copyInPlace :: CopyFlags -> Flag Bool
copyVerbosity :: CopyFlags -> Flag Verbosity
emptyCopyFlags :: CopyFlags
defaultCopyFlags :: CopyFlags
copyCommand :: CommandUI CopyFlags
-- | Flags to install: (package db, verbosity)
data InstallFlags
InstallFlags :: Flag PackageDB -> Flag FilePath -> Flag Bool -> Flag Bool -> Flag Verbosity -> InstallFlags
installPackageDB :: InstallFlags -> Flag PackageDB
installDistPref :: InstallFlags -> Flag FilePath
installUseWrapper :: InstallFlags -> Flag Bool
installInPlace :: InstallFlags -> Flag Bool
installVerbosity :: InstallFlags -> Flag Verbosity
emptyInstallFlags :: InstallFlags
defaultInstallFlags :: InstallFlags
installCommand :: CommandUI InstallFlags
data HaddockFlags
HaddockFlags :: [(String, FilePath)] -> [(String, [String])] -> Flag Bool -> Flag String -> Flag Bool -> Flag Bool -> Flag FilePath -> Flag Bool -> Flag FilePath -> Flag FilePath -> Flag Verbosity -> HaddockFlags
haddockProgramPaths :: HaddockFlags -> [(String, FilePath)]
haddockProgramArgs :: HaddockFlags -> [(String, [String])]
haddockHoogle :: HaddockFlags -> Flag Bool
haddockHtmlLocation :: HaddockFlags -> Flag String
haddockExecutables :: HaddockFlags -> Flag Bool
haddockInternal :: HaddockFlags -> Flag Bool
haddockCss :: HaddockFlags -> Flag FilePath
haddockHscolour :: HaddockFlags -> Flag Bool
haddockHscolourCss :: HaddockFlags -> Flag FilePath
haddockDistPref :: HaddockFlags -> Flag FilePath
haddockVerbosity :: HaddockFlags -> Flag Verbosity
emptyHaddockFlags :: HaddockFlags
defaultHaddockFlags :: HaddockFlags
haddockCommand :: CommandUI HaddockFlags
data HscolourFlags
HscolourFlags :: Flag FilePath -> Flag Bool -> Flag FilePath -> Flag Verbosity -> HscolourFlags
hscolourCSS :: HscolourFlags -> Flag FilePath
hscolourExecutables :: HscolourFlags -> Flag Bool
hscolourDistPref :: HscolourFlags -> Flag FilePath
hscolourVerbosity :: HscolourFlags -> Flag Verbosity
emptyHscolourFlags :: HscolourFlags
defaultHscolourFlags :: HscolourFlags
hscolourCommand :: CommandUI HscolourFlags
data BuildFlags
BuildFlags :: [(String, FilePath)] -> [(String, [String])] -> Flag FilePath -> Flag Verbosity -> BuildFlags
buildProgramPaths :: BuildFlags -> [(String, FilePath)]
buildProgramArgs :: BuildFlags -> [(String, [String])]
buildDistPref :: BuildFlags -> Flag FilePath
buildVerbosity :: BuildFlags -> Flag Verbosity
emptyBuildFlags :: BuildFlags
defaultBuildFlags :: BuildFlags
buildCommand :: ProgramConfiguration -> CommandUI BuildFlags
buildVerbose :: BuildFlags -> Verbosity
data CleanFlags
CleanFlags :: Flag Bool -> Flag FilePath -> Flag Verbosity -> CleanFlags
cleanSaveConf :: CleanFlags -> Flag Bool
cleanDistPref :: CleanFlags -> Flag FilePath
cleanVerbosity :: CleanFlags -> Flag Verbosity
emptyCleanFlags :: CleanFlags
defaultCleanFlags :: CleanFlags
cleanCommand :: CommandUI CleanFlags
data MakefileFlags
MakefileFlags :: Flag FilePath -> Flag FilePath -> Flag Verbosity -> MakefileFlags
makefileFile :: MakefileFlags -> Flag FilePath
makefileDistPref :: MakefileFlags -> Flag FilePath
makefileVerbosity :: MakefileFlags -> Flag Verbosity
emptyMakefileFlags :: MakefileFlags
defaultMakefileFlags :: MakefileFlags
makefileCommand :: CommandUI MakefileFlags
-- | Flags to register and unregister: (user package,
-- gen-script, in-place, verbosity)
data RegisterFlags
RegisterFlags :: Flag PackageDB -> Flag Bool -> Flag (Maybe FilePath) -> Flag Bool -> Flag FilePath -> Flag Verbosity -> RegisterFlags
regPackageDB :: RegisterFlags -> Flag PackageDB
regGenScript :: RegisterFlags -> Flag Bool
regGenPkgConf :: RegisterFlags -> Flag (Maybe FilePath)
regInPlace :: RegisterFlags -> Flag Bool
regDistPref :: RegisterFlags -> Flag FilePath
regVerbosity :: RegisterFlags -> Flag Verbosity
emptyRegisterFlags :: RegisterFlags
defaultRegisterFlags :: RegisterFlags
registerCommand :: CommandUI RegisterFlags
unregisterCommand :: CommandUI RegisterFlags
-- | Flags to sdist: (snapshot, verbosity)
data SDistFlags
SDistFlags :: Flag Bool -> Flag FilePath -> Flag Verbosity -> SDistFlags
sDistSnapshot :: SDistFlags -> Flag Bool
sDistDistPref :: SDistFlags -> Flag FilePath
sDistVerbosity :: SDistFlags -> Flag Verbosity
emptySDistFlags :: SDistFlags
defaultSDistFlags :: SDistFlags
sdistCommand :: CommandUI SDistFlags
data TestFlags
TestFlags :: Flag FilePath -> Flag Verbosity -> TestFlags
testDistPref :: TestFlags -> Flag FilePath
testVerbosity :: TestFlags -> Flag Verbosity
emptyTestFlags :: TestFlags
defaultTestFlags :: TestFlags
testCommand :: CommandUI TestFlags
-- | The location prefix for the copy command.
data CopyDest
NoCopyDest :: CopyDest
CopyTo :: FilePath -> CopyDest
CopyPrefix :: FilePath -> CopyDest
-- | Arguments to pass to a configure script, e.g. generated by
-- autoconf.
configureArgs :: Bool -> ConfigFlags -> [String]
configureOptions :: ShowOrParseArgs -> [OptionField ConfigFlags]
installDirsOptions :: [OptionField (InstallDirs (Flag PathTemplate))]
defaultDistPref :: FilePath
-- | All flags are monoids, they come in two flavours:
--
-- 1. list flags eg
--
-- -- --ghc-option=foo --ghc-option=bar ---- -- gives us all the values [foo, bar] -- -- 2. singular value flags, eg: -- --
-- --enable-foo --disable-foo ---- -- gives us Just False So this Flag type is for the latter singular kind -- of flag. Its monoid instance gives us the behaviour where it starts -- out as NoFlag and later flags override earlier ones. data Flag a Flag :: a -> Flag a NoFlag :: Flag a toFlag :: a -> Flag a fromFlag :: Flag a -> a fromFlagOrDefault :: a -> Flag a -> a flagToMaybe :: Flag a -> Maybe a flagToList :: Flag a -> [a] boolOpt :: SFlags -> SFlags -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a boolOpt' :: OptFlags -> OptFlags -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a trueArg :: SFlags -> LFlags -> Description -> (b -> Flag Bool) -> (Flag Bool -> (b -> b)) -> OptDescr b falseArg :: SFlags -> LFlags -> Description -> (b -> Flag Bool) -> (Flag Bool -> (b -> b)) -> OptDescr b optionVerbosity :: (flags -> Flag Verbosity) -> (Flag Verbosity -> flags -> flags) -> OptionField flags instance Show TestFlags instance Show MakefileFlags instance Show BuildFlags instance Show CleanFlags instance Show HaddockFlags instance Show HscolourFlags instance Show RegisterFlags instance Show SDistFlags instance Show InstallFlags instance Show CopyFlags instance Show ConfigFlags instance (Show a) => Show (Flag a) instance (Eq a) => Eq (Flag a) instance Monoid TestFlags instance Monoid MakefileFlags instance Monoid BuildFlags instance Monoid CleanFlags instance Monoid HaddockFlags instance Monoid HscolourFlags instance Monoid RegisterFlags instance Monoid SDistFlags instance Monoid InstallFlags instance Monoid CopyFlags instance Monoid ConfigFlags instance Monoid GlobalFlags instance (Enum a) => Enum (Flag a) instance (Bounded a) => Bounded (Flag a) instance Monoid (Flag a) instance Functor Flag -- | This is an alternative build system that delegates everything to the -- make program. All the commands just end up calling -- make with appropriate arguments. The intention was to allow -- preexisting packages that used makefiles to be wrapped into Cabal -- packages. In practice essentially all such packages were converted -- over to the "Simple" build system instead. Consequently this module is -- not used much and it certainly only sees cursory maintenance and no -- testing. Perhaps at some point we should stop pretending that it -- works. -- -- Uses the parsed command-line from Distribution.Setup in order to build -- Haskell tools using a backend build system based on make. Obviously we -- assume that there is a configure script, and that after the ConfigCmd -- has been run, there is a Makefile. Further assumptions: -- --
-- MIN_VERSION_<package>(A,B,C) ---- -- for each package in build-depends, which is true if -- the version of package in use is >= A.B.C, using -- the normal ordering on version numbers. module Distribution.Simple.Build.Macros generate :: PackageDescription -> LocalBuildInfo -> String -- | A bunch of dirs, paths and file names used for intermediate build -- steps. module Distribution.Simple.BuildPaths defaultDistPref :: FilePath srcPref :: FilePath -> FilePath hscolourPref :: FilePath -> PackageDescription -> FilePath haddockPref :: FilePath -> PackageDescription -> FilePath -- | The directory in which we put auto-generated modules autogenModulesDir :: LocalBuildInfo -> String -- | The name of the auto-generated module associated with a package autogenModuleName :: PackageDescription -> ModuleName cppHeaderName :: String haddockName :: PackageDescription -> FilePath mkLibName :: PackageIdentifier -> String mkProfLibName :: PackageIdentifier -> String mkSharedLibName :: PackageIdentifier -> CompilerId -> String -- | Extension for executable files (typically "" on Unix and -- "exe" on Windows or OS/2) exeExtension :: String -- | Extension for object files. For GHC and NHC the extension is -- "o". Hugs uses either "o" or "obj" -- depending on the used C compiler. objExtension :: String -- | Extension for dynamically linked (or shared) libraries (typically -- "so" on Unix and "dll" on Windows) dllExtension :: String -- | Generating the Paths_pkgname module. -- -- This is a module that Cabal generates for the benefit of packages. It -- enables them to find their version number and find any installed data -- files at runtime. This code should probably be split off into another -- module. module Distribution.Simple.Build.PathsModule generate :: PackageDescription -> LocalBuildInfo -> String -- | This is a fairly large module. It contains most of the GHC-specific -- code for configuring, building and installing packages. It also -- exports a function for finding out what packages are already -- installed. Configuring involves finding the ghc and -- ghc-pkg programs, finding what language extensions this -- version of ghc supports and returning a Compiler value. -- -- getInstalledPackages involves calling the ghc-pkg -- program to find out what packages are installed. -- -- Building is somewhat complex as there is quite a bit of information to -- take into account. We have to build libs and programs, possibly for -- profiling and shared libs. We have to support building libraries that -- will be usable by GHCi and also ghc's -split-objs feature. We -- have to compile any C files using ghc. Linking, especially for -- split-objs is remarkably complex, partly because there tend -- to be 1,000's of .o files and this can often be more than we -- can pass to the ld or ar programs in one go. -- -- There is also some code for generating Makefiles but the less -- said about that the better. -- -- Installing for libs and exes involves finding the right files and -- copying them to the right places. One of the more tricky things about -- this module is remembering the layout of files in the build directory -- (which is not explicitly documented) and thus what search dirs are -- used for various kinds of files. module Distribution.Simple.GHC configure :: Verbosity -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> IO (Compiler, ProgramConfiguration) getInstalledPackages :: Verbosity -> PackageDB -> ProgramConfiguration -> IO (PackageIndex InstalledPackageInfo) -- | Building for GHC. If .ghc-packages exists and is readable, add it to -- the command-line. build :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO () makefile :: PackageDescription -> LocalBuildInfo -> MakefileFlags -> IO () -- | Install for ghc, .hi, .a and, if --with-ghci given, .o installLib :: CopyFlags -> LocalBuildInfo -> FilePath -> FilePath -> FilePath -> PackageDescription -> IO () -- | Install executables for GHC. installExe :: CopyFlags -> LocalBuildInfo -> InstallDirs FilePath -> InstallDirs FilePath -> FilePath -> (FilePath, FilePath) -> PackageDescription -> IO () ghcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String] ghcVerbosityOptions :: Verbosity -> [String] -- | This module contains most of the JHC-specific code for configuring, -- building and installing packages. module Distribution.Simple.JHC configure :: Verbosity -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> IO (Compiler, ProgramConfiguration) getInstalledPackages :: Verbosity -> PackageDB -> ProgramConfiguration -> IO (PackageIndex InstalledPackageInfo) -- | Building a package for JHC. Currently C source files are not -- supported. build :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO () installLib :: Verbosity -> FilePath -> FilePath -> PackageDescription -> Library -> IO () installExe :: Verbosity -> FilePath -> FilePath -> (FilePath, FilePath) -> PackageDescription -> Executable -> IO () -- | This module contains most of the NHC-specific code for configuring, -- building and installing packages. module Distribution.Simple.NHC configure :: Verbosity -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> IO (Compiler, ProgramConfiguration) -- | FIX: For now, the target must contain a main module. Not used ATM. -- Re-add later. build :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO () -- | Install for nhc98: .hi and .a files installLib :: Verbosity -> FilePath -> FilePath -> PackageIdentifier -> Library -> IO () -- | Install executables for GHC. installExe :: Verbosity -> FilePath -> FilePath -> (FilePath, FilePath) -> Executable -> IO () -- | This defines a PreProcessor abstraction which represents a -- pre-processor that can transform one kind of file into another. There -- is also a PPSuffixHandler which is a combination of a file -- extension and a function for configuring a PreProcessor. It -- defines a bunch of known built-in preprocessors like cpp, -- cpphs, c2hs, hsc2hs, happy, -- alex etc and lists them in knownSuffixHandlers. On top -- of this it provides a function for actually preprocessing some sources -- given a bunch of known suffix handlers. This module is not as good as -- it could be, it could really do with a rewrite to address some of the -- problems we have with pre-processors. module Distribution.Simple.PreProcess -- | Apply preprocessors to the sources from hsSourceDirs, to obtain -- a Haskell source file for each module. preprocessSources :: PackageDescription -> LocalBuildInfo -> Bool -> Verbosity -> [PPSuffixHandler] -> IO () -- | Standard preprocessors: GreenCard, c2hs, hsc2hs, happy, alex and -- cpphs. knownSuffixHandlers :: [PPSuffixHandler] -- | Convenience function; get the suffixes of these preprocessors. ppSuffixes :: [PPSuffixHandler] -> [String] -- | A preprocessor for turning non-Haskell files with the given extension -- into plain Haskell source files. type PPSuffixHandler = (String, BuildInfo -> LocalBuildInfo -> PreProcessor) -- | The interface to a preprocessor, which may be implemented using an -- external program, but need not be. The arguments are the name of the -- input file, the name of the output file and a verbosity level. Here is -- a simple example that merely prepends a comment to the given source -- file: -- --
-- ppTestHandler :: PreProcessor
-- ppTestHandler =
-- PreProcessor {
-- platformIndependent = True,
-- runPreProcessor = mkSimplePreProcessor $ \inFile outFile verbosity ->
-- do info verbosity (inFile++" has been preprocessed to "++outFile)
-- stuff <- readFile inFile
-- writeFile outFile ("-- preprocessed as a test\n\n" ++ stuff)
-- return ExitSuccess
--
--
-- We split the input and output file names into a base directory and the
-- rest of the file name. The input base dir is the path in the list of
-- search dirs that this file was found in. The output base dir is the
-- build dir where all the generated source files are put.
--
-- The reason for splitting it up this way is that some pre-processors
-- don't simply generate one output .hs file from one input file but have
-- dependencies on other genereated files (notably c2hs, where building
-- one .hs file may require reading other .chi files, and then compiling
-- the .hs file may require reading a generated .h file). In these cases
-- the generated files need to embed relative path names to each other
-- (eg the generated .hs file mentions the .h file in the FFI imports).
-- This path must be relative to the base directory where the genereated
-- files are located, it cannot be relative to the top level of the build
-- tree because the compilers do not look for .h files relative to there,
-- ie we do not use "-I .", instead we use "-I dist/build" (or whatever
-- dist dir has been set by the user)
--
-- Most pre-processors do not care of course, so mkSimplePreProcessor and
-- runSimplePreProcessor functions handle the simple case.
data PreProcessor
PreProcessor :: Bool -> ((FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO ()) -> PreProcessor
platformIndependent :: PreProcessor -> Bool
runPreProcessor :: PreProcessor -> (FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO ()
mkSimplePreProcessor :: (FilePath -> FilePath -> Verbosity -> IO ()) -> (FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO ()
runSimplePreProcessor :: PreProcessor -> FilePath -> FilePath -> Verbosity -> IO ()
ppCpp :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppCpp' :: [String] -> BuildInfo -> LocalBuildInfo -> PreProcessor
ppGreenCard :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppC2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppHsc2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppHappy :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppAlex :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppUnlit :: PreProcessor
-- | This module contains most of the NHC-specific code for configuring,
-- building and installing packages.
module Distribution.Simple.Hugs
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> IO (Compiler, ProgramConfiguration)
-- | Building a package for Hugs.
build :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO ()
-- | Install for Hugs. For install, copy-prefix = prefix, but for copy
-- they're different. The library goes in
-- <copy-prefix>/lib/hugs/packages/<pkgname> (i.e.
-- <prefix>/lib/hugs/packages/<pkgname> on the target
-- system). Each executable goes in
-- <copy-prefix>/lib/hugs/programs/<exename> (i.e.
-- <prefix>/lib/hugs/programs/<exename> on the target system)
-- with a script <copy-prefix>/bin/<exename> pointing at
-- <prefix>/lib/hugs/programs/<exename>.
install :: Verbosity -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> (FilePath, FilePath) -> PackageDescription -> IO ()
-- | This is the entry point to actually building the modules in a package.
-- It doesn't actually do much itself, most of the work is delegated to
-- compiler-specific actions. It does do some non-compiler specific bits
-- like running pre-processors.
--
-- There's some stuff to do with generating makefiles which is a
-- well hidden feature that's used to build libraries inside the GHC
-- build system but which we'd like to kill off and replace with
-- something better (doing our own dependency analysis properly).
module Distribution.Simple.Build
-- | Build the libraries and executables in this package.
build :: PackageDescription -> LocalBuildInfo -> BuildFlags -> [PPSuffixHandler] -> IO ()
makefile :: PackageDescription -> LocalBuildInfo -> MakefileFlags -> [PPSuffixHandler] -> IO ()
initialBuildSteps :: FilePath -> PackageDescription -> LocalBuildInfo -> Verbosity -> [PPSuffixHandler] -> IO ()
-- | Generate and write out the Paths_pkg.hs and cabal_macros.h
-- files
writeAutogenFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
-- | This module deals with the haddock and hscolour
-- commands. Sadly this is a rather complicated module. It deals with two
-- versions of haddock (0.x and 2.x). It has to do pre-processing for
-- haddock 0.x which involves 'unlit'ing and using -DHADDOCK for
-- any source code that uses cpp. It uses information about
-- installed packages (from ghc-pkg) to find the locations of
-- documentation for dependent packages, so it can create links.
--
-- The hscolour support allows generating html versions of the
-- original source, with coloured syntax highlighting.
module Distribution.Simple.Haddock
haddock :: PackageDescription -> LocalBuildInfo -> [PPSuffixHandler] -> HaddockFlags -> IO ()
hscolour :: PackageDescription -> LocalBuildInfo -> [PPSuffixHandler] -> HscolourFlags -> IO ()
-- | This is the entry point into installing a built package. Performs the
-- "./setup install" and "./setup copy" actions. It
-- moves files into place based on the prefix argument. It does the
-- generic bits and then calls compiler-specific functions to do the
-- rest.
module Distribution.Simple.Install
-- | Perform the "./setup install" and "./setup copy"
-- actions. Move files into place based on the prefix argument. FIX: nhc
-- isn't implemented yet.
install :: PackageDescription -> LocalBuildInfo -> CopyFlags -> IO ()
-- | This module deals with registering and unregistering packages. There
-- are a couple ways it can do this, one is to do it directly. Another is
-- to generate a script that can be run later to do it. The idea here
-- being that the user is shielded from the details of what command to
-- use for package registration for a particular compiler. In practice
-- this aspect was not especially popular so we also provide a way to
-- simply generate the package registration file which then must be
-- manually passed to ghc-pkg. It is possible to generate
-- registration information for where the package is to be installed, or
-- alternatively to register the package inplace in the build tree. The
-- latter is occasionally handy, and will become more important when we
-- try to build multi-package systems.
--
-- This module does not delegate anything to the per-compiler modules but
-- just mixes it all in in this module, which is rather unsatisfactory.
-- The script generation and the unregister feature are not well used or
-- tested.
module Distribution.Simple.Register
register :: PackageDescription -> LocalBuildInfo -> RegisterFlags -> IO ()
unregister :: PackageDescription -> LocalBuildInfo -> RegisterFlags -> IO ()
-- | Register doesn't drop the register info file, it must be done in a
-- separate step.
writeInstalledConfig :: FilePath -> PackageDescription -> LocalBuildInfo -> Bool -> Maybe FilePath -> IO ()
removeInstalledConfig :: FilePath -> IO ()
removeRegScripts :: IO ()
-- | This deals with the configure phase. It provides the
-- configure action which is given the package description and
-- configure flags. It then tries to: configure the compiler; resolves
-- any conditionals in the package description; resolve the package
-- dependencies; check if all the extensions used by this package are
-- supported by the compiler; check that all the build tools are
-- available (including version checks if appropriate); checks for any
-- required pkg-config packages (updating the BuildInfo
-- with the results)
--
-- Then based on all this it saves the info in the LocalBuildInfo
-- and writes it out to the dist/setup-config file. It also
-- displays various details to the user, the amount of information
-- displayed depending on the verbosity level.
module Distribution.Simple.Configure
-- | Perform the "./setup configure" action. Returns the
-- .setup-config file.
configure :: (Either GenericPackageDescription PackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo
-- | After running configure, output the LocalBuildInfo to the
-- localBuildInfoFile.
writePersistBuildConfig :: FilePath -> LocalBuildInfo -> IO ()
-- | Read the localBuildInfoFile. Error if it doesn't exist. Also
-- fail if the file containing LocalBuildInfo is older than the .cabal
-- file, indicating that a re-configure is required.
getPersistBuildConfig :: FilePath -> IO LocalBuildInfo
-- | Check that localBuildInfoFile is up-to-date with respect to the .cabal
-- file.
checkPersistBuildConfig :: FilePath -> FilePath -> IO ()
-- | Try to read the localBuildInfoFile.
maybeGetPersistBuildConfig :: FilePath -> IO (Maybe LocalBuildInfo)
-- | -- dist/setup-config --localBuildInfoFile :: FilePath -> FilePath getInstalledPackages :: Verbosity -> Compiler -> PackageDB -> ProgramConfiguration -> IO (Maybe (PackageIndex InstalledPackageInfo)) -- | Test for a package dependency and record the version we have -- installed. configDependency :: Verbosity -> PackageIndex InstalledPackageInfo -> Dependency -> IO PackageIdentifier configCompiler :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> Verbosity -> IO (Compiler, ProgramConfiguration) configCompilerAux :: ConfigFlags -> IO (Compiler, ProgramConfiguration) -- | Makes a BuildInfo from C compiler and linker flags. -- -- This can be used with the output from configuration programs like -- pkg-config and similar package-specific programs like mysql-config, -- freealut-config etc. For example: -- --
-- ccflags <- rawSystemProgramStdoutConf verbosity prog conf ["--cflags"] -- ldflags <- rawSystemProgramStdoutConf verbosity prog conf ["--libs"] -- return (ccldOptionsBuildInfo (words ccflags) (words ldflags)) --ccLdOptionsBuildInfo :: [String] -> [String] -> BuildInfo tryGetConfigStateFile :: (Read a) => FilePath -> IO (Either String a) -- | This handles the sdist command. The module exports an -- sdist action but also some of the phases that make it up so -- that other tools can use just the bits they need. In particular the -- preparation of the tree of files to go into the source tarball is -- separated from actually building the source tarball. -- -- The createArchive action uses the external tar program -- and assumes that it accepts the -z flag. Neither of these -- assumptions are valid on Windows. The sdist action now also -- does some distribution QA checks. module Distribution.Simple.SrcDist -- | Create a source distribution. sdist :: PackageDescription -> Maybe LocalBuildInfo -> SDistFlags -> (FilePath -> FilePath) -> [PPSuffixHandler] -> IO () printPackageProblems :: Verbosity -> PackageDescription -> IO () -- | Prepare a directory tree of source files. prepareTree :: Verbosity -> PackageDescription -> Maybe LocalBuildInfo -> FilePath -> FilePath -> [PPSuffixHandler] -> IO FilePath -- | Create an archive from a tree of source files, and clean up the tree. createArchive :: Verbosity -> PackageDescription -> Maybe LocalBuildInfo -> FilePath -> FilePath -> IO FilePath -- | Prepare a directory tree of source files for a snapshot version. It is -- expected that the appropriate snapshot version has already been set in -- the package description, eg using snapshotPackage or -- snapshotVersion. prepareSnapshotTree :: Verbosity -> PackageDescription -> Maybe LocalBuildInfo -> FilePath -> FilePath -> [PPSuffixHandler] -> IO FilePath -- | Modifies a PackageDescription by appending a snapshot number -- corresponding to the given date. snapshotPackage :: CalendarTime -> PackageDescription -> PackageDescription -- | Modifies a Version by appending a snapshot number corresponding -- to the given date. snapshotVersion :: CalendarTime -> Version -> Version -- | Given a date produce a corresponding integer representation. For -- example given a date 18032008 produce the number -- 20080318. dateToSnapshotNumber :: CalendarTime -> Int -- | This defines the API that Setup.hs scripts can use to -- customise the way the build works. This module just defines the -- UserHooks type. The predefined sets of hooks that implement the -- Simple, Make and Configure build systems -- are defined in Distribution.Simple. The UserHooks is a -- big record of functions. There are 3 for each action, a pre, post and -- the action itself. There are few other miscellaneous hooks, ones to -- extend the set of programs and preprocessors and one to override the -- function used to read the .cabal file. -- -- This hooks type is widely agreed to not be the right solution. Partly -- this is because changes to it usually break custom Setup.hs -- files and yet many internal code changes do require changes to the -- hooks. For example we cannot pass any extra parameters to most of the -- functions that implement the various phases because it would involve -- changing the types of the corresponding hook. At some point it will -- have to be replaced. module Distribution.Simple.UserHooks -- | Hooks allow authors to add specific functionality before and after a -- command is run, and also to specify additional preprocessors. -- --