From 023d584433de7dd60736d8b53b786e81c1032298 Mon Sep 17 00:00:00 2001 From: Väinö Järvelä Date: Thu, 1 Mar 2018 14:50:20 +0200 Subject: wireshark: Add Darwin support --- .../networking/sniffers/wireshark/default.nix | 30 +++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'pkgs/applications/networking/sniffers/wireshark/default.nix') diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix index 682b7d311d71..81859eb1fe33 100644 --- a/pkgs/applications/networking/sniffers/wireshark/default.nix +++ b/pkgs/applications/networking/sniffers/wireshark/default.nix @@ -1,6 +1,6 @@ { stdenv, lib, fetchurl, pkgconfig, pcre, perl, flex, bison, gettext, libpcap, libnl, c-ares , gnutls, libgcrypt, libgpgerror, geoip, openssl, lua5, makeDesktopItem, python, libcap, glib -, libssh, zlib, cmake, extra-cmake-modules, fetchpatch +, libssh, zlib, cmake, extra-cmake-modules, fetchpatch, makeWrapper , withGtk ? false, gtk3 ? null, librsvg ? null, gsettings-desktop-schemas ? null, wrapGAppsHook ? null , withQt ? false, qt5 ? null , ApplicationServices, SystemConfiguration, gmp @@ -26,6 +26,8 @@ in stdenv.mkDerivation { cmakeFlags = [ "-DBUILD_wireshark_gtk=${if withGtk then "ON" else "OFF"}" "-DBUILD_wireshark=${if withQt then "ON" else "OFF"}" + "-DENABLE_QT5=${if withQt then "ON" else "OFF"}" + "-DENABLE_APPLICATION_BUNDLE=${if withQt && stdenv.isDarwin then "ON" else "OFF"}" ]; nativeBuildInputs = [ @@ -34,11 +36,12 @@ in stdenv.mkDerivation { buildInputs = [ gettext pcre perl libpcap lua5 libssh openssl libgcrypt - libgpgerror gnutls geoip c-ares python glib zlib + libgpgerror gnutls geoip c-ares python glib zlib makeWrapper ] ++ optionals withQt (with qt5; [ qtbase qtmultimedia qtsvg qttools ]) ++ optionals withGtk [ gtk3 librsvg gsettings-desktop-schemas ] ++ optionals stdenv.isLinux [ libcap libnl ] - ++ optionals stdenv.isDarwin [ SystemConfiguration ApplicationServices gmp ]; + ++ optionals stdenv.isDarwin [ SystemConfiguration ApplicationServices gmp ] + ++ optionals (withQt && stdenv.isDarwin) (with qt5; [ qtmacextras ]); patches = [ ./wireshark-lookup-dumpcap-in-path.patch ] # https://code.wireshark.org/review/#/c/23728/ @@ -46,9 +49,24 @@ in stdenv.mkDerivation { name = "fix-timeout.patch"; url = "https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commitdiff_plain;h=8b5b843fcbc3e03e0fc45f3caf8cf5fc477e8613;hp=94af9724d140fd132896b650d10c4d060788e4f0"; sha256 = "1g2dm7lwsnanwp68b9xr9swspx7hfj4v3z44sz3yrfmynygk8zlv"; - }); + }) + ++ stdenv.lib.optional stdenv.isDarwin ./cmake.patch; - postInstall = optionalString (withQt || withGtk) '' + postInstall = if stdenv.isDarwin then '' + ${optionalString withQt '' + mkdir -p $out/Applications + mv $out/bin/Wireshark.app $out/Applications/Wireshark.app + + for so in $out/Applications/Wireshark.app/Contents/PlugIns/wireshark/*.so; do + install_name_tool $so -change libwireshark.10.dylib $out/lib/libwireshark.10.dylib + install_name_tool $so -change libwiretap.7.dylib $out/lib/libwiretap.7.dylib + install_name_tool $so -change libwsutil.8.dylib $out/lib/libwsutil.8.dylib + done + + wrapProgram $out/Applications/Wireshark.app/Contents/MacOS/Wireshark \ + --set QT_PLUGIN_PATH ${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix} + ''} + '' else optionalString (withQt || withGtk) '' ${optionalString withGtk '' install -Dm644 -t $out/share/applications ../wireshark-gtk.desktop ''} @@ -75,7 +93,7 @@ in stdenv.mkDerivation { experts. It runs on UNIX, macOS and Windows. ''; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.darwin; maintainers = with maintainers; [ bjornfor fpletz ]; }; } -- cgit 1.4.1