Skip to content

Commit

Permalink
Custom-build: Document breaking change on built comps.
Browse files Browse the repository at this point in the history
As mentioned by e8c9d19, Cabal 3.12 introduced a breaking change where
an unnecessary (not requested) component of a package with a "Custom"
build-type is no longer built.

This caused breakage for Agda, and was undocumented.

The behaviour, despite breaking, is the desired one -- a package
shouldn't assume the executable will be built if only the library was
requested. This commit documents the breaking change to make sure it is
more visible.

In the meantime, we've also patched Agda to no longer expect the
executable to be built when only the library is installed.

Closes haskell#9777 and haskell#10235
  • Loading branch information
alt-romes committed Sep 3, 2024
1 parent 39b6924 commit 1c7e7a7
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions changelog.d/issue-9777
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
synopsis: Installing a library with a Custom setup no longer requires building the executable
packages: Cabal
issues: #9777

description: {

For example, if we have `pkg-a.cabal`:

```
library
build-depends: pkg-b
```

and `pkg-b.cabal`:

```
library
exposed-modules: ...

executable pkg-b-exe
main-is: ...
```


An invocation `cabal build pkg-a` will build `lib:pkg-a` and `lib:pkg-b`, but
not `exe:pkg-b-exe` because it is not needed for building `pkg-a`! Previously the executable would be built unnecessarily.

If the invocation were `cabal build pkg-a exe:pkg-b-exe` then all `lib:pkg-a`, `lib:pkg-b`, and `exe:pkg-b-exe` would be built.

Note: There may be a package whose Custom setup expects the executable to be
built together with the library always. Unfortunately, this is a breaking
change for them. To migrate, packages should no longer assume the executable is
built when only the library is requested (e.g. `cabal install --lib Agda` will
*not* build the `Agda` executable, while `cabal install Agda` will).

Agda is an example of a package which expected in its `Setup.hs` copy hook the
executable to already be built. This was fixed by inspecting the copy arguments
and making sure we only use the executable when it is built, since it is only
needed when the executable too is needed.

}

0 comments on commit 1c7e7a7

Please sign in to comment.