on iko/ghcjs-patch-master help sign in
Allow .so dynamic libraries on Darwin (#534)

* Allow .so dynamic libraries on Darwin This code is a hack that applied only to Darwin, it collects all required dynamic libraries into a single directory. It does this by listing all library dirs and then linkin all dynamic libraries in them. Before this change, it would link only `*.dylib` files. This was a problem, because (weirdly) a lot of libraries in Nixpkgs actually produce .so even on Darwin (and, weirdly, this somehow works). So we now link `.so` files as well. * Fix linking of dynamic libs with static on Darwin This piece of code `ln`s all libraries we might want to link with into a single directory and then hides all previous directories from Cabal. The problem is that this code only `ln`s dynamic libraries, however we might want to link with some library that only comes in a static version. So, `ln` static `.a` libraries too so that they are found when linking.

commit16f43b2b2f2c4ed4fa2d1eeb00785344a4bb87f3 authorKirill Elagin <kirelagin@gmail.com> dateThu 9 Apr 2020, 06:14 (7 years ago) parent6467559
1 file changed+1−1
builder/make-config-files.nix+1−1
builder/make-config-files.nix+1−1
@@ -170,7 +170,7 @@ in { identifier, component, fullName, flags ? {} }:
170170 done | sed 's|''${pkgroot}/../../../|/nix/store/|' | sort -u
171171 )
172172 for d in $dirsToLink; do
173− ln -f -s "$d/"*.dylib $dynamicLinksDir
173+ ln -f -s "$d/"*.{a,dylib,so} $dynamicLinksDir
174174 done
175175 # Edit the local package DB to reference the links directory.
176176 for f in "$out/${packageCfgDir}/"*.conf; do