Merge pull request #36162 from Kaali/wireshark

wireshark: Add Darwin support

authored by Jörg Thalheim and committed by GitHub ab59aa73 27e0de5d

+43 -6
+19
pkgs/applications/networking/sniffers/wireshark/cmake.patch
··· 1 + --- a/CMakeLists.txt 2 + +++ b/CMakeLists.txt 3 + @@ -19,6 +19,7 @@ 4 + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 5 + # 6 + 7 + +cmake_minimum_required(VERSION 3.7) 8 + project(Wireshark C CXX) 9 + 10 + # Updated by make-version.pl 11 + @@ -40,7 +41,7 @@ 12 + # Needed for GREATER_EQUAL operator 13 + cmake_minimum_required(VERSION 3.7) 14 + else() 15 + - cmake_minimum_required(VERSION 2.8.8) 16 + + cmake_minimum_required(VERSION 3.7) 17 + endif() 18 + 19 + # Needs to be set after cmake_minimum_required or cmake_policy(VERSION)
+24 -6
pkgs/applications/networking/sniffers/wireshark/default.nix
··· 1 1 { stdenv, lib, fetchurl, pkgconfig, pcre, perl, flex, bison, gettext, libpcap, libnl, c-ares 2 2 , gnutls, libgcrypt, libgpgerror, geoip, openssl, lua5, makeDesktopItem, python, libcap, glib 3 - , libssh, zlib, cmake, extra-cmake-modules, fetchpatch 3 + , libssh, zlib, cmake, extra-cmake-modules, fetchpatch, makeWrapper 4 4 , withGtk ? false, gtk3 ? null, librsvg ? null, gsettings-desktop-schemas ? null, wrapGAppsHook ? null 5 5 , withQt ? false, qt5 ? null 6 6 , ApplicationServices, SystemConfiguration, gmp ··· 26 26 cmakeFlags = [ 27 27 "-DBUILD_wireshark_gtk=${if withGtk then "ON" else "OFF"}" 28 28 "-DBUILD_wireshark=${if withQt then "ON" else "OFF"}" 29 + "-DENABLE_QT5=${if withQt then "ON" else "OFF"}" 30 + "-DENABLE_APPLICATION_BUNDLE=${if withQt && stdenv.isDarwin then "ON" else "OFF"}" 29 31 ]; 30 32 31 33 nativeBuildInputs = [ ··· 34 36 35 37 buildInputs = [ 36 38 gettext pcre perl libpcap lua5 libssh openssl libgcrypt 37 - libgpgerror gnutls geoip c-ares python glib zlib 39 + libgpgerror gnutls geoip c-ares python glib zlib makeWrapper 38 40 ] ++ optionals withQt (with qt5; [ qtbase qtmultimedia qtsvg qttools ]) 39 41 ++ optionals withGtk [ gtk3 librsvg gsettings-desktop-schemas ] 40 42 ++ optionals stdenv.isLinux [ libcap libnl ] 41 - ++ optionals stdenv.isDarwin [ SystemConfiguration ApplicationServices gmp ]; 43 + ++ optionals stdenv.isDarwin [ SystemConfiguration ApplicationServices gmp ] 44 + ++ optionals (withQt && stdenv.isDarwin) (with qt5; [ qtmacextras ]); 42 45 43 46 patches = [ ./wireshark-lookup-dumpcap-in-path.patch ] 44 47 # https://code.wireshark.org/review/#/c/23728/ ··· 46 49 name = "fix-timeout.patch"; 47 50 url = "https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commitdiff_plain;h=8b5b843fcbc3e03e0fc45f3caf8cf5fc477e8613;hp=94af9724d140fd132896b650d10c4d060788e4f0"; 48 51 sha256 = "1g2dm7lwsnanwp68b9xr9swspx7hfj4v3z44sz3yrfmynygk8zlv"; 49 - }); 52 + }) 53 + ++ stdenv.lib.optional stdenv.isDarwin ./cmake.patch; 50 54 51 - postInstall = optionalString (withQt || withGtk) '' 55 + postInstall = if stdenv.isDarwin then '' 56 + ${optionalString withQt '' 57 + mkdir -p $out/Applications 58 + mv $out/bin/Wireshark.app $out/Applications/Wireshark.app 59 + 60 + for so in $out/Applications/Wireshark.app/Contents/PlugIns/wireshark/*.so; do 61 + install_name_tool $so -change libwireshark.10.dylib $out/lib/libwireshark.10.dylib 62 + install_name_tool $so -change libwiretap.7.dylib $out/lib/libwiretap.7.dylib 63 + install_name_tool $so -change libwsutil.8.dylib $out/lib/libwsutil.8.dylib 64 + done 65 + 66 + wrapProgram $out/Applications/Wireshark.app/Contents/MacOS/Wireshark \ 67 + --set QT_PLUGIN_PATH ${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix} 68 + ''} 69 + '' else optionalString (withQt || withGtk) '' 52 70 ${optionalString withGtk '' 53 71 install -Dm644 -t $out/share/applications ../wireshark-gtk.desktop 54 72 ''} ··· 75 93 experts. It runs on UNIX, macOS and Windows. 76 94 ''; 77 95 78 - platforms = platforms.linux; 96 + platforms = platforms.linux ++ platforms.darwin; 79 97 maintainers = with maintainers; [ bjornfor fpletz ]; 80 98 }; 81 99 }