2019-05-21 19:06:36 +01:00
|
|
|
{ stdenv, fetchFromGitHub, pkgconfig
|
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";
|
2020-09-30 17:41:19 +01:00
|
|
|
version = "0.1.1";
|
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}";
|
2020-09-30 17:41:19 +01:00
|
|
|
sha256 = "0ilnnm4q22f8fagwp8kb37licy4ks861i2iqh2djsypqhnxvx3fv";
|
2019-05-21 19:06:36 +01:00
|
|
|
};
|
|
|
|
|
2020-09-09 16:09:16 +01:00
|
|
|
patches = [
|
|
|
|
(fetchpatch { # included upstream for > 0.1.0
|
|
|
|
name = "link-zlib.patch";
|
|
|
|
url = "https://github.com/libbpf/libbpf/commit/8b14cb43ff837.diff";
|
|
|
|
sha256 = "17mvjrs7s727drz013a8qlyj0345ldi2kph6pazcmxv6kl1qrz2z";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
patchFlags = "-p2";
|
|
|
|
# https://github.com/libbpf/libbpf/pull/201#issuecomment-689174740
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace ../scripts/check-reallocarray.sh \
|
|
|
|
--replace 'mktemp /tmp/' 'mktemp ' \
|
|
|
|
--replace '/bin/rm' 'rm'
|
|
|
|
'';
|
|
|
|
|
2019-05-21 19:06:36 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
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)" ];
|
|
|
|
|
|
|
|
# FIXME: Multi-output requires some fixes to the way the pkgconfig file is
|
|
|
|
# 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" ];
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Upstream mirror of libbpf";
|
|
|
|
homepage = "https://github.com/libbpf/libbpf";
|
|
|
|
license = with licenses; [ lgpl21 /* or */ bsd2 ];
|
2020-09-07 17:41:21 +01:00
|
|
|
maintainers = with maintainers; [ thoughtpolice vcunat ];
|
2019-05-21 19:06:36 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|