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

Rémy Oudompheng remyoudompheng at gmail.com
Sat Oct 12 07:37:18 UTC 2013


On 2010/10/22 Peter Simons <simons at cryp.to> wrote:
> 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,

Remember that except for dependency management you can use
manycabal2arch for this kind of task.

>  - compile the package, and

Due to variations in makepkg.conf, the packages generated by makepkg
may end up in a different directory. I suggest you mention what you
are expecting to find in makepkg.conf to make it work. In addition,
you may want to build packages in a chroot, because we need to check
whether external dependencies (C libraries) are correctly encoded in
the PKGBUILD.

>  - and registers the package in the Pacman database.

> 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

This name can be obtained by the following Haskell function:

archname :: GenericPackageDescription -> IO String
archname cabal = do
  sysProvides <- getDefaultSystemProvides
  case preprocess cabal sysProvides of
    Nothing -> return ""
    Just pkg -> arch_pkgname $ fst $ cabal2pkg pkg sysProvides

> 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.

This is mainly why I chose shell scripts over Makefiles for my own
system. Dependency checks should not necessarily be done according to
the modification time of file, but according to the pkgrel (which
should be bumped when necessary). I would personally add a "make
depend" rule that runs an external (Haskell or shell) program that
generates the needed info in a separate file depends.mk.

It is not necessary that depends.mk uses the Cabal names, since
everything will be expanded anyway. So you could use something like

#!/bin/bash
#This is makedepends.sh
for pkg in *
do
  source $pkg/PKGBUILD
  echo -n "\$(${pkg}_tarball):"
  for dep in $depends[@] $makedepends[@]
  do
    dep=${dep%>*}
    dep=${dep%=*}
    dep=${dep%<*}
    [ -d "$dep" ] && echo -n " \$(${dep}_tarball)"
  done
  echo
done

-- 
Rémy.



More information about the arch-haskell mailing list