libsvm: 3.25 -> 3.31
This commit is contained in:
parent
3d57138bd9
commit
ee71bbc2f7
|
@ -1,33 +1,49 @@
|
||||||
{lib, stdenv, fetchurl}:
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchurl
|
||||||
|
, fixDarwinDylibNames
|
||||||
|
, llvmPackages
|
||||||
|
, withOpenMP ? true
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "libsvm";
|
pname = "libsvm";
|
||||||
version = "3.25";
|
version = "3.31";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz";
|
url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz";
|
||||||
sha256 = "sha256-UjUOiqdAsXbh13Pp3AjxNAIYw34BvsN6uQ2wEn5LteU=";
|
sha256 = "sha256-AKtWH0jfX8kqhCCa2P5Rmery5Rmzwnm6z8k1l4p1zx8=";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildPhase = ''
|
patches = lib.optionals withOpenMP [ ./openmp.patch ];
|
||||||
make
|
|
||||||
make lib
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = let
|
buildInputs = lib.optionals (stdenv.cc.isClang && withOpenMP) [ llvmPackages.openmp ];
|
||||||
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 = lib.optionalString stdenv.isDarwin ''
|
buildFlags = [ "lib" "all" ];
|
||||||
install_name_tool -id libsvm.2.dylib $out/lib/libsvm.2.dylib;
|
|
||||||
'';
|
outputs = [ "out" "bin" "dev" ];
|
||||||
|
|
||||||
|
nativeBuildInputs = lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
|
||||||
|
|
||||||
|
installPhase =
|
||||||
|
let
|
||||||
|
libSuff = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||||
|
soVersion = "3";
|
||||||
|
in
|
||||||
|
''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
install -D libsvm.so.${soVersion} $out/lib/libsvm.${soVersion}${libSuff}
|
||||||
|
ln -s $out/lib/libsvm.${soVersion}${libSuff} $out/lib/libsvm${libSuff}
|
||||||
|
|
||||||
|
install -Dt $bin/bin/ svm-scale svm-train svm-predict
|
||||||
|
|
||||||
|
install -Dm644 -t $dev/include svm.h
|
||||||
|
mkdir $dev/include/libsvm
|
||||||
|
ln -s $dev/include/svm.h $dev/include/libsvm/svm.h
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A library for support vector machines";
|
description = "A library for support vector machines";
|
||||||
|
|
13
pkgs/development/libraries/libsvm/openmp.patch
Normal file
13
pkgs/development/libraries/libsvm/openmp.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
--- /Makefile 1970-01-01 01:00:01.000000000 +0100
|
||||||
|
+++ /Makefile 1970-01-01 01:00:01.000000000 +0100
|
||||||
|
@@ -9,8 +9,8 @@
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Uncomment the following lines to enable parallelization with OpenMP
|
||||||
|
-# CFLAGS += -fopenmp
|
||||||
|
-# SHARED_LIB_FLAG += -fopenmp
|
||||||
|
+CFLAGS += -fopenmp
|
||||||
|
+SHARED_LIB_FLAG += -fopenmp
|
||||||
|
|
||||||
|
all: svm-train svm-predict svm-scale
|
||||||
|
|
Loading…
Reference in a new issue