2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, flex, bison, bluez, pkg-config, withBluez ? false }:
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libpcap";
|
2021-03-09 03:18:52 +00:00
|
|
|
version = "1.10.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.tcpdump.org/release/${pname}-${version}.tar.gz";
|
2021-03-09 03:18:52 +00:00
|
|
|
sha256 = "sha256-jRK0JiPu7+6HLxI70NyF1TWwDfTULoZfmTxA97/JKx4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
nativeBuildInputs = [ flex bison ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ optionals withBluez [ bluez.dev pkg-config ];
|
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"}"
|
2021-03-09 03:18:52 +00:00
|
|
|
] ++ optionals stdenv.isDarwin [
|
|
|
|
"--disable-universal"
|
2020-06-18 07:06:33 +00:00
|
|
|
] ++ optionals (stdenv.hostPlatform == stdenv.buildPlatform)
|
|
|
|
[ "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
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
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;
|
|
|
|
};
|
|
|
|
}
|