From f2a376f52a49e1cc563b9a3d34a8be9194a33bcd Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Mon, 19 Jan 2015 18:32:10 +0100 Subject: [PATCH] Enable static libraries in "gmp" to allow static linking of Haskell programs. Haskell programs depend on gmp to implement the unbounded Integer type. Without static variants of gmp we cannot build statically linked Haskell programs, what some users have found desirable in the past. So far, we've used an override to derive our own copy of gmp in the Haskell ecosystem, but this patch ends the dichotomy between Haskell and the rest of Nixpkgs by enabling static gmp libraries in the default build default. --- pkgs/development/libraries/gmp/5.1.x.nix | 9 ++++----- pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/haskell-ng.nix | 16 ++++++++-------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix index 5e1282c1d505..0df1a4f8cd83 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, withStatic ? false }: +{ stdenv, fetchurl, m4, cxx ? true, withStatic ? true }: 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 @@ -30,6 +30,8 @@ stdenv.mkDerivation (rec { doCheck = true; + dontDisableStatic = withStatic; + enableParallelBuilding = true; meta = with stdenv.lib; { @@ -63,6 +65,3 @@ stdenv.mkDerivation (rec { 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 299cd0afd44b..c0cec16ca049 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3494,7 +3494,7 @@ let # Import Haskell infrastructure. - haskell = let pkgs_ = pkgs // { gmp = gmp.override { withStatic = true; }; }; + haskell = let pkgs_ = pkgs // { /* add necessary overrides here */ }; callPackage = newScope pkgs_; newScope = extra: lib.callPackageWith (pkgs_ // pkgs_.xorg // extra); in callPackage ./haskell-defaults.nix { pkgs = pkgs_; inherit callPackage newScope; }; diff --git a/pkgs/top-level/haskell-ng.nix b/pkgs/top-level/haskell-ng.nix index 2e0d61f18733..6a55023d3589 100644 --- a/pkgs/top-level/haskell-ng.nix +++ b/pkgs/top-level/haskell-ng.nix @@ -14,24 +14,24 @@ rec { libiconv = pkgs.darwin.libiconv; }); - ghc6104 = callPackage ../development/compilers/ghc/6.10.4.nix { ghc = compiler.ghc6102Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; - ghc6123 = callPackage ../development/compilers/ghc/6.12.3.nix { ghc = compiler.ghc6102Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; - ghc704 = callPackage ../development/compilers/ghc/7.0.4.nix ({ ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { + ghc6104 = callPackage ../development/compilers/ghc/6.10.4.nix { ghc = compiler.ghc6102Binary; }; + ghc6123 = callPackage ../development/compilers/ghc/6.12.3.nix { ghc = compiler.ghc6102Binary; }; + ghc704 = callPackage ../development/compilers/ghc/7.0.4.nix ({ ghc = compiler.ghc704Binary; } // stdenv.lib.optionalAttrs stdenv.isDarwin { libiconv = pkgs.darwin.libiconv; }); - ghc722 = callPackage ../development/compilers/ghc/7.2.2.nix ({ ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { + ghc722 = callPackage ../development/compilers/ghc/7.2.2.nix ({ ghc = compiler.ghc704Binary; } // stdenv.lib.optionalAttrs stdenv.isDarwin { libiconv = pkgs.darwin.libiconv; }); - ghc742 = callPackage ../development/compilers/ghc/7.4.2.nix ({ ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { + ghc742 = callPackage ../development/compilers/ghc/7.4.2.nix ({ ghc = compiler.ghc704Binary; } // stdenv.lib.optionalAttrs stdenv.isDarwin { libiconv = pkgs.darwin.libiconv; }); - ghc763 = callPackage ../development/compilers/ghc/7.6.3.nix ({ ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { + ghc763 = callPackage ../development/compilers/ghc/7.6.3.nix ({ ghc = compiler.ghc704Binary; } // stdenv.lib.optionalAttrs stdenv.isDarwin { libiconv = pkgs.darwin.libiconv; }); - ghc784 = callPackage ../development/compilers/ghc/7.8.4.nix ({ ghc = compiler.ghc742Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { + ghc784 = callPackage ../development/compilers/ghc/7.8.4.nix ({ ghc = compiler.ghc742Binary; } // stdenv.lib.optionalAttrs stdenv.isDarwin { libiconv = pkgs.darwin.libiconv; }); - ghc7101 = callPackage ../development/compilers/ghc/7.10.1.nix ({ ghc = compiler.ghc784; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { + ghc7101 = callPackage ../development/compilers/ghc/7.10.1.nix ({ ghc = compiler.ghc784; } // stdenv.lib.optionalAttrs stdenv.isDarwin { libiconv = pkgs.darwin.libiconv; }); ghcHEAD = callPackage ../development/compilers/ghc/head.nix ({ inherit (packages.ghc784) ghc alex happy; } // stdenv.lib.optionalAttrs stdenv.isDarwin {