cabal-pkg-config-version-hook-0.1.0.1: Make Cabal aware of pkg-config package versions
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.PkgConfigVersionHook

Description

     main :: IO ()
     main =
       defaultMainWithHooks $
         simpleUserHooks
           & addHook
             (mkSettings "nix-store")
               { macroName = NIX,
                 flagPrefixName = "nix"
               }
 

The above will look for a pkg-config package nix-store, and then

  • Define CPP, C and C++ macros

    • NIX_MAJOR, an integer
    • NIX_MINOR, an integer
    • NIX_PATCH, an integer; 0 if missing
    • NIX_IS_AT_LEAST(major,minor,patch), returning true when the discovered version >= the specified version
  • Set or unset flags like `nix-2_4` so that the flag is true when the discovered version is at least the version in the flag's name.
Synopsis

Documentation

addHook :: Settings -> UserHooks -> UserHooks Source #

Hook into Cabal to provide pkg-config metadata. Can be applied multiple times to support multiple packages.

mkSettings :: String -> Settings Source #

Derive a default Settings value from just a pkg-config package name.

data Settings Source #

How the metadata for a pkg-config package should be made available to the cabal file.

Constructors

Settings 

Fields

  • pkgConfigName :: String

    Name of the package; used for querying pkg-config.

  • macroName :: String

    Name to use in the Haskell CPP and C/C++ preprocessor macros.

    For example, `pkgConfigName = FOO` will set the macros

    • FOO_MAJOR
    • FOO_MINOR
    • FOO_PATCH
    • FOO_IS_AT_LEAST(major, minor, patch)
  • flagPrefixName :: String

    Name to use when setting flag values in the cabal file.

    Flags named with this prefix, followed by a dash, followed by a major version number, an underscore and a minor version number will be set when the detected package is at least that version.

composeConfHook :: Settings -> ((GenericPackageDescription, a) -> ConfigFlags -> IO b) -> (GenericPackageDescription, a) -> ConfigFlags -> IO b Source #

Extend the value of confHook. It's what powers addHook.