homebrew-core/Formula/libcap-ng.rb

46 lines
1.3 KiB
Ruby

class LibcapNg < Formula
desc "Library for Linux that makes using posix capabilities easy"
homepage "https://people.redhat.com/sgrubb/libcap-ng"
url "https://github.com/stevegrubb/libcap-ng/archive/v0.8.3.tar.gz"
sha256 "e542e9139961f0915ab5878427890cdc7762949fbe216bd0cb4ceedb309bb854"
license "LGPL-2.1-or-later"
bottle do
sha256 cellar: :any_skip_relocation, x86_64_linux: "09874a93df04e5be6d46acfd1956f2cebc440d6c5aeffd578cee8d318ba7d247"
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "python@3.10" => :build
depends_on "swig" => :build
depends_on :linux
uses_from_macos "m4" => :build
def install
system "./autogen.sh"
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--with-python3"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <cap-ng.h>
int main(int argc, char *argv[])
{
if(capng_have_permitted_capabilities() > -1)
printf("ok");
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lcap-ng", "-o", "test"
assert_equal "ok", `./test`
end
end