mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-18 13:19:10 +03:00
commit
2ab88f51f4
@ -1,33 +1,49 @@
|
||||
{lib, stdenv, fetchurl}:
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, fixDarwinDylibNames
|
||||
, llvmPackages
|
||||
, withOpenMP ? true
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libsvm";
|
||||
version = "3.25";
|
||||
version = "3.31";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz";
|
||||
sha256 = "sha256-UjUOiqdAsXbh13Pp3AjxNAIYw34BvsN6uQ2wEn5LteU=";
|
||||
sha256 = "sha256-AKtWH0jfX8kqhCCa2P5Rmery5Rmzwnm6z8k1l4p1zx8=";
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
make
|
||||
make lib
|
||||
'';
|
||||
patches = lib.optionals withOpenMP [ ./openmp.patch ];
|
||||
|
||||
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
|
||||
'';
|
||||
buildInputs = lib.optionals (stdenv.cc.isClang && withOpenMP) [ llvmPackages.openmp ];
|
||||
|
||||
postFixup = lib.optionalString stdenv.isDarwin ''
|
||||
install_name_tool -id libsvm.2.dylib $out/lib/libsvm.2.dylib;
|
||||
'';
|
||||
buildFlags = [ "lib" "all" ];
|
||||
|
||||
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; {
|
||||
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 New Issue
Block a user