From e001340cf659eb7f3c97d172710c21b3df35003c Mon Sep 17 00:00:00 2001 From: Allen Nelson Date: Thu, 28 May 2015 21:46:09 -0500 Subject: [PATCH] returned to two-file structure for liblapack --- .../science/math/liblapack/3.5.0.nix | 66 +++++++++++++++++++ .../science/math/liblapack/default.nix | 18 +---- pkgs/top-level/all-packages.nix | 6 +- 3 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 pkgs/development/libraries/science/math/liblapack/3.5.0.nix diff --git a/pkgs/development/libraries/science/math/liblapack/3.5.0.nix b/pkgs/development/libraries/science/math/liblapack/3.5.0.nix new file mode 100644 index 000000000000..510b18a55488 --- /dev/null +++ b/pkgs/development/libraries/science/math/liblapack/3.5.0.nix @@ -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 ]; + }; +} diff --git a/pkgs/development/libraries/science/math/liblapack/default.nix b/pkgs/development/libraries/science/math/liblapack/default.nix index 18aceeba1776..0487af4e9f4c 100644 --- a/pkgs/development/libraries/science/math/liblapack/default.nix +++ b/pkgs/development/libraries/science/math/liblapack/default.nix @@ -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 ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bb3b696e23a0..1da4a9803e5a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };