Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cabal ignores buildinfo in top-level of directory #10238

Open
mpickering opened this issue Aug 1, 2024 · 7 comments
Open

Cabal ignores buildinfo in top-level of directory #10238

mpickering opened this issue Aug 1, 2024 · 7 comments

Comments

@mpickering
Copy link
Collaborator

The documentation states:

If the package root directory contains a file called package.buildinfo after the configuration step, subsequent steps will read it to obtain additional settings for [build information](https://cabal.readthedocs.io/en/3.10/cabal-package.html#build- information) fields,to be merged with the ones given in the .cabal file. In particular, this file may be generated by the configure script mentioned above, allowing these settings to vary depending on the build environment.

However if you test this, then placing a .buildinfo file in the root of your project (and set the build type to configure) then it is ignored by cabal.

There is then some subsequent advice about using this with install-includes, which also doesn't work due to this bug.

This regression was introduced by #4874 which made Cabal look in the build directory for the .buildinfo rather than the current directory.

See tickets like #9401 work because they generate the .buildinfo file into the build directory (which is where configure is now run).

Sample project: https://gist.github.com/mpickering/bb13bae26146f0dfa39cb93241f1599c

@erikd
Copy link
Member

erikd commented Aug 2, 2024

I have been using cabal for well over a decade and I did not even know of this feature, let alone used it.

How long has it been part of cabal? What is the use case?

@erikd
Copy link
Member

erikd commented Aug 2, 2024

According to grep buildinfo doc/* most of the mentions of "buildinfo" are in the file doc/cabal-package-description-file.rst and according to Git, this file was added in October 2023.

@geekosaur
Copy link
Collaborator

geekosaur commented Aug 2, 2024

That date is rather misleading because the documentation received a major overhaul around then, and in particular things were split into a number of new files. (#9379)

IIRC buildinfo is normally created by Setup.hs for configure or custom setup; presumably the intent of a top-level buildinfo is for it to be created by some build utility that is driving Setup-based builds.

@erikd
Copy link
Member

erikd commented Aug 2, 2024

I have 643 cabal.project files on my system, but not a single package.buildinfo file.

@fgaz

This comment was marked as duplicate.

@erikd
Copy link
Member

erikd commented Aug 2, 2024

@fgaz Of these projects, over 160 of them have dist-newstyle directories suggesting that they have been built.

@mpickering
Copy link
Collaborator Author

@erikd This feature has been in cabal for quite a long time (10 years?), it's the mechanism which you can modify the build if you are using the configure build type.

The documentation explains that this should work so I raised an issue to explain that it doesn't. It caused a bug in hadrian if you are interested in that - https://gitlab.haskell.org/ghc/ghc/-/issues/23594.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants