[Haskell-cafe] Embedding version info in executables

Herbert Valerio Riedel hvr at gnu.org
Fri Jul 11 12:09:43 UTC 2014


On 2014-07-11 at 11:46:36 +0200, Alexander V Vershilov wrote:
> It's possible to use a SimpelUserHook setup type, and then in Setup.hs
> add preBuild hook that will generate a file in ./dist/autobuild/, then you
> can import this file in Main.hs and use this information.
>
> I have used such Setup.hs (have not reviewed it for years), I think it may
> be improved.

Btw, the main problem with that variant is that it breaks down if you
want need `cabal sdist` to work.

In order to have `cabal sdist` do something sensible I had to hack up an
abomination of a `Setup.hs` which would rewrite the .cabal file and
replace the `Setup.hs` by a `build-type: Simple` compliant one during
`sdist` creation. It's really a pity Cabal makes this use-case so hard
to achieve, as it would just need to provide a hook to determine the
version-field dynamically...

Cheers,
  hvr


More information about the Haskell-Cafe mailing list