nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{lib, stdenv, fetchurl}:
2
3stdenv.mkDerivation rec {
4 pname = "libsvm";
5 version = "3.25";
6
7 src = fetchurl {
8 url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz";
9 sha256 = "sha256-UjUOiqdAsXbh13Pp3AjxNAIYw34BvsN6uQ2wEn5LteU=";
10 };
11
12 buildPhase = ''
13 make
14 make lib
15 '';
16
17 installPhase = let
18 libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
19 in ''
20 install -D libsvm.so.2 $out/lib/libsvm.2${libSuff}
21 ln -s $out/lib/libsvm.2${libSuff} $out/lib/libsvm${libSuff}
22 install -Dt $out/bin/ svm-scale svm-train svm-predict
23 install -Dm644 -t $out/include svm.h
24 mkdir $out/include/libsvm
25 ln -s $out/include/svm.h $out/include/libsvm/svm.h
26 '';
27
28 postFixup = lib.optionalString stdenv.isDarwin ''
29 install_name_tool -id libsvm.2.dylib $out/lib/libsvm.2.dylib;
30 '';
31
32 meta = with lib; {
33 description = "A library for support vector machines";
34 homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/";
35 license = licenses.bsd3;
36 maintainers = [ maintainers.spwhitt ];
37 platforms = platforms.unix;
38 };
39}