2022-09-22 12:36:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, libbpf
|
|
|
|
, elfutils
|
|
|
|
, zlib
|
|
|
|
, libpcap
|
2023-03-27 19:17:25 +00:00
|
|
|
, bpftools
|
2022-09-22 12:36:57 +00:00
|
|
|
, llvmPackages
|
|
|
|
, pkg-config
|
|
|
|
, m4
|
|
|
|
, emacs-nox
|
|
|
|
, wireshark-cli
|
|
|
|
, nukeReferences
|
|
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "xdp-tools";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "1.4.2";
|
2022-09-22 12:36:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xdp-project";
|
|
|
|
repo = "xdp-tools";
|
|
|
|
rev = "v${version}";
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-kWgjt7mYwHtf8I4sXPzzrQJkWQyC8AC85ulGOWmQNZI=";
|
2022-09-22 12:36:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "lib" ];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libbpf
|
|
|
|
elfutils
|
|
|
|
libpcap
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
depsBuildBuild = [
|
|
|
|
emacs-nox # to generate man pages from .org
|
|
|
|
];
|
2022-09-22 12:36:57 +00:00
|
|
|
nativeBuildInputs = [
|
2023-03-27 19:17:25 +00:00
|
|
|
bpftools
|
2022-09-22 12:36:57 +00:00
|
|
|
llvmPackages.clang
|
|
|
|
llvmPackages.llvm
|
|
|
|
pkg-config
|
|
|
|
m4
|
|
|
|
nukeReferences
|
|
|
|
];
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-09-22 12:36:57 +00:00
|
|
|
wireshark-cli # for tshark
|
|
|
|
];
|
|
|
|
|
|
|
|
# When building BPF, the default CC wrapper is interfering a bit too much.
|
|
|
|
BPF_CFLAGS = "-fno-stack-protector -Wno-error=unused-command-line-argument";
|
|
|
|
|
|
|
|
PRODUCTION = 1;
|
|
|
|
DYNAMIC_LIBXDP = 1;
|
|
|
|
FORCE_SYSTEM_LIBBPF = 1;
|
|
|
|
FORCE_EMACS = 1;
|
|
|
|
|
|
|
|
makeFlags = [ "PREFIX=$(out)" "LIBDIR=$(lib)/lib" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# Note that even the static libxdp would refer to BPF_OBJECT_DIR ?=$(LIBDIR)/bpf
|
|
|
|
rm "$lib"/lib/*.a
|
|
|
|
# Drop unfortunate references to glibc.dev/include at least from $lib
|
|
|
|
nuke-refs "$lib"/lib/bpf/*.o
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/xdp-project/xdp-tools";
|
|
|
|
description = "Library and utilities for use with XDP";
|
2024-05-15 15:35:15 +00:00
|
|
|
license = with licenses; [ gpl2Only lgpl21 bsd2 ];
|
2022-11-21 17:40:18 +00:00
|
|
|
maintainers = with maintainers; [ tirex vcunat vifino ];
|
2022-09-22 12:36:57 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|