nixpkgs/pkgs/development/libraries/libsvm/default.nix
Doron Behar 0eafcccbc2 libsvm: make it possible to use it for saga
saga, as possibly other packages too, searches for svm.h in
include/libsvm/svm.h. Since the package doesn't hold a proper install
target, it should be OK to link the `svm.h` to `libsvm/svm.h` in
`$out/include/`.
2020-08-03 22:20:54 +03:00

40 lines
1.1 KiB
Nix

{stdenv, fetchurl}:
stdenv.mkDerivation rec {
pname = "libsvm";
version = "3.24";
src = fetchurl {
url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz";
sha256 = "15l69y23fxslrap415dvqb383x5fxvbffp9giszjfqjf38h1m26m";
};
buildPhase = ''
make
make lib
'';
installPhase = let
libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
in ''
install -D libsvm.so.2 $out/lib/libsvm.2${libSuff}
ln -s $out/lib/libsvm.2${libSuff} $out/lib/libsvm${libSuff}
install -Dt $out/bin/ svm-scale svm-train svm-predict
install -Dm644 -t $out/include svm.h
mkdir $out/include/libsvm
ln -s $out/include/svm.h $out/include/libsvm/svm.h
'';
postFixup = stdenv.lib.optionalString stdenv.isDarwin ''
install_name_tool -id libsvm.2.dylib $out/lib/libsvm.2.dylib;
'';
meta = with stdenv.lib; {
description = "A library for support vector machines";
homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/";
license = licenses.bsd3;
maintainers = [ maintainers.spwhitt ];
platforms = platforms.unix;
};
}