1{ stdenv, fetchurl, flex, bison }:
2
3stdenv.mkDerivation rec {
4 name = "libpcap-1.7.4";
5
6 src = fetchurl {
7 url = "http://www.tcpdump.org/release/${name}.tar.gz";
8 sha256 = "1c28ykkizd7jqgzrfkg7ivqjlqs9p6lygp26bsw2i0z8hwhi3lvs";
9 };
10
11 nativeBuildInputs = [ flex bison ];
12
13 # We need to force the autodetection because detection doesn't
14 # work in pure build enviroments.
15 configureFlags =
16 if stdenv.isLinux then [ "--with-pcap=linux" ]
17 else if stdenv.isDarwin then [ "--with-pcap=bpf" ]
18 else [];
19
20 prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
21 substituteInPlace configure --replace " -arch i386" ""
22 '';
23
24 preInstall = ''mkdir -p $out/bin'';
25
26 crossAttrs = {
27 # Stripping hurts in static libraries
28 dontStrip = true;
29 configureFlags = configureFlags ++ [ "ac_cv_linux_vers=2" ];
30 };
31
32 meta = {
33 homepage = http://www.tcpdump.org;
34 description = "Packet Capture Library";
35 };
36}