2020-07-24 11:45:37 +01:00
|
|
|
{ stdenv, fetchFromGitHub, fixDarwinDylibNames }:
|
2018-07-31 22:52:04 +01:00
|
|
|
|
2020-07-24 11:45:37 +01:00
|
|
|
let
|
|
|
|
soVersion = "4";
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "liblinear";
|
2020-11-14 05:05:51 +00:00
|
|
|
version = "2.42";
|
2018-07-31 22:52:04 +01:00
|
|
|
|
2020-07-24 11:45:37 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cjlin1";
|
|
|
|
repo = "liblinear";
|
|
|
|
rev = "v${builtins.replaceStrings ["."] [""] version}";
|
2020-11-14 05:05:51 +00:00
|
|
|
sha256 = "0p0hpjajfkskhd7jiv5zwhfa8hi49q3mgifjlkqvy99xspv98ijj";
|
2018-07-31 22:52:04 +01:00
|
|
|
};
|
|
|
|
|
2020-07-24 11:45:37 +01:00
|
|
|
outputs = [ "bin" "dev" "out" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
|
|
|
|
|
|
|
|
buildFlags = [ "lib" "predict" "train" ];
|
2018-07-31 22:52:04 +01:00
|
|
|
|
2020-02-25 15:31:53 +00:00
|
|
|
installPhase = ''
|
2020-01-15 11:47:40 +00:00
|
|
|
${if stdenv.isDarwin then ''
|
2020-07-24 11:45:37 +01:00
|
|
|
install -D liblinear.so.${soVersion} $out/lib/liblinear.${soVersion}.dylib
|
|
|
|
ln -s $out/lib/liblinear.${soVersion}.dylib $out/lib/liblinear.dylib
|
2020-01-15 11:47:40 +00:00
|
|
|
'' else ''
|
2020-07-24 11:45:37 +01:00
|
|
|
install -Dt $out/lib liblinear.so.${soVersion}
|
|
|
|
ln -s $out/lib/liblinear.so.${soVersion} $out/lib/liblinear.so
|
2020-01-15 11:47:40 +00:00
|
|
|
''}
|
2020-07-24 11:45:37 +01:00
|
|
|
install -D train $bin/bin/liblinear-train
|
|
|
|
install -D predict $bin/bin/liblinear-predict
|
|
|
|
install -Dm444 -t $dev/include linear.h
|
2018-07-31 22:52:04 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A library for large linear classification";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.csie.ntu.edu.tw/~cjlin/liblinear/";
|
2018-07-31 22:52:04 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = [ maintainers.danieldk ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|