pcsclite: add policy kit support

This commit is contained in:
Peter Hoeg 2020-09-08 20:32:01 +08:00
parent c1db6868bb
commit 2b93e96d0b

View file

@ -1,4 +1,15 @@
{ lib, stdenv, fetchurl, pkg-config, udev, dbus, perl, python3, IOKit }: { stdenv
, lib
, fetchurl
, autoreconfHook
, pkg-config
, perl
, python3
, dbus
, polkit
, systemd
, IOKit
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "pcsclite"; pname = "pcsclite";
@ -13,14 +24,23 @@ stdenv.mkDerivation rec {
patches = [ ./no-dropdir-literals.patch ]; patches = [ ./no-dropdir-literals.patch ];
postPatch = ''
sed -i configure.ac \
-e "s@polkit_policy_dir=.*@polkit_policy_dir=$bin/share/polkit-1/actions@"
'';
configureFlags = [ configureFlags = [
"--enable-confdir=/etc"
# The OS should care on preparing the drivers into this location # The OS should care on preparing the drivers into this location
"--enable-usbdropdir=/var/lib/pcsc/drivers" "--enable-usbdropdir=/var/lib/pcsc/drivers"
"--enable-confdir=/etc" ]
] ++ lib.optional stdenv.isLinux ++ (if stdenv.isLinux then [
"--with-systemdsystemunitdir=\${out}/etc/systemd/system" "--enable-ipcdir=/run/pcscd"
++ lib.optional (!stdenv.isLinux) "--enable-polkit"
"--disable-libsystemd"; "--with-systemdsystemunitdir=${placeholder "bin"}/lib/systemd/system"
] else [
"--disable-libsystemd"
]);
postConfigure = '' postConfigure = ''
sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ { sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ {
@ -33,10 +53,12 @@ stdenv.mkDerivation rec {
moveToOutput bin/pcsc-spy "$dev" moveToOutput bin/pcsc-spy "$dev"
''; '';
nativeBuildInputs = [ pkg-config perl ]; enableParallelBuilding = true;
nativeBuildInputs = [ autoreconfHook pkg-config perl ];
buildInputs = [ python3 ] buildInputs = [ python3 ]
++ lib.optionals stdenv.isLinux [ udev dbus ] ++ lib.optionals stdenv.isLinux [ dbus polkit systemd ]
++ lib.optionals stdenv.isDarwin [ IOKit ]; ++ lib.optionals stdenv.isDarwin [ IOKit ];
meta = with lib; { meta = with lib; {