Commit aed0650f authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Add a pkgconfig-depends: field to the .cabal file

parent 0d9583ca
......@@ -562,6 +562,7 @@ data BuildInfo = BuildInfo {
buildTools :: [Dependency], -- ^ tools needed to build this bit
ccOptions :: [String], -- ^ options for C compiler
ldOptions :: [String], -- ^ options for linker
pkgconfigDepends :: [Dependency], -- ^ pkg-config packages that are used
frameworks :: [String], -- ^support frameworks for Mac OS X
cSources :: [FilePath],
hsSourceDirs :: [FilePath], -- ^ where to look for the haskell module hierarchy
......@@ -584,6 +585,7 @@ nullBuildInfo = BuildInfo {
buildTools = [],
ccOptions = [],
ldOptions = [],
pkgconfigDepends = [],
frameworks = [],
cSources = [],
hsSourceDirs = [],
......@@ -648,6 +650,9 @@ binfoFieldDescrs =
, listField "ld-options"
showToken parseTokenQ
ldOptions (\val binfo -> binfo{ldOptions=val})
, commaListField "pkgconfig-depends"
showDependency parsePkgconfigDependency
pkgconfigDepends (\xs binfo -> binfo{pkgconfigDepends=xs})
, listField "frameworks"
showToken parseTokenQ
frameworks (\val binfo -> binfo{frameworks=val})
......@@ -757,6 +762,7 @@ unionBuildInfo b1 b2
buildTools = combine buildTools,
ccOptions = combine ccOptions,
ldOptions = combine ldOptions,
pkgconfigDepends = combine pkgconfigDepends,
frameworks = combine frameworks,
cSources = combine cSources,
hsSourceDirs = combine hsSourceDirs,
......
......@@ -50,8 +50,8 @@ module Distribution.ParseUtils (
Field(..), fName, lineNo,
FieldDescr(..), readFields,
parseFilePathQ, parseTokenQ,
parseModuleNameQ, parseDependency, parseOptVersion,
parsePackageNameQ, parseVersionRangeQ,
parseModuleNameQ, parseDependency, parsePkgconfigDependency,
parseOptVersion, parsePackageNameQ, parseVersionRangeQ,
parseTestedWithQ, parseLicenseQ, parseExtensionQ,
parseSepList, parseCommaList, parseOptCommaList,
showFilePath, showToken, showTestedWith, showDependency, showFreeText,
......@@ -415,6 +415,16 @@ parseDependency = do name <- parsePackageNameQ
skipSpaces
return $ Dependency name ver
-- 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` "+-._")
skipSpaces
ver <- parseVersionRangeQ <++ return AnyVersion
skipSpaces
return $ Dependency name ver
parsePackageNameQ :: ReadP r String
parsePackageNameQ = parseQuoted parsePackageName <++ parsePackageName
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment