Would it be possible to change the default custom-setup stanza to setup-depends on Cabal + the build-depends of the library and executable(s).
The motivation for this is that git-annex, for example, does not have a custom-setup stanza, and cannot currently be built with cabal new-build.
Currently, attempting to new-build git-annex results in:
$ cabal new-build --constraint="any.git-annex -testsuite"
Resolving dependencies...
In order, the following will be built (use -v for more details):
- git-annex-6.20171214 (exe:git-annex) -testsuite -dbus -concurrentoutput (requires build)
- dummypkg-0 (lib) (first run)
Configuring git-annex-6.20171214 (all, legacy fallback)...
cabal: Failed to build git-annex-6.20171214 (which is required by dummypkg-0).
The failure occurred during the configure step. The exception was:
dieVerbatim: user error (cabal: '/usr/bin/ghc' exited with an error:
/home/matthew/dummypkg/dist-newstyle/tmp/src-3285/git-annex-6.20171214/Utility/FileSize.hs:10:1:
error:
Failed to load interface for ‘System.PosixCompat.Files’
It is a member of the hidden package ‘unix-compat-0.5.0.1’.
Perhaps you need to add ‘unix-compat’ to the build-depends in your .cabal
file.
Use -v to see a list of the files searched for.
)
Why can't this be fixed by adding a custom-setup stanza to git-annex?
It still builds fine with cabal build. I thought new-build was going to be backwards compatible since it will eventually replace build.
This doesn't work with old-style cabal build either when you don't have the necessary packages installed and don't run install --only-dep beforehand.
OK, fair enough. I'll go file an issue with git-annex. Feel free to close this if you feel it isn't worth implementing.
If someone wrote a patch implementing this, I'd most likely accept it, but right now I feel there are more important new-build bugs we should concentrate on.
This would probably also require support for conditionals in custom-setup (#4286).
Presuming run time dependencies are needed atbuikd time for setup.hs is very hostile to cross compilation. I am very against this.
Most helpful comment
This would probably also require support for conditionals in custom-setup (#4286).