haskell / haskell/cabal

Disable library building, only build other components

Open
#2,775 5 comments 0 reactions 0 assignees View on GitHub
Cabal: cmd/build type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

(I may be missing something obvious, in which case, please let me know how this should be handled.)

When you specify components, you can get fine-grained control over which executables are built. However, there seems to be no way to control the library component. This has a number of repercussions:
- No way to build only the library: `cabal build` will build _all_ components
- No way to build just an executable/test suite/benchmark without building the library
- Due to the fact that `--enable-tests` or `--enable-benchmarks` can modify the cabal_macros.h file, building your library and then rebuilding with test suites enabled can force the entire library to be recompiled, even though that's not necessary (this may actually be worth opening as a separate bug report).

Backwards compatibility will be a problem for any changes we want to make here. Ideally, I'd have said that `lib` is its own component, and a command `cabal build lib` would build only the library, whereas `cabal build exe:foo` would _not_ build the library. However, the latter would be a breaking change. So perhaps we can add a `--no-build-library` flag?

(And I've referred to `cabal` the executable here, but I'd really like to see this in Cabal-the-library.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.