nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 91 lines 2.8 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 perl, 6 gmp, 7 gf2x ? null, 8 # I asked the ntl maintainer weather or not to include gf2x by default: 9 # > If I remember correctly, gf2x is now thread safe, so there's no reason not to use it. 10 withGf2x ? true, 11 tune ? false, # tune for current system; non reproducible and time consuming 12}: 13 14assert withGf2x -> gf2x != null; 15 16stdenv.mkDerivation (finalAttrs: { 17 pname = "ntl"; 18 version = "11.6.0"; 19 20 src = fetchurl { 21 url = "http://www.shoup.net/ntl/ntl-${finalAttrs.version}.tar.gz"; 22 hash = "sha256-vA75rOsHWmoGc6yNj0fV+EWMcv6AbkRo+9XT2v8FYYI="; 23 }; 24 25 strictDeps = true; 26 depsBuildBuild = [ 27 perl # needed for ./configure 28 ]; 29 buildInputs = [ 30 gmp 31 ]; 32 33 sourceRoot = "ntl-${finalAttrs.version}/src"; 34 35 enableParallelBuilding = true; 36 37 dontAddPrefix = true; # DEF_PREFIX instead 38 39 # Written in perl, does not support autoconf-style 40 # --build=/--host= options: 41 # Error: unrecognized option: --build=x86_64-unknown-linux-gnu 42 configurePlatforms = [ ]; 43 44 # reference: http://shoup.net/ntl/doc/tour-unix.html 45 dontAddStaticConfigureFlags = true; # perl config doesn't understand it. 46 configureFlags = [ 47 "DEF_PREFIX=$(out)" 48 "NATIVE=off" # don't target code to current hardware (reproducibility, portability) 49 "TUNE=${ 50 if tune then 51 "auto" 52 else if stdenv.hostPlatform.isx86 then 53 "x86" # "chooses options that should be well suited for most x86 platforms" 54 else 55 "generic" # "chooses options that should be OK for most platforms" 56 }" 57 "CXX=${stdenv.cc.targetPrefix}c++" 58 "AR=${stdenv.cc.targetPrefix}ar" 59 ] 60 ++ lib.optionals (!stdenv.hostPlatform.isStatic) [ 61 "SHARED=on" # genereate a shared library 62 ] 63 ++ lib.optionals withGf2x [ 64 "NTL_GF2X_LIB=on" 65 "GF2X_PREFIX=${gf2x}" 66 ]; 67 68 enableParallelChecking = true; 69 doCheck = true; # takes some time 70 71 meta = { 72 description = "Library for doing Number Theory"; 73 longDescription = '' 74 NTL is a high-performance, portable C++ library providing data 75 structures and algorithms for manipulating signed, arbitrary 76 length integers, and for vectors, matrices, and polynomials over 77 the integers and over finite fields. 78 ''; 79 # Upstream contact: maintainer is victorshoup on GitHub. Alternatively the 80 # email listed on the homepage. 81 homepage = "http://www.shoup.net/ntl/"; 82 # also locally at "${src}/doc/tour-changes.html"; 83 changelog = "https://www.shoup.net/ntl/doc/tour-changes.html"; 84 teams = [ lib.teams.sage ]; 85 license = lib.licenses.gpl2Plus; 86 platforms = lib.platforms.all; 87 # Does not cross compile 88 # https://github.com/libntl/ntl/issues/8 89 broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform); 90 }; 91})