Merge pull request #294869 from atorres1985-contrib/primecount

primecount, primesieve: refactor

authored by Thiago Kenji Okada and committed by GitHub 1040e568 f8a35f42

+41 -28
+18 -13
pkgs/applications/science/math/primecount/default.nix pkgs/by-name/pr/primecount/package.nix
··· 1 1 { lib 2 - , stdenv 3 - , fetchFromGitHub 4 2 , cmake 3 + , fetchFromGitHub 5 4 , primesieve 5 + , stdenv 6 6 }: 7 7 8 - stdenv.mkDerivation rec { 8 + stdenv.mkDerivation (finalAttrs: { 9 9 pname = "primecount"; 10 10 version = "7.10"; 11 11 12 12 src = fetchFromGitHub { 13 13 owner = "kimwalisch"; 14 14 repo = "primecount"; 15 - rev = "v${version}"; 15 + rev = "v${finalAttrs.version}"; 16 16 hash = "sha256-z7sHGR6zZSTV1PbL0WPGHf52CYQ572KC1yznCuIEJbQ="; 17 17 }; 18 18 19 + outputs = [ "out" "dev" "lib" "man" ]; 20 + 19 21 nativeBuildInputs = [ 20 22 cmake 21 23 ]; ··· 23 25 buildInputs = [ 24 26 primesieve 25 27 ]; 28 + 29 + strictDeps = true; 26 30 27 31 cmakeFlags = [ 28 - "-DBUILD_LIBPRIMESIEVE=ON" 29 - "-DBUILD_PRIMECOUNT=ON" 30 - "-DBUILD_SHARED_LIBS=ON" 31 - "-DBUILD_STATIC_LIBS=OFF" 32 - "-DBUILD_TESTS=ON" 32 + (lib.cmakeBool "BUILD_LIBPRIMESIEVE" true) 33 + (lib.cmakeBool "BUILD_PRIMECOUNT" true) 34 + (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) 35 + (lib.cmakeBool "BUILD_STATIC_LIBS" stdenv.hostPlatform.isStatic) 36 + (lib.cmakeBool "BUILD_TESTS" true) 33 37 ]; 34 38 35 - meta = with lib; { 39 + meta = { 36 40 homepage = "https://github.com/kimwalisch/primecount"; 37 - changelog = "https://github.com/kimwalisch/primecount/blob/v${version}/ChangeLog"; 38 41 description = "Fast prime counting function implementations"; 39 42 longDescription = '' 40 43 primecount is a command-line program and C/C++ library that counts the ··· 50 53 of CPU cores. primecount has already been used to compute several prime 51 54 counting function world records. 52 55 ''; 53 - license = licenses.bsd2; 56 + changelog = "https://github.com/kimwalisch/primecount/blob/${finalAttrs.src.rev}/ChangeLog"; 57 + license = lib.licenses.bsd2; 58 + mainProgram = "primecount"; 54 59 inherit (primesieve.meta) maintainers platforms; 55 60 }; 56 - } 61 + })
+23 -11
pkgs/applications/science/math/primesieve/default.nix pkgs/by-name/pr/primesieve/package.nix
··· 1 1 { lib 2 + , cmake 3 + , fetchFromGitHub 2 4 , stdenv 3 - , fetchFromGitHub 4 - , cmake 5 + , primecount 5 6 }: 6 7 7 - stdenv.mkDerivation rec { 8 + stdenv.mkDerivation (finalAttrs: { 8 9 pname = "primesieve"; 9 10 version = "12.1"; 10 11 11 12 src = fetchFromGitHub { 12 13 owner = "kimwalisch"; 13 14 repo = "primesieve"; 14 - rev = "v${version}"; 15 + rev = "v${finalAttrs.version}"; 15 16 hash = "sha256-AHl2GfZ1oJ8ZyjJzvg10AqN7TA7HFZ+qa6N2v51Qa78="; 16 17 }; 17 18 19 + outputs = [ "out" "dev" "lib" "man" ]; 20 + 18 21 nativeBuildInputs = [ cmake ]; 19 22 20 - meta = with lib; { 23 + strictDeps = true; 24 + 25 + passthru = { 26 + tests = { 27 + inherit primecount; # dependent 28 + }; 29 + }; 30 + 31 + meta = { 21 32 homepage = "https://primesieve.org/"; 22 - changelog = "https://github.com/kimwalisch/primesieve/blob/v${version}/ChangeLog"; 23 33 description = "Fast C/C++ prime number generator"; 24 34 longDescription = '' 25 35 primesieve is a command-line program and C/C++ library for quickly ··· 29 39 CPU cores whenever possible i.e. if sequential ordering is not 30 40 required. primesieve can generate primes and prime k-tuplets up to 264. 31 41 ''; 32 - license = licenses.bsd2; 33 - maintainers = teams.sage.members ++ 34 - (with maintainers; [ abbradar AndersonTorres ]); 35 - platforms = platforms.unix; 42 + changelog = "https://github.com/kimwalisch/primesieve/blob/${finalAttrs.src.rev}/ChangeLog"; 43 + license = lib.licenses.bsd2; 44 + mainProgram = "primesieve"; 45 + maintainers = lib.teams.sage.members ++ 46 + (with lib.maintainers; [ abbradar AndersonTorres ]); 47 + platforms = lib.platforms.unix; 36 48 }; 37 - } 49 + })
-4
pkgs/top-level/all-packages.nix
··· 24233 24233 24234 24234 prime-server = callPackage ../development/libraries/prime-server { }; 24235 24235 24236 - primecount = callPackage ../applications/science/math/primecount { }; 24237 - 24238 - primesieve = callPackage ../applications/science/math/primesieve { }; 24239 - 24240 24236 proj = callPackage ../development/libraries/proj { 24241 24237 stdenv = if stdenv.cc.isClang then overrideLibcxx llvmPackages_13.stdenv else stdenv; 24242 24238 };