2023-03-24 00:07:29 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
let
|
2023-03-24 00:07:29 +00:00
|
|
|
soVersion = "5";
|
2020-08-20 17:08:02 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "liblinear";
|
2023-03-24 00:07:29 +00:00
|
|
|
version = "2.46";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cjlin1";
|
|
|
|
repo = "liblinear";
|
|
|
|
rev = "v${builtins.replaceStrings ["."] [""] version}";
|
2023-03-24 00:07:29 +00:00
|
|
|
sha256 = "sha256-mKd6idfr6mIIDEie8DCS+drtfpgKoS/5UXI0JenTxlA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
makeFlags = [ "AR=${stdenv.cc.targetPrefix}ar" "RANLIB=${stdenv.cc.targetPrefix}ranlib" ];
|
2021-02-17 17:02:09 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
outputs = [ "bin" "dev" "out" ];
|
|
|
|
|
|
|
|
buildFlags = [ "lib" "predict" "train" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
${if stdenv.isDarwin then ''
|
2020-08-20 17:08:02 +00:00
|
|
|
install -D liblinear.so.${soVersion} $out/lib/liblinear.${soVersion}.dylib
|
|
|
|
ln -s $out/lib/liblinear.${soVersion}.dylib $out/lib/liblinear.dylib
|
2020-04-24 23:36:52 +00:00
|
|
|
'' else ''
|
2020-08-20 17:08:02 +00:00
|
|
|
install -Dt $out/lib liblinear.so.${soVersion}
|
|
|
|
ln -s $out/lib/liblinear.so.${soVersion} $out/lib/liblinear.so
|
2020-04-24 23:36:52 +00:00
|
|
|
''}
|
2020-08-20 17:08:02 +00:00
|
|
|
install -D train $bin/bin/liblinear-train
|
|
|
|
install -D predict $bin/bin/liblinear-predict
|
|
|
|
install -Dm444 -t $dev/include linear.h
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A library for large linear classification";
|
|
|
|
homepage = "https://www.csie.ntu.edu.tw/~cjlin/liblinear/";
|
|
|
|
license = licenses.bsd3;
|
2021-09-18 10:52:07 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|