haskellPackages.mkDerivation: propagate pc deps for GHC >= 9.4
This change essentially amounts to inlining __CabalEagerPkgConfigWorkaround into haskellPackages.mkDerivation and applying it automatically for the affected GHC versions. This is a bit overeager, but the best automatic solution we can come up with for now. Consequently, we don't need __CabalEagerPkgConfigWorkaround in nixpkgs anymore nor downstream at least for “standard” haskellPackages builds. __CabalEagerPkgConfigWorkaround is preserved for now since it is still necessary if using GHC < 9.4 with Cabal >= 3.10 or cabal-install >= 3.10. The one thing that may or may not be negatively affected by this change is ghcWithPackages. I doubt this is a problem in practice though, since it didn't provide pkg-config in the first place. passthru.env and shellFor do and work correctly since they rely on mkDerivation.
This commit is contained in:
parent
f6f780f129
commit
a83158c7b9
|
@ -112,44 +112,4 @@ in {
|
|||
fourmolu = overrideCabal (drv: {
|
||||
libraryHaskellDepends = drv.libraryHaskellDepends ++ [ self.file-embed ];
|
||||
}) (disableCabalFlag "fixity-th" super.fourmolu);
|
||||
|
||||
# Apply workaround for Cabal 3.8 bug https://github.com/haskell/cabal/issues/8455
|
||||
# by making `pkg-config --static` happy. Note: Cabal 3.9 is also affected, so
|
||||
# the GHC 9.6 configuration shall need similar overrides.
|
||||
X11-xft = __CabalEagerPkgConfigWorkaround super.X11-xft;
|
||||
# Jailbreaks for https://github.com/gtk2hs/gtk2hs/issues/323#issuecomment-1416723309
|
||||
glib = __CabalEagerPkgConfigWorkaround (doJailbreak super.glib);
|
||||
cairo = __CabalEagerPkgConfigWorkaround (doJailbreak super.cairo);
|
||||
pango = __CabalEagerPkgConfigWorkaround (doJailbreak super.pango);
|
||||
|
||||
# Cabal 3.8 bug workaround for haskell-gi family of libraries
|
||||
gi-atk = __CabalEagerPkgConfigWorkaround super.gi-atk;
|
||||
gi-cairo = __CabalEagerPkgConfigWorkaround super.gi-cairo;
|
||||
gi-gdk = __CabalEagerPkgConfigWorkaround super.gi-gdk;
|
||||
gi-gdkpixbuf = __CabalEagerPkgConfigWorkaround super.gi-gdkpixbuf;
|
||||
gi-gio = __CabalEagerPkgConfigWorkaround super.gi-gio;
|
||||
gi-glib = __CabalEagerPkgConfigWorkaround super.gi-glib;
|
||||
gi-gmodule = __CabalEagerPkgConfigWorkaround super.gi-gmodule;
|
||||
gi-gobject = __CabalEagerPkgConfigWorkaround super.gi-gobject;
|
||||
gi-gtk = __CabalEagerPkgConfigWorkaround super.gi-gtk;
|
||||
gi-harfbuzz = __CabalEagerPkgConfigWorkaround super.gi-harfbuzz;
|
||||
gi-pango = __CabalEagerPkgConfigWorkaround super.gi-pango;
|
||||
gi-vte = __CabalEagerPkgConfigWorkaround super.gi-vte;
|
||||
haskell-gi = __CabalEagerPkgConfigWorkaround super.haskell-gi;
|
||||
haskell-gi-base = __CabalEagerPkgConfigWorkaround super.haskell-gi-base;
|
||||
svgcairo = __CabalEagerPkgConfigWorkaround super.svgcairo;
|
||||
gtk3 = __CabalEagerPkgConfigWorkaround super.gtk3;
|
||||
webkit2gtk3-javascriptcore = __CabalEagerPkgConfigWorkaround super.webkit2gtk3-javascriptcore;
|
||||
gi-javascriptcore = __CabalEagerPkgConfigWorkaround super.gi-javascriptcore;
|
||||
gi-soup = __CabalEagerPkgConfigWorkaround super.gi-soup;
|
||||
gio = __CabalEagerPkgConfigWorkaround super.gio;
|
||||
gtk = __CabalEagerPkgConfigWorkaround super.gtk;
|
||||
termonad = __CabalEagerPkgConfigWorkaround super.termonad;
|
||||
gi-cairo-render = __CabalEagerPkgConfigWorkaround super.gi-cairo-render;
|
||||
gi-dbusmenu = __CabalEagerPkgConfigWorkaround super.gi-dbusmenu;
|
||||
gi-dbusmenugtk3 = __CabalEagerPkgConfigWorkaround super.gi-dbusmenugtk3;
|
||||
gi-gdkx11 = __CabalEagerPkgConfigWorkaround super.gi-gdkx11;
|
||||
gi-xlib = __CabalEagerPkgConfigWorkaround super.gi-xlib;
|
||||
gtk-sni-tray = __CabalEagerPkgConfigWorkaround super.gtk-sni-tray;
|
||||
taffybar = __CabalEagerPkgConfigWorkaround super.taffybar;
|
||||
}
|
||||
|
|
|
@ -243,37 +243,8 @@ self: super: {
|
|||
package-version # doctest <0.21, tasty-hedgehog <1.4
|
||||
;
|
||||
|
||||
# Apply workaround for Cabal 3.9 bug https://github.com/haskell/cabal/issues/8455
|
||||
# by making `pkg-config --static` happy. Note: Cabal 3.8 is also affected, so
|
||||
# the GHC 9.4 configuration needs similar overrides.
|
||||
inherit (pkgs.lib.mapAttrs (_: __CabalEagerPkgConfigWorkaround) super)
|
||||
X11-xft
|
||||
cairo
|
||||
gi-atk
|
||||
gi-cairo
|
||||
gi-cairo-render
|
||||
gi-dbusmenu
|
||||
gi-dbusmenugtk3
|
||||
gi-gdk
|
||||
gi-gdkpixbuf
|
||||
gi-gdkx11
|
||||
gi-gio
|
||||
gi-glib
|
||||
gi-gmodule
|
||||
gi-gobject
|
||||
gi-harfbuzz
|
||||
gi-pango
|
||||
gi-xlib
|
||||
glib
|
||||
gtk-sni-tray
|
||||
haskell-gi
|
||||
haskell-gi-base
|
||||
pango
|
||||
taffybar
|
||||
;
|
||||
|
||||
# Avoid triggering an issue in ghc-9.6.2
|
||||
gi-gtk = disableParallelBuilding (__CabalEagerPkgConfigWorkaround super.gi-gtk);
|
||||
gi-gtk = disableParallelBuilding super.gi-gtk;
|
||||
|
||||
# Pending text-2.0 support https://github.com/gtk2hs/gtk2hs/issues/327
|
||||
gtk = doJailbreak super.gtk;
|
||||
|
|
|
@ -256,8 +256,40 @@ let
|
|||
|
||||
isHaskellPkg = x: x ? isHaskellLibrary;
|
||||
|
||||
allPkgconfigDepends = pkg-configDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
|
||||
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
|
||||
# Work around a Cabal bug requiring pkg-config --static --libs to work even
|
||||
# when linking dynamically, affecting Cabal 3.8 and 3.9.
|
||||
# https://github.com/haskell/cabal/issues/8455
|
||||
#
|
||||
# For this, we treat the runtime system/pkg-config dependencies of a Haskell
|
||||
# derivation as if they were propagated from their dependencies which allows
|
||||
# pkg-config --static to work in most cases.
|
||||
allPkgconfigDepends =
|
||||
let
|
||||
# Take list of derivations and return list of the transitive dependency
|
||||
# closure, only taking into account buildInputs. Loosely based on
|
||||
# closePropagationFast.
|
||||
propagatePlainBuildInputs = drvs:
|
||||
builtins.map (i: i.val) (
|
||||
builtins.genericClosure {
|
||||
startSet = builtins.map (drv:
|
||||
{ key = drv.outPath; val = drv; }
|
||||
) (builtins.filter lib.isDerivation drvs);
|
||||
operator = { val, ... }:
|
||||
builtins.concatMap (drv:
|
||||
if !lib.isDerivation drv
|
||||
then [ ]
|
||||
else [ { key = drv.outPath; val = drv; } ]
|
||||
) (val.buildInputs or [ ] ++ val.propagatedBuildInputs or [ ]);
|
||||
}
|
||||
);
|
||||
in
|
||||
|
||||
if lib.versionAtLeast ghc.version "9.3"
|
||||
then propagatePlainBuildInputs allPkgconfigDepends'
|
||||
else allPkgconfigDepends';
|
||||
allPkgconfigDepends' =
|
||||
pkg-configDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
|
||||
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
|
||||
|
||||
depsBuildBuild = [ nativeGhc ]
|
||||
# CC_FOR_BUILD may be necessary if we have no C preprocessor for the host
|
||||
|
|
Loading…
Reference in a new issue