lol
at 24.11-pre 64 lines 1.7 kB view raw
1{ stdenv 2, lib 3, fetchFromGitLab 4, fetchpatch 5, gmp 6, python3 7, tune ? false # tune to hardware, impure 8}: 9 10stdenv.mkDerivation rec { 11 version = "0.9.2"; 12 pname = "zn_poly"; 13 14 # sage has picked up the maintenance (bug fixes and building, not development) 15 # from the original, now unmaintained project which can be found at 16 # http://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/ 17 src = fetchFromGitLab { 18 owner = "sagemath"; 19 repo = "zn_poly"; 20 rev = version; 21 hash = "sha256-QBItcrrpOGj22/ShTDdfZjm63bGW2xY4c71R1q8abPE="; 22 }; 23 24 buildInputs = [ 25 gmp 26 ]; 27 28 nativeBuildInputs = [ 29 python3 # needed by ./configure to create the makefile 30 ]; 31 32 # name of library file ("libzn_poly.so") 33 libbasename = "libzn_poly"; 34 libext = stdenv.hostPlatform.extensions.sharedLibrary; 35 36 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ]; 37 38 # Tuning (either autotuning or with hand-written parameters) is possible 39 # but not implemented here. 40 # It seems buggy anyways (see homepage). 41 buildFlags = [ "all" "${libbasename}${libext}" ]; 42 43 configureFlags = lib.optionals (!tune) [ 44 "--disable-tuning" 45 ]; 46 47 # `make install` fails to install some header files and the lib file. 48 installPhase = '' 49 mkdir -p "$out/include/zn_poly" 50 mkdir -p "$out/lib" 51 cp "${libbasename}"*"${libext}" "$out/lib" 52 cp include/*.h "$out/include/zn_poly" 53 ''; 54 55 doCheck = true; 56 57 meta = with lib; { 58 homepage = "https://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/"; 59 description = "Polynomial arithmetic over Z/nZ"; 60 license = with licenses; [ gpl3 ]; 61 maintainers = teams.sage.members; 62 platforms = platforms.unix; 63 }; 64}