returned to two-file structure for liblapack

This commit is contained in:
Allen Nelson 2015-05-28 21:46:09 -05:00
parent 2c125cf37a
commit e001340cf6
3 changed files with 73 additions and 17 deletions

@ -0,0 +1,66 @@
{
stdenv,
fetchurl,
gfortran,
cmake,
python,
atlas ? null,
shared ? false
}:
let
atlasMaybeShared = if atlas != null then atlas.override { inherit shared; }
else null;
usedLibExtension = if shared then ".so" else ".a";
inherit (stdenv.lib) optional optionals concatStringsSep;
inherit (builtins) hasAttr attrNames;
version = "3.5.0";
in
stdenv.mkDerivation rec {
name = "liblapack-${version}";
src = fetchurl {
url = "http://www.netlib.org/lapack/lapack-${version}.tgz";
sha256 = "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s";
};
propagatedBuildInputs = [ atlasMaybeShared ];
buildInputs = [ gfortran cmake ];
nativeBuildInputs = [ python ];
cmakeFlags = [
"-DUSE_OPTIMIZED_BLAS=ON"
"-DCMAKE_Fortran_FLAGS=-fPIC"
]
++ (optionals (atlas != null) [
"-DBLAS_ATLAS_f77blas_LIBRARY=${atlasMaybeShared}/lib/libf77blas${usedLibExtension}"
"-DBLAS_ATLAS_atlas_LIBRARY=${atlasMaybeShared}/lib/libatlas${usedLibExtension}"
])
++ (optional shared "-DBUILD_SHARED_LIBS=ON")
# If we're on darwin, CMake will automatically detect impure paths. This switch
# prevents that.
++ (optional stdenv.isDarwin "-DCMAKE_OSX_SYSROOT:PATH=''")
;
doCheck = ! shared;
checkPhase = "
sed -i 's,^#!.*,#!${python}/bin/python,' lapack_testing.py
ctest
";
enableParallelBuilding = true;
passthru = {
blas = atlas;
};
meta = {
inherit version;
description = "Linear Algebra PACKage";
homepage = "http://www.netlib.org/lapack/";
license = "revised-BSD";
platforms = stdenv.lib.platforms.all;
maintainers = [ stdenv.lib.maintainers.simons ];
};
}

@ -5,8 +5,7 @@
cmake,
python,
atlas ? null,
shared ? false,
version ? "3.4.1"
shared ? false
}:
let
atlasMaybeShared = if atlas != null then atlas.override { inherit shared; }
@ -14,25 +13,14 @@ let
usedLibExtension = if shared then ".so" else ".a";
inherit (stdenv.lib) optional optionals concatStringsSep;
inherit (builtins) hasAttr attrNames;
# Hashes of the versions of liblapack we know about.
versions2sha = {
"3.4.1" = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f";
"3.5.0" = "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s";
};
version = "3.4.1";
in
if !(builtins.hasAttr version versions2sha)
then throw ''
Unknown liblapack version ${version}.
Available versions: ${concatStringsSep ", " (attrNames versions2sha)}
''
else
stdenv.mkDerivation rec {
name = "liblapack-${version}";
src = fetchurl {
url = "http://www.netlib.org/lapack/lapack-${version}.tgz";
sha256 = versions2sha."${version}";
sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f";
};
propagatedBuildInputs = [ atlasMaybeShared ];

@ -13835,11 +13835,13 @@ let
jags = callPackage ../applications/science/math/jags { };
liblapack = callPackage ../development/libraries/science/math/liblapack { };
liblapack = callPackage ../development/libraries/science/math/liblapack {
atlas = null;
};
liblapackWithAtlas = liblapack.override { inherit atlas; };
liblapack_3_5_0 = liblapack.override { version = "3.5.0"; };
liblapack_3_5_0 = callPackage ../development/libraries/science/math/liblapack/3.5.0.nix { };
liblbfgs = callPackage ../development/libraries/science/math/liblbfgs { };