Look for DLLs in /bin directory of pkgconfig deps (#1422)
We include the /bin directory of `component.libs` in `extra-lib-dirs` on windows, but not `components.pkgconfig`. This causes confusing differences between the behavior depending on how a dependency was specified in the `.cabal` file or added in a module. If it wounds up in `components.libs` the need for DLLs would propagate correctly, but if it was only in `componets.pkgconfig` DLLs would not be included when building TH code and did not get symlinked to `exe` component output /bin dirs.
commite9a93540c32455534ce92aec11370897e0bf944f
authorHamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
dateFri 1 Apr 2022, 16:35 (5 years ago)
parent956ffff
builder/make-config-files.nix+4−1
@@ -82,7 +82,10 @@ let
8282
8383 ${lib.concatStringsSep "\n" (lib.mapAttrsToList flagsAndConfig {
8484 "extra-lib-dirs" = map (p: "${lib.getLib p}/lib") component.libs
85− ++ lib.optionals (stdenv.hostPlatform.isWindows) (map (p: "${lib.getBin p}/bin") component.libs);
85+ # On windows also include `bin` directories that may contain DLLs
86+ ++ lib.optionals (stdenv.hostPlatform.isWindows)
87+ (map (p: "${lib.getBin p}/bin")
88+ (component.libs ++ lib.concatLists component.pkgconfig));
8689 "extra-include-dirs" = map (p: "${lib.getDev p}/include") component.libs;
8790 "extra-framework-dirs" = map (p: "${p}/Library/Frameworks") component.frameworks;
8891 })}
builder/shell-for.nix+1
@@ -96,6 +96,7 @@ let
9696 component = {
9797 depends = packageInputs;
9898 libs = [];
99+ pkgconfig = [];
99100 frameworks = [];
100101 doExactConfig = false;
101102 };