-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
Copy pathlibcap-ng.rb
60 lines (51 loc) · 1.79 KB
/
libcap-ng.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
class LibcapNg < Formula
desc "Library for Linux that makes using posix capabilities easy"
homepage "https://people.redhat.com/sgrubb/libcap-ng/"
url "https://people.redhat.com/sgrubb/libcap-ng/libcap-ng-0.8.5.tar.gz"
sha256 "3ba5294d1cbdfa98afaacfbc00b6af9ed2b83e8a21817185dfd844cc8c7ac6ff"
license all_of: ["LGPL-2.1-or-later", "GPL-2.0-or-later"]
livecheck do
url :homepage
regex(/href=.*?libcap-ng[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_linux: "981ae5326e20f2844c171f30110902780b64b3860c8f96e4e631434434a230bc"
sha256 cellar: :any_skip_relocation, x86_64_linux: "9213f1b147c170ebc3b4cb8e900562183885668dd745d0888d985d9fd0cfdbe3"
end
head do
url "https://github.com/stevegrubb/libcap-ng.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "m4" => :build
end
depends_on "python-setuptools" => :build
depends_on "python@3.13" => [:build, :test]
depends_on "swig" => :build
depends_on :linux
def python3
"python3.13"
end
def install
system "./autogen.sh" if build.head?
system "./configure", *std_configure_args,
"--disable-silent-rules",
"--with-python3"
system "make", "install", "py3execdir=#{prefix/Language::Python.site_packages(python3)}"
end
test do
(testpath/"test.c").write <<~C
#include <stdio.h>
#include <cap-ng.h>
int main(int argc, char *argv[])
{
if(capng_have_permitted_capabilities() > -1)
printf("ok");
}
C
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lcap-ng", "-o", "test"
assert_equal "ok", `./test`
system python3, "-c", "import capng"
end
end