2021-01-19 06:50:56 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config
|
2020-03-09 22:53:53 +00:00
|
|
|
, libelf, zlib
|
2020-09-09 16:09:16 +01:00
|
|
|
, fetchpatch
|
2019-05-21 19:06:36 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
with builtins;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "libbpf";
|
2021-12-02 08:28:23 +00:00
|
|
|
version = "0.6.0";
|
2019-05-21 19:06:36 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-08-31 23:26:57 +01:00
|
|
|
owner = "libbpf";
|
|
|
|
repo = "libbpf";
|
|
|
|
rev = "v${version}";
|
2021-12-02 08:28:23 +00:00
|
|
|
sha256 = "sha256-p9wUDC7r6+ElbheNkTkZW4eMNAvPbvpUyQjTjCE34ck=";
|
2019-05-21 19:06:36 +01:00
|
|
|
};
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-03-09 22:53:53 +00:00
|
|
|
buildInputs = [ libelf zlib ];
|
2019-05-21 19:06:36 +01:00
|
|
|
|
|
|
|
sourceRoot = "source/src";
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
2021-12-04 11:25:09 +00:00
|
|
|
postInstall = ''
|
|
|
|
# install linux's libbpf-compatible linux/btf.h
|
|
|
|
install -Dm444 ../include/uapi/linux/btf.h -t $out/include/linux
|
|
|
|
'';
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
# FIXME: Multi-output requires some fixes to the way the pkg-config file is
|
2019-05-21 19:06:36 +01: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-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-05-21 19:06:36 +01:00
|
|
|
description = "Upstream mirror of libbpf";
|
|
|
|
homepage = "https://github.com/libbpf/libbpf";
|
|
|
|
license = with licenses; [ lgpl21 /* or */ bsd2 ];
|
2021-12-04 11:25:09 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice vcunat saschagrunert martinetd ];
|
2019-05-21 19:06:36 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|