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?
Now that the same
haskell-gigenerates bindings automatically we need to be able to detect what version a user has when building Leksah. We are using Cabal flags inleksah.cabal:Then later we have:
When using
cabal-installthe flags are disabled automatically when thepkgconfig-dependsare not met.It is not entirely satisfactory because:
stack(this is the biggest drawback and why I am putting the issue here)pkg-configlibrary without rebuildinghaskell-giwe 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?