2020-09-08 14:32:01 +02:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2023-12-06 18:49:26 +01:00
|
|
|
, fetchFromGitLab
|
2020-09-08 14:32:01 +02:00
|
|
|
, autoreconfHook
|
2021-10-18 13:56:45 +02:00
|
|
|
, autoconf-archive
|
2023-12-06 18:41:16 +01:00
|
|
|
, flex
|
2020-09-08 14:32:01 +02:00
|
|
|
, pkg-config
|
|
|
|
, perl
|
|
|
|
, python3
|
|
|
|
, dbus
|
|
|
|
, polkit
|
2023-10-22 13:05:22 +02:00
|
|
|
, systemdLibs
|
2020-09-08 14:32:01 +02:00
|
|
|
, IOKit
|
2023-12-06 18:53:21 +01:00
|
|
|
, testers
|
2023-12-06 18:49:26 +01:00
|
|
|
, nix-update-script
|
2022-09-04 11:36:39 +02:00
|
|
|
, pname ? "pcsclite"
|
|
|
|
, polkitSupport ? false
|
2020-09-08 14:32:01 +02:00
|
|
|
}:
|
2011-09-19 15:01:47 +02:00
|
|
|
|
2023-12-06 18:53:21 +01:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-09-04 11:36:39 +02:00
|
|
|
inherit pname;
|
2024-03-04 10:27:42 +01:00
|
|
|
version = "2.0.3";
|
2010-01-09 18:35:57 +01:00
|
|
|
|
2024-01-24 10:53:04 +01:00
|
|
|
outputs = [ "out" "lib" "dev" "doc" "man" ];
|
2018-06-21 12:40:15 +02:00
|
|
|
|
2023-12-06 18:49:26 +01:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "salsa.debian.org";
|
|
|
|
owner = "rousseau";
|
|
|
|
repo = "PCSC";
|
2023-12-06 18:53:21 +01:00
|
|
|
rev = "refs/tags/${finalAttrs.version}";
|
2024-03-04 10:27:42 +01:00
|
|
|
hash = "sha256-VDQh2PYAMFwgWvZFD20H3JxgKSFrSUoDLv/6fKEoy5Y=";
|
2010-01-09 18:35:57 +01:00
|
|
|
};
|
|
|
|
|
2013-02-23 14:00:49 +01:00
|
|
|
configureFlags = [
|
2020-09-08 14:32:01 +02:00
|
|
|
"--enable-confdir=/etc"
|
2015-08-06 04:25:37 +02:00
|
|
|
# The OS should care on preparing the drivers into this location
|
2013-02-23 14:00:49 +01:00
|
|
|
"--enable-usbdropdir=/var/lib/pcsc/drivers"
|
2022-11-07 02:01:06 +01:00
|
|
|
(lib.enableFeature stdenv.isLinux "libsystemd")
|
2022-09-04 11:36:39 +02:00
|
|
|
(lib.enableFeature polkitSupport "polkit")
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2020-09-08 14:32:01 +02:00
|
|
|
"--enable-ipcdir=/run/pcscd"
|
2024-01-24 10:53:04 +01:00
|
|
|
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
|
2022-09-04 11:36:39 +02:00
|
|
|
];
|
2010-01-09 18:35:57 +01:00
|
|
|
|
2023-12-06 18:41:16 +01:00
|
|
|
makeFlags = [
|
|
|
|
"POLICY_DIR=$(out)/share/polkit-1/actions"
|
|
|
|
];
|
2016-06-04 12:42:16 +02:00
|
|
|
|
2023-12-27 01:04:27 +01:00
|
|
|
# disable building pcsc-wirecheck{,-gen} when cross compiling
|
|
|
|
# see also: https://github.com/LudovicRousseau/PCSC/issues/25
|
|
|
|
postPatch = lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
|
|
substituteInPlace src/Makefile.am \
|
|
|
|
--replace "noinst_PROGRAMS = testpcsc pcsc-wirecheck pcsc-wirecheck-gen" \
|
|
|
|
"noinst_PROGRAMS = testpcsc"
|
|
|
|
'';
|
|
|
|
|
2018-06-21 12:40:15 +02:00
|
|
|
postInstall = ''
|
|
|
|
# pcsc-spy is a debugging utility and it drags python into the closure
|
|
|
|
moveToOutput bin/pcsc-spy "$dev"
|
|
|
|
'';
|
|
|
|
|
2020-09-08 14:32:01 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-12-06 18:41:16 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
|
|
|
autoconf-archive
|
|
|
|
flex
|
|
|
|
pkg-config
|
|
|
|
perl
|
|
|
|
];
|
2021-03-11 00:15:49 +01:00
|
|
|
|
|
|
|
buildInputs = [ python3 ]
|
2023-10-22 13:05:22 +02:00
|
|
|
++ lib.optionals stdenv.isLinux [ systemdLibs ]
|
2022-09-04 11:36:39 +02:00
|
|
|
++ lib.optionals stdenv.isDarwin [ IOKit ]
|
|
|
|
++ lib.optionals polkitSupport [ dbus polkit ];
|
2010-01-09 18:35:57 +01:00
|
|
|
|
2023-12-06 18:53:21 +01:00
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = finalAttrs.finalPackage;
|
|
|
|
command = "pcscd --version";
|
|
|
|
};
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
2023-12-06 18:39:52 +01:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2010-01-09 18:35:57 +01:00
|
|
|
description = "Middleware to access a smart card using SCard API (PC/SC)";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://pcsclite.apdu.fr/";
|
2023-12-06 18:45:02 +01:00
|
|
|
changelog = "https://salsa.debian.org/rousseau/PCSC/-/blob/${finalAttrs.version}/ChangeLog";
|
2014-03-21 22:32:21 +01:00
|
|
|
license = licenses.bsd3;
|
2023-12-06 18:45:02 +01:00
|
|
|
mainProgram = "pcscd";
|
2023-12-06 18:40:08 +01:00
|
|
|
maintainers = [ maintainers.anthonyroussel ];
|
2015-12-03 19:13:31 +01:00
|
|
|
platforms = with platforms; unix;
|
2010-01-09 18:35:57 +01:00
|
|
|
};
|
2023-12-06 18:53:21 +01:00
|
|
|
})
|