@@ -1,93 +1,60 @@
1−{ fetchurl, mkDerivation, fetchpatch, stdenv, lib, pkgconfig, autoreconfHook, wrapGAppsHook
1+{ fetchurl, fetchpatch, stdenv, lib, pkgconfig, autoreconfHook
2−, libgpgerror, libassuan, qtbase, wrapQtAppsHook
2+, libgpgerror, libassuan
4−, libcap ? null, libsecret ? null
3+, libcap ? null, libsecret ? null, ncurses ? null, gtk2 ? null, gcr ? null
5−, enabledFlavors ? [ "curses" "tty" "gtk2" "qt" "gnome3" "emacs" ]
4+, qt4 ? null, qt5 ? null
8−with stdenv.lib;
8+assert qt5 != null -> qt4 == null;
9−
9+assert qt4 != null -> qt5 == null;
10−assert isList enabledFlavors && enabledFlavors != [];
13− pinentryMkDerivation =
12+ mkDerivation =
14− if (builtins.elem "qt" enabledFlavors)
13+ if qt5 != null
15− then mkDerivation
14+ then qt5.mkDerivation
16 else stdenv.mkDerivation;
15 else stdenv.mkDerivation;
18− mkFlag = pfxTrue: pfxFalse: cond: name:
19− "--${if cond then pfxTrue else pfxFalse}-${name}";
20− mkEnable = mkFlag "enable" "disable";
21− mkWith = mkFlag "with" "without";
23− mkEnablePinentry = f:
25− info = flavorInfo.${f};
26− flag = flavorInfo.${f}.flag or null;
28− optionalString (flag != null)
29− (mkEnable (elem f enabledFlavors) ("pinentry-" + flag));
32− curses = { bin = "curses"; flag = "curses"; buildInputs = [ ncurses ]; };
33− tty = { bin = "tty"; flag = "tty"; };
34− gtk2 = { bin = "gtk-2"; flag = "gtk2"; buildInputs = [ gtk2 ]; };
35− gnome3 = { bin = "gnome3"; flag = "gnome3"; buildInputs = [ gcr ]; nativeBuildInputs = [ wrapGAppsHook ]; };
36− qt = { bin = "qt"; flag = "qt"; buildInputs = [ qtbase ]; nativeBuildInputs = [ wrapQtAppsHook ]; };
37− emacs = { bin = "emacs"; flag = "emacs"; buildInputs = []; };
42−pinentryMkDerivation rec {
18+mkDerivation rec {
43− pname = "pinentry";
19+ name = "pinentry-1.1.0";
46 src = fetchurl {
21 src = fetchurl {
47− url = "mirror://gnupg/pinentry/${pname}-${version}.tar.bz2";
22+ url = "mirror://gnupg/pinentry/${name}.tar.bz2";
48 sha256 = "0w35ypl960pczg5kp6km3dyr000m1hf0vpwwlh72jjkjza36c1v8";
23 sha256 = "0w35ypl960pczg5kp6km3dyr000m1hf0vpwwlh72jjkjza36c1v8";
51− nativeBuildInputs = [ pkgconfig autoreconfHook ]
26+ nativeBuildInputs = [ pkgconfig autoreconfHook ];
52− ++ concatMap(f: flavorInfo.${f}.nativeBuildInputs or []) enabledFlavors;
27+ buildInputs =
53− buildInputs = [ libgpgerror libassuan libcap libsecret ]
28+ [ libgpgerror libassuan libcap libsecret gtk2 gcr ncurses qt4 ]
54− ++ concatMap(f: flavorInfo.${f}.buildInputs or []) enabledFlavors;
29+ ++ stdenv.lib.optional (qt5 != null) qt5.qtbase;
56− dontWrapGApps = true;
31+ prePatch = ''
57− dontWrapQtApps = true;
32+ substituteInPlace pinentry/pinentry-curses.c --replace ncursesw ncurses
59 patches = [
35 patches = [
60 ./autoconf-ar.patch
36 ./autoconf-ar.patch
61− ] ++ optionals (elem "gtk2" enabledFlavors) [
37+ ] ++ lib.optionals (gtk2 != null) [
62 (fetchpatch {
38 (fetchpatch {
63− url = "https://salsa.debian.org/debian/pinentry/raw/debian/1.1.0-1/debian/patches/0007-gtk2-When-X11-input-grabbing-fails-try-again-over-0..patch";
39+ url = "https://salsa.debian.org/debian/pinentry/raw/debian/1.1.0-1/debian/patches/"
40+ + "0007-gtk2-When-X11-input-grabbing-fails-try-again-over-0..patch";
64 sha256 = "15r1axby3fdlzz9wg5zx7miv7gqx2jy4immaw4xmmw5skiifnhfd";
41 sha256 = "15r1axby3fdlzz9wg5zx7miv7gqx2jy4immaw4xmmw5skiifnhfd";
68 configureFlags = [
45 configureFlags = [
69− (mkWith (libcap != null) "libcap")
46+ (stdenv.lib.withFeature (libcap != null) "libcap")
70− (mkEnable (libsecret != null) "libsecret")
47+ (stdenv.lib.enableFeature (libsecret != null) "libsecret")
71− ] ++ (map mkEnablePinentry (attrNames flavorInfo));
48+ (stdenv.lib.enableFeature (ncurses != null) "pinentry-curses")
72−
49+ (stdenv.lib.enableFeature true "pinentry-tty")
73− postInstall =
50+ (stdenv.lib.enableFeature enableEmacs "pinentry-emacs")
74− concatStrings (flip map enabledFlavors (f:
51+ (stdenv.lib.enableFeature (gtk2 != null) "pinentry-gtk2")
75− let
52+ (stdenv.lib.enableFeature (gcr != null) "pinentry-gnome3")
76− binary = "pinentry-" + flavorInfo.${f}.bin;
53+ (stdenv.lib.enableFeature (qt4 != null || qt5 != null) "pinentry-qt")
78− moveToOutput bin/${binary} ${placeholder f}
55+ "--with-libassuan-prefix=${libassuan.dev}"
79− ln -sf ${placeholder f}/bin/${binary} ${placeholder f}/bin/pinentry
56+ "--with-libgpg-error-prefix=${libgpgerror.dev}"
80− '' + optionalString (f == "gnome3") ''
57+ ];
81− wrapGApp ${placeholder f}/bin/${binary}
82− '' + optionalString (f == "qt") ''
83− wrapQtApp ${placeholder f}/bin/${binary}
85− ln -sf ${placeholder (head enabledFlavors)}/bin/pinentry-${flavorInfo.${head enabledFlavors}.bin} $out/bin/pinentry
88− outputs = [ "out" ] ++ enabledFlavors;
90− passthru = { flavors = enabledFlavors; };
92 meta = with stdenv.lib; {
59 meta = with stdenv.lib; {
93 homepage = http://gnupg.org/aegypten2/;
60 homepage = http://gnupg.org/aegypten2/;
@@ -98,6 +65,6 @@ pinentryMkDerivation rec {
98 Pinentry provides a console and (optional) GTK and Qt GUIs allowing users
65 Pinentry provides a console and (optional) GTK and Qt GUIs allowing users
99 to enter a passphrase when `gpg' or `gpg2' is run and needs it.
66 to enter a passphrase when `gpg' or `gpg2' is run and needs it.
101− maintainers = with maintainers; [ ttuegel fpletz ];
68+ maintainers = [ maintainers.ttuegel ];