about summary refs log tree commit diff
path: root/pkgs/by-name/pr
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2024-03-10 18:32:56 -0300
committerAnderson Torres <torres.anderson.85@protonmail.com>2024-03-11 11:04:30 -0300
commit4014f72257542d26671ac5c5f6fec8eb3f42c5f0 (patch)
tree4aab9a9689fb2b244b2b3199ef3d3e2b87f79eb9 /pkgs/by-name/pr
parent8bc529842155f8672e58ef4d7f3bc88c606113f1 (diff)
downloadnixlib-4014f72257542d26671ac5c5f6fec8eb3f42c5f0.tar
nixlib-4014f72257542d26671ac5c5f6fec8eb3f42c5f0.tar.gz
nixlib-4014f72257542d26671ac5c5f6fec8eb3f42c5f0.tar.bz2
nixlib-4014f72257542d26671ac5c5f6fec8eb3f42c5f0.tar.lz
nixlib-4014f72257542d26671ac5c5f6fec8eb3f42c5f0.tar.xz
nixlib-4014f72257542d26671ac5c5f6fec8eb3f42c5f0.tar.zst
nixlib-4014f72257542d26671ac5c5f6fec8eb3f42c5f0.zip
primecount: refactor
- finalAttrs
- split outputs
- strictDeps
- use lib.cmake* functions
- no nested with
- mainProgram
Diffstat (limited to 'pkgs/by-name/pr')
-rw-r--r--pkgs/by-name/pr/primecount/package.nix31
1 files changed, 18 insertions, 13 deletions
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;
   };
-}
+})