2021-01-21 18:00:13 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames }:
|
2018-07-31 23:52:04 +02:00
|
|
|
|
2020-07-24 12:45:37 +02:00
|
|
|
let
|
|
|
|
soVersion = "4";
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "liblinear";
|
2021-02-26 17:47:01 +01:00
|
|
|
version = "2.43";
|
2018-07-31 23:52:04 +02:00
|
|
|
|
2020-07-24 12:45:37 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cjlin1";
|
|
|
|
repo = "liblinear";
|
|
|
|
rev = "v${builtins.replaceStrings ["."] [""] version}";
|
2021-02-26 17:47:01 +01:00
|
|
|
sha256 = "sha256-qcSMuWHJgsapWs1xgxv3fKSXcx18q8cwyIn3E4RCGKA=";
|
2018-07-31 23:52:04 +02:00
|
|
|
};
|
|
|
|
|
2021-02-17 12:39:03 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace blas/Makefile \
|
|
|
|
--replace "ar rcv" "${stdenv.cc.targetPrefix}ar rcv" \
|
|
|
|
--replace "ranlib" "${stdenv.cc.targetPrefix}ranlib"
|
|
|
|
'';
|
|
|
|
|
2020-07-24 12:45:37 +02:00
|
|
|
outputs = [ "bin" "dev" "out" ];
|
|
|
|
|
2021-01-21 18:00:13 +01:00
|
|
|
nativeBuildInputs = lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
|
2020-07-24 12:45:37 +02:00
|
|
|
|
|
|
|
buildFlags = [ "lib" "predict" "train" ];
|
2018-07-31 23:52:04 +02:00
|
|
|
|
2020-02-25 16:31:53 +01:00
|
|
|
installPhase = ''
|
2020-01-15 12:47:40 +01:00
|
|
|
${if stdenv.isDarwin then ''
|
2020-07-24 12:45:37 +02: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 12:47:40 +01:00
|
|
|
'' else ''
|
2020-07-24 12:45:37 +02:00
|
|
|
install -Dt $out/lib liblinear.so.${soVersion}
|
|
|
|
ln -s $out/lib/liblinear.so.${soVersion} $out/lib/liblinear.so
|
2020-01-15 12:47:40 +01:00
|
|
|
''}
|
2020-07-24 12:45:37 +02: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 23:52:04 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-21 18:00:13 +01:00
|
|
|
meta = with lib; {
|
2018-07-31 23:52:04 +02:00
|
|
|
description = "A library for large linear classification";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.csie.ntu.edu.tw/~cjlin/liblinear/";
|
2018-07-31 23:52:04 +02:00
|
|
|
license = licenses.bsd3;
|
2021-09-12 16:42:12 +02:00
|
|
|
maintainers = [ ];
|
2018-07-31 23:52:04 +02:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|