nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.09 44 lines 1.2 kB view raw
1{ stdenv, fetchurl, flex, bison, bluez, pkgconfig, withBluez ? false }: 2 3with stdenv.lib; 4 5stdenv.mkDerivation rec { 6 pname = "libpcap"; 7 version = "1.9.1"; 8 9 src = fetchurl { 10 url = "https://www.tcpdump.org/release/${pname}-${version}.tar.gz"; 11 sha256 = "153h1378diqyc27jjgz6gg5nxmb4ddk006d9xg69nqavgiikflk3"; 12 }; 13 14 nativeBuildInputs = [ flex bison ] 15 ++ optionals withBluez [ bluez.dev pkgconfig ]; 16 17 # We need to force the autodetection because detection doesn't 18 # work in pure build environments. 19 configureFlags = [ 20 ("--with-pcap=" + { 21 linux = "linux"; 22 darwin = "bpf"; 23 }.${stdenv.hostPlatform.parsed.kernel.name}) 24 ] ++ optionals (stdenv.hostPlatform == stdenv.buildPlatform) 25 [ "ac_cv_linux_vers=2" ]; 26 27 prePatch = optionalString stdenv.isDarwin '' 28 substituteInPlace configure --replace " -arch i386" "" 29 ''; 30 31 postInstall = '' 32 if [ "$dontDisableStatic" -ne "1" ]; then 33 rm -f $out/lib/libpcap.a 34 fi 35 ''; 36 37 meta = { 38 homepage = "https://www.tcpdump.org"; 39 description = "Packet Capture Library"; 40 platforms = platforms.unix; 41 maintainers = with maintainers; [ fpletz ]; 42 license = licenses.bsd3; 43 }; 44}