Subject: bug#53655: haskell build system cannot build attoparsec

From: "Philip Munksgaard" <[email-masked]>
Date: Wed, 23 Feb 2022 12:25:36 +0100

On Wed, 23 Feb 2022, at 12:06, Philip Munksgaard wrote:
> And yes, this is indeed the issue I'm mostly concerned about.  It seems 
> like 
> `/gnu/store/25ql0xsjqf0alrvy6hmpw6gzirzbqfmv-ghc-attoparsec-0.14.4/ghc-attoparsec-0.14.4.conf` 
> is expected to be a file, while it is in fact a directory. I'm not sure 
> what that means or why it is important though.

Upon further investigation, it seems like the `register` function in `guix/build/haskell-build-system.scm` assumes that running `runhaskell Setup.hs register --gen-pkg-config=...` will at most result in a single configuration file, while the documentation for `--gen-pkg-config` clearly states that it is also possible that it results in a directory[0].

The relevant section states:

> This option outputs a directory if the package requires multiple registrations: this can occur if internal/convenience libraries are used. These configuration file names are sorted so that they can be registered in order.

I think we need to amend `haskell-build-system.scm` to be able to handle such cases.

0: https://downloads.haskell.org/cabal/Cabal-3.0.0.0/doc/users-guide/installing-packages.html#cmdoption-setup-register-gen-pkg-config