haskell / haskell/cabal

Have cabal_macros.h generate PKGCONFIG_VERSION and MIN_PKGCONFIG_VERSION

Open
#4,237 11 comments 0 reactions 0 assignees View on GitHub
old-milestone: ⊥ type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I ran into an issue today where I needed to write some code like this:

```
#if /* version is greater than 2.1 */
wibble
#else
wobble
#endif
```

This is in a project where `` is detected with `pkgconfig-depends`. I would have hoped that the autogenerated `cabal_macros.h` would provide some way of detecting ``'s version (as specified in `.pc`, but sadly that doesn't seem to be the case, so I have to work around it manually by using `Cabal` flags and `cpp-options: -DC_LIBRARY_VERSION=xyz`.

Would it be unreasonable to have `cabal_macros.h` spit out `PKGCONFIG_VERSION` and `MIN_PKGCONFIG_VERSION` macros for every `pkg-config` dependency? There's the issue that `pkg-config` names can contain characters that aren't permissible in `Cabal` package names. For example, `glib-2.0` contains a period. But maybe we could just turn periods into underscores like we currently do hyphens.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.