2020-02-21 09:56:29 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchpatch, fetchurl, cmake, ctags, swig
|
2017-10-29 09:20:12 +00:00
|
|
|
# data, compression
|
|
|
|
, bzip2, curl, hdf5, json_c, lzma, lzo, protobuf, snappy
|
|
|
|
# maths
|
2020-03-31 15:47:18 +01:00
|
|
|
, blas, lapack, eigen, nlopt, lp_solve, colpack, glpk
|
2017-10-29 09:20:12 +00:00
|
|
|
# libraries
|
2018-11-08 20:42:29 +00:00
|
|
|
, libarchive, libxml2
|
2017-10-29 09:20:12 +00:00
|
|
|
# extra support
|
|
|
|
, pythonSupport ? true, pythonPackages ? null
|
|
|
|
, opencvSupport ? false, opencv ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert pythonSupport -> pythonPackages != null;
|
|
|
|
assert opencvSupport -> opencv != null;
|
|
|
|
|
2020-04-20 21:50:55 +01:00
|
|
|
assert (!blas.isILP64) && (!lapack.isILP64);
|
2020-03-31 15:47:18 +01:00
|
|
|
|
2020-02-21 09:56:29 +00:00
|
|
|
let
|
2017-10-29 09:20:12 +00:00
|
|
|
pname = "shogun";
|
2020-02-21 09:56:29 +00:00
|
|
|
version = "6.1.4";
|
|
|
|
rxcppVersion = "4.0.0";
|
|
|
|
gtestVersion = "1.8.0";
|
|
|
|
srcs = {
|
|
|
|
toolbox = fetchFromGitHub {
|
|
|
|
owner = pname + "-toolbox";
|
|
|
|
repo = pname;
|
|
|
|
rev = pname + "_" + version;
|
|
|
|
sha256 = "38aULxK50wQ2+/ERosSpRyBmssmYSGv5aaWfWSlrSRc=";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
# we need the packed archive
|
|
|
|
rxcpp = fetchurl {
|
|
|
|
url = "https://github.com/Reactive-Extensions/RxCpp/archive/v${rxcppVersion}.tar.gz";
|
|
|
|
sha256 = "0y2isr8dy2n1yjr9c5570kpc9lvdlch6jv0jvw000amwn5d3krsh";
|
|
|
|
};
|
|
|
|
gtest = fetchurl {
|
|
|
|
url = "https://github.com/google/googletest/archive/release-${gtestVersion}.tar.gz";
|
|
|
|
sha256 = "1n5p1m2m3fjrjdj752lf92f9wq3pl5cbsfrb49jqbg52ghkz99jq";
|
|
|
|
};
|
2017-10-29 09:20:12 +00:00
|
|
|
};
|
2020-02-21 09:56:29 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
src = srcs.toolbox;
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
mkdir -p $sourceRoot/third_party/{rxcpp,gtest}
|
|
|
|
ln -s ${srcs.rxcpp} $sourceRoot/third_party/rxcpp/v${rxcppVersion}.tar.gz
|
|
|
|
ln -s ${srcs.gtest} $sourceRoot/third_party/gtest/release-${gtestVersion}.tar.gz
|
|
|
|
'';
|
|
|
|
|
|
|
|
# broken
|
|
|
|
doCheck = false;
|
2017-10-29 09:20:12 +00:00
|
|
|
|
2018-03-05 20:54:22 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/awild82/shogun/commit/365ce4c4c700736d2eec8ba6c975327a5ac2cd9b.patch";
|
|
|
|
sha256 = "158hqv4xzw648pmjbwrhxjp7qcppqa7kvriif87gn3zdn711c49s";
|
|
|
|
})
|
|
|
|
];
|
2017-12-03 11:27:45 +00:00
|
|
|
|
2020-02-21 09:56:29 +00:00
|
|
|
CCACHE_DISABLE="1";
|
2017-10-29 09:20:12 +00:00
|
|
|
CCACHE_DIR=".ccache";
|
|
|
|
|
|
|
|
buildInputs = with lib; [
|
2020-03-31 15:47:18 +01:00
|
|
|
blas lapack bzip2 cmake colpack curl ctags eigen hdf5 json_c lp_solve lzma lzo
|
|
|
|
protobuf nlopt snappy swig (libarchive.dev) libxml2 lapack glpk
|
2017-10-29 09:20:12 +00:00
|
|
|
]
|
|
|
|
++ optionals (pythonSupport) (with pythonPackages; [ python ply numpy ])
|
|
|
|
++ optional (opencvSupport) opencv;
|
|
|
|
|
2020-02-21 09:56:29 +00:00
|
|
|
NIX_CFLAGS_COMPILE="-faligned-new";
|
|
|
|
|
|
|
|
cmakeFlags =
|
|
|
|
let
|
|
|
|
onOff = b: if b then "ON" else "OFF";
|
|
|
|
flag = n: b: "-D"+n+"="+onOff b;
|
|
|
|
in
|
|
|
|
with lib; [
|
|
|
|
(flag "ENABLE_TESTING" doCheck)
|
|
|
|
(flag "BUILD_META_EXAMPLES" doCheck)
|
|
|
|
(flag "CMAKE_VERBOSE_MAKEFILE:BOOL" doCheck)
|
|
|
|
(flag "PythonModular" pythonSupport)
|
|
|
|
(flag "OpenCV" opencvSupport)
|
|
|
|
];
|
2017-10-29 09:20:12 +00:00
|
|
|
|
2020-02-21 09:56:29 +00:00
|
|
|
enableParallelBuilding = true;
|
2018-04-05 21:53:34 +01:00
|
|
|
|
2017-10-29 09:20:12 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A toolbox which offers a wide range of efficient and unified machine learning methods";
|
|
|
|
homepage = "http://shogun-toolbox.org/";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ edwtjo ];
|
|
|
|
};
|
|
|
|
}
|