From 7c5a1b1d5178b69833f7df77ae7192df464897e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 6 Jul 2014 13:37:46 +0200 Subject: [PATCH] haskellPackages: use static-enabled 'gmp' to enable statically linked Haskell binaries Pass '-optl-static -optl-pthread' to GHC to enable static linking. Fixes . Further details can be found at . --- pkgs/development/libraries/gmp/5.1.x.nix | 15 +++++++++------ pkgs/top-level/all-packages.nix | 5 ++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix index cba8d394c2ba..9e28334804bd 100644 --- a/pkgs/development/libraries/gmp/5.1.x.nix +++ b/pkgs/development/libraries/gmp/5.1.x.nix @@ -1,8 +1,8 @@ -{ stdenv, fetchurl, m4, cxx ? true }: +{ stdenv, fetchurl, m4, cxx ? true, withStatic ? false }: with { inherit (stdenv.lib) optional; }; -stdenv.mkDerivation rec { +stdenv.mkDerivation (rec { name = "gmp-5.1.3"; src = fetchurl { # we need to use bz2, others aren't in bootstrapping stdenv @@ -27,10 +27,10 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - meta = { + meta = with stdenv.lib; { homepage = "http://gmplib.org/"; description = "GMP, the GNU multiple precision arithmetic library"; - license = stdenv.lib.licenses.gpl3Plus; + license = licenses.gpl3Plus; longDescription = '' GMP is a free library for arbitrary precision arithmetic, operating @@ -54,7 +54,10 @@ stdenv.mkDerivation rec { asymptotically faster algorithms. ''; - platforms = stdenv.lib.platforms.all; - maintainers = [ stdenv.lib.maintainers.simons ]; + platforms = platforms.all; + maintainers = [ maintainers.simons ]; }; } + // stdenv.lib.optionalAttrs withStatic { dontDisableStatic = true; } +) + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 685a8b7705dd..fd81f36e379f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2933,7 +2933,10 @@ let # Import Haskell infrastructure. - haskell = callPackage ./haskell-defaults.nix { inherit pkgs; }; + haskell = let pkgs_ = pkgs // { gmp = gmp.override { withStatic = true; }; }; + callPackage = newScope pkgs_; + newScope = extra: lib.callPackageWith (pkgs_ // pkgs_.xorg // extra); + in callPackage ./haskell-defaults.nix { pkgs = pkgs_; inherit callPackage newScope; }; # Available GHC versions.