make LTS branch pre-releases
[cabal.git] / Cabal-syntax / src / Distribution / Types / PkgconfigDependency.hs
blob695d3a3a184d1c6a25016f109360808a243ee1b3
1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE DeriveGeneric #-}
4 module Distribution.Types.PkgconfigDependency
5 ( PkgconfigDependency (..)
6 ) where
8 import Distribution.Compat.Prelude
9 import Prelude ()
11 import Distribution.Types.PkgconfigName
12 import Distribution.Types.PkgconfigVersionRange
14 import Distribution.Parsec
15 import Distribution.Pretty
17 import qualified Distribution.Compat.CharParsing as P
19 -- | Describes a dependency on a pkg-config library
21 -- @since 2.0.0.2
22 data PkgconfigDependency
23 = PkgconfigDependency
24 PkgconfigName
25 PkgconfigVersionRange
26 deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)
28 instance Binary PkgconfigDependency
29 instance Structured PkgconfigDependency
30 instance NFData PkgconfigDependency where rnf = genericRnf
32 instance Pretty PkgconfigDependency where
33 pretty (PkgconfigDependency name PcAnyVersion) = pretty name
34 pretty (PkgconfigDependency name ver) = pretty name <+> pretty ver
36 instance Parsec PkgconfigDependency where
37 parsec = do
38 name <- parsec
39 P.spaces
40 verRange <- parsec <|> pure anyPkgconfigVersion
41 pure $ PkgconfigDependency name verRange