nixpkgs/pkgs/applications/networking/sniffers/wireshark/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

196 lines
3.9 KiB
Nix
Raw Normal View History

2023-03-04 12:18:41 +00:00
{ lib
, stdenv
2023-03-04 16:56:24 +00:00
, fetchFromGitLab
2023-10-05 08:51:44 +00:00
, ApplicationServices
, asciidoctor
, bcg729
2023-03-04 12:18:41 +00:00
, bison
2023-10-05 08:51:44 +00:00
, buildPackages
2023-03-04 12:18:41 +00:00
, c-ares
2023-10-05 08:51:44 +00:00
, cmake
, flex
, gettext
, glib
, gmp
2023-03-04 12:18:41 +00:00
, gnutls
2023-10-05 08:51:44 +00:00
, libcap
2023-03-04 12:18:41 +00:00
, libgcrypt
, libgpg-error
2023-10-05 08:51:44 +00:00
, libkrb5
2023-03-04 17:19:04 +00:00
, libmaxminddb
2023-10-05 08:51:44 +00:00
, libnl
2023-03-04 17:19:04 +00:00
, libopus
2023-10-05 08:51:44 +00:00
, libpcap
2023-03-04 17:19:04 +00:00
, libsmi
2023-10-05 08:51:44 +00:00
, libssh
, lua5
2023-03-04 17:19:04 +00:00
, lz4
2023-10-05 08:51:44 +00:00
, makeWrapper
2023-03-04 17:19:04 +00:00
, minizip
2023-03-04 12:18:41 +00:00
, nghttp2
2023-11-16 16:48:46 +00:00
, nghttp3
2023-03-04 16:56:24 +00:00
, ninja
2023-11-16 16:48:46 +00:00
, opencore-amr
2023-10-05 08:51:44 +00:00
, openssl
, pcre2
, perl
, pkg-config
, python3
, sbc
, snappy
, spandsp3
, speexdsp
, SystemConfiguration
2023-03-04 12:18:41 +00:00
, wrapGAppsHook
2023-10-05 08:51:44 +00:00
, zlib
, zstd
2023-03-04 12:18:41 +00:00
, withQt ? true
2023-05-06 10:20:38 +00:00
, qt6 ? null
}:
2023-05-06 10:20:38 +00:00
assert withQt -> qt6 != null;
2023-10-05 08:51:44 +00:00
stdenv.mkDerivation rec {
pname = "wireshark-${if withQt then "qt" else "cli"}";
version = "4.2.4";
2023-10-05 08:51:44 +00:00
outputs = [ "out" "dev" ];
2023-03-04 16:56:24 +00:00
src = fetchFromGitLab {
repo = "wireshark";
owner = "wireshark";
rev = "v${version}";
hash = "sha256-yGKqklNy1SkmWOaYI0jsTy2rLq5W/dbh8fIUrBSSdw8=";
};
2023-10-05 08:51:44 +00:00
patches = [
2023-11-16 16:48:46 +00:00
./patches/lookup-dumpcap-in-path.patch
];
2023-10-05 08:51:44 +00:00
depsBuildBuild = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
buildPackages.stdenv.cc
];
2017-03-15 21:53:32 +00:00
2023-10-05 08:51:44 +00:00
nativeBuildInputs = [
asciidoctor
bison
cmake
flex
makeWrapper
ninja
perl
pkg-config
python3
] ++ lib.optionals withQt [
qt6.wrapQtAppsHook
wrapGAppsHook
];
2022-04-05 02:52:26 +00:00
buildInputs = [
2023-11-16 16:48:22 +00:00
bcg729
c-ares
2023-03-04 12:18:41 +00:00
gettext
2023-11-16 16:48:22 +00:00
glib
gnutls
2023-03-04 12:18:41 +00:00
libgcrypt
libgpg-error
2023-11-16 16:48:22 +00:00
libkrb5
2023-03-04 17:19:04 +00:00
libmaxminddb
libopus
2023-11-16 16:48:22 +00:00
libpcap
2023-03-04 17:19:04 +00:00
libsmi
2023-11-16 16:48:22 +00:00
libssh
lua5
2023-03-04 17:19:04 +00:00
lz4
minizip
2023-11-16 16:48:22 +00:00
nghttp2
2023-11-16 16:48:46 +00:00
nghttp3
opencore-amr
2023-11-16 16:48:22 +00:00
openssl
pcre2
snappy
spandsp3
speexdsp
2023-03-04 12:18:41 +00:00
zlib
2023-11-16 16:48:22 +00:00
zstd
2023-10-05 08:51:44 +00:00
] ++ lib.optionals withQt (with qt6; [
qt5compat
qtbase
qtmultimedia
qtsvg
qttools
]) ++ lib.optionals (withQt && stdenv.isLinux) [
qt6.qtwayland
] ++ lib.optionals stdenv.isLinux [
libcap
libnl
sbc
] ++ lib.optionals stdenv.isDarwin [
ApplicationServices
gmp
SystemConfiguration
];
2022-04-05 02:52:26 +00:00
strictDeps = true;
2023-10-05 08:51:44 +00:00
cmakeFlags = [
"-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"
2023-11-16 16:48:22 +00:00
"-DENABLE_APPLICATION_BUNDLE=${if withQt && stdenv.isDarwin then "ON" else "OFF"}"
2023-10-05 08:51:44 +00:00
"-DLEMON_C_COMPILER=cc"
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
"-DHAVE_C99_VSNPRINTF_EXITCODE__TRYRUN_OUTPUT="
2023-11-16 16:48:22 +00:00
"-DHAVE_C99_VSNPRINTF_EXITCODE=0"
2023-10-05 08:51:44 +00:00
];
# Avoid referencing -dev paths because of debug assertions.
env.NIX_CFLAGS_COMPILE = toString [ "-DQT_NO_DEBUG" ];
dontFixCmake = true;
dontWrapGApps = true;
shellHook = ''
# to be able to run the resulting binary
export WIRESHARK_RUN_FROM_BUILD_DIRECTORY=1
'';
postPatch = ''
sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
'';
postInstall = ''
2023-11-16 16:48:46 +00:00
cmake --install . --prefix "''${!outputDev}" --component Development
'' + lib.optionalString (stdenv.isDarwin && withQt) ''
mkdir -p $out/Applications
mv $out/bin/Wireshark.app $out/Applications/Wireshark.app
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
done
2023-11-16 16:48:46 +00:00
'';
preFixup = ''
qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
meta = with lib; {
2014-09-19 19:12:14 +00:00
description = "Powerful network protocol analyzer";
longDescription = ''
Wireshark (formerly known as "Ethereal") is a powerful network
protocol analyzer developed by an international team of networking
experts. It runs on UNIX, macOS and Windows.
'';
2023-10-05 08:51:44 +00:00
homepage = "https://www.wireshark.org";
changelog = "https://www.wireshark.org/docs/relnotes/wireshark-${version}.html";
license = licenses.gpl2Plus;
2018-03-01 12:50:20 +00:00
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ bjornfor fpletz ];
mainProgram = if withQt then "wireshark" else "tshark";
};
}