nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchurl
4, flex
5, bison
6, bluez
7, libnl
8, libxcrypt
9, pkg-config
10, withBluez ? false
11, withRemote ? false
12}:
13
14stdenv.mkDerivation rec {
15 pname = "libpcap";
16 version = "1.10.4";
17
18 src = fetchurl {
19 url = "https://www.tcpdump.org/release/${pname}-${version}.tar.gz";
20 hash = "sha256-7RmgOD+tcuOtQ1/SOdfNgNZJFrhyaVUBWdIORxYOvl8=";
21 };
22
23 buildInputs = lib.optionals stdenv.isLinux [ libnl ]
24 ++ lib.optionals withRemote [ libxcrypt ];
25
26 nativeBuildInputs = [ flex bison ]
27 ++ lib.optionals stdenv.isLinux [ pkg-config ]
28 ++ lib.optionals withBluez [ bluez.dev ];
29
30 # We need to force the autodetection because detection doesn't
31 # work in pure build environments.
32 configureFlags = [
33 "--with-pcap=${if stdenv.isLinux then "linux" else "bpf"}"
34 ] ++ lib.optionals stdenv.isDarwin [
35 "--disable-universal"
36 ] ++ lib.optionals withRemote [
37 "--enable-remote"
38 ] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform)
39 [ "ac_cv_linux_vers=2" ];
40
41 postInstall = ''
42 if [ "$dontDisableStatic" -ne "1" ]; then
43 rm -f $out/lib/libpcap.a
44 fi
45 '';
46
47 meta = with lib; {
48 homepage = "https://www.tcpdump.org";
49 description = "Packet Capture Library";
50 platforms = platforms.unix;
51 maintainers = with maintainers; [ fpletz ];
52 license = licenses.bsd3;
53 };
54}