class Libbpf < Formula desc "Berkeley Packet Filter library" homepage "https://github.com/libbpf/libbpf" url "https://github.com/libbpf/libbpf/archive/refs/tags/v1.6.3.tar.gz" sha256 "989ed3c1a3db8ff0f7c08dd43953c6b9d0c3ac252653a48d566aaedf98bc80ca" license "BSD-2-Clause" bottle do sha256 cellar: :any_skip_relocation, arm64_linux: "421a520e8a32f1ec6649ecee40143990cda2930a3dedad72185ab4ef053489a4" sha256 cellar: :any_skip_relocation, x86_64_linux: "d1a7b1021a6678f835fa3b9f07bd265884674862c2ec6a324e70c0e01ac398ce" 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