libbpf: fix incomplete linkage

Also use a better reallocarray fix.
gstqt5
Vladimír Čunát 2020-09-09 17:09:16 +02:00
parent fa0ed8d276
commit 16124457d0
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA
1 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,6 @@
{ stdenv, fetchFromGitHub, pkgconfig
, libelf, zlib
, fetchpatch
}:
with builtins;
@ -15,6 +16,21 @@ stdenv.mkDerivation rec {
sha256 = "1wi3a795jq0smqg1c5ml2ghai47n1m5ijmch017wscybx4jdlynv";
};
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'
'';
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libelf zlib ];
@ -22,14 +38,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
makeFlags = [ "PREFIX=$(out)" ];
patchPhase = ''
substituteInPlace ../scripts/check-reallocarray.sh \
--replace '/bin/rm' 'rm'
# Without patching this the config-test program will be refused by our CC wrapper.
chmod +w ../scripts
sed -e '2a NIX_ENFORCE_PURITY=0' -i ../scripts/check-reallocarray.sh
'';
# 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.