Subject: guix import hackage does not support build-tools and build-tool-depends stanzas

From: "Philip Munksgaard" <[email-masked]>
Date: Thu, 01 Jul 2021 20:26:17 +0200

The two stanzas build-tools[0] and build-tool-depends[1] are not supported by the cabal importer[2], which means that the generated build files for a package such as language-c-quote[3] doesn't work.

For instance, the attached language-c-quote.scm was generated by amending the result of running `guix cabal import -r language-c-quote`. Building it with `guix build -f language-c-quote.scm` yields the following error:

```
Setup.hs: The program 'alex' version >=3 is required but it could not be
found.

command "runhaskell" "Setup.hs" "configure" "--prefix=/gnu/store/javas0gpngal7lcmc77srpcc9z4891ni-ghc-language-c-quote-0.13" "--libdir=/gnu/store/javas0gpngal7lcmc77srpcc9z4891ni-ghc-language-c-quote-0.13/lib" "--docdir=/gnu/store/javas0gpngal7lcmc77srpcc9z4891ni-ghc-language-c-quote-0.13/share/doc/ghc-language-c-quote-0.13" "--libsubdir=$compiler/$pkg-$version" "--package-db=/tmp/guix-build-ghc-language-c-quote-0.13.drv-0/package.conf.d" "--global" "--enable-tests" "--enable-shared" "--enable-executable-dynamic" "--ghc-option=-fPIC" "--ghc-option=-optl=-Wl,-rpath=/gnu/store/javas0gpngal7lcmc77srpcc9z4891ni-ghc-language-c-quote-0.13/lib/$compiler/$pkg-$version" failed with status 1
builder for `/gnu/store/4l01sv6w7a7y8sikka48pd14rvw1wvj6-ghc-language-c-quote-0.13.drv' failed with exit code 1
build of /gnu/store/4l01sv6w7a7y8sikka48pd14rvw1wvj6-ghc-language-c-quote-0.13.drv failed
View build log at '/var/log/guix/drvs/4l/01sv6w7a7y8sikka48pd14rvw1wvj6-ghc-language-c-quote-0.13.drv.bz2'.
guix build: error: build of `/gnu/store/4l01sv6w7a7y8sikka48pd14rvw1wvj6-ghc-language-c-quote-0.13.drv' failed
```

The attached language-c-quote-fixed.scm adds the `ghc-happy` and `ghc-alex` packages to native-inputs, as required by the build-tools stanzas in the original cabal file.

However, build-tools has actually been deprecated in favor of build-tool-depends, as noted in the documentation, so I guess we should actually implement support for it in addition to build-tools.

0: https://cabal.readthedocs.io/en/3.4/cabal-package.html#pkg-field-build-tools
1: https://cabal.readthedocs.io/en/3.4/cabal-package.html#pkg-field-build-tool-depends
2: https://git.savannah.gnu.org/cgit/guix.git/tree/guix/import/cabal.scm
3: https://hackage.haskell.org/package/language-c-quote