10 stdenv.mkDerivation rec {
15 url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz";
16 sha256 = "sha256-1doSzMPQ7thFP732+sfZ8AUvPopfB6IXTk7wqdg9zfg=";
19 patches = lib.optionals withOpenMP [ ./openmp.patch ];
21 buildInputs = lib.optionals (stdenv.cc.isClang && withOpenMP) [ llvmPackages.openmp ];
34 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
38 libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
41 if stdenv.hostPlatform.isDarwin then
42 "libsvm.${soVersion}${libSuff}"
44 "libsvm${libSuff}.${soVersion}";
49 install -D libsvm.so.${soVersion} $out/lib/${libName}
50 ln -s $out/lib/${libName} $out/lib/libsvm${libSuff}
52 install -Dt $bin/bin/ svm-scale svm-train svm-predict
54 install -Dm644 -t $dev/include svm.h
55 mkdir $dev/include/libsvm
56 ln -s $dev/include/svm.h $dev/include/libsvm/svm.h
62 description = "Library for support vector machines";
63 homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/";
64 license = licenses.bsd3;
66 platforms = platforms.unix;