pcsc-tools: make gui, dbus, and systemd each (independently) optional

This commit is contained in:
Adam Joseph 2024-04-15 13:09:16 -07:00 committed by Florian Klink
parent b9fe1f4e3b
commit 12cf912670

View File

@ -7,8 +7,8 @@
, makeWrapper
, pkg-config
, wrapGAppsHook
, systemd
, dbus
, systemdSupport ? stdenv.isLinux, 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 ]}"