Merge pull request #305260 from flokli/pcsc-fixes

pcsclite, pcsc{-d,tools}: fix cross, {systemd,udev,dbus}Support flags
This commit is contained in:
Florian Klink 2024-04-22 11:25:23 +03:00 committed by GitHub
commit 6b812ac187
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 10 deletions

View File

@ -7,8 +7,8 @@
, makeWrapper
, pkg-config
, wrapGAppsHook
, systemd
, dbus
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
, dbusSupport ? stdenv.isLinux, dbus
, pcsclite
, PCSC
, wget
@ -16,8 +16,13 @@
, perlPackages
, testers
, nix-update-script
# gui does not cross compile properly
, withGui ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
}:
assert systemdSupport -> dbusSupport;
stdenv.mkDerivation (finalAttrs: {
pname = "pcsc-tools";
version = "1.7.1";
@ -33,16 +38,20 @@ stdenv.mkDerivation (finalAttrs: {
"--datarootdir=${placeholder "out"}/share"
];
buildInputs = [ dbus perlPackages.perl pcsclite ]
++ lib.optional stdenv.isDarwin PCSC
++ lib.optional stdenv.isLinux systemd;
buildInputs = lib.optionals dbusSupport [
dbus
] ++ [
perlPackages.perl pcsclite
] ++ lib.optional stdenv.isDarwin PCSC
++ lib.optional systemdSupport systemd;
nativeBuildInputs = [
autoconf-archive
autoreconfHook
gobject-introspection
makeWrapper
pkg-config
] ++ lib.optionals withGui [
gobject-introspection
wrapGAppsHook
];
@ -54,6 +63,7 @@ stdenv.mkDerivation (finalAttrs: {
wrapProgram $out/bin/scriptor \
--set PERL5LIB "${with perlPackages; makePerlPath [ ChipcardPCSC libintl-perl ]}"
'' + lib.optionalString withGui ''
wrapProgram $out/bin/gscriptor \
''${makeWrapperArgs[@]} \
--set PERL5LIB "${with perlPackages; makePerlPath [
@ -66,6 +76,7 @@ stdenv.mkDerivation (finalAttrs: {
Cairo
CairoGObject
]}"
'' + ''
wrapProgram $out/bin/ATR_analysis \
--set PERL5LIB "${with perlPackages; makePerlPath [ ChipcardPCSC libintl-perl ]}"

View File

@ -10,6 +10,10 @@
, dbus
, polkit
, systemdLibs
, dbusSupport ? stdenv.isLinux
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemdLibs
, udevSupport ? dbusSupport
, libusb1
, IOKit
, testers
, nix-update-script
@ -17,6 +21,9 @@
, polkitSupport ? false
}:
assert polkitSupport -> dbusSupport;
assert systemdSupport -> dbusSupport;
stdenv.mkDerivation (finalAttrs: {
inherit pname;
version = "2.1.0";
@ -35,11 +42,13 @@ stdenv.mkDerivation (finalAttrs: {
"--enable-confdir=/etc"
# The OS should care on preparing the drivers into this location
"--enable-usbdropdir=/var/lib/pcsc/drivers"
(lib.enableFeature stdenv.isLinux "libsystemd")
(lib.enableFeature systemdSupport "libsystemd")
(lib.enableFeature polkitSupport "polkit")
] ++ lib.optionals stdenv.isLinux [
"--enable-ipcdir=/run/pcscd"
] ++ lib.optionals systemdSupport [
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
] ++ lib.optionals (!udevSupport) [
"--disable-libudev"
];
makeFlags = [
@ -70,9 +79,11 @@ stdenv.mkDerivation (finalAttrs: {
];
buildInputs = [ python3 ]
++ lib.optionals stdenv.isLinux [ systemdLibs ]
++ lib.optionals systemdSupport [ systemdLibs ]
++ lib.optionals stdenv.isDarwin [ IOKit ]
++ lib.optionals polkitSupport [ dbus polkit ];
++ lib.optionals dbusSupport [ dbus ]
++ lib.optionals polkitSupport [ polkit ]
++ lib.optionals (!udevSupport) [ libusb1 ];
passthru = {
tests = {

View File

@ -3312,6 +3312,9 @@ with self; {
"-Wno-error=implicit-int"
"-Wno-error=int-conversion"
]);
postPatch = ''
substituteInPlace Makefile.PL --replace pkg-config $PKG_CONFIG
'';
NIX_CFLAGS_LINK = "-L${lib.getLib pkgs.pcsclite}/lib -lpcsclite";
# tests fail; look unfinished
doCheck = false;