
Does Cabal have a way to produce binary distributions from a package? I need to create a binary distribution of my project which does not depend on GHC or any development tools. The package should include all required data files and configuration files. I've got the latter covered with Data-Files and getDataFileName, but not sure about what to do regarding configuration files -- read/write to $HOME/.myproject/config or $HOME/.myprojectrc, etc., or what? I'm specifically targeting Redhat because that's the production server, but I'm wondering if there is or will be a way to agnostically access data files and configuration files without having to think about what OS it will be running on, in the same way I can use sockets or file access without worrying about the particular OS. Something like cabal sdist --binary --rpm/deb/arch/win/etc? How does everyone else package up their Haskell programs for binary distribution? Cheers!

On Fri, Aug 20, 2010 at 10:18, Christopher Done
Does Cabal have a way to produce binary distributions from a package?
I need to create a binary distribution of my project which does not depend on GHC or any development tools. The package should include all required data files and configuration files. I've got the latter covered with Data-Files and getDataFileName, but not sure about what to do regarding configuration files -- read/write to $HOME/.myproject/config or $HOME/.myprojectrc, etc., or what?
I'm specifically targeting Redhat because that's the production server, but I'm wondering if there is or will be a way to agnostically access data files and configuration files without having to think about what OS it will be running on, in the same way I can use sockets or file access without worrying about the particular OS.
Something like cabal sdist --binary --rpm/deb/arch/win/etc?
How does everyone else package up their Haskell programs for binary distribution?
This is what package managers like rpm, dpkg, pacman, etc shines at. So for Distribution for Linux that's what I suggest you use. For Windows you'd probably have to hook things up to some installer-generator (WiX[1] maybe?). Other options are autopackage[2] and zeroinstall[3]. /M [1] http://wix.sourceforge.net/ [2] http://www.autopackage.org/ [3] http://zero-install.sourceforge.net/ -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

Hey autopackage looks swish! WiX also looks like a nice, more native
solution for Windows. Cheers!
On 20 August 2010 11:36, Magnus Therning
On Fri, Aug 20, 2010 at 10:18, Christopher Done
wrote: Does Cabal have a way to produce binary distributions from a package?
I need to create a binary distribution of my project which does not depend on GHC or any development tools. The package should include all required data files and configuration files. I've got the latter covered with Data-Files and getDataFileName, but not sure about what to do regarding configuration files -- read/write to $HOME/.myproject/config or $HOME/.myprojectrc, etc., or what?
I'm specifically targeting Redhat because that's the production server, but I'm wondering if there is or will be a way to agnostically access data files and configuration files without having to think about what OS it will be running on, in the same way I can use sockets or file access without worrying about the particular OS.
Something like cabal sdist --binary --rpm/deb/arch/win/etc?
How does everyone else package up their Haskell programs for binary distribution?
This is what package managers like rpm, dpkg, pacman, etc shines at. So for Distribution for Linux that's what I suggest you use. For Windows you'd probably have to hook things up to some installer-generator (WiX[1] maybe?).
Other options are autopackage[2] and zeroinstall[3].
/M
[1] http://wix.sourceforge.net/ [2] http://www.autopackage.org/ [3] http://zero-install.sourceforge.net/ -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

On 20 August 2010 10:18, Christopher Done
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. 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.
I need to create a binary distribution of my project which does not depend on GHC or any development tools. The package should include all required data files and configuration files. I've got the latter covered with Data-Files and getDataFileName, but not sure about what to do regarding configuration files -- read/write to $HOME/.myproject/config or $HOME/.myprojectrc, etc., or what?
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.
I'm specifically targeting Redhat because that's the production server, but I'm wondering if there is or will be a way to agnostically access data files and configuration files without having to think about what OS it will be running on, in the same way I can use sockets or file access without worrying about the particular OS.
Something like cabal sdist --binary --rpm/deb/arch/win/etc?
We might eventually add something for generic binaries but we will leave specific distros and packaging systems to specialised tools.
How does everyone else package up their Haskell programs for binary distribution?
As I mentioned there are also tools like cabal2rpm that help build binary packages for specific distros. Duncan

On 20 August 2010 11:43, Duncan Coutts
On 20 August 2010 10:18, Christopher Done
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
Do you know about getAppUserDataDirectory in System.Directory?
Thanks, I'd forgotten about that.
participants (3)
-
Christopher Done
-
Duncan Coutts
-
Magnus Therning