rio: 0.0.36 -> 0.0.37
[NixPkgs.git] / pkgs / tools / networking / packetdrill / default.nix
blobbaf2a53c4d78e5333019f731d299d73dc7a757ec
1 { lib, stdenv, fetchFromGitHub, fetchpatch, bison, flex, cmake, libpcap }:
2 stdenv.mkDerivation rec {
3   pname = "packetdrill";
4   version = "unstable-2020-08-22";
6   src = fetchFromGitHub {
7     owner = "google";
8     repo = "packetdrill";
9     rev = "68a34fa73cf221e5f52d6fa4f203bcd93062be1b";
10     sha256 = "0djkwb6l2959f44d98vwb092rghf0qmii8391vrpxqb99j6pv4h6";
11   };
12   patches = [
13     # Upstream fix for -fno-common toolchains
14     (fetchpatch {
15       name = "fno-common.patch";
16       url = "https://github.com/google/packetdrill/commit/c08292838de81a71ee477d5bf9d95b1130a1292b.patch";
17       sha256 = "1irbar1zkydmgqb12r3xd80dwj2jfxnxayxpb4nmbma8xm7knb10";
18       stripLen = 3;
19     })
20   ];
22   setSourceRoot = ''
23     export sourceRoot=$(realpath */gtests/net/packetdrill)
24   '';
26   env.NIX_CFLAGS_COMPILE = toString [
27     "-Wno-error=unused-result"
28     "-Wno-error=stringop-truncation"
29     "-Wno-error=address-of-packed-member"
30   ];
31   nativeBuildInputs = [ bison flex cmake libpcap ];
32   buildInputs = [ libpcap ];
34   installPhase = ''
35     install -m 0755 -t $out/bin -D \
36       packetdrill \
37       packet_parser_test \
38       packet_to_string_test \
39       checksum_test
40     mkdir -p $out/share
41     cp -r ../tests $out/share/packetdrill-tests
42   '';
44   meta = {
45     description = "Quick, precise tests for entire TCP/UDP/IPv4/IPv6 network stacks";
46     homepage = "https://github.com/google/packetdrill";
47     license = lib.licenses.gpl2Plus;
48     platforms = lib.platforms.linux;
49     maintainers = with lib.maintainers; [ dmjio cleverca22 ];
50   };