Relocatable libraries in windows
jfoell at gmail.com
Fri Apr 15 17:07:21 CEST 2011
Here is the script.
# This function should unroll a hackageDB tarball,
# configure it, build it, install it (in a relocatable way)
# and then clean up after itself.
# Assumption1: run in 'msys' environment on windows machine
# Assumption2: User installed GHC with Haskell Platform installer
# Warning: This script assumes there are no spaces in the paths
# used. If there are spaces, then this may break. Space-safe
# mods are welcome. <jfoell at gmail.com>
# Point this variable to the 'lib' directory of your
# Haskell Platform installation
echo USAGE: mkhslib [path/to/]package.tar.gz
echo EXAMPLE: mkhslib ~/downloads/atom-1.0.4.tar.gz
# Handle wrong arguments
case $# in
# Handle standard help args
if [ $1 = "-h" -o $1 = "--help" ]; then
# Unpack, configure, build, install, clean up
PKG_ID=`basename $1 .tar.gz`
cd `dirname $1`
tar -xzf `basename $1` &&
cd $PKG_ID &&
runhaskell Setup configure --prefix=$HASKELL_LIB_DIR/extralibs &&
runhaskell Setup build &&
runhaskell Setup install &&
cd .. &&
rm -rf $PKG_ID
# Building libraries bakes the absolute path into the conf file,
# which makes the library non-relocatable. This doesn't work with
# our goal to make this repo relocatable. So... we must replace
# the absolute path with the haskell-compiler variable '$topdir'.
SED_SEARCH=`echo $HASKELL_LIB_DIR | sed -e 's%/c/%c:/%'`
sed -i -e "s%$SED_SEARCH%\$topdir%"
On Fri, Apr 15, 2011 at 10:05 AM, Jake Foell <jfoell at gmail.com> wrote:
> Dear haskell rascals,
> In an attempt to create a relocatable repository of development tools, I
> created this simple script to configure/build/install packages from
> hackageDB. This script is meant to be used in an 'msys' environment on a
> windows machine.
> To quote the Cabal User's Guide (sec 22.214.171.124)
>> A library cannot (currently) be prefix-independent, because it will be
>> linked into an executable whose file system location bears no relation to
>> the library package
> So far, this attempt has been successful for me. Improvements, criticism,
> and other solutions are welcome. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries