about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/pcsclite/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/pcsclite/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/pcsclite/default.nix54
1 files changed, 34 insertions, 20 deletions
diff --git a/nixpkgs/pkgs/tools/security/pcsclite/default.nix b/nixpkgs/pkgs/tools/security/pcsclite/default.nix
index a4ae25715c3f..08a4b5b08d02 100644
--- a/nixpkgs/pkgs/tools/security/pcsclite/default.nix
+++ b/nixpkgs/pkgs/tools/security/pcsclite/default.nix
@@ -1,8 +1,9 @@
 { stdenv
 , lib
-, fetchurl
+, fetchFromGitLab
 , autoreconfHook
 , autoconf-archive
+, flex
 , pkg-config
 , perl
 , python3
@@ -10,28 +11,26 @@
 , polkit
 , systemdLibs
 , IOKit
+, testers
+, nix-update-script
 , pname ? "pcsclite"
 , polkitSupport ? false
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   inherit pname;
-  version = "1.9.5";
+  version = "2.0.1";
 
   outputs = [ "bin" "out" "dev" "doc" "man" ];
 
-  src = fetchurl {
-    url = "https://pcsclite.apdu.fr/files/pcsc-lite-${version}.tar.bz2";
-    hash = "sha256-nuP5szNTdWIXeJNVmtT3uNXCPr6Cju9TBWwC2xQEnQg=";
+  src = fetchFromGitLab {
+    domain = "salsa.debian.org";
+    owner = "rousseau";
+    repo = "PCSC";
+    rev = "refs/tags/${finalAttrs.version}";
+    hash = "sha256-7NGlU4byGxtGBticewg8K4FUiDSQZAiB7Q/y+LaqKPo=";
   };
 
-  patches = [ ./no-dropdir-literals.patch ];
-
-  postPatch = ''
-    sed -i configure.ac \
-      -e "s@polkit_policy_dir=.*@polkit_policy_dir=$bin/share/polkit-1/actions@"
-  '';
-
   configureFlags = [
     "--enable-confdir=/etc"
     # The OS should care on preparing the drivers into this location
@@ -43,11 +42,9 @@ stdenv.mkDerivation rec {
     "--with-systemdsystemunitdir=${placeholder "bin"}/lib/systemd/system"
   ];
 
-  postConfigure = ''
-    sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ {
-      s/(DROPDIR *)(.*)/\1(getenv("PCSCLITE_HP_DROPDIR") ? : \2)/
-    }' config.h
-  '';
+  makeFlags = [
+    "POLICY_DIR=$(out)/share/polkit-1/actions"
+  ];
 
   postInstall = ''
     # pcsc-spy is a debugging utility and it drags python into the closure
@@ -56,17 +53,34 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  nativeBuildInputs = [ autoreconfHook autoconf-archive pkg-config perl ];
+  nativeBuildInputs = [
+    autoreconfHook
+    autoconf-archive
+    flex
+    pkg-config
+    perl
+  ];
 
   buildInputs = [ python3 ]
     ++ lib.optionals stdenv.isLinux [ systemdLibs ]
     ++ lib.optionals stdenv.isDarwin [ IOKit ]
     ++ lib.optionals polkitSupport [ dbus polkit ];
 
+  passthru = {
+    tests.version = testers.testVersion {
+      package = finalAttrs.finalPackage;
+      command = "pcscd --version";
+    };
+    updateScript = nix-update-script { };
+  };
+
   meta = with lib; {
     description = "Middleware to access a smart card using SCard API (PC/SC)";
     homepage = "https://pcsclite.apdu.fr/";
+    changelog = "https://salsa.debian.org/rousseau/PCSC/-/blob/${finalAttrs.version}/ChangeLog";
     license = licenses.bsd3;
+    mainProgram = "pcscd";
+    maintainers = [ maintainers.anthonyroussel ];
     platforms = with platforms; unix;
   };
-}
+})