nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix

66 lines
2.0 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, gfortran, perl, which, config, coreutils
# Most packages depending on openblas expect integer width to match pointer width,
# but some expect to use 32-bit integers always (for compatibility with reference BLAS).
, blas64 ? null
}:
2014-08-28 21:39:01 +00:00
with stdenv.lib;
2015-02-26 12:44:03 +00:00
2015-10-11 14:16:27 +00:00
let blas64_ = blas64; in
2014-08-28 21:39:01 +00:00
let local = config.openblas.preferLocalBuild or false;
2015-04-24 23:21:20 +00:00
binary =
{ i686-linux = "32";
2015-04-24 23:21:20 +00:00
x86_64-linux = "64";
x86_64-darwin = "64";
2015-04-24 23:21:20 +00:00
}."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}");
genericFlags =
[ "DYNAMIC_ARCH=1"
"NUM_THREADS=64"
];
localFlags = config.openblas.flags or
optionals (hasAttr "target" config.openblas) [ "TARGET=${config.openblas.target}" ];
2015-10-11 14:16:27 +00:00
blas64 = if blas64_ != null then blas64_ else hasPrefix "x86_64" stdenv.system;
2014-08-28 21:39:01 +00:00
2016-09-10 00:42:54 +00:00
version = "0.2.19";
2015-10-11 14:16:27 +00:00
in
stdenv.mkDerivation {
2014-08-28 21:39:01 +00:00
name = "openblas-${version}";
src = fetchurl {
2015-11-05 16:24:31 +00:00
url = "https://github.com/xianyi/OpenBLAS/archive/v${version}.tar.gz";
2016-09-10 00:42:54 +00:00
sha256 = "0mw5ra1vjsqiba79zdhqfkqq6v3bla5a5c0wj7vca9qgjzjbah4w";
2014-08-28 21:39:01 +00:00
name = "openblas-${version}.tar.gz";
};
2015-10-11 14:16:27 +00:00
inherit blas64;
nativeBuildInputs = optionals stdenv.isDarwin [coreutils] ++ [gfortran perl which];
makeFlags =
(if local then localFlags else genericFlags)
++
optionals stdenv.isDarwin ["MACOSX_DEPLOYMENT_TARGET=10.9"]
++
[
"FC=gfortran"
# Note that clang is available through the stdenv on OSX and
# thus is not an explicit dependency.
"CC=${if stdenv.isDarwin then "clang" else "gcc"}"
''PREFIX="''$(out)"''
"BINARY=${binary}"
"USE_OPENMP=${if stdenv.isDarwin then "0" else "1"}"
"INTERFACE64=${if blas64 then "1" else "0"}"
];
2014-08-28 21:39:01 +00:00
2015-10-11 14:16:27 +00:00
doCheck = true;
checkTarget = "tests";
2014-08-29 15:02:39 +00:00
meta = with stdenv.lib; {
2014-08-28 21:39:01 +00:00
description = "Basic Linear Algebra Subprograms";
2014-08-29 15:02:39 +00:00
license = licenses.bsd3;
2014-08-28 21:39:01 +00:00
homepage = "https://github.com/xianyi/OpenBLAS";
platforms = platforms.unix;
2014-08-29 15:02:39 +00:00
maintainers = with maintainers; [ ttuegel ];
2014-08-28 21:39:01 +00:00
};
}