Added RPM generation capability to Cabal

Duncan Coutts duncan.coutts at
Tue Feb 20 18:51:08 EST 2007

Great stuff Bryan, I look forward to seeing the patches. Do darcs send
them to this list for review.


On Tue, 2007-02-20 at 15:39 -0800, Bryan O'Sullivan wrote:
> 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
> This new capability is easy to use. It adds a single new Cabal command, 
> called rpm.
> 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
> The rpm command has converted the dependencies in the haxr.cabal file 
> into build-time and runtime dependencies in the haxr.spec file that it 
> generated, but rpmbuild can’t find the HaXml package.
> Having earlier built a HaXml package using the rpm command, I can 
> install it with the system’s rpm command.
> # 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 database, with no problems.
> _______________________________________________
> cabal-devel mailing list
> cabal-devel at

More information about the cabal-devel mailing list