[arch-haskell] Make-based incremental build for arch-haskell

Peter Simons simons at cryp.to
Sat Oct 12 07:37:17 UTC 2013


I have created a fairly simple GNUmakefile to perform incremental builds
of the arch-haskell repository (a.k.a. "habs"). The code can be accessed
by means of Git as follows:

  git clone http://git.cryp.to/arch-haskell

The repository is very small -- currently, it builds only pandoc,
hledger, and uulib (plus all packages that these three depend on). The
set of packages is determined by a bunch of symbolic links that are part
of the repository:

  ~/src/arch-haskell$ ls -l src/*.cabal
  lrwxrwxrwx 1 simons users 27 Oct 22 13:44 src/binary.cabal -> binary/
  lrwxrwxrwx 1 simons users 19 Oct 22 13:44 src/csv.cabal -> csv/0.1.1/csv.cabal
  lrwxrwxrwx 1 simons users 27 Oct 22 13:44 src/digest.cabal -> digest/
  lrwxrwxrwx 1 simons users 28 Oct 22 13:44 src/hledger.cabal -> hledger/0.12.1/hledger.cabal
  lrwxrwxrwx 1 simons users 36 Oct 22 13:44 src/hledger-lib.cabal -> hledger-lib/0.12.1/hledger-lib.cabal

As you can see, these links refer to the Hackage database, which is
supposed to be copied into the src/ directory as well. The make target
"update" will do that automatically. Given those files, "make all" ...

 - generates a PKGBUILD for every Cabal package,

 - compile the package, and

 - and registers the package in the Pacman database.

If you'd like to try out the build, run these commands in a freshly
checked-out copy of the <http://git.cryp.to/arch-haskell> repository:

  # Populate the src/ directory with a recent version of Hackage.
  make update

  # Unregister Haskell packages from Pacman to make sure that the
  # following builds don't have any hidden dependencies.
  make clean

  # Build all packages (pandoc, hledger, and uulib).

Instead of building all targets, it's also possible to build only
selected targets by running "make haskell-zlib" or "make hledger".

Now, the GNUmakefile needs to map package names from Cabal to ArchLinux.
Currently, this is accomplished using a hard-coded list. For example,
hledger needs the following variable assignment

   hledger_name = hledger

to tell make that this package deviates from the normal "haskell-NAME"
scheme. Obviously, this list ought to be generated automatically from
the information contained in the haskell-Ashlin's library, but I
haven't yet automated the task.

Furthermore, make needs dependency information about the packages. This
know-how, too, is currently hard-coded in the GNUmakefile. For example:

  $(pandoc_tarball) : $(HTTP_tarball) $(xhtml_tarball) $(texmath_tarball) $(zip-archive_tarball)
  $(network_tarball) : $(parsec_tarball)
  $(HTTP_tarball) : $(network_tarball)
  $(texmath_tarball) : $(xml_tarball) $(parsec_tarball)
  $(zip-archive_tarball) : $(digest_tarball) $(zlib_tarball) $(binary_tarball)

Maintaining that information manually is out of question, IMHO, and we
really ought to generate that information from the Cabal files. I'm not
yet sure how to do it, though.

Anyway, let me know what you think.

Take care,

More information about the arch-haskell mailing list