• Niklas Hambuechen's avatar
    Add cabal file generation to Makefile.am · 3736b078
    Niklas Hambuechen authored
    This allows us to specify the exact version ranges of dependencies we
    support, across all operating systems.
    
    See issue #988.
    
    This commit only adds the cabal file and declares the dependencies.
    Enforcing them will be subject of a later commit.
    
    So far, we have only given the names of dependency in most cases,
    making sure that Ganeti builds with the dependency versions that are in
    Debian.
    This has caused problems for users that were not running Debian, or
    when there were packages installed in the compiling user's ~/.ghc
    directory, leading to compile-time type errors instead of pre-build
    configuration errors; for an example, see:
      https://code.google.com/p/ganeti/issues/detail?id=979#c10
    
    By explicitly listing our dependencies, we make clear which versions
    are supported.
    
    Modules and executables listed in the cabal file are automatically
    generated from the Makefile; executables are symlinked in an apps/
    directory to avoid repeated compilation as explained in:
    
      http://stackoverflow.com/a/6711739/263061
      http://stackoverflow.com/q/12305970/263061
    
    For example, in apps/ there is:
    
      hluxid.hs -> ../src/hluxid.hs
      hluxid.hs.stamp
      [...]
    
    Each executable symlink has a stamp file to track its modification time
    because make follow symlinks and thus does not see symlink modification
    times.
    
    In addition to declaring our dependencies, this setup allows building
    Ganeti's Haskell code with cabal to support editor integration and
    cabal-based tooling, the Makefile remains the default way to build Ganeti.
    Signed-off-by: default avatarNiklas Hambuechen <niklash@google.com>
    Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
    3736b078