Skip to content

Commit

Permalink
Merge pull request #93759 from danieldk/liblinear-2.40
Browse files Browse the repository at this point in the history
liblinear: 2.30 -> 2.40
  • Loading branch information
danieldk authored Jul 31, 2020
2 parents b6107d3 + 0e29fcd commit c31de49
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions pkgs/development/libraries/liblinear/default.nix
Original file line number Diff line number Diff line change
@@ -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/";
Expand Down

0 comments on commit c31de49

Please sign in to comment.