homebrew-core/Formula/libseccomp.rb

52 lines
1.4 KiB
Ruby

class Libseccomp < Formula
desc "Interface to the Linux Kernel's syscall filtering mechanism"
homepage "https://github.com/seccomp/libseccomp"
url "https://github.com/seccomp/libseccomp/releases/download/v2.5.4/libseccomp-2.5.4.tar.gz"
sha256 "d82902400405cf0068574ef3dc1fe5f5926207543ba1ae6f8e7a1576351dcbdb"
license "LGPL-2.1-only"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any_skip_relocation, x86_64_linux: "49db89117b474de352eabc99840644ff081d9120d54d1eaf5cda150798852075"
end
head do
url "https://github.com/seccomp/libseccomp.git", branch: "main"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "gperf" => :build
depends_on :linux
def install
system "./autogen.sh" if build.head?
system "./configure", *std_configure_args, "--disable-silent-rules"
system "make", "install"
end
test do
ver_major, ver_minor, = version.to_s.split(".")
(testpath/"test.c").write <<~EOS
#include <seccomp.h>
int main(int argc, char *argv[])
{
if(SCMP_VER_MAJOR != #{ver_major})
return 1;
if(SCMP_VER_MINOR != #{ver_minor})
return 1;
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lseccomp", "-o", "test"
system "./test"
end
end