mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-17 18:34:41 +00:00
pinentry: build with multiple outputs in single drv
Co-authored-by: Florian Klink <flokli@flokli.de> Co-authored-by: worldofpeace <worldofpeace@protonmail.ch>
This commit is contained in:
parent
12441bdf9f
commit
cb0adc11ff
|
@ -34,7 +34,6 @@ with lib;
|
|||
networkmanager-openvpn = super.networkmanager-openvpn.override { withGnome = false; };
|
||||
networkmanager-vpnc = super.networkmanager-vpnc.override { withGnome = false; };
|
||||
networkmanager-iodine = super.networkmanager-iodine.override { withGnome = false; };
|
||||
pinentry = super.pinentry.override { gtk2 = null; gcr = null; qt4 = null; qt5 = null; };
|
||||
gobject-introspection = super.gobject-introspection.override { x11Support = false; };
|
||||
}));
|
||||
};
|
||||
|
|
|
@ -1,60 +1,93 @@
|
|||
{ fetchurl, fetchpatch, stdenv, lib, pkgconfig, autoreconfHook
|
||||
, libgpgerror, libassuan
|
||||
, libcap ? null, libsecret ? null, ncurses ? null, gtk2 ? null, gcr ? null
|
||||
, qt4 ? null, qt5 ? null
|
||||
, enableEmacs ? false
|
||||
{ fetchurl, mkDerivation, fetchpatch, stdenv, lib, pkgconfig, autoreconfHook, wrapGAppsHook
|
||||
, libgpgerror, libassuan, qtbase, wrapQtAppsHook
|
||||
, ncurses, gtk2, gcr
|
||||
, libcap ? null, libsecret ? null
|
||||
, enabledFlavors ? [ "curses" "tty" "gtk2" "qt" "gnome3" "emacs" ]
|
||||
}:
|
||||
|
||||
assert qt5 != null -> qt4 == null;
|
||||
assert qt4 != null -> qt5 == null;
|
||||
with stdenv.lib;
|
||||
|
||||
assert isList enabledFlavors && enabledFlavors != [];
|
||||
|
||||
let
|
||||
mkDerivation =
|
||||
if qt5 != null
|
||||
then qt5.mkDerivation
|
||||
pinentryMkDerivation =
|
||||
if (builtins.elem "qt" enabledFlavors)
|
||||
then mkDerivation
|
||||
else stdenv.mkDerivation;
|
||||
|
||||
mkFlag = pfxTrue: pfxFalse: cond: name:
|
||||
"--${if cond then pfxTrue else pfxFalse}-${name}";
|
||||
mkEnable = mkFlag "enable" "disable";
|
||||
mkWith = mkFlag "with" "without";
|
||||
|
||||
mkEnablePinentry = f:
|
||||
let
|
||||
info = flavorInfo.${f};
|
||||
flag = flavorInfo.${f}.flag or null;
|
||||
in
|
||||
optionalString (flag != null)
|
||||
(mkEnable (elem f enabledFlavors) ("pinentry-" + flag));
|
||||
|
||||
flavorInfo = {
|
||||
curses = { bin = "curses"; flag = "curses"; buildInputs = [ ncurses ]; };
|
||||
tty = { bin = "tty"; flag = "tty"; };
|
||||
gtk2 = { bin = "gtk-2"; flag = "gtk2"; buildInputs = [ gtk2 ]; };
|
||||
gnome3 = { bin = "gnome3"; flag = "gnome3"; buildInputs = [ gcr ]; nativeBuildInputs = [ wrapGAppsHook ]; };
|
||||
qt = { bin = "qt"; flag = "qt"; buildInputs = [ qtbase ]; nativeBuildInputs = [ wrapQtAppsHook ]; };
|
||||
emacs = { bin = "emacs"; flag = "emacs"; buildInputs = []; };
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
mkDerivation rec {
|
||||
name = "pinentry-1.1.0";
|
||||
pinentryMkDerivation rec {
|
||||
pname = "pinentry";
|
||||
version = "1.1.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnupg/pinentry/${name}.tar.bz2";
|
||||
url = "mirror://gnupg/pinentry/${pname}-${version}.tar.bz2";
|
||||
sha256 = "0w35ypl960pczg5kp6km3dyr000m1hf0vpwwlh72jjkjza36c1v8";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig autoreconfHook ];
|
||||
buildInputs =
|
||||
[ libgpgerror libassuan libcap libsecret gtk2 gcr ncurses qt4 ]
|
||||
++ stdenv.lib.optional (qt5 != null) qt5.qtbase;
|
||||
nativeBuildInputs = [ pkgconfig autoreconfHook ]
|
||||
++ concatMap(f: flavorInfo.${f}.nativeBuildInputs or []) enabledFlavors;
|
||||
buildInputs = [ libgpgerror libassuan libcap libsecret ]
|
||||
++ concatMap(f: flavorInfo.${f}.buildInputs or []) enabledFlavors;
|
||||
|
||||
prePatch = ''
|
||||
substituteInPlace pinentry/pinentry-curses.c --replace ncursesw ncurses
|
||||
'';
|
||||
dontWrapGApps = true;
|
||||
dontWrapQtApps = true;
|
||||
|
||||
patches = [
|
||||
./autoconf-ar.patch
|
||||
] ++ lib.optionals (gtk2 != null) [
|
||||
] ++ optionals (elem "gtk2" enabledFlavors) [
|
||||
(fetchpatch {
|
||||
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";
|
||||
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";
|
||||
sha256 = "15r1axby3fdlzz9wg5zx7miv7gqx2jy4immaw4xmmw5skiifnhfd";
|
||||
})
|
||||
];
|
||||
|
||||
configureFlags = [
|
||||
(stdenv.lib.withFeature (libcap != null) "libcap")
|
||||
(stdenv.lib.enableFeature (libsecret != null) "libsecret")
|
||||
(stdenv.lib.enableFeature (ncurses != null) "pinentry-curses")
|
||||
(stdenv.lib.enableFeature true "pinentry-tty")
|
||||
(stdenv.lib.enableFeature enableEmacs "pinentry-emacs")
|
||||
(stdenv.lib.enableFeature (gtk2 != null) "pinentry-gtk2")
|
||||
(stdenv.lib.enableFeature (gcr != null) "pinentry-gnome3")
|
||||
(stdenv.lib.enableFeature (qt4 != null || qt5 != null) "pinentry-qt")
|
||||
(mkWith (libcap != null) "libcap")
|
||||
(mkEnable (libsecret != null) "libsecret")
|
||||
] ++ (map mkEnablePinentry (attrNames flavorInfo));
|
||||
|
||||
"--with-libassuan-prefix=${libassuan.dev}"
|
||||
"--with-libgpg-error-prefix=${libgpgerror.dev}"
|
||||
];
|
||||
postInstall =
|
||||
concatStrings (flip map enabledFlavors (f:
|
||||
let
|
||||
binary = "pinentry-" + flavorInfo.${f}.bin;
|
||||
in ''
|
||||
moveToOutput bin/${binary} ${placeholder f}
|
||||
ln -sf ${placeholder f}/bin/${binary} ${placeholder f}/bin/pinentry
|
||||
'' + optionalString (f == "gnome3") ''
|
||||
wrapGApp ${placeholder f}/bin/${binary}
|
||||
'' + optionalString (f == "qt") ''
|
||||
wrapQtApp ${placeholder f}/bin/${binary}
|
||||
'')) + ''
|
||||
ln -sf ${placeholder (head enabledFlavors)}/bin/pinentry-${flavorInfo.${head enabledFlavors}.bin} $out/bin/pinentry
|
||||
'';
|
||||
|
||||
outputs = [ "out" ] ++ enabledFlavors;
|
||||
|
||||
passthru = { flavors = enabledFlavors; };
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://gnupg.org/aegypten2/;
|
||||
|
@ -65,6 +98,6 @@ mkDerivation rec {
|
|||
Pinentry provides a console and (optional) GTK and Qt GUIs allowing users
|
||||
to enter a passphrase when `gpg' or `gpg2' is run and needs it.
|
||||
'';
|
||||
maintainers = [ maintainers.ttuegel ];
|
||||
maintainers = with maintainers; [ ttuegel fpletz ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5521,34 +5521,15 @@ in
|
|||
|
||||
phodav = callPackage ../tools/networking/phodav { };
|
||||
|
||||
pinentry = callPackage ../tools/security/pinentry {
|
||||
pinentry = libsForQt5.callPackage ../tools/security/pinentry {
|
||||
libcap = if stdenv.isDarwin then null else libcap;
|
||||
gcr = null;
|
||||
qt4 = null;
|
||||
qt5 = null;
|
||||
};
|
||||
|
||||
pinentry_ncurses = res.pinentry.override {
|
||||
gtk2 = null;
|
||||
};
|
||||
|
||||
pinentry_emacs = res.pinentry.override {
|
||||
enableEmacs = true;
|
||||
};
|
||||
|
||||
pinentry_gnome = res.pinentry.override {
|
||||
inherit gcr;
|
||||
};
|
||||
|
||||
pinentry_qt4 = res.pinentry.override {
|
||||
gtk2 = null;
|
||||
inherit qt4;
|
||||
};
|
||||
|
||||
pinentry_qt5 = res.pinentry.override {
|
||||
gtk2 = null;
|
||||
inherit qt5;
|
||||
};
|
||||
pinentry_curses = (stdenv.lib.getOutput "curses" pinentry);
|
||||
pinentry_emacs = (stdenv.lib.getOutput "emacs" pinentry);
|
||||
pinentry_gtk2 = (stdenv.lib.getOutput "gtk2" pinentry);
|
||||
pinentry_qt = (stdenv.lib.getOutput "qt" pinentry);
|
||||
pinentry_gnome = (stdenv.lib.getOutput "gnome" pinentry);
|
||||
|
||||
pinentry_mac = callPackage ../tools/security/pinentry/mac.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) Cocoa;
|
||||
|
|
Loading…
Reference in a new issue