Conditional test for detecting cross-compilation
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the feature request**
At the moment, anything that requires running code on the build platform tends to be broken (or a pain to make work) when doing cross-compilation, e.g.
- Compiler plugins
- Custom setups that call out to external binaries
- TH that calls out to external binaries
It would be nice to be able to state that such packages won't work when cross-compiling, much as it can be useful to say that some package just won't work on, say, Windows.
i.e. I want to write
```
if cross
buildable: False
```
Possibly it would be better to instead have tests like `host-os` and `build-os` rather than just `os`, but then we would also need to be able to say
```
if (host-os != build-os)
```
or something. Not sure if that fits into cabal's conditional model.
**Additional context**
We have a lot of packages, and we want to cross-compile most of them. At the moment what we do is try to cross-compile _all_ of them, with exceptions. However, we can generally be smart enough to avoid things that are not buildable (I think cabal does not plan them, which is better than e.g. getting a planning failure). But we can't state the constraint that some packages don't build when cross-compiling, so we have to have manual exceptions for them.
Contributor guide
Assessment
This issue has not been assessed yet.