From 4fc94e6222d8be99e06e5d8de1e97251ded5f5ff Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 25 Mar 2015 16:09:00 -0700 Subject: [PATCH] pinentry: Update build --- pkgs/tools/security/pinentry/default.nix | 33 +++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/pkgs/tools/security/pinentry/default.nix b/pkgs/tools/security/pinentry/default.nix index bd81b61e12ad..44ad0e05ca77 100644 --- a/pkgs/tools/security/pinentry/default.nix +++ b/pkgs/tools/security/pinentry/default.nix @@ -1,10 +1,14 @@ -{ fetchurl, stdenv, pkgconfig, glib -, useGtk ? !stdenv.isDarwin, gtk -, useNcurses ? true, ncurses -, useQt4 ? false, qt4 }: - -assert useGtk || useNcurses || useQt4; +{ fetchurl, stdenv, pkgconfig +, libcap ? null, ncurses ? null, gtk ? null, qt4 ? null +}: +let + mkFlag = pfxTrue: pfxFalse: cond: name: "--${if cond then pfxTrue else pfxFalse}-${name}"; + mkEnable = mkFlag "enable" "disable"; + mkWith = mkFlag "with" "without"; + hasX = gtk != null || qt4 != null; +in +with stdenv.lib; stdenv.mkDerivation rec { name = "pinentry-0.9.0"; @@ -13,16 +17,15 @@ stdenv.mkDerivation rec { sha256 = "1awhajq21hcjgqfxg9czaxg555gij4bba6axrwg8w6lfmc3ml14h"; }; - buildInputs = let opt = stdenv.lib.optional; in [] - ++ opt useGtk glib - ++ opt useGtk gtk - ++ opt useNcurses ncurses - ++ opt useQt4 qt4; + buildInputs = [ libcap gtk ncurses qt4 ]; - configureFlags = [ "--disable-pinentry-gtk" "--disable-pinentry-qt" ] - ++ (if useGtk || useQt4 then ["--with-x"] else ["--without-x"]) - ++ (if useGtk then ["--enable-pinentry-gtk2"] else ["--disable-pinentry-gtk"]) - ++ (if useQt4 then ["--enable-pinentry-qt4"] else ["--disable-pinentry-qt4"]); + configureFlags = [ + (mkWith (libcap != null) "libcap") + (mkEnable (ncurses != null) "pinentry-curses") + (mkEnable true "pinentry-tty") + (mkEnable (gtk != null) "pinentry-gtk2") + (mkEnable (qt4 != null) "pinentry-qt4") + ]; nativeBuildInputs = [ pkgconfig ];