diff --git a/pkgs/development/libraries/liblinear/default.nix b/pkgs/development/libraries/liblinear/default.nix index af09b1241de6..09f3aacca63e 100644 --- a/pkgs/development/libraries/liblinear/default.nix +++ b/pkgs/development/libraries/liblinear/default.nix @@ -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/";