2015-05-18 23:45:18 +01:00
|
|
|
{ stdenv, fetchurl, gfortran, perl, liblapack, config, coreutils }:
|
2014-08-28 22:39:01 +01:00
|
|
|
|
2015-04-17 13:35:19 +01:00
|
|
|
with stdenv.lib;
|
2015-02-26 12:44:03 +00:00
|
|
|
|
2014-08-28 22:39:01 +01:00
|
|
|
let local = config.openblas.preferLocalBuild or false;
|
2015-04-25 00:21:20 +01:00
|
|
|
binary =
|
|
|
|
{
|
|
|
|
i686-linux = "32";
|
|
|
|
x86_64-linux = "64";
|
2015-05-18 23:01:43 +01:00
|
|
|
x86_64-darwin = "64";
|
2015-04-25 00:21:20 +01:00
|
|
|
}."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}");
|
2015-04-17 13:35:19 +01:00
|
|
|
genericFlags =
|
|
|
|
[
|
|
|
|
"DYNAMIC_ARCH=1"
|
|
|
|
"NUM_THREADS=64"
|
2015-04-25 00:21:20 +01:00
|
|
|
"BINARY=${binary}"
|
2015-06-04 00:15:50 +01:00
|
|
|
"USE_OPENMP=1"
|
|
|
|
"NUM_THREADS=64"
|
2015-04-17 13:35:19 +01:00
|
|
|
];
|
|
|
|
localFlags = config.openblas.flags or
|
|
|
|
optionals (hasAttr "target" config.openblas) [ "TARGET=${config.openblas.target}" ];
|
2014-08-28 22:39:01 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2015-04-25 00:21:20 +01:00
|
|
|
version = "0.2.14";
|
2014-08-28 22:39:01 +01:00
|
|
|
|
|
|
|
name = "openblas-${version}";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/xianyi/OpenBLAS/tarball/v${version}";
|
2015-04-25 00:21:20 +01:00
|
|
|
sha256 = "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db";
|
2014-08-28 22:39:01 +01:00
|
|
|
name = "openblas-${version}.tar.gz";
|
|
|
|
};
|
|
|
|
|
|
|
|
preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz";
|
|
|
|
|
2015-05-18 23:01:43 +01:00
|
|
|
nativeBuildInputs = optionals stdenv.isDarwin [coreutils] ++ [gfortran perl];
|
2015-04-17 13:35:19 +01:00
|
|
|
|
|
|
|
makeFlags =
|
|
|
|
(if local then localFlags else genericFlags)
|
|
|
|
++
|
2015-05-18 23:01:43 +01:00
|
|
|
optionals stdenv.isDarwin ["MACOSX_DEPLOYMENT_TARGET=10.9"]
|
|
|
|
++
|
2015-04-17 13:35:19 +01:00
|
|
|
[
|
|
|
|
"FC=gfortran"
|
2015-05-18 23:45:18 +01:00
|
|
|
# Note that clang is available through the stdenv on OSX and
|
|
|
|
# thus is not an explicit dependency.
|
2015-05-18 23:01:43 +01:00
|
|
|
"CC=${if stdenv.isDarwin then "clang" else "gcc"}"
|
2015-04-17 13:35:19 +01:00
|
|
|
''PREFIX="''$(out)"''
|
|
|
|
"INTERFACE64=1"
|
|
|
|
];
|
2014-08-28 22:39:01 +01:00
|
|
|
|
2014-08-29 16:02:39 +01:00
|
|
|
meta = with stdenv.lib; {
|
2014-08-28 22:39:01 +01:00
|
|
|
description = "Basic Linear Algebra Subprograms";
|
2014-08-29 16:02:39 +01:00
|
|
|
license = licenses.bsd3;
|
2014-08-28 22:39:01 +01:00
|
|
|
homepage = "https://github.com/xianyi/OpenBLAS";
|
2015-05-18 23:45:18 +01:00
|
|
|
platforms = with platforms; unix;
|
2014-08-29 16:02:39 +01:00
|
|
|
maintainers = with maintainers; [ ttuegel ];
|
2014-08-28 22:39:01 +01:00
|
|
|
};
|
|
|
|
}
|