How to build relocatable packages with cabal

I'm trying to distribute cabal-built haskell libraries using zero-install ( http://0install.net/ ). The main requirement of 0install packages is that they - be relocatable to arbitrary paths without modifying them (packages are read-only and contents are verified by a manifest, so prefix-dependant binaries are impossible) - be runnable without modification as long as environment variables are correctly set up so that they can find their dependencies. I believe $GHC_PACKAGE_PATH should be sufficient for most cabal packages from this very old ticket ( http://hackage.haskell.org/trac/hackage/ticket/469 ), I see:
Configuring a relocatable package should be something that is done explicitly. At the moment it is done simply by configuring it in the right way, but Cabal is never aware that the user is trying to construct a relocatable package.
Are there any instructions on how to configure cabal to build a relocatable package? I have tried setting prefix to an empty string and "/" in the configure step, but neither of those work. My current build process is: ---- #!/bin/sh set -eux cd "$SRCDIR" cabal configure -v --builddir="$BUILDDIR" --prefix="/" cabal build -v --builddir="$BUILDDIR" cabal copy --builddir="$BUILDDIR" --destdir="$DISTDIR" cabal register --gen-pkg-config="$DISTDIR/package.conf" --builddir="$BUILDDIR" ---- But the created package doesn't seem valid (`ghc-pkg list` can't even parse it, and I'm not sure what the chances of it actually working would be). I'm specifically trying to build hspec here, but ideally there would be some recipe that works for all typical cabal projects. Any assistance wooud be appreciated. Thanks, - Tim.

On Sat, Nov 12, 2011 at 5:34 PM, Tim Cuthbertson
I'm trying to distribute cabal-built haskell libraries using zero-install ( http://0install.net/ ).
I'm interested in the related problem of trying to distribute an executable, for which I may not have control over where it gets installed (particularly on Windows, where people just put stuff wherever they want because there are no standards). Further complicating things, the executable needs some data files.
participants (2)
-
Bryan O'Sullivan
-
Tim Cuthbertson