Merge pull request #8042 from adnelson/liblapack_atlas_dependency_optional

Liblapack atlas dependency optional
This commit is contained in:
Peter Simons 2015-05-30 19:25:54 +02:00
commit d3073741a3
3 changed files with 54 additions and 15 deletions

View File

@ -1,10 +1,22 @@
{ stdenv, fetchurl, gfortran, atlas, cmake, python, shared ? false }:
{
stdenv,
fetchurl,
gfortran,
cmake,
python,
atlas ? null,
shared ? false
}:
let
atlasMaybeShared = atlas.override { inherit shared; };
atlasMaybeShared = if atlas != null then atlas.override { inherit shared; }
else null;
usedLibExtension = if shared then ".so" else ".a";
in
stdenv.mkDerivation rec {
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";
@ -17,11 +29,16 @@ 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"
]
++ (stdenv.lib.optional shared "-DBUILD_SHARED_LIBS=ON")
++ (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;

View File

@ -1,10 +1,21 @@
{ stdenv, fetchurl, gfortran, atlas, cmake, python, shared ? false }:
{
stdenv,
fetchurl,
gfortran,
cmake,
python,
atlas ? null,
shared ? false
}:
let
atlasMaybeShared = atlas.override { inherit shared; };
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.4.1";
inherit (stdenv.lib) optional;
in
stdenv.mkDerivation rec {
name = "liblapack-${version}";
src = fetchurl {
@ -18,10 +29,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

@ -13851,7 +13851,7 @@ let
# great feature, but it's of limited use with pre-built binaries
# coming from a central build farm.
tolerateCpuTimingInaccuracy = true;
liblapack = liblapack_3_5_0;
liblapack = liblapack_3_5_0WithoutAtlas;
withLapack = false;
};
@ -13867,8 +13867,17 @@ 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 { };
# We have essentially 4 permutations of liblapack: version 3.4.1 or 3.5.0,
# and with or without atlas as a dependency. The default `liblapack` is 3.4.1
# with atlas. Atlas, when built with liblapack as a dependency, uses 3.5.0
# without atlas. Etc.
liblapackWithAtlas = callPackage ../development/libraries/science/math/liblapack {};
liblapackWithoutAtlas = liblapackWithAtlas.override { atlas = null; };
liblapack_3_5_0WithAtlas = callPackage ../development/libraries/science/math/liblapack/3.5.0.nix {};
liblapack_3_5_0WithoutAtlas = liblapack_3_5_0WithAtlas.override { atlas = null; };
liblapack = liblapackWithAtlas;
liblapack_3_5_0 = liblapack_3_5_0WithAtlas;
liblbfgs = callPackage ../development/libraries/science/math/liblbfgs { };