2021-12-26 17:43:05 +00:00
|
|
|
{ fetchFromGitHub
|
2020-09-25 04:45:31 +00:00
|
|
|
, fetchpatch
|
2021-12-26 17:43:05 +00:00
|
|
|
, libelf
|
|
|
|
, pkg-config
|
|
|
|
, stdenv
|
|
|
|
, zlib
|
|
|
|
, lib
|
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libbpf";
|
2022-02-20 05:27:41 +00:00
|
|
|
version = "0.7.0";
|
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-02-20 05:27:41 +00:00
|
|
|
sha256 = "sha256-NFVJ8JquWVzu+QoaaOMzhnu6/IqdP1FPhtJFidXA4L4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ libelf zlib ];
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|