summary refs log tree commit diff
path: root/pkgs/os-specific/linux/libbpf
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2020-09-09 17:09:16 +0200
committerVladimír Čunát <v@cunat.cz>2020-09-09 17:21:26 +0200
commit16124457d0d947ce0d98bfcb7c18f0b88c9ad398 (patch)
tree06db710eb8fee5bb917f3ab11e30c4b6a4dd429b /pkgs/os-specific/linux/libbpf
parentfa0ed8d276dd48ef211c0d55251b3e8e968807b1 (diff)
downloadnixpkgs-16124457d0d947ce0d98bfcb7c18f0b88c9ad398.tar
nixpkgs-16124457d0d947ce0d98bfcb7c18f0b88c9ad398.tar.gz
nixpkgs-16124457d0d947ce0d98bfcb7c18f0b88c9ad398.tar.bz2
nixpkgs-16124457d0d947ce0d98bfcb7c18f0b88c9ad398.tar.lz
nixpkgs-16124457d0d947ce0d98bfcb7c18f0b88c9ad398.tar.xz
nixpkgs-16124457d0d947ce0d98bfcb7c18f0b88c9ad398.tar.zst
nixpkgs-16124457d0d947ce0d98bfcb7c18f0b88c9ad398.zip
libbpf: fix incomplete linkage
Also use a better reallocarray fix.
Diffstat (limited to 'pkgs/os-specific/linux/libbpf')
-rw-r--r--pkgs/os-specific/linux/libbpf/default.nix24
1 files changed, 16 insertions, 8 deletions
diff --git a/pkgs/os-specific/linux/libbpf/default.nix b/pkgs/os-specific/linux/libbpf/default.nix
index 1c54b93e8ab..68ccef6529c 100644
--- a/pkgs/os-specific/linux/libbpf/default.nix
+++ b/pkgs/os-specific/linux/libbpf/default.nix
@@ -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.