mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
Fix propagation of pkgconfig and frameworks (#715)
pkgconfig-depends that make use of propagatedBuildInputs and frameworks are not propagated to the exe component that links them. This seems to be because our libraries do not not include their dependencies as `buildInputs`. To make this work it also seems to be necessary for pkgconfig depends themselves to be `propagaedBuildInputs`.
This commit is contained in:
parent
4cf7a55a2a
commit
9c6eb16428
@ -215,12 +215,14 @@ stdenv.mkDerivation ({
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
propagatedBuildInputs =
|
||||
frameworks # Frameworks will be needed at link time
|
||||
# Not sure why pkgconfig needs to be propagatedBuildInputs but
|
||||
# for gi-gtk-hs it seems to help.
|
||||
++ builtins.concatLists pkgconfig;
|
||||
|
||||
buildInputs = component.libs
|
||||
++ frameworks
|
||||
++ builtins.concatLists pkgconfig
|
||||
# Note: This is a hack until we can fix properly. See:
|
||||
# https://github.com/haskell-gi/haskell-gi/issues/226
|
||||
++ lib.optional (lib.strings.hasPrefix "gi-" fullName) gobject-introspection;
|
||||
++ map (d: d.components.library or d) component.depends;
|
||||
|
||||
nativeBuildInputs =
|
||||
[shellWrappers buildPackages.removeReferencesTo]
|
||||
|
@ -84,6 +84,7 @@ let
|
||||
component = components.setup // {
|
||||
depends = config.setup-depends ++ components.setup.depends ++ package.setup-depends;
|
||||
extraSrcFiles = components.setup.extraSrcFiles ++ [ "Setup.hs" "Setup.lhs" ];
|
||||
pkgconfig = if components ? library then components.library.pkgconfig or [] else [];
|
||||
};
|
||||
inherit package name src flags revision patches defaultSetupSrc;
|
||||
inherit (pkg) preUnpack postUnpack;
|
||||
|
@ -28,6 +28,12 @@ let
|
||||
# because cabal will end up ignoring that built version;
|
||||
removeSelected = lib.filter
|
||||
(input: lib.all (cfg: (input.identifier or null) != cfg.identifier) selected);
|
||||
# Also since a will include the library component of b in its buildInputs
|
||||
# (to make `propagatedBuildInputs` of `pkgconfig-depends` work) those should
|
||||
# also be excluded (the pkgconfig depends of b will still be included in the
|
||||
# system shells buildInputs via b's own buildInputs).
|
||||
removeSelectedInputs = lib.filter
|
||||
(input: lib.all (cfg: input != cfg.components.library or null) selected);
|
||||
|
||||
packageInputs = removeSelected
|
||||
(lib.concatMap (cfg: cfg.depends) selectedConfigs
|
||||
@ -37,7 +43,7 @@ let
|
||||
|
||||
# Add the system libraries and build tools of the selected haskell
|
||||
# packages to the shell.
|
||||
systemInputs = lib.concatMap (p: p.components.all.buildInputs) selected;
|
||||
systemInputs = removeSelectedInputs (lib.concatMap (p: p.components.all.buildInputs) selected);
|
||||
nativeBuildInputs = removeSelected
|
||||
(lib.concatMap (p: p.components.all.executableToolDepends) selected);
|
||||
|
||||
|
@ -13,7 +13,7 @@ in pkgs.lib.evalModules {
|
||||
# as well as pkgconfPkgs, which are used to resolve pkgconfig name to nixpkgs names. We simply
|
||||
# augment the existing pkgs set with the specific mappings:
|
||||
pkgs = pkgs // (import ./lib/system-nixpkgs-map.nix pkgs);
|
||||
pkgconfPkgs = pkgs // (import ./lib/pkgconf-nixpkgs-map.nix pkgs);
|
||||
pkgconfPkgs = import ./lib/pkgconf-nixpkgs-map.nix pkgs;
|
||||
|
||||
inherit buildModules;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user