2021-12-26 17:43:05 +00:00
|
|
|
{ fetchFromGitHub
|
2022-07-14 12:49:19 +00:00
|
|
|
, elfutils
|
2021-12-26 17:43:05 +00:00
|
|
|
, pkg-config
|
|
|
|
, stdenv
|
|
|
|
, zlib
|
|
|
|
, lib
|
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libbpf";
|
2022-10-06 18:32:54 +00:00
|
|
|
version = "1.0.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-12-26 17:43:05 +00:00
|
|
|
owner = "libbpf";
|
|
|
|
repo = "libbpf";
|
|
|
|
rev = "v${version}";
|
2022-10-06 18:32:54 +00:00
|
|
|
sha256 = "sha256-2rzVah+CxCztKnlEWMIQrUS2JJTLiWscfIA1aOBtIzs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2022-07-14 12:49:19 +00:00
|
|
|
buildInputs = [ elfutils zlib ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2022-01-26 04:04:25 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "-C src" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
passthru.tests = {
|
|
|
|
bpf = nixosTests.bpf;
|
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postInstall = ''
|
|
|
|
# install linux's libbpf-compatible linux/btf.h
|
2022-02-20 05:27:41 +00:00
|
|
|
install -Dm444 include/uapi/linux/*.h -t $out/include/linux
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# FIXME: Multi-output requires some fixes to the way the pkg-config file is
|
2020-04-24 23:36:52 +00:00
|
|
|
# constructed (it gets put in $out instead of $dev for some reason, with
|
|
|
|
# improper paths embedded). Don't enable it for now.
|
|
|
|
|
|
|
|
# outputs = [ "out" "dev" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Upstream mirror of libbpf";
|
2021-12-26 17:43:05 +00:00
|
|
|
homepage = "https://github.com/libbpf/libbpf";
|
|
|
|
license = with licenses; [ lgpl21 /* or */ bsd2 ];
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice vcunat saschagrunert martinetd ];
|
2021-12-26 17:43:05 +00:00
|
|
|
platforms = platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|