[Haskell-cafe] Creating binary distributions with Cabal

Christopher Done chrisdone at googlemail.com
Fri Aug 20 12:50:19 EDT 2010


On 20 August 2010 11:43, Duncan Coutts <duncan.coutts at googlemail.com> wrote:
> On 20 August 2010 10:18, Christopher Done <chrisdone at googlemail.com> wrote:
>> Does Cabal have a way to produce binary distributions from a package?
>
> No but it's not too hard to do.
>
> If you actually want an RPM or a DEB etc, then look into the cabal2rpm
> etc tools, they help automate the process.

Thanks, I hadn't seen this! It's ideal for my specific use case. :-)

> If you want a generic binary then:
>
> You first prepare an image, but using:
>
> cabal copy --destdir=./tmp/image/
>
> Now you tar up the image directory, unpack it on the target.
>
> Note that the prefix/paths you specified at configure time need to be
> the same on the target machine. There is no support yet on unix for
> relocatable / prefix independent binaries. In particular it needs the
> paths to be correct to be able to find data files.

Hmm, this is okay for me in this particular case anyway as I'm just
giving a distribution to the production admins who then unpack it,
i.e. I know the configuration of the target machine.

> Right, config files you should just look in a per-user or global
> location. You can use a data file to store a default so that the
> program can work with no config file.

Seems reasonable when someone else says it. Wasn't sure if there might
be a standard API for dealing with this. Thus far I've been relying on
a --config=PATH argument to the program. I suppose a combination
thereof encompasses most use cases.

On 20 August 2010 18:25, John MacFarlane <jgm at berkeley.edu> wrote:
> Do you know about getAppUserDataDirectory in System.Directory?

Thanks, I'd forgotten about that.


More information about the Haskell-Cafe mailing list