summary refs log tree commit diff
path: root/pkgs/applications/networking/sniffers/wireshark/default.nix
diff options
context:
space:
mode:
authorVäinö Järvelä <vaino.jarvela@reaktor.com>2018-03-01 14:50:20 +0200
committerVäinö Järvelä <vaino.jarvela@reaktor.com>2018-03-01 15:31:30 +0200
commit023d584433de7dd60736d8b53b786e81c1032298 (patch)
tree919e46fb951e46db3e1e623e66b7fa63a13cc521 /pkgs/applications/networking/sniffers/wireshark/default.nix
parent565f22d27aba3c53fcf4155dba639f2071d08ed6 (diff)
downloadnixpkgs-023d584433de7dd60736d8b53b786e81c1032298.tar
nixpkgs-023d584433de7dd60736d8b53b786e81c1032298.tar.gz
nixpkgs-023d584433de7dd60736d8b53b786e81c1032298.tar.bz2
nixpkgs-023d584433de7dd60736d8b53b786e81c1032298.tar.lz
nixpkgs-023d584433de7dd60736d8b53b786e81c1032298.tar.xz
nixpkgs-023d584433de7dd60736d8b53b786e81c1032298.tar.zst
nixpkgs-023d584433de7dd60736d8b53b786e81c1032298.zip
wireshark: Add Darwin support
Diffstat (limited to 'pkgs/applications/networking/sniffers/wireshark/default.nix')
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix30
1 files changed, 24 insertions, 6 deletions
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index 682b7d311d7..81859eb1fe3 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 ];
   };
 }