RPM packaging tool for Haskell Cabal-based packages

Version on this page:0.12.6
LTS Haskell 12.24:0.12.6
Stackage Nightly 2018-12-17:0.12.6
Latest on Hackage:0.12.6

See all snapshots cabal-rpm appears in

GPL-3 licensed by Jens Petersen, Bryan O'Sullivan
Maintained by Jens Petersen

Module documentation for 0.12.6

There are no documented modules for this package.

Build Status Hackage Stackage LTS Stackage Nightly Gitter license


cabal-rpm is a tool for RPM packaging of Haskell Cabal-based packages. It interacts with yum/dnf to install build dependencies and can also act as a cabal-install wrapper installing dependencies packaged in Fedora before running “cabal install”.

Cabal-rpm was originally created by Bryan O’Sullivan (see README.orig) but has since been updated to work with current Cabal and Fedora Packaging Guidelines replacing cabal2spec. It is used by Fedora and OpenSuSE. It is licensed under the terms of the GPL version 3 (see the COPYING file).

You can build from source as normal by running cabal install or via Hackage with cabal install cabal-rpm.


cabal-rpm assumes you are using ghc-rpm-macros for Haskell RPM packaging. It currently needs Cabal 1.10 or later to build (ie ghc 7 or later).


The package is on Hackage. If you have cabal-install (part of Haskell Platform) you can install simply with

$ cabal install cabal-rpm


To create a .spec file for a Haskell src package in the current dir:

$ cabal-rpm spec

or directly on a .cabal file:

$ cabal-rpm spec path/to/mypkg.cabal

or on a package source dir:

$ cabal-rpm spec mypkg-0.1

You can also package directly from hackage:

$ cabal-rpm srpm somepkg


$ cabal-rpm local somepkg-0.1

will unpack ‘somepkg-0.1’ from hackage (if the dir does not exist, otherwise it uses the existing dir), create a spec file for it, and build it.

cabal-rpm creates .spec files in the current dir and if a .spec file already exists it will append .cblrpm to the generated filename to avoid overwriting an existing file.

$ cabal-rpm install [pkg][-ver]

will yum/dnf install available missing dependencies and run “cabal install” to build the package.

$ cabal-rpm diff

diffs the current spec file with a freshly generated spec file.

$ cabal-rpm update

updates the package to the latest Hackage version

$ cabal-rpm refresh

updates the spec file to the current cabal-rpm packaging.

There are more commands: prep, builddep, depends, requires, missingdeps. See the manpage or help output for more details.


The latest source code is available from:


More features are planned and patches welcome. See the TODO file for more details.


* 0.12.6 (2018-10-20)
- update: remove old revised .cabal
- convert revised .cabal file to unix format
- spec: support haskell-gi libraries
- most of SysCmd moved to simple-cmd library (new dep)
- can now download multiple source files
- use line-buffering for stdout
- always do cabal update
- support ghc_without_dynamic for static executables
- build with Cabal-2.4 (ghc-8.6)

* 0.12.5 (2018-07-29)
- update: more careful now with fuzz 1
-- handle revised to non-revised
-- improved for subpackaging
- improvements to revising of .cabal files
-- place after any subpackages
-- use revision when prep'ing and building
- use "fedpkg sources" to fetch current Fedora sources
- refresh: handle subpackages
- missing: better output for missing sub-deps
- do not put doc* in docs

* 0.12.4 (2018-05-31)
- now uses Hackage revisions of packages (using wget)
- spec --stream STREAM replaces --hackage
- disable https for ghc < 7.10

* 0.12.3 (2018-05-14)
- build: remove erroneous tarball check
- refresh: use cblrpm for old cabal-rpm

* 0.12.2 (2018-03-29)
- diff now supports CBLRPM_DIFF envvar to override "diff -u"
- try to build even when missing rpms deps not available
- package now builds with Cabal-2.2

* 0.12.1 (2018-02-20)
- new option --missing: comments out missing dependencies
- put license files in lib subpackage
- no longer append %_isa to C BuildRequires (#54)
- no longer leave leftover tmpdirs (#26)
- change 'cblrpm' to 'cabal-rpm' in documentation
- drop support for SCM snapshot releases

* 0.12 (2017-11-17)
- default to querying directly via https
- fix stackage-query usage and suggest installing if missing
- run cabal update before cabal commands
- devel packages now provide doc subpackage for forward compatibility
- new --hackage option to get package version from Hackage not Stackage
- do not add .cabal files containing "doc" to docs
- silence mock rpmbuild -bs warnings about undefined %ghc_version
- allow building with ghc-8.2 and Cabal-2.0

* 0.11.2 (2017-07-31)
- fix cabal-rpm update --subpackage
- fix rpm installation when no sudo (#49)
- fix handling of no exposed modules (#50)
- fix license handling for selfdep binlib (#51)

* 0.11.1 (2017-03-13)
- support building meta (compat) packages
- invocation of optional stackage-query to update to LTS now works
- initial --subpackage support for %{subpkgs} of missing deps:
including downloading, but update is not properly implemented yet
- new %{pkgver} macro
- (+-+) absorbs extra space
- update no longer resets release for %{subpkgs}

* 0.11 (2017-01-27)
- refresh command now reads the cabal-rpm version header in the spec file and
installs that version of cabal-rpm under ~/.cblrpm/ and uses it to make patch
- diff and update now follow package-version args
- update tries to use stackage-query to check latest Stackage version
before falling back to latest Hackage
- update from Hackage now follows "Default available version"
- sync some changes from opensuse-haskell/cabal-rpm
- rename Setup to Options
- silence <$> import warnings

* 0.10.1 (2016-11-29)
- no longer need to remove License file by hand
- use new %ghc_fix_rpath
- include Contributors in docs
- warn about duplicate docs in datadir and remove them

* 0.10.0 (2016-07-27)
- rename executable and manpage back to 'cabal-rpm': more predictable
- explicit error for unknown command
- sort docs and include upstream changelogs and news
- add cabal-rpm version header line to spec files
- new highly experimental command to refresh spec files
- only add "ExclusiveArch: %{ghc_arches_with_ghci}" for RHEL/EPEL
- use revised Hackage .cabal files on SUSE (@peti)
- on SUSE add explicit requires for pkgconfig
- new --compiler option (@peti)
- new --distro option (@peti)
- new --strict option which fails when unresolved cdeps (@peti),
otherwise a warning is output
- update now shows diff
- use %cabal_test (@mimi1vx)
- no longer duplicate docs in datadir
- package datadir better
- for SUSE libs executables now go in the base package

* 0.9.11 (2016-05-06)
- build with Cabal-1.24

* 0.9.10 (2016-03-24)
- bugfixes
- update no longer tries to grep non-existent .git
- fix duplicate clibs
- fix build with ghc-8.0 (Cabal-1.23 and time-1.6)
- SuSE improvements: no disttag or rpmdev-bumpspec

* 0.9.9 (2016-01-25)
- couple of minor improvements for SUSE packaging

* 0.9.8 (2015-10-08)
- better %license logic
- fix handling of versions without '.'
- no duplicate test deps

* 0.9.7 (2015-08-28)
- only list buildable executables in spec file
- bring back 'build' as an alias for 'local'
- use %license macro
- do not warn about missing optional system programs

* 0.9.6 (2015-05-21)
- make "cabal list" quiet
- filter missing packages from repoquery

* (2015-05-01)
- add old-locale Cabal flag to fix build on ghc-7.10

* 0.9.5 (2015-04-20)
- fix for dnf repoquery
- create SOURCES/ for tarball
- fixes for Cabal-1.22
- nogpgcheck for Fedora 22+
- warn about hidden backup spec files

* 0.9.4 (2015-02-17)
- use dnf if installed instead of yum for install and repoquery
- update now only commits changes and new source if git origin is ssh
- allow Cabal-1.22

* 0.9.3 (2015-02-05)
- make sure tarball destdir exists before copying
- improve output for listing missing packages
- update improvements: new-sources first, continue if patch fails, git commit changes
- spec: sort executables and use %pkg_name in %ghc_fix_dynamic_rpath
- drop the debuginfo handling for C files
- ignore emacs temp ".#pkgname.spec" files

* 0.9.2 (2014-12-18)
- lots of bug fixes
- improved missingdeps output
- use https for hackage URLs (codeblock)
- no longer override %_sourcedir, %_rpmdir, and %_srcrpmdir, unless git dir
- new "update" command to update spec to latest version
- use 'rpm --eval "%{?dist}"' to determine OS type
- fix build and warnings for Cabal 1.20
- use TMPDIR

* 0.9.1 (2014-08-26)
- missingdeps now lists missing dependencies recursively and outputs Hackage
package names rather than ghc-*-devel package names
- do not assume package order when testing if dependencies installed
- check ~/.cabal/packages/ exists before looking for tarballs
- pass actual exeNames to %ghc_fix_dynamic_rpath

* 0.9 (2014-07-17)
- reworked initial logic to make better use of existing spec files,
and prep source tree properly
- default to Library packaging instead of BinLib:
override with --binary which replaces --library
- prep src for version in existing spec file when building
- 'install' command now does local recursive rpmbuilding
- try "rpm -qf" and then rpmquery to resolve clib devel depends
- support SUSE packaging (thanks Jan Matějka)
- support RHEL5 packaging
- support Cabal-1.20
- improve output for 'depends' command
- no duplicate clibs deps
- include "cblrpm" in tempdir names
- use current dir name as a last guess of package name

* 0.8.11 (2014-05-17)
- build command renamed again from "rpm" to "local" (like fedpkg)
- use .spec file to determine pkg-ver when no .cabal file around
- automatically generate bcond for %check and add testsuite BRs
when testsuites available
- disable debuginfo explicitly when no c-sources in preparation for
ghc-rpm-macros no longer disabling debuginfo
- reset filemode of downloaded hackage tarballs to 0644:
workaround for cabal-install setting 0600
- include release again in initial changelog
- also pull in Cabal and ghc-rpm-macros when yum installing deps
- no longer depends on regex-compat
- some refactorings

* 0.8.10 (2014-03-03)
- diff command replaces cblrpm-diff script
- new missingdeps command
- replace use of rpmspec: no "rpmspec --srpm" on RHEL 5 and 6

* 0.8.9 (2014-02-10)
- bugfix for error handling dir with spec file
- cblrpm-diff arg is now optional

* 0.8.8 (2014-02-09)
- updated GPLv3 license headers
- use .spec file to determine package if no .cabal file (works with
or without arg)
- bugfix: install command now works even if some dependencies not packaged
- bugfix: do not re-copy cached tarball each time
- use new shorter hackage2 URL for packages
- capitalize start of summary and description
- filter @ and \ quotes in descriptions
- new prep command (like "rpmbuild -bp" or "fedpkg prep")
- new depends and requires commands list package depends or buildrequires
- new builddep command (like yum-buildep, but allows missing packages)
- notice for overwriting existing spec file with force option

* 0.8.7 (2013-12-31)
- new "install" command wrapping "cabal install"
- "build" command renamed to "rpm"
- sort devel Requires
- cblrpm-diff: allow package arg
- support copying tarball fetched from another remote-repo (Ricky Elrod)
- hlint cleanup
- support AGPL license in Cabal-1.18

* 0.8.6 (2013-10-04)
- check for _darcs or .git dir in package topdir not pwd

* 0.8.5 (2013-09-29)
- fix repoquery when a package update exists for C lib
- make cblrpm-diff quieter

* 0.8.4 (2013-09-28)
- use repoquery to determine extra C library dependencies
- quote "pkgconfig(foo)" for rpm query and yum install
- show sudo command before sudo password prompt appears
- exclude hsc2hs from build tool deps
- devel provides ghc-<pkg>-static
- drop release from initial changelog entry for packager to add an entry
- do not try to fetch tarball for a darcs or git source dir

* 0.8.3 (2013-07-12)
- only try to install missing dependencies
- for executables depending on own lib add BR chrpath and %ghc_fix_dynamic_rpath
- word-wrap generic descriptions
- map ffi to libffi
- move modules to toplevel
- Rpm module split into Spec and Build in Commands/

* 0.8.2 (2013-07-02)
- handle pkg-ver arg, and check cabal list is non-empty
- sort all generated deps
- use yum-builddep again to install deps
- copy tarball into cwd for rpmbuild
- warn about long synopsis rather than multiline
- wrap after end of sentence near end of line
- use _isa in requires ghc-<pkg>
- --version now outputs to stdout
- new --force flag to overwrite existing .spec file

* 0.8.1 (2013-06-14)
- word wrapping of descriptions
- use generic description for shared subpackage
- simplify logic for summary and description processing

* 0.8.0 (2013-05-31)
- new simplier revision to Fedora Packaging
- drop %common_summary and %common_description
- drop %ghc_package, %ghc_description, %ghc_devel_package,
%ghc_devel_description, %ghc_devel_post_postun, %ghc_files,
and %ghc_devel_requires
- check external programs available before use
- tweaks for ghc-7.6.3 and Cabal-1.16

* 0.7.1 (2013-03-22)
- add final full-stop to description if missing
- add ver-rel to initial changelog entry
- fix use of cblrpm-diff force lib option
- output warning when .spec already exists
- fix handling of package names that end in a digit
- output when trying a path
- map curl C dep to libcurl

* 0.7.0 (2013-01-22)
- cabal-rpm command renamed to cblrpm, and cabal-rpm-diff to cblrpm-diff
- cblrpm now has commands for spec, srpm, and build
- cblrpm will try to install packaged uninstalled depends with sudo yum install
- add %ghc_arches_with_ghci for hamlet dep
- cblrpm-diff supports -l
- cblrpm --version
- sort extralibs depends
- cleanup of unused options and help output

* 0.6.6 (2012-11-21)
- generate BRs and Req's for C libraries (extra-libraries)
- initial map for some C libs: libglut, libiw, libz, libX*
- generate BRs and Req's for pkgconfig-depends
- generate BRs for build-tools
- initial map for build-tools: gtk2hs-buildtools
- map LGPL-2.1 license to LGPLv2+ tag
- backup suffix changed from .cabal-rpm to .cblrpm
- don't mistake non-existent file in cwd for a package

* 0.6.5 (2012-11-01)
- drop hscolour BuildRequires
- simplify generated BuildRequires: drop version ranges for now,
exclude pkg self, base libs, and Cabal
- use ExclusiveArch ghc_arches_with_ghci for template-haskell dep
- replace --name option with --library to force Lib

* 0.6.4 (2012-09-25)
- add cabal-rpm-diff
- fix manpage generation

* 0.6.3 (2012-09-24)
- support tarball path argument
- use a temporary working dir for opening tarball or cabal unpack
- add a manpage

* 0.6.2 (2012-09-10)
- fix output of L/GPL version

* 0.6.1 (2012-07-25)
- fix "cabal-rpm pkg" when other *pkg* packages exist in hackage
- always generate the extra docs list from the pkg src dir!
- now no backslash at end of common_description

* 0.6.0 (2012-07-24)
- updated to work with Cabal >= 1.10 and current cabal2spec style packaging
using currently actively used ghc-rpm-macros
- should generate haskell dependencies correctly and also summary and
description text
- some of the generic compiler supported was dropped for simplicity
- rpmbuild support will be re-introduced in a future version

* 0.5.1 and earlier (2007-2008) released by Bryan O'Sullivan
- should work with ghc-6.8

# Local Variables:
# mode: text
# End:
comments powered byDisqus