on iko/ghcjs-patch-master help sign in
Considerate/overlays fixes (#262)

* Fix loadArchive clang++ error on macOS GHC 8.6.4 introduced an issue where linking to `-libc++` will cause GHC to resolve the library path to `c++` which in turn is a link to clang++. This results in the following error: ``` ghc: loadArchive: Neither an archive, nor a fat archive: `/nix/store/?-clang-wrapper-5.0.2/bin/clang++' <no location info>: error: loadArchive "/nix/store/?-clang-wrapper-5.0.2/bin/clang++": failed ``` The provided patch reverts the linking behavior of GHC to not resolve `-libc++` to `c++`. * Propagate unpack hooks to setup

commit46fad8195472cf52f1604930003a43bf8f5d3d56 authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateTue 22 Oct 2019, 22:15 (7 years ago) parent3984c0e
4 files changed+19−2
builder/hspkg-builder.nix+1 builder/setup-builder.nix+8−2 overlays/bootstrap.nix+1 overlays/patches/ghc/ghc-macOS-loadArchive-fix.patch+9
builder/hspkg-builder.nix+1
@@ -41,6 +41,7 @@ let
4141 else setup-builder {
4242 setup-depends = package.setup-depends;
4343 inherit package name src flags revision patches defaultSetupSrc;
44+ inherit (config) preUnpack postUnpack;
4445 };
4546
4647 buildComp = componentId: component: comp-builder {
builder/setup-builder.nix+8−2
@@ -1,6 +1,8 @@
11{ stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles }:
22
3−{ setup-depends, package, name, src, flags, revision, patches, defaultSetupSrc }:
3+{ setup-depends, package, name, src, flags, revision, patches, defaultSetupSrc
4+, preUnpack ? null, postUnpack ? null
5+}:
46
57let
68 component = {
@@ -31,6 +33,9 @@ let
3133 inherit (package) identifier;
3234 inherit fullName flags component;
3335 };
36+ hooks = haskellLib.optionalHooks {
37+ inherit preUnpack postUnpack;
38+ };
3439
3540in
3641 stdenv.lib.fix (drv:
@@ -66,5 +71,6 @@ in
6671 install ./Setup $out/bin/Setup
6772 '';
6873 }
69− // lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; }
74+ // (lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; })
75+ // hooks
7076 ))
overlays/bootstrap.nix+1
@@ -66,6 +66,7 @@ self: super: rec {
6666 ++ self.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-reinstallable-lib-ghc.patch
6767 ++ self.lib.optional (version == "8.6.5") ./patches/ghc/ghc-8.6.5-reinstallable-lib-ghc.patch
6868 ++ self.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-better-plusSimplCountErrors.patch
69+ ++ self.lib.optional (versionAtLeast "8.6.4" && self.stdenv.isDarwin) ./patches/ghc/ghc-macOS-loadArchive-fix.patch
6970 ;
7071 in ({
7172 ghc844 = self.callPackage ../compiler/ghc {
overlays/patches/ghc/ghc-macOS-loadArchive-fix.patchnew file+9
@@ -0,0 +1,9 @@
1+--- a/compiler/ghci/Linker.hs
2++++ b/compiler/ghci/Linker.hs
3+@@ -1487,7 +1487,6 @@ locateLib hsc_env is_hs lib_dirs gcc_dirs lib
4+ dyn_obj_file = lib <.> "dyn_o"
5+ arch_files = [ "lib" ++ lib ++ lib_tag <.> "a"
6+ , lib <.> "a" -- native code has no lib_tag
7+- , "lib" ++ lib, lib
8+ ]
9+ lib_tag = if is_hs && loading_profiled_hs_libs then "_p" else ""