homebrew-core/Formula/libnftnl.rb

29 lines
1.1 KiB
Ruby

class Libnftnl < Formula
desc "Netfilter library providing interface to the nf_tables subsystem"
homepage "https://netfilter.org/projects/libnftnl/"
url "https://www.netfilter.org/pub/libnftnl/libnftnl-1.2.2.tar.bz2"
sha256 "9efc004f9d15918d68f9e98e194d55e030168f33bb67c3e7a545b740c9ed6d0a"
license "GPL-2.0-or-later"
bottle do
sha256 cellar: :any_skip_relocation, x86_64_linux: "62f67f45a10e6025403d475470701dda793778ad178e1e627e8b7ffc195b3bd7"
end
depends_on "pkg-config" => [:build, :test]
depends_on "libmnl"
depends_on :linux
def install
system "./configure", *std_configure_args, "--disable-silent-rules"
system "make", "install"
pkgshare.install "examples"
inreplace pkgshare/"examples/Makefile", Superenv.shims_path/"ld", "ld"
end
test do
pkg_config_flags = shell_output("pkg-config --cflags --libs libnftnl libmnl").chomp.split
system ENV.cc, pkgshare/"examples/nft-set-get.c", *pkg_config_flags, "-o", "nft-set-get"
assert_match "error: Operation not permitted", shell_output("#{testpath}/nft-set-get inet 2>&1", 1)
end
end