Cabal-2.0.1.0: A framework for packaging Haskell software

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

Distribution.Simple.LocalBuildInfo

Contents

Description

Once a package has been configured we have resolved conditionals and dependencies, configured the compiler and other needed external programs. The LocalBuildInfo is used to hold all this information. It holds the install dirs, the compiler, the exact package dependencies, the configured programs, the package database to use and a bunch of miscellaneous configure flags. It gets saved and reloaded from a file (dist/setup-config). It gets passed in to very many subsequent build actions.

Synopsis

Documentation

data LocalBuildInfo Source #

Data cached after configuration step. See also ConfigFlags.

Constructors

LocalBuildInfo 

Fields

Instances

Read LocalBuildInfo Source # 
Show LocalBuildInfo Source # 
Generic LocalBuildInfo Source # 

Associated Types

type Rep LocalBuildInfo :: * -> * #

Binary LocalBuildInfo Source # 
type Rep LocalBuildInfo Source # 
type Rep LocalBuildInfo = D1 (MetaData "LocalBuildInfo" "Distribution.Types.LocalBuildInfo" "Cabal-2.0.1.0-Fpcf4XP791MK0bLoYSsg8W" False) (C1 (MetaCons "LocalBuildInfo" PrefixI True) ((:*:) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configFlags") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ConfigFlags)) (S1 (MetaSel (Just Symbol "flagAssignment") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FlagAssignment))) ((:*:) (S1 (MetaSel (Just Symbol "componentEnabledSpec") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentRequestedSpec)) (S1 (MetaSel (Just Symbol "extraConfigArgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String])))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "installDirTemplates") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 InstallDirTemplates)) (S1 (MetaSel (Just Symbol "compiler") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Compiler))) ((:*:) (S1 (MetaSel (Just Symbol "hostPlatform") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Platform)) (S1 (MetaSel (Just Symbol "buildDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FilePath))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentGraph") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Graph ComponentLocalBuildInfo))) (S1 (MetaSel (Just Symbol "componentNameMap") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map ComponentName [ComponentLocalBuildInfo])))) ((:*:) (S1 (MetaSel (Just Symbol "installedPkgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 InstalledPackageIndex)) (S1 (MetaSel (Just Symbol "pkgDescrFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "localPkgDescr") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageDescription)) (S1 (MetaSel (Just Symbol "withPrograms") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ProgramDb))) ((:*:) (S1 (MetaSel (Just Symbol "withPackageDB") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageDBStack)) (S1 (MetaSel (Just Symbol "withVanillaLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))))) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "withProfLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "withSharedLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) ((:*:) (S1 (MetaSel (Just Symbol "withDynExe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "withProfExe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "withProfLibDetail") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ProfDetailLevel)) (S1 (MetaSel (Just Symbol "withProfExeDetail") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ProfDetailLevel))) ((:*:) (S1 (MetaSel (Just Symbol "withOptimization") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 OptimisationLevel)) (S1 (MetaSel (Just Symbol "withDebugInfo") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 DebugInfoLevel))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "withGHCiLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "splitObjs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) ((:*:) (S1 (MetaSel (Just Symbol "stripExes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "stripLibs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "exeCoverage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "libCoverage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) ((:*:) (S1 (MetaSel (Just Symbol "progPrefix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PathTemplate)) ((:*:) (S1 (MetaSel (Just Symbol "progSuffix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PathTemplate)) (S1 (MetaSel (Just Symbol "relocatable") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))))))))

externalPackageDeps :: LocalBuildInfo -> [(UnitId, MungedPackageId)] Source #

Deprecated: You almost certainly don't want this function, which agglomerates the dependencies of ALL enabled components. If you're using this to write out information on your dependencies, read off the dependencies directly from the actual component in question. To be removed in Cabal 2.2

External package dependencies for the package as a whole. This is the union of the individual componentPackageDeps, less any internal deps.

localComponentId :: LocalBuildInfo -> ComponentId Source #

Extract the ComponentId from the public library component of a LocalBuildInfo if it exists, or make a fake component ID based on the package ID.

localUnitId :: LocalBuildInfo -> UnitId Source #

Extract the UnitId from the library component of a LocalBuildInfo if it exists, or make a fake unit ID based on the package ID.

localCompatPackageKey :: LocalBuildInfo -> String Source #

Extract the compatibility package key from the public library component of a LocalBuildInfo if it exists, or make a fake package key based on the package ID.

Buildable package components

data ComponentName Source #

Instances

Eq ComponentName Source # 
Ord ComponentName Source # 
Read ComponentName Source # 
Show ComponentName Source # 
Generic ComponentName Source # 

Associated Types

type Rep ComponentName :: * -> * #

Binary ComponentName Source # 
Text ComponentName Source # 
type Rep ComponentName Source # 

componentNameString :: ComponentName -> Maybe UnqualComponentName Source #

This gets the underlying unqualified component name. In fact, it is guaranteed to uniquely identify a component, returning Nothing if the ComponentName was for the public library.

data ComponentLocalBuildInfo Source #

The first five fields are common across all algebraic variants.

Constructors

LibComponentLocalBuildInfo 

Fields

FLibComponentLocalBuildInfo 

Fields

ExeComponentLocalBuildInfo 

Fields

TestComponentLocalBuildInfo 

Fields

BenchComponentLocalBuildInfo 

Fields

Instances

Read ComponentLocalBuildInfo Source # 
Show ComponentLocalBuildInfo Source # 
Generic ComponentLocalBuildInfo Source # 
Binary ComponentLocalBuildInfo Source # 
IsNode ComponentLocalBuildInfo Source # 
type Rep ComponentLocalBuildInfo Source # 
type Rep ComponentLocalBuildInfo = D1 (MetaData "ComponentLocalBuildInfo" "Distribution.Types.ComponentLocalBuildInfo" "Cabal-2.0.1.0-Fpcf4XP791MK0bLoYSsg8W" False) ((:+:) ((:+:) (C1 (MetaCons "LibComponentLocalBuildInfo" PrefixI True) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentLocalName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentName)) ((:*:) (S1 (MetaSel (Just Symbol "componentComponentId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentId)) (S1 (MetaSel (Just Symbol "componentUnitId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UnitId)))) ((:*:) (S1 (MetaSel (Just Symbol "componentIsIndefinite_") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) ((:*:) (S1 (MetaSel (Just Symbol "componentInstantiatedWith") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(ModuleName, OpenModule)])) (S1 (MetaSel (Just Symbol "componentPackageDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(UnitId, MungedPackageId)]))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentIncludes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(OpenUnitId, ModuleRenaming)])) ((:*:) (S1 (MetaSel (Just Symbol "componentExeDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])) (S1 (MetaSel (Just Symbol "componentInternalDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentCompatPackageKey") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) (S1 (MetaSel (Just Symbol "componentCompatPackageName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 MungedPackageName))) ((:*:) (S1 (MetaSel (Just Symbol "componentExposedModules") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [ExposedModule])) (S1 (MetaSel (Just Symbol "componentIsPublic") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))))))) (C1 (MetaCons "FLibComponentLocalBuildInfo" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentLocalName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentName)) ((:*:) (S1 (MetaSel (Just Symbol "componentComponentId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentId)) (S1 (MetaSel (Just Symbol "componentUnitId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UnitId)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentPackageDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(UnitId, MungedPackageId)])) (S1 (MetaSel (Just Symbol "componentIncludes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(OpenUnitId, ModuleRenaming)]))) ((:*:) (S1 (MetaSel (Just Symbol "componentExeDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])) (S1 (MetaSel (Just Symbol "componentInternalDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId]))))))) ((:+:) (C1 (MetaCons "ExeComponentLocalBuildInfo" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentLocalName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentName)) ((:*:) (S1 (MetaSel (Just Symbol "componentComponentId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentId)) (S1 (MetaSel (Just Symbol "componentUnitId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UnitId)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentPackageDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(UnitId, MungedPackageId)])) (S1 (MetaSel (Just Symbol "componentIncludes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(OpenUnitId, ModuleRenaming)]))) ((:*:) (S1 (MetaSel (Just Symbol "componentExeDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])) (S1 (MetaSel (Just Symbol "componentInternalDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])))))) ((:+:) (C1 (MetaCons "TestComponentLocalBuildInfo" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentLocalName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentName)) ((:*:) (S1 (MetaSel (Just Symbol "componentComponentId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentId)) (S1 (MetaSel (Just Symbol "componentUnitId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UnitId)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentPackageDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(UnitId, MungedPackageId)])) (S1 (MetaSel (Just Symbol "componentIncludes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(OpenUnitId, ModuleRenaming)]))) ((:*:) (S1 (MetaSel (Just Symbol "componentExeDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])) (S1 (MetaSel (Just Symbol "componentInternalDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])))))) (C1 (MetaCons "BenchComponentLocalBuildInfo" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentLocalName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentName)) ((:*:) (S1 (MetaSel (Just Symbol "componentComponentId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentId)) (S1 (MetaSel (Just Symbol "componentUnitId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UnitId)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "componentPackageDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(UnitId, MungedPackageId)])) (S1 (MetaSel (Just Symbol "componentIncludes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(OpenUnitId, ModuleRenaming)]))) ((:*:) (S1 (MetaSel (Just Symbol "componentExeDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])) (S1 (MetaSel (Just Symbol "componentInternalDeps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [UnitId])))))))))
type Key ComponentLocalBuildInfo Source # 

foldComponent :: (Library -> a) -> (ForeignLib -> a) -> (Executable -> a) -> (TestSuite -> a) -> (Benchmark -> a) -> Component -> a Source #

componentBuildable :: Component -> Bool Source #

Is a component buildable (i.e., not marked with buildable: False)? See also this note in Distribution.Types.ComponentRequestedSpec.

Since: 2.0.0.2

pkgComponents :: PackageDescription -> [Component] Source #

All the components in the package.

pkgBuildableComponents :: PackageDescription -> [Component] Source #

A list of all components in the package that are buildable, i.e., were not marked with buildable: False. This does NOT indicate if we are actually going to build the component, see enabledComponents instead.

Since: 2.0.0.2

getComponentLocalBuildInfo :: LocalBuildInfo -> ComponentName -> ComponentLocalBuildInfo Source #

Deprecated: This function is not well-defined, because a ComponentName does not uniquely identify a ComponentLocalBuildInfo. If you have a TargetInfo, you should use targetCLBI to get the ComponentLocalBuildInfo. Otherwise, use componentNameTargets to get all possible ComponentLocalBuildInfos. This will be removed in Cabal 2.2.

componentsInBuildOrder :: LocalBuildInfo -> [ComponentName] -> [ComponentLocalBuildInfo] Source #

Deprecated: You've got TargetInfo right? Use neededTargetsInBuildOrder on the UnitIds you can nodeKey out.

depLibraryPaths Source #

Arguments

:: Bool

Building for inplace?

-> Bool

Generate prefix-relative library paths

-> LocalBuildInfo 
-> ComponentLocalBuildInfo

Component that is being built

-> NoCallStackIO [FilePath] 

Determine the directories containing the dynamic libraries of the transitive dependencies of the component we are building.

When wanted, and possible, returns paths relative to the installDirs prefix

allLibModules :: Library -> ComponentLocalBuildInfo -> [ModuleName] Source #

Get all module names that needed to be built by GHC; i.e., all of these ModuleNames have interface files associated with them that need to be installed.

withAllComponentsInBuildOrder :: PackageDescription -> LocalBuildInfo -> (Component -> ComponentLocalBuildInfo -> IO ()) -> IO () Source #

Perform the action on each buildable Library or Executable (Component) in the PackageDescription, subject to the build order specified by the compBuildOrder field of the given LocalBuildInfo

withComponentsInBuildOrder :: PackageDescription -> LocalBuildInfo -> [ComponentName] -> (Component -> ComponentLocalBuildInfo -> IO ()) -> IO () Source #

Deprecated: You have got a TargetInfo right? Use withNeededTargetsInBuildOrder on the UnitIds you can nodeKey out.

withComponentsLBI :: PackageDescription -> LocalBuildInfo -> (Component -> ComponentLocalBuildInfo -> IO ()) -> IO () Source #

Deprecated: Use withAllComponentsInBuildOrder

withLibLBI :: PackageDescription -> LocalBuildInfo -> (Library -> ComponentLocalBuildInfo -> IO ()) -> IO () Source #

Perform the action on each enabled library in the package description with the ComponentLocalBuildInfo.

withExeLBI :: PackageDescription -> LocalBuildInfo -> (Executable -> ComponentLocalBuildInfo -> IO ()) -> IO () Source #

Perform the action on each enabled Executable in the package description. Extended version of withExe that also gives corresponding build info.

withBenchLBI :: PackageDescription -> LocalBuildInfo -> (Benchmark -> ComponentLocalBuildInfo -> IO ()) -> IO () Source #

Perform the action on each enabled Benchmark in the package description.

Installation directories

absoluteInstallDirs :: PackageDescription -> LocalBuildInfo -> CopyDest -> InstallDirs FilePath Source #

Backwards compatibility function which computes the InstallDirs assuming that $libname points to the public library (or some fake package identifier if there is no public library.) IF AT ALL POSSIBLE, please use absoluteComponentInstallDirs instead.

prefixRelativeInstallDirs :: PackageId -> LocalBuildInfo -> InstallDirs (Maybe FilePath) Source #

Backwards compatibility function which computes the InstallDirs assuming that $libname points to the public library (or some fake package identifier if there is no public library.) IF AT ALL POSSIBLE, please use prefixRelativeComponentInstallDirs instead.