Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
8bccb4d6
Commit
8bccb4d6
authored
Nov 01, 2016
by
John Ericson
Committed by
GitHub
Nov 01, 2016
Browse files
Merge pull request #4067 from Ericson2314/dep-types
Make more dependency types
parents
3007be18
b63ebe1b
Changes
25
Hide whitespace changes
Inline
Side-by-side
Cabal/Cabal.cabal
View file @
8bccb4d6
...
...
@@ -143,6 +143,7 @@ library
Distribution.Make
Distribution.ModuleName
Distribution.Package
Distribution.Package.TextClass
Distribution.PackageDescription
Distribution.PackageDescription.Check
Distribution.PackageDescription.Configuration
...
...
Cabal/Distribution/Backpack/ComponentsGraph.hs
View file @
8bccb4d6
...
...
@@ -52,8 +52,8 @@ toComponentsGraph enabled pkg_descr =
-- The dependencies for the given component
componentDeps
component
=
[
CExeName
toolname
|
Dependency
pkg
name
_
<-
buildTools
bi
,
let
toolname
=
packageNameTo
UnqualComponentName
pkg
name
|
LegacyExe
Dependency
name
_
<-
buildTools
bi
,
let
toolname
=
mk
UnqualComponentName
name
,
toolname
`
elem
`
map
exeName
(
executables
pkg_descr
)
]
++
[
if
pkgname
==
packageName
pkg_descr
...
...
Cabal/Distribution/Backpack/ConfiguredComponent.hs
View file @
8bccb4d6
...
...
@@ -140,9 +140,8 @@ toConfiguredComponent pkg_descr this_cid
|
otherwise
=
Map
.
toList
external_lib_map
exe_deps
=
[
cid
|
Dependency
pkgname
_
<-
buildTools
bi
,
let
name
=
packageNameToUnqualComponentName
pkgname
,
Just
cid
<-
[
Map
.
lookup
name
exe_map
]
]
|
LegacyExeDependency
name
_
<-
buildTools
bi
,
Just
cid
<-
[
Map
.
lookup
(
mkUnqualComponentName
name
)
exe_map
]
]
-- | Also computes the 'ComponentId', and sets cc_public if necessary.
-- This is Cabal-only; cabal-install won't use this.
...
...
Cabal/Distribution/InstalledPackageInfo.hs
View file @
8bccb4d6
...
...
@@ -49,6 +49,7 @@ import Distribution.Compat.Prelude
import
Distribution.ParseUtils
import
Distribution.License
import
Distribution.Package
hiding
(
installedUnitId
,
installedPackageId
)
import
Distribution.Package.TextClass
()
import
Distribution.Backpack
import
qualified
Distribution.Package
as
Package
import
Distribution.ModuleName
...
...
Cabal/Distribution/Package.hs
View file @
8bccb4d6
...
...
@@ -23,6 +23,7 @@ module Distribution.Package (
packageNameToUnqualComponentName
,
unqualComponentNameToPackageName
,
PackageIdentifier
(
..
),
PackageId
,
PkgconfigName
,
unPkgconfigName
,
mkPkgconfigName
,
-- * Package keys/installed package IDs (used for linker symbols)
ComponentId
,
unComponentId
,
mkComponentId
,
...
...
@@ -43,6 +44,8 @@ module Distribution.Package (
-- * Package source dependencies
Dependency
(
..
),
LegacyExeDependency
(
..
),
PkgconfigDependency
(
..
),
thisPackageVersion
,
notThisPackageVersion
,
simplifyDependency
,
...
...
@@ -59,7 +62,7 @@ import Distribution.Compat.Prelude
import
Distribution.Utils.ShortText
import
Distribution.Version
(
Version
,
VersionRange
,
anyVersion
,
thisVersion
(
Version
,
VersionRange
,
thisVersion
,
notThisVersion
,
simplifyVersionRange
,
nullVersion
)
...
...
@@ -69,7 +72,7 @@ import Distribution.Compat.ReadP
import
Distribution.Text
import
Distribution.ModuleName
import
Text.PrettyPrint
(
(
<+>
),
text
)
import
Text.PrettyPrint
(
text
)
-- | An unqualified component name, for any kind of component.
--
...
...
@@ -175,6 +178,44 @@ instance Text PackageName where
instance
NFData
PackageName
where
rnf
(
PackageName
pkg
)
=
rnf
pkg
-- | A pkg-config library name
--
-- This is parsed as any valid argument to the pkg-config utility.
--
-- @since 2.0
newtype
PkgconfigName
=
PkgconfigName
ShortText
deriving
(
Generic
,
Read
,
Show
,
Eq
,
Ord
,
Typeable
,
Data
)
-- | Convert 'PkgconfigName' to 'String'
--
-- @since 2.0
unPkgconfigName
::
PkgconfigName
->
String
unPkgconfigName
(
PkgconfigName
s
)
=
fromShortText
s
-- | Construct a 'PkgconfigName' from a 'String'
--
-- 'mkPkgconfigName' is the inverse to 'unPkgconfigName'
--
-- Note: No validations are performed to ensure that the resulting
-- 'PkgconfigName' is valid
--
-- @since 2.0
mkPkgconfigName
::
String
->
PkgconfigName
mkPkgconfigName
=
PkgconfigName
.
toShortText
instance
Binary
PkgconfigName
-- pkg-config allows versions and other letters in package names, eg
-- "gtk+-2.0" is a valid pkg-config package _name_. It then has a package
-- version number like 2.10.13
instance
Text
PkgconfigName
where
disp
=
Disp
.
text
.
unPkgconfigName
parse
=
mkPkgconfigName
<$>
munch1
(
\
c
->
isAlphaNum
c
||
c
`
elem
`
"+-._"
)
instance
NFData
PkgconfigName
where
rnf
(
PkgconfigName
pkg
)
=
rnf
pkg
-- | Type alias so we can use the shorter name PackageId.
type
PackageId
=
PackageIdentifier
...
...
@@ -354,19 +395,33 @@ mkLegacyUnitId = newSimpleUnitId . mkComponentId . display
data
Dependency
=
Dependency
PackageName
VersionRange
deriving
(
Generic
,
Read
,
Show
,
Eq
,
Typeable
,
Data
)
instance
Binary
Dependency
-- | Describes a legacy `build-tools`-style dependency on an executable
--
-- It is "legacy" because we do not know what the build-tool referred to. It
-- could refer to a pkg-config executable (PkgconfigName), or an internal
-- executable (UnqualComponentName). Thus the name is stringly typed.
--
-- @since 2.0
data
LegacyExeDependency
=
LegacyExeDependency
String
VersionRange
deriving
(
Generic
,
Read
,
Show
,
Eq
,
Typeable
,
Data
)
instance
Text
Dependency
where
disp
(
Dependency
name
ver
)
=
disp
name
<+>
disp
ver
-- | Describes a dependency on a pkg-config library
--
-- @since 2.0
data
PkgconfigDependency
=
PkgconfigDependency
PkgconfigName
VersionRange
deriving
(
Generic
,
Read
,
Show
,
Eq
,
Typeable
,
Data
)
parse
=
do
name
<-
parse
Parse
.
skipSpaces
ver
<-
parse
<++
return
anyVersion
Parse
.
skipSpaces
return
(
Dependency
name
ver
)
instance
Binary
Dependency
instance
Binary
LegacyExeDependency
instance
Binary
PkgconfigDependency
instance
NFData
Dependency
where
rnf
=
genericRnf
instance
NFData
LegacyExeDependency
where
rnf
=
genericRnf
instance
NFData
PkgconfigDependency
where
rnf
=
genericRnf
thisPackageVersion
::
PackageIdentifier
->
Dependency
thisPackageVersion
(
PackageIdentifier
n
v
)
=
...
...
Cabal/Distribution/Package/TextClass.hs
0 → 100644
View file @
8bccb4d6
-- | *Dependency Text instances moved from Distribution.Package
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
Distribution.Package.TextClass
()
where
import
Prelude
()
import
Distribution.Compat.Prelude
import
Distribution.Package
import
Distribution.ParseUtils
import
Distribution.Version
(
anyVersion
)
import
qualified
Distribution.Compat.ReadP
as
Parse
import
qualified
Text.PrettyPrint
as
Disp
import
Distribution.Compat.ReadP
import
Distribution.Text
import
Text.PrettyPrint
((
<+>
))
instance
Text
Dependency
where
disp
(
Dependency
name
ver
)
=
disp
name
<+>
disp
ver
parse
=
do
name
<-
parse
Parse
.
skipSpaces
ver
<-
parse
<++
return
anyVersion
Parse
.
skipSpaces
return
(
Dependency
name
ver
)
instance
Text
LegacyExeDependency
where
disp
(
LegacyExeDependency
name
ver
)
=
Disp
.
text
name
<+>
disp
ver
parse
=
do
name
<-
parseMaybeQuoted
parseBuildToolName
Parse
.
skipSpaces
ver
<-
parse
<++
return
anyVersion
Parse
.
skipSpaces
return
$
LegacyExeDependency
name
ver
where
-- like parsePackageName but accepts symbols in components
parseBuildToolName
::
Parse
.
ReadP
r
String
parseBuildToolName
=
do
ns
<-
sepBy1
component
(
Parse
.
char
'-'
)
return
(
intercalate
"-"
ns
)
where
component
=
do
cs
<-
munch1
(
\
c
->
isAlphaNum
c
||
c
==
'+'
||
c
==
'_'
)
if
all
isDigit
cs
then
pfail
else
return
cs
instance
Text
PkgconfigDependency
where
disp
(
PkgconfigDependency
name
ver
)
=
disp
name
<+>
disp
ver
parse
=
do
name
<-
parse
Parse
.
skipSpaces
ver
<-
parse
<++
return
anyVersion
Parse
.
skipSpaces
return
$
PkgconfigDependency
name
ver
Cabal/Distribution/PackageDescription/Parse.hs
View file @
8bccb4d6
...
...
@@ -55,6 +55,7 @@ import Distribution.ParseUtils hiding (parseFields)
import
Distribution.PackageDescription
import
Distribution.PackageDescription.Utils
import
Distribution.Package
import
Distribution.Package.TextClass
()
import
Distribution.ModuleName
import
Distribution.Version
import
Distribution.Verbosity
...
...
@@ -407,7 +408,7 @@ binfoFieldDescrs =
[
boolField
"buildable"
buildable
(
\
val
binfo
->
binfo
{
buildable
=
val
})
,
commaListField
"build-tools"
disp
parse
BuildTool
disp
parse
buildTools
(
\
xs
binfo
->
binfo
{
buildTools
=
xs
})
,
commaListFieldWithSep
vcat
"build-depends"
disp
parse
...
...
@@ -425,7 +426,7 @@ binfoFieldDescrs =
showToken
parseTokenQ'
ldOptions
(
\
val
binfo
->
binfo
{
ldOptions
=
val
})
,
commaListField
"pkgconfig-depends"
disp
parse
PkgconfigDependency
disp
parse
pkgconfigDepends
(
\
xs
binfo
->
binfo
{
pkgconfigDepends
=
xs
})
,
listField
"frameworks"
showToken
parseTokenQ
...
...
Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs
View file @
8bccb4d6
...
...
@@ -41,6 +41,7 @@ import qualified Distribution.Compat.Parsec as Parsec
import
Distribution.Compiler
(
CompilerFlavor
(
..
))
import
Distribution.ModuleName
(
ModuleName
)
import
Distribution.Package
import
Distribution.Package.TextClass
()
import
Distribution.PackageDescription
import
Distribution.Types.ForeignLib
import
Distribution.Parsec.Class
...
...
@@ -415,7 +416,7 @@ binfoFieldDescrs =
[
boolField
"buildable"
buildable
(
\
val
binfo
->
binfo
{
buildable
=
val
})
,
commaListField
"build-tools"
disp
parsec
BuildTool
disp
parsec
buildTools
(
\
xs
binfo
->
binfo
{
buildTools
=
xs
})
,
commaListFieldWithSep
vcat
"build-depends"
disp
parsec
...
...
@@ -433,7 +434,7 @@ binfoFieldDescrs =
showToken
parsecToken'
ldOptions
(
\
val
binfo
->
binfo
{
ldOptions
=
val
})
,
commaListField
"pkgconfig-depends"
disp
parsec
PkgconfigDependency
disp
parsec
pkgconfigDepends
(
\
xs
binfo
->
binfo
{
pkgconfigDepends
=
xs
})
,
listField
"frameworks"
showToken
parsecToken
...
...
Cabal/Distribution/ParseUtils.hs
View file @
8bccb4d6
...
...
@@ -19,6 +19,7 @@
-- This module is meant to be local-only to Distribution...
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE Rank2Types #-}
module
Distribution.ParseUtils
(
LineNo
,
PError
(
..
),
PWarning
(
..
),
locatedErrorMsg
,
syntaxError
,
warning
,
runP
,
runE
,
ParseResult
(
..
),
catchParseError
,
parseFail
,
showPWarning
,
...
...
@@ -27,14 +28,14 @@ module Distribution.ParseUtils (
showFields
,
showSingleNamedField
,
showSimpleSingleNamedField
,
parseFields
,
parseFieldsFlat
,
parseFilePathQ
,
parseTokenQ
,
parseTokenQ'
,
parseModuleNameQ
,
parseBuildTool
,
parsePkgconfigDependency
,
parseModuleNameQ
,
parseOptVersion
,
parsePackageNameQ
,
parseTestedWithQ
,
parseLicenseQ
,
parseLanguageQ
,
parseExtensionQ
,
parseSepList
,
parseCommaList
,
parseOptCommaList
,
showFilePath
,
showToken
,
showTestedWith
,
showFreeText
,
parseFreeText
,
field
,
simpleField
,
listField
,
listFieldWithSep
,
spaceListField
,
commaListField
,
commaListFieldWithSep
,
commaNewLineListField
,
optsField
,
liftField
,
boolField
,
parseQuoted
,
indentWith
,
optsField
,
liftField
,
boolField
,
parseQuoted
,
parseMaybeQuoted
,
indentWith
,
UnrecFieldParser
,
warnUnrec
,
ignoreUnrec
,
)
where
...
...
@@ -611,7 +612,7 @@ ifelse (f:fs) = do fs' <- ifelse fs
-- |parse a module name
parseModuleNameQ
::
ReadP
r
ModuleName
parseModuleNameQ
=
parseQuoted
parse
<++
parse
parseModuleNameQ
=
parse
Maybe
Quoted
parse
parseFilePathQ
::
ReadP
r
FilePath
parseFilePathQ
=
parseTokenQ
...
...
@@ -624,43 +625,16 @@ betweenSpaces act = do skipSpaces
skipSpaces
return
res
parseBuildTool
::
ReadP
r
Dependency
parseBuildTool
=
do
name
<-
parseBuildToolNameQ
ver
<-
betweenSpaces
$
parse
<++
return
anyVersion
return
$
Dependency
name
ver
parseBuildToolNameQ
::
ReadP
r
PackageName
parseBuildToolNameQ
=
parseQuoted
parseBuildToolName
<++
parseBuildToolName
-- like parsePackageName but accepts symbols in components
parseBuildToolName
::
ReadP
r
PackageName
parseBuildToolName
=
do
ns
<-
sepBy1
component
(
ReadP
.
char
'-'
)
return
(
mkPackageName
(
intercalate
"-"
ns
))
where
component
=
do
cs
<-
munch1
(
\
c
->
isAlphaNum
c
||
c
==
'+'
||
c
==
'_'
)
if
all
isDigit
cs
then
pfail
else
return
cs
-- pkg-config allows versions and other letters in package names,
-- eg "gtk+-2.0" is a valid pkg-config package _name_.
-- It then has a package version number like 2.10.13
parsePkgconfigDependency
::
ReadP
r
Dependency
parsePkgconfigDependency
=
do
name
<-
munch1
(
\
c
->
isAlphaNum
c
||
c
`
elem
`
"+-._"
)
ver
<-
betweenSpaces
$
parse
<++
return
anyVersion
return
$
Dependency
(
mkPackageName
name
)
ver
parsePackageNameQ
::
ReadP
r
PackageName
parsePackageNameQ
=
parseQuoted
parse
<++
parse
parsePackageNameQ
=
parse
Maybe
Quoted
parse
parseOptVersion
::
ReadP
r
Version
parseOptVersion
=
parseQuoted
ver
<++
ver
parseOptVersion
=
parse
Maybe
Quoted
ver
where
ver
::
ReadP
r
Version
ver
=
parse
<++
return
nullVersion
parseTestedWithQ
::
ReadP
r
(
CompilerFlavor
,
VersionRange
)
parseTestedWithQ
=
parseQuoted
tw
<++
tw
parseTestedWithQ
=
parse
Maybe
Quoted
tw
where
tw
::
ReadP
r
(
CompilerFlavor
,
VersionRange
)
tw
=
do
compiler
<-
parseCompilerFlavorCompat
...
...
@@ -668,7 +642,7 @@ parseTestedWithQ = parseQuoted tw <++ tw
return
(
compiler
,
version
)
parseLicenseQ
::
ReadP
r
License
parseLicenseQ
=
parseQuoted
parse
<++
parse
parseLicenseQ
=
parse
Maybe
Quoted
parse
-- urgh, we can't define optQuotes :: ReadP r a -> ReadP r a
-- because the "compat" version of ReadP isn't quite powerful enough. In
...
...
@@ -676,10 +650,10 @@ parseLicenseQ = parseQuoted parse <++ parse
-- Hence the trick above to make 'lic' polymorphic.
parseLanguageQ
::
ReadP
r
Language
parseLanguageQ
=
parseQuoted
parse
<++
parse
parseLanguageQ
=
parse
Maybe
Quoted
parse
parseExtensionQ
::
ReadP
r
Extension
parseExtensionQ
=
parseQuoted
parse
<++
parse
parseExtensionQ
=
parse
Maybe
Quoted
parse
parseHaskellString
::
ReadP
r
String
parseHaskellString
=
readS_to_P
reads
...
...
@@ -711,5 +685,8 @@ parseOptCommaList = parseSepList (optional (ReadP.char ','))
parseQuoted
::
ReadP
r
a
->
ReadP
r
a
parseQuoted
=
between
(
ReadP
.
char
'"'
)
(
ReadP
.
char
'"'
)
parseMaybeQuoted
::
(
forall
r
.
ReadP
r
a
)
->
ReadP
r'
a
parseMaybeQuoted
p
=
parseQuoted
p
<++
p
parseFreeText
::
ReadP
.
ReadP
s
String
parseFreeText
=
ReadP
.
munch
(
const
True
)
Cabal/Distribution/Parsec/Class.hs
View file @
8bccb4d6
...
...
@@ -5,8 +5,6 @@ module Distribution.Parsec.Class (
parsecWarning
,
-- * Utilities
parsecTestedWith
,
parsecPkgconfigDependency
,
parsecBuildTool
,
parsecToken
,
parsecToken'
,
parsecFilePath
,
...
...
@@ -35,8 +33,10 @@ import Distribution.ModuleName (ModuleName)
import
qualified
Distribution.ModuleName
as
ModuleName
import
Distribution.Package
(
Dependency
(
..
),
LegacyExeDependency
(
..
),
PkgconfigDependency
(
..
),
UnqualComponentName
,
mkUnqualComponentName
,
PackageName
,
mkPackageName
)
PackageName
,
mkPackageName
,
PkgconfigName
,
mkPkgconfigName
)
import
Distribution.System
(
Arch
(
..
),
ClassificationStrictness
(
..
),
OS
(
..
),
classifyArch
,
classifyOS
)
...
...
@@ -105,6 +105,9 @@ instance Parsec UnqualComponentName where
instance
Parsec
PackageName
where
parsec
=
mkPackageName
<$>
parsecUnqualComponentName
instance
Parsec
PkgconfigName
where
parsec
=
mkPkgconfigName
<$>
P
.
munch1
(
\
c
->
isAlphaNum
c
||
c
`
elem
`
"+-._"
)
instance
Parsec
ModuleName
where
parsec
=
ModuleName
.
fromComponents
<$>
P
.
sepBy1
component
(
P
.
char
'.'
)
where
...
...
@@ -130,6 +133,25 @@ instance Parsec Dependency where
ver
<-
parsec
<|>
pure
anyVersion
return
(
Dependency
name
ver
)
instance
Parsec
LegacyExeDependency
where
parsec
=
do
name
<-
parsecMaybeQuoted
nameP
P
.
spaces
verRange
<-
parsecMaybeQuoted
parsec
<|>
pure
anyVersion
pure
$
LegacyExeDependency
name
verRange
where
nameP
=
intercalate
"-"
<$>
P
.
sepBy1
component
(
P
.
char
'-'
)
component
=
do
cs
<-
P
.
munch1
(
\
c
->
isAlphaNum
c
||
c
==
'+'
||
c
==
'_'
)
if
all
isDigit
cs
then
fail
"invalid component"
else
return
cs
instance
Parsec
PkgconfigDependency
where
parsec
=
do
name
<-
parsec
P
.
spaces
verRange
<-
parsec
<|>
pure
anyVersion
pure
$
PkgconfigDependency
name
verRange
instance
Parsec
Version
where
parsec
=
mkVersion
<$>
P
.
sepBy1
P
.
integral
(
P
.
char
'.'
)
...
...
@@ -346,25 +368,6 @@ parsecTestedWith = do
ver
<-
parsec
<|>
pure
anyVersion
return
(
name
,
ver
)
parsecPkgconfigDependency
::
P
.
Stream
s
Identity
Char
=>
P
.
Parsec
s
[
PWarning
]
Dependency
parsecPkgconfigDependency
=
do
name
<-
P
.
munch1
(
\
c
->
isAlphaNum
c
||
c
`
elem
`
"+-._"
)
P
.
spaces
verRange
<-
parsec
<|>
pure
anyVersion
pure
$
Dependency
(
mkPackageName
name
)
verRange
parsecBuildTool
::
P
.
Stream
s
Identity
Char
=>
P
.
Parsec
s
[
PWarning
]
Dependency
parsecBuildTool
=
do
name
<-
parsecMaybeQuoted
nameP
P
.
spaces
verRange
<-
parsec
<|>
pure
anyVersion
pure
$
Dependency
(
mkPackageName
name
)
verRange
where
nameP
=
intercalate
"-"
<$>
P
.
sepBy1
component
(
P
.
char
'-'
)
component
=
do
cs
<-
P
.
munch1
(
\
c
->
isAlphaNum
c
||
c
==
'+'
||
c
==
'_'
)
if
all
isDigit
cs
then
fail
"invalid component"
else
return
cs
parsecToken
::
P
.
Stream
s
Identity
Char
=>
P
.
Parsec
s
[
PWarning
]
String
parsecToken
=
parsecHaskellString
<|>
(
P
.
munch1
(
\
x
->
not
(
isSpace
x
)
&&
x
/=
','
)
P
.<?>
"identifier"
)
...
...
Cabal/Distribution/Simple/Build.hs
View file @
8bccb4d6
...
...
@@ -538,7 +538,7 @@ addInternalBuildTools pkg lbi bi progs =
internalExeNames
=
map
(
unUnqualComponentName
.
exeName
)
(
executables
pkg
)
buildToolNames
=
map
buildToolName
(
buildTools
bi
)
where
buildToolName
(
Dependency
pname
_
)
=
unPackageName
pname
buildToolName
(
LegacyExe
Dependency
pname
_
)
=
pname
-- TODO: build separate libs in separate dirs so that we can build
...
...
Cabal/Distribution/Simple/Configure.hs
View file @
8bccb4d6
...
...
@@ -565,10 +565,10 @@ configure (pkg_descr0', pbi) cfg = do
[
buildTool
|
let
exeNames
=
map
(
unUnqualComponentName
.
exeName
)
(
executables
pkg_descr
)
,
bi
<-
enabledBuildInfos
pkg_descr
enabled
,
buildTool
@
(
Dependency
toolPName
reqVer
)
,
buildTool
@
(
LegacyExe
Dependency
toolPName
reqVer
)
<-
buildTools
bi
,
let
isInternal
=
unPackageName
toolPName
`
elem
`
exeNames
toolPName
`
elem
`
exeNames
-- we assume all internal build-tools are
-- versioned with the package:
&&
packageVersion
pkg_descr
`
withinRange
`
reqVer
...
...
@@ -1364,7 +1364,7 @@ combinedConstraints constraints dependencies installedPackages = do
-- -----------------------------------------------------------------------------
-- Configuring program dependencies
configureRequiredPrograms
::
Verbosity
->
[
Dependency
]
->
ProgramDb
configureRequiredPrograms
::
Verbosity
->
[
LegacyExe
Dependency
]
->
ProgramDb
->
IO
ProgramDb
configureRequiredPrograms
verbosity
deps
progdb
=
foldM
(
configureRequiredProgram
verbosity
)
progdb
deps
...
...
@@ -1375,10 +1375,10 @@ configureRequiredPrograms verbosity deps progdb =
-- known (exists in the input 'ProgramDb'), we will make sure that the
-- program matches the required version; otherwise we will accept
-- any version of the program and assume that it is a simpleProgram.
configureRequiredProgram
::
Verbosity
->
ProgramDb
->
Dependency
configureRequiredProgram
::
Verbosity
->
ProgramDb
->
LegacyExe
Dependency
->
IO
ProgramDb
configureRequiredProgram
verbosity
progdb
(
Dependency
prog
Pkg
Name
verRange
)
=
(
LegacyExe
Dependency
progName
verRange
)
=
case
lookupKnownProgram
progName
progdb
of
Nothing
->
-- Try to configure it as a 'simpleProgram' automatically
...
...
@@ -1428,8 +1428,6 @@ configureRequiredProgram verbosity progdb
|
otherwise
->
do
(
_
,
_
,
progdb'
)
<-
requireProgramVersion
verbosity
prog
verRange
progdb
return
progdb'
where
progName
=
unPackageName
progPkgName
-- -----------------------------------------------------------------------------
-- Configuring pkg-config package dependencies
...
...
@@ -1459,7 +1457,7 @@ configurePkgconfigPackages verbosity pkg_descr progdb enabled
pkgconfig
=
getDbProgramOutput
(
lessVerbose
verbosity
)
pkgConfigProgram
progdb
requirePkg
dep
@
(
Dependency
pkgn
range
)
=
do
requirePkg
dep
@
(
Pkgconfig
Dependency
pkgn
range
)
=
do
version
<-
pkgconfig
[
"--modversion"
,
pkg
]
`
catchIO
`
(
\
_
->
die
notFound
)
`
catchExit
`
(
\
_
->
die
notFound
)
...
...
@@ -1482,7 +1480,7 @@ configurePkgconfigPackages verbosity pkg_descr progdb enabled
|
isAnyVersion
range
=
""
|
otherwise
=
" version "
++
display
range
pkg
=
unP
ackage
Name
pkgn
pkg
=
unP
kgconfig
Name
pkgn
-- Adds pkgconfig dependencies to the build info for a component
addPkgConfigBI
compBI
setCompBI
comp
=
do
...
...
@@ -1505,10 +1503,10 @@ configurePkgconfigPackages verbosity pkg_descr progdb enabled
addPkgConfigBIBench
=
addPkgConfigBI
benchmarkBuildInfo
$
\
bench
bi
->
bench
{
benchmarkBuildInfo
=
bi
}
pkgconfigBuildInfo
::
[
Dependency
]
->
NoCallStackIO
BuildInfo
pkgconfigBuildInfo
::
[
Pkgconfig
Dependency
]
->
NoCallStackIO
BuildInfo
pkgconfigBuildInfo
[]
=
return
mempty
pkgconfigBuildInfo
pkgdeps
=
do
let
pkgs
=
nub
[
display
pkg
|
Dependency
pkg
_
<-
pkgdeps
]
let
pkgs
=
nub
[
display
pkg
|
Pkgconfig
Dependency
pkg
_
<-
pkgdeps
]
ccflags
<-
pkgconfig
(
"--cflags"
:
pkgs
)
ldflags
<-
pkgconfig
(
"--libs"
:
pkgs
)
return
(
ccLdOptionsBuildInfo
(
words
ccflags
)
(
words
ldflags
))
...
...
Cabal/Distribution/Simple/Setup.hs
View file @
8bccb4d6
...
...
@@ -85,6 +85,7 @@ import qualified Distribution.Compat.ReadP as Parse
import
qualified
Text.PrettyPrint
as
Disp
import
Distribution.ModuleName
import
Distribution.Package
import
Distribution.Package.TextClass
()
import
Distribution.PackageDescription
hiding
(
Flag
)
import
Distribution.Simple.Command
hiding
(
boolOpt
,
boolOpt'
)
import
qualified
Distribution.Simple.Command
as
Command
...
...
Cabal/Distribution/Types/BuildInfo.hs
View file @
8bccb4d6
...
...
@@ -27,11 +27,11 @@ import Language.Haskell.Extension
-- Consider refactoring into executable and library versions.
data
BuildInfo
=
BuildInfo
{
buildable
::
Bool
,
-- ^ component is buildable here
buildTools
::
[
Dependency
],
-- ^ tools needed to build this bit
buildTools
::
[
LegacyExe
Dependency
],
-- ^ tools needed to build this bit
cppOptions
::
[
String
],
-- ^ options for pre-processing Haskell code
ccOptions
::
[
String
],
-- ^ options for C compiler
ldOptions
::
[
String
],
-- ^ options for linker
pkgconfigDepends
::
[
Dependency
],
-- ^ pkg-config packages that are used
pkgconfigDepends
::
[
Pkgconfig
Dependency
],
-- ^ pkg-config packages that are used
frameworks
::
[
String
],
-- ^support frameworks for Mac OS X
extraFrameworkDirs
::
[
String
],
-- ^ extra locations to find frameworks.
cSources
::
[
FilePath
],
...
...
cabal-install/Distribution/Client/PackageHash.hs
View file @
8bccb4d6
...
...
@@ -29,7 +29,8 @@ module Distribution.Client.PackageHash (
)
where
import
Distribution.Package
(
PackageId
,
PackageName
,
PackageIdentifier
(
..
),
mkComponentId
)
(
PackageId
,
PackageIdentifier
(
..
),
mkComponentId
,
PkgconfigName
)
import
Distribution.System
(
Platform
,
OS
(
Windows
),
buildOS
)
import
Distribution.PackageDescription
...
...
@@ -139,7 +140,7 @@ data PackageHashInputs = PackageHashInputs {
pkgHashPkgId
::
PackageId
,
pkgHashComponent
::
Maybe
CD
.
Component
,
pkgHashSourceHash
::
PackageSourceHash
,
pkgHashPkgConfigDeps
::
Set
(
P
ackage
Name
,
Maybe
Version
),
pkgHashPkgConfigDeps
::
Set
(
P
kgconfig
Name
,
Maybe
Version
),
pkgHashDirectDeps
::
Set
InstalledPackageId
,
pkgHashOtherConfig
::
PackageHashConfigInputs
}
...
...
cabal-install/Distribution/Client/ProjectPlanning.hs
View file @
8bccb4d6
...
...
@@ -1270,7 +1270,7 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
++
display
pn
++
" from "
++
display
(
elabPkgSourceId
elab1
))
(
pkgConfigDbPkgVersion
pkgConfigDB
pn
))
|
Dependency
pn
_
<-
PD
.
pkgconfigDepends
bi
]
|
Pkgconfig
Dependency
pn
_
<-
PD
.
pkgconfigDepends
bi
]
compSetupDependencies
=
concatMap
(
elaborateLibSolverId
mapDep
)
(
CD
.
setupDeps
deps0
)
...
...
@@ -1429,8 +1429,8 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
$
[
(
pn
,
fromMaybe
(
error
$
"pkgPkgConfigDependencies: impossible! "
++
display
pn
++
" from "
++
display
pkgid
)
(
pkgConfigDbPkgVersion
pkgConfigDB
pn
))
|
Dependency
pn
_
<-
concatMap
PD
.
pkgconfigDepends