Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

zn_poly: 0.9 -> 0.9.1

Sage has taken over maintenance since the original author no longer
maintains the project.

+32 -9
+32 -9
pkgs/development/libraries/science/math/zn_poly/default.nix
··· 1 1 { stdenv 2 - , fetchurl 2 + , lib 3 + , fetchFromGitLab 4 + , fetchpatch 3 5 , gmp 4 6 , python2 7 + , tune ? false # tune to hardware, impure 5 8 }: 6 9 7 10 stdenv.mkDerivation rec { 8 - version = "0.9"; 11 + version = "0.9.1"; 9 12 pname = "zn_poly"; 10 13 name = "${pname}-${version}"; 11 14 12 - src = fetchurl { 13 - url = "http://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/releases/zn_poly-${version}.tar.gz"; 14 - sha256 = "1kxl25av7i3v68k32hw5bayrfcvmahmqvs97mlh9g238gj4qb851"; 15 + # sage has picked up the maintenance (bug fixes and building, not development) 16 + # from the original, now unmaintained project which can be found at 17 + # http://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/ 18 + src = fetchFromGitLab { 19 + owner = "sagemath"; 20 + repo = "zn_poly"; 21 + rev = version; 22 + sha256 = "0ra5vy585bqq7g3317iw6fp44iqgqvds3j0l1va6mswimypq4vxb"; 15 23 }; 16 24 17 25 buildInputs = [ ··· 22 30 python2 # needed by ./configure to create the makefile 23 31 ]; 24 32 25 - libname = "libzn_poly${stdenv.targetPlatform.extensions.sharedLibrary}"; 33 + # name of library file ("libzn_poly.so") 34 + libbasename = "libzn_poly"; 35 + libext = "${stdenv.targetPlatform.extensions.sharedLibrary}"; 26 36 27 37 makeFlags = [ "CC=cc" ]; 28 38 29 39 # Tuning (either autotuning or with hand-written paramters) is possible 30 40 # but not implemented here. 31 41 # It seems buggy anyways (see homepage). 32 - buildFlags = [ "all" libname ]; 42 + buildFlags = [ "all" "${libbasename}${libext}" ]; 33 43 44 + configureFlags = lib.optionals (!tune) [ 45 + "--disable-tuning" 46 + ]; 47 + 48 + patches = [ 49 + # fix format-security by not passing variables directly to printf 50 + # https://gitlab.com/sagemath/zn_poly/merge_requests/1 51 + (fetchpatch { 52 + name = "format-security.patch"; 53 + url = "https://gitlab.com/timokau/zn_poly/commit/1950900a80ec898d342b8bcafa148c8027649766.patch"; 54 + sha256 = "1gks9chvsfpc6sg5h3nqqfia4cgvph7jmj9dw67k7dk7kv9y0rk1"; 55 + }) 56 + ]; 34 57 35 58 # `make install` fails to install some header files and the lib file. 36 59 installPhase = '' 37 60 mkdir -p "$out/include/zn_poly" 38 61 mkdir -p "$out/lib" 39 - cp "${libname}" "$out/lib" 62 + cp "${libbasename}"*"${libext}" "$out/lib" 40 63 cp include/*.h "$out/include/zn_poly" 41 64 ''; 42 65 43 66 doCheck = true; 44 67 45 - meta = with stdenv.lib; { 68 + meta = with lib; { 46 69 homepage = http://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/; 47 70 description = "Polynomial arithmetic over Z/nZ"; 48 71 license = with licenses; [ gpl3 ];