summary refs log tree commit diff
path: root/pkgs/os-specific/linux/libbpf/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/libbpf/default.nix')
-rw-r--r--pkgs/os-specific/linux/libbpf/default.nix41
1 files changed, 26 insertions, 15 deletions
diff --git a/pkgs/os-specific/linux/libbpf/default.nix b/pkgs/os-specific/linux/libbpf/default.nix
index 0a98475384d..2e497584fab 100644
--- a/pkgs/os-specific/linux/libbpf/default.nix
+++ b/pkgs/os-specific/linux/libbpf/default.nix
@@ -1,43 +1,54 @@
-{ stdenv, fetchFromGitHub, pkgconfig
+{ lib, stdenv, fetchFromGitHub, pkg-config
 , libelf, zlib
+, fetchpatch
 }:
 
 with builtins;
 
 stdenv.mkDerivation rec {
   pname = "libbpf";
-  version = "0.0.9";
+  version = "0.1.1";
 
   src = fetchFromGitHub {
-    owner = "libbpf";
-    repo = "libbpf";
-    rev = "v${version}";
-    sha256 = "18l0gff7nm841mwhr7bc7x863xcyvwh58zl7mc0amnsjqlbrvqg7";
+    owner  = "libbpf";
+    repo   = "libbpf";
+    rev    = "v${version}";
+    sha256 = "0ilnnm4q22f8fagwp8kb37licy4ks861i2iqh2djsypqhnxvx3fv";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
+  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 = [ pkg-config ];
   buildInputs = [ libelf zlib ];
 
   sourceRoot = "source/src";
   enableParallelBuilding = true;
   makeFlags = [ "PREFIX=$(out)" ];
 
-  patchPhase = ''
-    substituteInPlace ../scripts/check-reallocarray.sh \
-      --replace '/bin/rm' 'rm'
-  '';
-
-  # FIXME: Multi-output requires some fixes to the way the pkgconfig file is
+  # FIXME: Multi-output requires some fixes to the way the pkg-config 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; {
+  meta = with lib; {
     description = "Upstream mirror of libbpf";
     homepage    = "https://github.com/libbpf/libbpf";
     license     = with licenses; [ lgpl21 /* or */ bsd2 ];
-    maintainers = with maintainers; [ thoughtpolice ];
+    maintainers = with maintainers; [ thoughtpolice vcunat ];
     platforms   = platforms.linux;
   };
 }