summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/networking/sniffers/wireshark/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking/sniffers/wireshark/default.nix')
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix38
1 files changed, 29 insertions, 9 deletions
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index 81dd459f5cb0..191924ac7002 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -9,6 +9,7 @@
, buildPackages
, c-ares
, cmake
+, fixDarwinDylibNames
, flex
, gettext
, glib
@@ -49,12 +50,14 @@
, withQt ? true
, qt6 ? null
}:
-
+let
+ isAppBundle = withQt && stdenv.isDarwin;
+in
assert withQt -> qt6 != null;
stdenv.mkDerivation rec {
pname = "wireshark-${if withQt then "qt" else "cli"}";
- version = "4.2.5";
+ version = "4.2.6";
outputs = [ "out" "dev" ];
@@ -62,7 +65,7 @@ stdenv.mkDerivation rec {
repo = "wireshark";
owner = "wireshark";
rev = "v${version}";
- hash = "sha256-g0b0YGWQzWsALVnNJl/WQGl9J2QjaLnry2VL6qvN1FQ=";
+ hash = "sha256-zlFTUgsEKraE9crS5SZ13r93JJzUb6eyBhusJbbGwsE=";
};
patches = [
@@ -86,6 +89,8 @@ stdenv.mkDerivation rec {
] ++ lib.optionals withQt [
qt6.wrapQtAppsHook
wrapGAppsHook3
+ ] ++ lib.optionals stdenv.isDarwin [
+ fixDarwinDylibNames
];
buildInputs = [
@@ -139,7 +144,7 @@ stdenv.mkDerivation rec {
"-DBUILD_wireshark=${if withQt then "ON" else "OFF"}"
# Fix `extcap` and `plugins` paths. See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=16444
"-DCMAKE_INSTALL_LIBDIR=lib"
- "-DENABLE_APPLICATION_BUNDLE=${if withQt && stdenv.isDarwin then "ON" else "OFF"}"
+ "-DENABLE_APPLICATION_BUNDLE=${if isAppBundle then "ON" else "OFF"}"
"-DLEMON_C_COMPILER=cc"
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
"-DHAVE_C99_VSNPRINTF_EXITCODE__TRYRUN_OUTPUT="
@@ -163,14 +168,20 @@ stdenv.mkDerivation rec {
postInstall = ''
cmake --install . --prefix "''${!outputDev}" --component Development
- '' + lib.optionalString (stdenv.isDarwin && withQt) ''
+ '' + lib.optionalString isAppBundle ''
mkdir -p $out/Applications
mv $out/bin/Wireshark.app $out/Applications/Wireshark.app
+ '' + lib.optionalString stdenv.isDarwin ''
+ local flags=()
+ for file in $out/lib/*.dylib; do
+ flags+=(-change @rpath/"$(basename "$file")" "$file")
+ done
- for f in $(find $out/Applications/Wireshark.app/Contents/PlugIns -name "*.so"); do
- for dylib in $(otool -L $f | awk '/^\t*lib/ {print $1}'); do
- install_name_tool -change "$dylib" "$out/lib/$dylib" "$f"
- done
+ for file in $out/lib/wireshark/extcap/*; do
+ if [ -L "$file" ]; then continue; fi
+ echo "$file: fixing dylib references"
+ # note that -id does nothing on binaries
+ install_name_tool -id "$file" "''${flags[@]}" "$file"
done
'';
@@ -178,6 +189,15 @@ stdenv.mkDerivation rec {
qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
+ # This is done to remove some binary wrappers that wrapQtApps adds in *.app directories.
+ # Copying because unfortunately pointing Wireshark (when built as an appbundle) at $out/lib instead is nontrivial.
+ postFixup = lib.optionalString isAppBundle ''
+ rm -rf $out/Applications/Wireshark.app/Contents/MacOS/extcap $out/Applications/Wireshark.app/Contents/PlugIns
+ mkdir -p $out/Applications/Wireshark.app/Contents/PlugIns/wireshark
+ cp -r $out/lib/wireshark/plugins/4-2 $out/Applications/Wireshark.app/Contents/PlugIns/wireshark/4-2
+ cp -r $out/lib/wireshark/extcap $out/Applications/Wireshark.app/Contents/MacOS/extcap
+ '';
+
meta = with lib; {
description = "Powerful network protocol analyzer";
longDescription = ''