From 8983b60f87d64745867c5051f655e9708ed2a3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Fri, 19 Sep 2014 18:49:08 +0200 Subject: [PATCH] wireshark: add CLI and Qt versions In addition to our existing GTK version. * Only install desktop file if building a GUI version. * The Qt build appends "-qt" to the wireshark binary name. Undo it so the desktop file works. * The 'wireshark' attribute still refers to the GTK version, for backwards compatibility. --- .../networking/sniffers/wireshark/default.nix | 33 ++++++++++++++----- pkgs/top-level/all-packages.nix | 8 ++++- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix index af1b39170f8..69f0ff5301a 100644 --- a/pkgs/applications/networking/sniffers/wireshark/default.nix +++ b/pkgs/applications/networking/sniffers/wireshark/default.nix @@ -1,12 +1,21 @@ { stdenv, fetchurl, pkgconfig, perl, flex, bison, libpcap, libnl, c-ares -, gnutls, libgcrypt, geoip, heimdal, lua5, gtk, makeDesktopItem, python -, libcap +, gnutls, libgcrypt, geoip, heimdal, lua5, makeDesktopItem, python, libcap, glib +, withGtk ? false, gtk ? null +, withQt ? false, qt4 ? null }: -let version = "1.12.1"; in +assert withGtk -> !withQt && gtk != null; +assert withQt -> !withGtk && qt4 != null; + +with stdenv.lib; + +let + version = "1.12.1"; + variant = if withGtk then "gtk" else if withQt then "qt" else "cli"; +in stdenv.mkDerivation { - name = "wireshark-${version}"; + name = "wireshark-${variant}-${version}"; src = fetchurl { url = "http://www.wireshark.org/download/src/wireshark-${version}.tar.bz2"; @@ -15,12 +24,18 @@ stdenv.mkDerivation { buildInputs = [ bison flex perl pkgconfig libpcap lua5 heimdal libgcrypt gnutls - geoip libnl c-ares gtk python libcap - ]; + geoip libnl c-ares python libcap glib + ] ++ optional withQt qt4 + ++ optional withGtk gtk; patches = [ ./wireshark-lookup-dumpcap-in-path.patch ]; - configureFlags = "--disable-usr-local --disable-silent-rules --with-gtk2 --without-gtk3 --without-qt --with-ssl"; + configureFlags = "--disable-usr-local --disable-silent-rules --with-ssl" + + (if withGtk then + " --with-gtk2 --without-gtk3 --without-qt" + else if withQt then + " --without-gtk2 --without-gtk3 --with-qt" + else " --disable-wireshark"); desktopItem = makeDesktopItem { name = "Wireshark"; @@ -32,11 +47,13 @@ stdenv.mkDerivation { categories = "Network;System"; }; - postInstall = '' + postInstall = optionalString (withQt || withGtk) '' mkdir -p "$out"/share/applications/ mkdir -p "$out"/share/icons/ cp "$desktopItem/share/applications/"* "$out/share/applications/" cp image/wsicon.svg "$out"/share/icons/wireshark.svg + '' + optionalString withQt '' + mv "$out/bin/wireshark-qt" "$out/bin/wireshark" ''; enableParallelBuilding = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 469e4eb23cc..344a91abe12 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8983,7 +8983,13 @@ let wavesurfer = callPackage ../applications/misc/audio/wavesurfer { }; - wireshark = callPackage ../applications/networking/sniffers/wireshark { }; + wireshark-cli = callPackage ../applications/networking/sniffers/wireshark { + withQt = false; + withGtk = false; + }; + wireshark-gtk = wireshark-cli.override { withGtk = true; }; + wireshark-qt = wireshark-cli.override { withQt = true; }; + wireshark = wireshark-gtk; wvdial = callPackage ../os-specific/linux/wvdial { };