From e69b7b804b16308982678d28ef291e3f5c402629 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 18 Sep 2023 17:08:08 +0200 Subject: [PATCH] Set `PKG_CONFIG_ALLOW_SYSTEM_(CFLAGS|LIBS)` by default --- Cabal/src/Distribution/Simple/Program/Builtin.hs | 7 +++++++ changelog.d/pkgconfig-envvars | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 changelog.d/pkgconfig-envvars diff --git a/Cabal/src/Distribution/Simple/Program/Builtin.hs b/Cabal/src/Distribution/Simple/Program/Builtin.hs index 1f3db0740f3..c866c0a9c82 100644 --- a/Cabal/src/Distribution/Simple/Program/Builtin.hs +++ b/Cabal/src/Distribution/Simple/Program/Builtin.hs @@ -400,4 +400,11 @@ pkgConfigProgram :: Program pkgConfigProgram = (simpleProgram "pkg-config") { programFindVersion = findProgramVersion "--version" id + , programPostConf = \_ pkgConfProg -> + let programOverrideEnv' = + programOverrideEnv pkgConfProg + ++ [ ("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS", Just "1") + , ("PKG_CONFIG_ALLOW_SYSTEM_LIBS", Just "1") + ] + in pure $ pkgConfProg{programOverrideEnv = programOverrideEnv'} } diff --git a/changelog.d/pkgconfig-envvars b/changelog.d/pkgconfig-envvars new file mode 100644 index 00000000000..69b0ef4bed9 --- /dev/null +++ b/changelog.d/pkgconfig-envvars @@ -0,0 +1,8 @@ ++synopsis: PkgConfig environment variables ++prs: #9134 ++ ++description: { ++ ++- `cabal` invokes `pkg-config` with `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS` and `PKG_CONFIG_ALLOW_SYSTEM_LIBS` set ++ ++}