2020-09-08 12:32:01 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, autoreconfHook
|
2021-10-18 11:56:45 +00:00
|
|
|
, autoconf-archive
|
2020-09-08 12:32:01 +00:00
|
|
|
, pkg-config
|
|
|
|
, perl
|
|
|
|
, python3
|
|
|
|
, dbus
|
|
|
|
, polkit
|
|
|
|
, systemd
|
|
|
|
, IOKit
|
|
|
|
}:
|
2011-09-19 13:01:47 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "pcsclite";
|
2021-10-18 11:56:45 +00:00
|
|
|
version = "1.9.4";
|
2010-01-09 17:35:57 +00:00
|
|
|
|
2018-06-21 10:40:15 +00:00
|
|
|
outputs = [ "bin" "out" "dev" "doc" "man" ];
|
|
|
|
|
2010-01-09 17:35:57 +00:00
|
|
|
src = fetchurl {
|
2018-06-12 20:40:32 +00:00
|
|
|
url = "https://pcsclite.apdu.fr/files/pcsc-lite-${version}.tar.bz2";
|
2021-10-18 11:56:45 +00:00
|
|
|
sha256 = "sha256:0jqwnpywk9ka3q88b1k93p8s0xhmx1isdpcqa80nd8p04z1am34a";
|
2010-01-09 17:35:57 +00:00
|
|
|
};
|
|
|
|
|
2016-06-04 10:42:16 +00:00
|
|
|
patches = [ ./no-dropdir-literals.patch ];
|
|
|
|
|
2020-09-08 12:32:01 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i configure.ac \
|
|
|
|
-e "s@polkit_policy_dir=.*@polkit_policy_dir=$bin/share/polkit-1/actions@"
|
|
|
|
'';
|
|
|
|
|
2013-02-23 13:00:49 +00:00
|
|
|
configureFlags = [
|
2020-09-08 12:32:01 +00:00
|
|
|
"--enable-confdir=/etc"
|
2015-08-06 02:25:37 +00:00
|
|
|
# The OS should care on preparing the drivers into this location
|
2013-02-23 13:00:49 +00:00
|
|
|
"--enable-usbdropdir=/var/lib/pcsc/drivers"
|
2020-09-08 12:32:01 +00:00
|
|
|
]
|
|
|
|
++ (if stdenv.isLinux then [
|
|
|
|
"--enable-ipcdir=/run/pcscd"
|
|
|
|
"--enable-polkit"
|
|
|
|
"--with-systemdsystemunitdir=${placeholder "bin"}/lib/systemd/system"
|
|
|
|
] else [
|
|
|
|
"--disable-libsystemd"
|
|
|
|
]);
|
2010-01-09 17:35:57 +00:00
|
|
|
|
2016-06-04 10:42:16 +00:00
|
|
|
postConfigure = ''
|
|
|
|
sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ {
|
|
|
|
s/(DROPDIR *)(.*)/\1(getenv("PCSCLITE_HP_DROPDIR") ? : \2)/
|
|
|
|
}' config.h
|
|
|
|
'';
|
|
|
|
|
2018-06-21 10:40:15 +00:00
|
|
|
postInstall = ''
|
|
|
|
# pcsc-spy is a debugging utility and it drags python into the closure
|
|
|
|
moveToOutput bin/pcsc-spy "$dev"
|
|
|
|
'';
|
|
|
|
|
2020-09-08 12:32:01 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-10-18 11:56:45 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook autoconf-archive pkg-config perl ];
|
2021-03-10 23:15:49 +00:00
|
|
|
|
|
|
|
buildInputs = [ python3 ]
|
2020-09-08 12:32:01 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ dbus polkit systemd ]
|
2021-03-10 23:15:49 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ IOKit ];
|
2010-01-09 17:35:57 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2010-01-09 17:35:57 +00:00
|
|
|
description = "Middleware to access a smart card using SCard API (PC/SC)";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://pcsclite.apdu.fr/";
|
2014-03-21 21:32:21 +00:00
|
|
|
license = licenses.bsd3;
|
2015-12-03 18:13:31 +00:00
|
|
|
platforms = with platforms; unix;
|
2010-01-09 17:35:57 +00:00
|
|
|
};
|
|
|
|
}
|