packetdrill: 1.0 -> unstable-2020-08-22, fix build

also switch to cmake build
This commit is contained in:
Robert Scott 2020-10-07 20:21:31 +01:00
parent c2ebb8becb
commit 87fad4d39e
2 changed files with 20 additions and 32 deletions

View file

@ -1,24 +1,36 @@
{ stdenv, fetchFromGitHub, bison, flex }:
stdenv.mkDerivation {
version = "1.0";
{ stdenv, fetchFromGitHub, bison, flex, cmake, libpcap }:
stdenv.mkDerivation rec {
pname = "packetdrill";
version = "unstable-2020-08-22";
src = fetchFromGitHub {
owner = "google";
repo = "packetdrill";
rev = "58a7865c47e3a71e92ca0e4cc478c320e1c35f82";
sha256 = "09sqiakmn63idfjhy2ddf1456sfhi8yhsbp8lxvc1yfjikjxwwbc";
rev = "68a34fa73cf221e5f52d6fa4f203bcd93062be1b";
sha256 = "0djkwb6l2959f44d98vwb092rghf0qmii8391vrpxqb99j6pv4h6";
};
setSourceRoot = ''
export sourceRoot=$(realpath */gtests/net/packetdrill)
'';
NIX_CFLAGS_COMPILE = [
"-Wno-error=unused-result"
"-Wno-error=stringop-truncation"
"-Wno-error=address-of-packed-member"
];
nativeBuildInputs = [ bison flex ];
patches = [ ./nix.patch ];
enableParallelBuilding = true;
nativeBuildInputs = [ bison flex cmake libpcap ];
buildInputs = [ libpcap ];
installPhase = ''
install -m 0755 -t $out/bin -D \
packetdrill \
packet_parser_test \
packet_to_string_test \
checksum_test
mkdir -p $out/share
cp -r ../tests $out/share/packetdrill-tests
'';
meta = {
description = "Quick, precise tests for entire TCP/UDP/IPv4/IPv6 network stacks";
homepage = "https://github.com/google/packetdrill";

View file

@ -1,24 +0,0 @@
diff --git a/gtests/net/packetdrill/Makefile.common b/gtests/net/packetdrill/Makefile.common
index 0ec741f..bf1cbb1 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -33,7 +33,7 @@ packetdrill-lib := \
packetdrill-objs := packetdrill.o $(packetdrill-lib)
packetdrill: $(packetdrill-objs)
- $(CC) -o packetdrill -g -static $(packetdrill-objs) $(packetdrill-ext-libs)
+ $(CC) -o packetdrill -g $(packetdrill-objs) $(packetdrill-ext-libs)
test-bins := checksum_test packet_parser_test packet_to_string_test
tests: $(test-bins)
@@ -43,6 +43,10 @@ tests: $(test-bins)
binaries: packetdrill $(test-bins)
+install: packetdrill $(test-bins)
+ mkdir -p ${out}/bin
+ cp -vi $^ ${out}/bin
+
checksum_test-objs := $(packetdrill-lib) checksum_test.o
checksum_test: $(checksum_test-objs)
$(CC) -o checksum_test $(checksum_test-objs) $(packetdrill-ext-libs)