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.
This commit is contained in:
Bjørn Forsman 2014-09-19 18:49:08 +02:00
parent 1daa2e5a7e
commit 8983b60f87
2 changed files with 32 additions and 9 deletions

View File

@ -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;

View File

@ -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 { };