[Haskell-cafe] Distributing a program with support files

Isaac Dupree isaacdupree at charter.net
Sun May 27 09:56:35 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil Mitchell wrote:
> Hi,
> 
> I'm wanting to release a Haskell program, but am confused how I should
> distribute the associated files it needs. On Windows I would use the
> functions to find the path of the executable, and find the support
> files relative to that - in Haskell (because of Linux) that isn't the
> case.
> 
> The basic setup I have is:
> 
> foo.exe - main binary
> library.hs - required by the binary
> examples\*.hs - a massive tree of examples, which can be used by the binary
> 
> foo.exe also needs to create temporary files relative to library.hs
> and the examples.

I think the standard Unix technique (not that I like it) is:
Find out at compile time (e.g. ./configure or later):
 -where to put the executable (e.g. /usr/local/bin/NAME or /usr/bin/NAME
 -where to put the library files (e.g. in /usr/local/share/NAME/ or
/usr/share/NAME/) and embed this knowledge in the executable
Find out at run time:
where to put temporary files: environment-variable TMPDIR if it exists,
otherwise /tmp .

GHC/libraries might have utility functions for some of those, such as
finding the temp-dir... or maybe Cabal for the build-time things...

(If you can do without creating temporary files, that's usually a better
approach for that :)

Isaac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGWY4THgcxvIWYTTURAqNiAJ9HuwsYkYgFMv2iFt8Q+Cge6cQfVgCeKmRY
ATVnn14r9e3iicdIyCXWS1A=
=yQs7
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list