Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchurl 4, fixDarwinDylibNames 5, llvmPackages 6, withOpenMP ? true 7}: 8 9stdenv.mkDerivation rec { 10 pname = "libsvm"; 11 version = "3.32"; 12 13 src = fetchurl { 14 url = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-${version}.tar.gz"; 15 sha256 = "sha256-hkTMZRjKiLvFDYyOrRc08aubbxcBcEXvmuOHc6plPa0="; 16 }; 17 18 patches = lib.optionals withOpenMP [ ./openmp.patch ]; 19 20 buildInputs = lib.optionals (stdenv.cc.isClang && withOpenMP) [ llvmPackages.openmp ]; 21 22 buildFlags = [ "lib" "all" ]; 23 24 outputs = [ "out" "bin" "dev" ]; 25 26 nativeBuildInputs = lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ]; 27 28 installPhase = 29 let 30 libSuff = stdenv.hostPlatform.extensions.sharedLibrary; 31 soVersion = "3"; 32 libName = if stdenv.isDarwin then "libsvm.${soVersion}${libSuff}" else "libsvm${libSuff}.${soVersion}"; 33 in 34 '' 35 runHook preInstall 36 37 install -D libsvm.so.${soVersion} $out/lib/${libName} 38 ln -s $out/lib/${libName} $out/lib/libsvm${libSuff} 39 40 install -Dt $bin/bin/ svm-scale svm-train svm-predict 41 42 install -Dm644 -t $dev/include svm.h 43 mkdir $dev/include/libsvm 44 ln -s $dev/include/svm.h $dev/include/libsvm/svm.h 45 46 runHook postInstall 47 ''; 48 49 meta = with lib; { 50 description = "Library for support vector machines"; 51 homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/"; 52 license = licenses.bsd3; 53 maintainers = [ ]; 54 platforms = platforms.unix; 55 }; 56}