Cabal: some suggestions
Manuel M T Chakravarty
chak at cse.unsw.edu.au
Fri Jul 15 11:35:15 EDT 2005
I just replaced C->Haskell's (quite elaborate) make-based build system
by a Cabal-based system. Overall, this worked quite well (but partially
because I simplified some of c2hs's old structure anyway). So, here
some feedback.
* Having the ability to specify multiple source directories is quite
important (at least for non-library packages). So, please include
Cabal 1.0.1 or higher with GHC soon.
* Installation is still too inflexible. In particular, the
pre/post hooks (and I guess not only the installation ones)
need to get the PackageDescription as an argument. Due to
the lack of the PackageDescription, I had to add a ./configure
mangled shell script that I invoke from the postInst hook. See
http://www.cse.unsw.edu.au/~chak/repos/c2hs/Setup.hs
<see appended code for postInst.sh.in - our web server
won't serve it via http due to the filename>
Essentially, I need to create wrapper scripts (like ghc) to pass
an install-location dependent path to the main executable. (Actually,
two scripts one for running the c2hs inplace in the build tree and
one for after proper installation.)
Wrapper scripts are really common, so ideally there should be special
support for those.
* There doesn't seem to be anything to handle documentation.
* Maybe not really a Cabal problem, but --make with GHC on larger
programs is quite tedious. When you change, say, Main.hs ghc walks
through all the other modules telling you its skipping them, which
takes quite a long time, only to spot a type in the change that you
just makes...and then you can start looking at all the skipping
messages again.
It's not the skipping messages that bother me. It's how long ghc
takes to figure out that it actually only needs to compile one file.
This is actually the problem which bother me most at the moment.
Anyway, its great to have Cabal.
Manuel
-=- postInst.sh.in -=-
#!/bin/sh
prefix=/home/chak/sandbox
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib/c2hs-0.14.0
echo "Moving executable into $libdir/"
/bin/sh install-sh -d $libdir
/bin/sh install-sh -s -m 755 $bindir/c2hs $libdir/
echo "Installing wrapper and C2HS.hs"
/bin/sh install-sh -c -m 755 c2hs/c2hs $bindir/
/bin/sh install-sh -c -m 644 c2hs/lib/C2HS.hs $libdir/
More information about the Libraries
mailing list