From 4014f72257542d26671ac5c5f6fec8eb3f42c5f0 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 10 Mar 2024 18:32:56 -0300 Subject: primecount: refactor - finalAttrs - split outputs - strictDeps - use lib.cmake* functions - no nested with - mainProgram --- pkgs/by-name/pr/primecount/package.nix | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'pkgs/by-name/pr') diff --git a/pkgs/by-name/pr/primecount/package.nix b/pkgs/by-name/pr/primecount/package.nix index c3e2565989ed..791acca6ae5d 100644 --- a/pkgs/by-name/pr/primecount/package.nix +++ b/pkgs/by-name/pr/primecount/package.nix @@ -1,21 +1,23 @@ { lib -, stdenv -, fetchFromGitHub , cmake +, fetchFromGitHub , primesieve +, stdenv }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "primecount"; version = "7.10"; src = fetchFromGitHub { owner = "kimwalisch"; repo = "primecount"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-z7sHGR6zZSTV1PbL0WPGHf52CYQ572KC1yznCuIEJbQ="; }; + outputs = [ "out" "dev" "lib" "man" ]; + nativeBuildInputs = [ cmake ]; @@ -24,17 +26,18 @@ stdenv.mkDerivation rec { primesieve ]; + strictDeps = true; + cmakeFlags = [ - "-DBUILD_LIBPRIMESIEVE=ON" - "-DBUILD_PRIMECOUNT=ON" - "-DBUILD_SHARED_LIBS=ON" - "-DBUILD_STATIC_LIBS=OFF" - "-DBUILD_TESTS=ON" + (lib.cmakeBool "BUILD_LIBPRIMESIEVE" true) + (lib.cmakeBool "BUILD_PRIMECOUNT" true) + (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) + (lib.cmakeBool "BUILD_STATIC_LIBS" stdenv.hostPlatform.isStatic) + (lib.cmakeBool "BUILD_TESTS" true) ]; - meta = with lib; { + meta = { homepage = "https://github.com/kimwalisch/primecount"; - changelog = "https://github.com/kimwalisch/primecount/blob/v${version}/ChangeLog"; description = "Fast prime counting function implementations"; longDescription = '' primecount is a command-line program and C/C++ library that counts the @@ -50,7 +53,9 @@ stdenv.mkDerivation rec { of CPU cores. primecount has already been used to compute several prime counting function world records. ''; - license = licenses.bsd2; + changelog = "https://github.com/kimwalisch/primecount/blob/${finalAttrs.src.rev}/ChangeLog"; + license = lib.licenses.bsd2; + mainProgram = "primecount"; inherit (primesieve.meta) maintainers platforms; }; -} +}) -- cgit 1.4.1