Merge pull request #93759 from danieldk/liblinear-2.40

liblinear: 2.30 -> 2.40
This commit is contained in:
Daniël de Kok 2020-07-31 20:32:20 +02:00 committed by GitHub
commit c31de496b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,35 +1,37 @@
{ stdenv, fetchurl, fixDarwinDylibNames }:
{ stdenv, fetchFromGitHub, fixDarwinDylibNames }:
stdenv.mkDerivation rec {
let
soVersion = "4";
in stdenv.mkDerivation rec {
pname = "liblinear";
version = "2.30";
version = "2.40";
src = fetchurl {
url = "https://www.csie.ntu.edu.tw/~cjlin/liblinear/liblinear-${version}.tar.gz";
sha256 = "1b66jpg9fdwsq7r52fccr8z7nqcivrin5d8zg2f134ygqqwp0748";
src = fetchFromGitHub {
owner = "cjlin1";
repo = "liblinear";
rev = "v${builtins.replaceStrings ["."] [""] version}";
sha256 = "041fby9vc7nvj0gls5zd9mhw7yqazm530bmln38mfz7wd06z1d6b";
};
buildPhase = ''
make
make lib
'';
outputs = [ "bin" "dev" "out" ];
nativeBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
buildFlags = [ "lib" "predict" "train" ];
installPhase = ''
mkdir -p $out/lib $out/bin $out/include
${if stdenv.isDarwin then ''
cp liblinear.so.3 $out/lib/liblinear.3.dylib
ln -s $out/lib/liblinear.3.dylib $out/lib/liblinear.dylib
install -D liblinear.so.${soVersion} $out/lib/liblinear.${soVersion}.dylib
ln -s $out/lib/liblinear.${soVersion}.dylib $out/lib/liblinear.dylib
'' else ''
cp liblinear.so.3 $out/lib/liblinear.so.3
ln -s $out/lib/liblinear.so.3 $out/lib/liblinear.so
install -Dt $out/lib liblinear.so.${soVersion}
ln -s $out/lib/liblinear.so.${soVersion} $out/lib/liblinear.so
''}
cp train $out/bin/liblinear-train
cp predict $out/bin/liblinear-predict
cp linear.h $out/include
install -D train $bin/bin/liblinear-train
install -D predict $bin/bin/liblinear-predict
install -Dm444 -t $dev/include linear.h
'';
nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin [ fixDarwinDylibNames ];
meta = with stdenv.lib; {
description = "A library for large linear classification";
homepage = "https://www.csie.ntu.edu.tw/~cjlin/liblinear/";