[Haskell-cafe] Embedding version info in executables

Alexander V Vershilov alexander.vershilov at gmail.com
Fri Jul 11 12:26:31 UTC 2014

Yes, this is a problem.

To be honest, the project where I used this approach was never public, and
we didn't use sdist. I think that it's possible to check if you have
`git` executable,
and if the the project is in repository, otherwise there is no sense
in this information,
and information from a cabal file that is given to the hook  can be used.

On 11 July 2014 16:09, Herbert Valerio Riedel <hvr at gnu.org> wrote:
> 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