2023-02-02 18:25:31 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, flex
|
|
|
|
, bison
|
|
|
|
, bluez
|
2023-04-12 12:48:02 +00:00
|
|
|
, libnl
|
2023-02-02 18:25:31 +00:00
|
|
|
, libxcrypt
|
|
|
|
, pkg-config
|
|
|
|
, withBluez ? false
|
|
|
|
, withRemote ? false
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libpcap";
|
2023-04-29 16:46:19 +00:00
|
|
|
version = "1.10.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.tcpdump.org/release/${pname}-${version}.tar.gz";
|
2023-04-29 16:46:19 +00:00
|
|
|
hash = "sha256-7RmgOD+tcuOtQ1/SOdfNgNZJFrhyaVUBWdIORxYOvl8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ libnl ]
|
|
|
|
++ lib.optionals withRemote [ libxcrypt ];
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
nativeBuildInputs = [ flex bison ]
|
2023-04-12 12:48:02 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ pkg-config ]
|
|
|
|
++ lib.optionals withBluez [ bluez.dev ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# We need to force the autodetection because detection doesn't
|
2020-08-20 17:08:02 +00:00
|
|
|
# work in pure build environments.
|
2020-04-24 23:36:52 +00:00
|
|
|
configureFlags = [
|
2021-04-19 03:05:28 +00:00
|
|
|
"--with-pcap=${if stdenv.isLinux then "linux" else "bpf"}"
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2021-03-09 03:18:52 +00:00
|
|
|
"--disable-universal"
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals withRemote [
|
|
|
|
"--enable-remote"
|
|
|
|
] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform)
|
2020-06-18 07:06:33 +00:00
|
|
|
[ "ac_cv_linux_vers=2" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
postInstall = ''
|
2020-07-18 16:06:22 +00:00
|
|
|
if [ "$dontDisableStatic" -ne "1" ]; then
|
|
|
|
rm -f $out/lib/libpcap.a
|
|
|
|
fi
|
2020-06-18 07:06:33 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.tcpdump.org";
|
|
|
|
description = "Packet Capture Library";
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ fpletz ];
|
|
|
|
license = licenses.bsd3;
|
|
|
|
};
|
|
|
|
}
|