about summary refs log tree commit diff
path: root/pkgs/applications/networking
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
parent565f22d27aba3c53fcf4155dba639f2071d08ed6 (diff)
downloadnixlib-023d584433de7dd60736d8b53b786e81c1032298.tar
nixlib-023d584433de7dd60736d8b53b786e81c1032298.tar.gz
nixlib-023d584433de7dd60736d8b53b786e81c1032298.tar.bz2
nixlib-023d584433de7dd60736d8b53b786e81c1032298.tar.lz
nixlib-023d584433de7dd60736d8b53b786e81c1032298.tar.xz
nixlib-023d584433de7dd60736d8b53b786e81c1032298.tar.zst
nixlib-023d584433de7dd60736d8b53b786e81c1032298.zip
wireshark: Add Darwin support
Diffstat (limited to 'pkgs/applications/networking')
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/cmake.patch19
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix30
2 files changed, 43 insertions, 6 deletions
diff --git a/pkgs/applications/networking/sniffers/wireshark/cmake.patch b/pkgs/applications/networking/sniffers/wireshark/cmake.patch
new file mode 100644
index 000000000000..890fffedce03
--- /dev/null
+++ b/pkgs/applications/networking/sniffers/wireshark/cmake.patch
@@ -0,0 +1,19 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -19,6 +19,7 @@
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ #
+ 
++cmake_minimum_required(VERSION 3.7)
+ project(Wireshark C CXX)
+ 
+ # Updated by make-version.pl
+@@ -40,7 +41,7 @@
+ 	# Needed for GREATER_EQUAL operator
+ 	cmake_minimum_required(VERSION 3.7)
+ else()
+-	cmake_minimum_required(VERSION 2.8.8)
++	cmake_minimum_required(VERSION 3.7)
+ endif()
+ 
+ # Needs to be set after cmake_minimum_required or cmake_policy(VERSION)
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 ];
   };
 }