about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libpcap
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libpcap')
-rw-r--r--nixpkgs/pkgs/development/libraries/libpcap/default.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libpcap/default.nix b/nixpkgs/pkgs/development/libraries/libpcap/default.nix
new file mode 100644
index 000000000000..c04d4a001a17
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpcap/default.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchurl, flex, bison, bluez, pkg-config, withBluez ? false }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  pname = "libpcap";
+  version = "1.10.0";
+
+  src = fetchurl {
+    url = "https://www.tcpdump.org/release/${pname}-${version}.tar.gz";
+    sha256 = "sha256-jRK0JiPu7+6HLxI70NyF1TWwDfTULoZfmTxA97/JKx4=";
+  };
+
+  nativeBuildInputs = [ flex bison ]
+    ++ optionals withBluez [ bluez.dev pkg-config ];
+
+  # We need to force the autodetection because detection doesn't
+  # work in pure build environments.
+  configureFlags = [
+    ("--with-pcap=" + {
+      linux = "linux";
+      darwin = "bpf";
+    }.${stdenv.hostPlatform.parsed.kernel.name})
+  ] ++ optionals stdenv.isDarwin [
+    "--disable-universal"
+  ] ++ optionals (stdenv.hostPlatform == stdenv.buildPlatform)
+    [ "ac_cv_linux_vers=2" ];
+
+  postInstall = ''
+    if [ "$dontDisableStatic" -ne "1" ]; then
+      rm -f $out/lib/libpcap.a
+    fi
+  '';
+
+  meta = {
+    homepage = "https://www.tcpdump.org";
+    description = "Packet Capture Library";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fpletz ];
+    license = licenses.bsd3;
+  };
+}