python312Packages.llama-index: 0.12.9 -> 0.12.9.post1 (#371957)
[NixPkgs.git] / pkgs / by-name / li / libsvm / package.nix
blob4653352086fe353ab9282e47b39cb468ed0c4aa4
2   lib,
3   stdenv,
4   fetchurl,
5   fixDarwinDylibNames,
6   llvmPackages,
7   withOpenMP ? true,
8 }:
10 stdenv.mkDerivation rec {
11   pname = "libsvm";
12   version = "3.33";
14   src = fetchurl {
15     url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz";
16     sha256 = "sha256-1doSzMPQ7thFP732+sfZ8AUvPopfB6IXTk7wqdg9zfg=";
17   };
19   patches = lib.optionals withOpenMP [ ./openmp.patch ];
21   buildInputs = lib.optionals (stdenv.cc.isClang && withOpenMP) [ llvmPackages.openmp ];
23   buildFlags = [
24     "lib"
25     "all"
26   ];
28   outputs = [
29     "out"
30     "bin"
31     "dev"
32   ];
34   nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
36   installPhase =
37     let
38       libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
39       soVersion = "3";
40       libName =
41         if stdenv.hostPlatform.isDarwin then
42           "libsvm.${soVersion}${libSuff}"
43         else
44           "libsvm${libSuff}.${soVersion}";
45     in
46     ''
47       runHook preInstall
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
58       runHook postInstall
59     '';
61   meta = with lib; {
62     description = "Library for support vector machines";
63     homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/";
64     license = licenses.bsd3;
65     maintainers = [ ];
66     platforms = platforms.unix;
67   };