2021-04-26 19:14:03 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2024-01-13 08:15:51 +00:00
|
|
|
, fetchFromGitLab
|
2021-04-26 19:14:03 +00:00
|
|
|
, autoreconfHook
|
2021-12-06 16:07:01 +00:00
|
|
|
, autoconf-archive
|
2024-01-13 08:15:51 +00:00
|
|
|
, flex
|
2021-04-26 19:14:03 +00:00
|
|
|
, pkg-config
|
|
|
|
, perl
|
|
|
|
, python3
|
|
|
|
, dbus
|
|
|
|
, polkit
|
2023-11-16 04:20:00 +00:00
|
|
|
, systemdLibs
|
2021-04-26 19:14:03 +00:00
|
|
|
, IOKit
|
2024-01-13 08:15:51 +00:00
|
|
|
, testers
|
|
|
|
, nix-update-script
|
2022-11-02 22:02:43 +00:00
|
|
|
, pname ? "pcsclite"
|
|
|
|
, polkitSupport ? false
|
2021-04-26 19:14:03 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-11-02 22:02:43 +00:00
|
|
|
inherit pname;
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "2.0.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
outputs = [ "out" "lib" "dev" "doc" "man" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "salsa.debian.org";
|
|
|
|
owner = "rousseau";
|
|
|
|
repo = "PCSC";
|
|
|
|
rev = "refs/tags/${finalAttrs.version}";
|
|
|
|
hash = "sha256-7NGlU4byGxtGBticewg8K4FUiDSQZAiB7Q/y+LaqKPo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
configureFlags = [
|
2021-04-26 19:14:03 +00:00
|
|
|
"--enable-confdir=/etc"
|
2020-04-24 23:36:52 +00:00
|
|
|
# The OS should care on preparing the drivers into this location
|
|
|
|
"--enable-usbdropdir=/var/lib/pcsc/drivers"
|
2022-11-21 17:40:18 +00:00
|
|
|
(lib.enableFeature stdenv.isLinux "libsystemd")
|
2022-11-02 22:02:43 +00:00
|
|
|
(lib.enableFeature polkitSupport "polkit")
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2021-04-26 19:14:03 +00:00
|
|
|
"--enable-ipcdir=/run/pcscd"
|
2024-02-29 20:09:43 +00:00
|
|
|
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
|
2022-11-02 22:02:43 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
makeFlags = [
|
|
|
|
"POLICY_DIR=$(out)/share/polkit-1/actions"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-02-29 20:09:43 +00: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"
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
# pcsc-spy is a debugging utility and it drags python into the closure
|
|
|
|
moveToOutput bin/pcsc-spy "$dev"
|
|
|
|
'';
|
|
|
|
|
2021-04-26 19:14:03 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
|
|
|
autoconf-archive
|
|
|
|
flex
|
|
|
|
pkg-config
|
|
|
|
perl
|
|
|
|
];
|
2021-03-19 17:17:44 +00:00
|
|
|
|
|
|
|
buildInputs = [ python3 ]
|
2023-11-16 04:20:00 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ systemdLibs ]
|
2022-11-02 22:02:43 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ IOKit ]
|
|
|
|
++ lib.optionals polkitSupport [ dbus polkit ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = finalAttrs.finalPackage;
|
|
|
|
command = "pcscd --version";
|
|
|
|
};
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Middleware to access a smart card using SCard API (PC/SC)";
|
|
|
|
homepage = "https://pcsclite.apdu.fr/";
|
2024-01-13 08:15:51 +00:00
|
|
|
changelog = "https://salsa.debian.org/rousseau/PCSC/-/blob/${finalAttrs.version}/ChangeLog";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
2024-01-13 08:15:51 +00:00
|
|
|
mainProgram = "pcscd";
|
|
|
|
maintainers = [ maintainers.anthonyroussel ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = with platforms; unix;
|
|
|
|
};
|
2024-01-13 08:15:51 +00:00
|
|
|
})
|