class Libbpf < Formula desc "Berkeley Packet Filter library" homepage "https://github.com/libbpf/libbpf" url "https://github.com/libbpf/libbpf/archive/refs/tags/v1.5.1.tar.gz" sha256 "e5ff89750e48ab5ecdfc02a759aa0dacd1e7980e98e16bdb4bfa8ff0b3b4b98f" license "BSD-2-Clause" bottle do sha256 cellar: :any_skip_relocation, arm64_linux: "8c72de89080be7e7cdf36aa77682708562ad73dedb234f34ceebf1c4e068bd7b" sha256 cellar: :any_skip_relocation, x86_64_linux: "0c04b2d4c14b62ae7a30ae5cbbec288c3b2961de0a684f96f2c9c2ec41d240cf" end depends_on "pkgconf" => :build depends_on "elfutils" depends_on :linux depends_on "zlib" def install system "make", "-C", "src" system "make", "-C", "src", "install", "PREFIX=#{prefix}", "LIBDIR=#{lib}" end test do (testpath/"test.c").write <<~C #include "bpf/libbpf.h" #include int main() { printf("%s", libbpf_version_string()); return(0); } C system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lbpf", "-o", "test" system "./test" end end