haskell / haskell/cabal

Unable to extend `pkg-config` path in cabal.project.local

Open
#6,062 1 comment 2 reactions 0 assignees View on GitHub
Cabal: cmd/build re: pkg-config type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

When using `pkg-config` on a mac, there are a number of packages that `brew` will install as keg-only, meaning, among other things that `pkg-config` won't find them out of the box.

One such example is `icu4c`, which is forced to be keg-only because Apple ships a tiny subset of ICU itself.

In #4242 we seemed to be taking the view of `pkg-config` as magic that doesn't need any setup, but in order to depend on any of the transitive dependencies of `icu4c`, on a mac you need to do something like:

```
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"
```

Simply trying to fall back on using `extra-lib-dirs:` and `extra-include-dirs:` doesn't cut it, because all of the subsequent packages are themselves `pkg-config`ured.

I could move this into my .profile, but that step is an active barrier to participation.

I'd ideally like to be able to keep the damage for something like this contained to my `cabal.project.local`, but I can't, as at the moment there is no way to either

a.) extend the `PKG_CONFIG_PATH` like we can our ability to search for libs and dirs more naively, e.g. adding a `pkg-config-dirs:` option for `cabal.project.local`

or more messily

b.) just specify some enviromment variable I'd like to have set.

I need multiple libraries as well, so falling back on legacy custom builds is not really an option.

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.