Duplicate component name in build path.
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Ref.: https://github.com/haskell/cabal/issues/4548 When building sublibraries with cabal today, you end up with build paths like:
```
$pkg/l/$comp/build/$comp/
```
note the duplicate `$lib` in there.
Tracking this down, leads us to two commits by @ezyang almost a decade ago.
on Mar 30, 2016 https://github.com/haskell/cabal/commit/8e3c2d7fade0e61ef0be1be90b265bfba867f0df
introduced the `componentBuildDir` which added the `$comp` as a suffix to the `$buildDir`.
```
$pkg/l/$comp/build/$comp/
^^^^^
```
(this is `lib:Cabal`).
on Aug 21, 2016 https://github.com/haskell/cabal/commit/d9bf6788adf6d416d6335fd79c4c1b3fbc7d0ad1
Changed the
```
distBuildRootDirectory display pkgid
```
to also include a `c/$comp` suffix. This was later modified by @hvr to have distinct single letter names for different components. E.g. `l` for library.
```
$pkg/l/$comp/build/$comp/
^^^^^^^
```
(this is `cabal-install`).
Thus we now have `$comp` redundantly twice in the path. Also the _buildPath_ we pass to `runConfigureScript` (in `ConfigureScript.hs`), via `ConfigFlags:CommonSetupFlags:setupDistPref` is `$pkg/l/$comp/build`.
It seems to me we've basically changed the component build path twice; while we only need to change it once to make it unique per component. As such I'm proposing to conceptually revert the `componentBuildDir` change from https://github.com/haskell/cabal/commit/8e3c2d7fade0e61ef0be1be90b265bfba867f0df. And leave `$pkg/l/$comp/build` to be the build directory. This will also transparently make `build-type: Configure` work for components. We already run the `configure` script in the `$pkg/l/$comp` folder per component.
Contributor guide
Assessment
This issue has not been assessed yet.