@@ -1,9 +1,21 @@
11{ fetchurl, fetchpatch, stdenv, lib, pkgconfig
2−, libgpgerror, libassuan, libcap ? null, libsecret ? null, ncurses ? null, gtk2 ? null, gcr ? null, qt ? null
2+, libgpgerror, libassuan
3+, libcap ? null, libsecret ? null, ncurses ? null, gtk2 ? null, gcr ? null
4+, qt4 ? null, qt5 ? null
35, enableEmacs ? false
46}:
57
6−stdenv.mkDerivation rec {
8+assert qt5 != null -> qt4 == null;
9+assert qt4 != null -> qt5 == null;
10+
11+let
12+ mkDerivation =
13+ if qt5 != null
14+ then qt5.mkDerivation
15+ else stdenv.mkDerivation;
16+in
17+
18+mkDerivation rec {
719 name = "pinentry-1.1.0";
820
921 src = fetchurl {
@@ -12,7 +24,9 @@ stdenv.mkDerivation rec {
1224 };
1325
1426 nativeBuildInputs = [ pkgconfig ];
15− buildInputs = [ libgpgerror libassuan libcap libsecret gtk2 gcr ncurses qt ];
27+ buildInputs =
28+ [ libgpgerror libassuan libcap libsecret gtk2 gcr ncurses qt4 ]
29+ ++ stdenv.lib.optional (qt5 != null) qt5.qtbase;
1630
1731 prePatch = ''
1832 substituteInPlace pinentry/pinentry-curses.c --replace ncursesw ncurses
@@ -34,7 +48,7 @@ stdenv.mkDerivation rec {
3448 (stdenv.lib.enableFeature enableEmacs "pinentry-emacs")
3549 (stdenv.lib.enableFeature (gtk2 != null) "pinentry-gtk2")
3650 (stdenv.lib.enableFeature (gcr != null) "pinentry-gnome3")
37− (stdenv.lib.enableFeature (qt != null) "pinentry-qt")
51+ (stdenv.lib.enableFeature (qt4 != null || qt5 != null) "pinentry-qt")
3852
3953 "--with-libassuan-prefix=${libassuan.dev}"
4054 "--with-libgpg-error-prefix=${libgpgerror.dev}"