The Haskell community has a very nice implementation-independent mechanism for building libraries and applications, called Cabal.
I spent a few hours over the past couple of days hacking on Cabal to add the ability to build RPM packages. You can fetch my darcs repository from here:
darcs get --partial http://darcs.serpentine.com/cabal-rpm
This new capability is easy to use. It adds a single new Cabal
runhaskell Setup.*hs rpm
This generates a spec file, and builds source and binary RPMs.
Here’s a quick example, of trying to build the Haskell XML-RPC library:
~/src/darcs/haxr $ runghc Setup.*hs rpm Source tarball created: dist/SOURCES/haxr-3000.0.0.tar.gz error: Failed build dependencies: HaXml-ghc66 >= 1.13 is needed by haxr-3000.0.0-1.i386 HaXml-ghc66 < 1.14 is needed by haxr-3000.0.0-1.i386 Setup.lhs: rpmbuild failed with status 1
rpm command has converted the dependencies in the
file into build-time and runtime dependencies in the
that it generated, but
rpmbuild can’t find the
Having earlier built a HaXml package using the
rpm command, I can
install it with the system’s
# rpm -i haxml-ghc66-1.13.2-1.i386.rpm Reading package info from stdin ... done. Saving old package config file... done. Writing new package config file... done.
The RPM’s post-install scriptlet informs GHC’s package manager about the package’s availability:
# ghc-pkg list --simple | tr ' ' '\n' | grep -i haxml HaXml-1.13.2
Now if I try to build
haxr again, it will succeed.
By default, the
rpm command builds both normal and profiling-enabled
libraries. It also uses Haddock to
generate library documentation. It’s possible to control these
behaviours from the command line.
The command also provides a
--gen-spec option, which only generates
a spec file. You can use this >spec file as a basis for crafting one
of your own.
I’ve used the
rpm command to build about a third of the packages
listed in the Hackage package
with no problems.