-
Niklas Hambuechen authored
This uses `cabal configure` to determine which exact dependency versions we are compiling against, and ensures that these versions are used by passing -package-id flags to GHC. The `cabal configure` step makes the build fail before compiling / type checking if the user tries to compile against a dependency version we don't support; before, this case led to type errors which were not clearly user errors. This fixes issue #988. The output of `cabal configure` is also used to generate MIN_VERSION_* macros. MIN_VERSION_* macros are the standard way to build CPP dependency switches in Haskell packages, and they replace our custom macros (like PARALLEL3 and NO_REGEX_PCRE) which had to be hand-built for each dependency. We can now query the version of any Haskell dependency without having to manually add a flag via autoconf. All ghc and hlint invocations were adjusted to take these macros into account. This change introduces a Haskell-build-time dependency on cabal-install (for `cabal configure`) and the Cabal API (for obtaining the configured dependency versions and generating the macros). Any cabal version since Debian Squeeze is supported. Note that our use of Cabal does not imply any downloading of dependencies at build time, hermetic builds are unaffected by this change. For developers we now require hlint >= 1.8.60, to make use of its --cpp-file option. However, hlint >= 1.9.12 is recommended since for hlint >= 1.8.58 && < 1.9.12 the --utf8 flag is non-functional (see https://github.com/ndmitchell/hlint/issues/96); this can be worked though by using the equivalent `--encoding=UTF-8` flag. Signed-off-by: Niklas Hambuechen <niklash@google.com> Reviewed-by: Klaus Aehlig <aehlig@google.com>
8e193466