removed default dependency of liblapack on ATLAS. was causing an unnecessary double-build of atlas

This commit is contained in:
Allen Nelson 2015-05-28 11:56:29 -05:00
parent 6eb8ff878d
commit 2c125cf37a
3 changed files with 36 additions and 57 deletions

View File

@ -1,49 +0,0 @@
{ stdenv, fetchurl, gfortran, atlas, cmake, python, shared ? false }:
let
atlasMaybeShared = atlas.override { inherit shared; };
usedLibExtension = if shared then ".so" else ".a";
in
stdenv.mkDerivation rec {
version = "3.5.0";
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"
"-DBLAS_ATLAS_f77blas_LIBRARY=${atlasMaybeShared}/lib/libf77blas${usedLibExtension}"
"-DBLAS_ATLAS_atlas_LIBRARY=${atlasMaybeShared}/lib/libatlas${usedLibExtension}"
"-DCMAKE_Fortran_FLAGS=-fPIC"
]
++ (stdenv.lib.optional shared "-DBUILD_SHARED_LIBS=ON")
;
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 ];
};
}

View File

@ -1,15 +1,38 @@
{ stdenv, fetchurl, gfortran, atlas, cmake, python, shared ? false }:
{
stdenv,
fetchurl,
gfortran,
cmake,
python,
atlas ? null,
shared ? false,
version ? "3.4.1"
}:
let
atlasMaybeShared = atlas.override { inherit shared; };
atlasMaybeShared = if atlas != null then atlas.override { inherit shared; }
else null;
usedLibExtension = if shared then ".so" else ".a";
version = "3.4.1";
inherit (stdenv.lib) optional;
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";
};
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 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f";
sha256 = versions2sha."${version}";
};
propagatedBuildInputs = [ atlasMaybeShared ];
@ -18,10 +41,12 @@ stdenv.mkDerivation rec {
cmakeFlags = [
"-DUSE_OPTIMIZED_BLAS=ON"
"-DBLAS_ATLAS_f77blas_LIBRARY=${atlasMaybeShared}/lib/libf77blas${usedLibExtension}"
"-DBLAS_ATLAS_atlas_LIBRARY=${atlasMaybeShared}/lib/libatlas${usedLibExtension}"
"-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.

View File

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