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.
This commit is contained in:
Peter Simons 2015-01-19 18:32:10 +01:00
parent 600135bba5
commit f2a376f52a
3 changed files with 13 additions and 14 deletions

View File

@ -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; }
)

View File

@ -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; };

View File

@ -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 {