From 3cb0c6624c282ab7cc553d05e8d19005c2e8fab8 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 30 Sep 2022 06:59:16 +0900 Subject: [PATCH] libbpf: add libbpf_1 for libbpf 1.0.1 libbpf 1.x breaks too many packages to do a hard transition: just keep both packages for a while longer. See https://github.com/libbpf/libbpf/issues/590 for discussion with upstream --- pkgs/os-specific/linux/libbpf/0.x.nix | 49 +++++++++++++++++++++++ pkgs/os-specific/linux/libbpf/default.nix | 4 +- pkgs/top-level/all-packages.nix | 5 ++- 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 pkgs/os-specific/linux/libbpf/0.x.nix diff --git a/pkgs/os-specific/linux/libbpf/0.x.nix b/pkgs/os-specific/linux/libbpf/0.x.nix new file mode 100644 index 000000000000..2c15e3d49ee1 --- /dev/null +++ b/pkgs/os-specific/linux/libbpf/0.x.nix @@ -0,0 +1,49 @@ +{ fetchFromGitHub +, elfutils +, pkg-config +, stdenv +, zlib +, lib +, nixosTests +}: + +stdenv.mkDerivation rec { + pname = "libbpf"; + version = "0.8.1"; + + src = fetchFromGitHub { + owner = "libbpf"; + repo = "libbpf"; + rev = "v${version}"; + sha256 = "sha256-daVS+TErmDU8ksThOvcepg1A61iD8N8GIkC40cmc9/8="; + }; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ elfutils zlib ]; + + enableParallelBuilding = true; + makeFlags = [ "PREFIX=$(out)" "-C src" ]; + + passthru.tests = { + bpf = nixosTests.bpf; + }; + + postInstall = '' + # install linux's libbpf-compatible linux/btf.h + install -Dm444 include/uapi/linux/*.h -t $out/include/linux + ''; + + # 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 lib; { + description = "Upstream mirror of libbpf"; + homepage = "https://github.com/libbpf/libbpf"; + license = with licenses; [ lgpl21 /* or */ bsd2 ]; + maintainers = with maintainers; [ thoughtpolice vcunat saschagrunert martinetd ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/os-specific/linux/libbpf/default.nix b/pkgs/os-specific/linux/libbpf/default.nix index 2c15e3d49ee1..04322a35b4fe 100644 --- a/pkgs/os-specific/linux/libbpf/default.nix +++ b/pkgs/os-specific/linux/libbpf/default.nix @@ -9,13 +9,13 @@ stdenv.mkDerivation rec { pname = "libbpf"; - version = "0.8.1"; + version = "1.0.1"; src = fetchFromGitHub { owner = "libbpf"; repo = "libbpf"; rev = "v${version}"; - sha256 = "sha256-daVS+TErmDU8ksThOvcepg1A61iD8N8GIkC40cmc9/8="; + sha256 = "sha256-2rzVah+CxCztKnlEWMIQrUS2JJTLiWscfIA1aOBtIzs="; }; nativeBuildInputs = [ pkg-config ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eecc50b96c10..0f91dc67522b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16111,7 +16111,10 @@ with pkgs; bump = callPackage ../development/tools/github/bump { }; - libbpf = callPackage ../os-specific/linux/libbpf { }; + libbpf_1 = callPackage ../os-specific/linux/libbpf { }; + libbpf_0 = callPackage ../os-specific/linux/libbpf/0.x.nix { }; + # until more issues are fixed default to libbpf 0.x + libbpf = libbpf_0; bpftools = callPackage ../os-specific/linux/bpftools { };