From c865b8e35e364e1193770243bc4b41e8178b1982 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Fri, 7 Apr 2017 01:28:44 +0200 Subject: [PATCH] haskell: add the linkWithGold function to link packages with ld.gold Also support linking the double-conversion package with ld.gold. --- pkgs/development/haskell-modules/configuration-common.nix | 8 +++++++- pkgs/development/haskell-modules/lib.nix | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index d84db527951..643f71f9f87 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -171,7 +171,13 @@ self: super: { else dontCheck super.fsnotify; double-conversion = if !pkgs.stdenv.isDarwin - then addExtraLibrary super.double-conversion pkgs.stdenv.cc.cc.lib + then addExtraLibrary + # https://github.com/bos/double-conversion/pull/17 + (appendPatch super.double-conversion (pkgs.fetchpatch { + url = "https://github.com/basvandijk/double-conversion/commit/0927e347d53dbd96d1949930e728cc2471dd4b14.patch"; + sha256 = "042yqbq5p6nc9nymmbz9hgp51dlc5asaj9bf91kw5fph6dw2hwg9"; + })) + pkgs.stdenv.cc.cc.lib else addExtraLibrary (overrideCabal super.double-conversion (drv: { postPatch = '' diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix index 912d26c806c..f88f2f2cf54 100644 --- a/pkgs/development/haskell-modules/lib.nix +++ b/pkgs/development/haskell-modules/lib.nix @@ -79,6 +79,9 @@ rec { fixupPhase = ":"; }); + linkWithGold = drv : appendConfigureFlag drv + "--ghc-option=-optl-fuse-ld=gold --ld-option=-fuse-ld=gold --with-ld=ld.gold"; + # link executables statically against haskell libs to reduce closure size justStaticExecutables = drv: overrideCabal drv (drv: { enableSharedExecutables = false;