Skip to content

Detecting pkg-config versions #2197

@hamishmack

Description

@hamishmack

Now that the same haskell-gi generates bindings automatically we need to be able to detect what version a user has when building Leksah. We are using Cabal flags in leksah.cabal:

flag gtk-318
    description:
        GTK+ is 3.18 or later

flag gtk-320
    description:
        GTK+ is 3.20 or later

Then later we have:

    if flag(gtk-318)
        pkgconfig-depends: gtk+-3.0 >= 3.18
        cpp-options:       -DMIN_VERSION_GTK_3_18

    if flag(gtk-320)
        pkgconfig-depends: gtk+-3.0 >= 3.20
        cpp-options:       -DMIN_VERSION_GTK_3_20

When using cabal-install the flags are disabled automatically when the pkgconfig-depends are not met.

It is not entirely satisfactory because:

  • It does not work automatically with stack (this is the biggest drawback and why I am putting the issue here)
  • You have to add a flag for every version check
  • If the someone upgrades the underlying pkg-config library without rebuilding haskell-gi we will think they have newer bindings than they do.

Is there a way to make this work automatically with Stack? Alternatively can you suggest a better way to do this detection that will work automatically with Stack?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions