-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
Copy pathlibass.rb
78 lines (69 loc) · 2.77 KB
/
libass.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
class Libass < Formula
desc "Subtitle renderer for the ASS/SSA subtitle format"
homepage "https://github.com/libass/libass"
url "https://github.com/libass/libass/releases/download/0.17.3/libass-0.17.3.tar.xz"
sha256 "eae425da50f0015c21f7b3a9c7262a910f0218af469e22e2931462fed3c50959"
license "ISC"
bottle do
sha256 cellar: :any, arm64_sequoia: "2c948ddd9b7a94dd267cdc24cd684903b292d26d6ce92e6d2d7c68136b071e4d"
sha256 cellar: :any, arm64_sonoma: "9e8889c7d434e4a56a0f9abbb1fded340dae984d05121ad5413715e3abb03fd3"
sha256 cellar: :any, arm64_ventura: "d0724c2ba6a6aa6f1ffb604a5cde5bf341e835369e72216042bbb2587acb83cf"
sha256 cellar: :any, arm64_monterey: "f16d796553df4b3ae94c458ae687ce824ea8e66a75bd66ff6df2f0bfe4202ab7"
sha256 cellar: :any, sonoma: "4db6c9473a71166cd6cc5d95b5fab7da9432e081855aad495fe2eb7c0b51bf31"
sha256 cellar: :any, ventura: "1284a21e45e033cf6df87e7fc01e3d9fb3204e24ba5580bdfac941fff69e9a63"
sha256 cellar: :any, monterey: "07a27068fd1c52b021d39b0cd9daa99b2fd6f0ac8f70e05b20b9116c5d848507"
sha256 cellar: :any_skip_relocation, arm64_linux: "e92f33c8e54a1e66f87a3aa40b1f64095f739fa7dd38272c41e1c3ade66e391e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "45ef7e90470c2f9a0304b343b6216b9632be26599ca0cbadd3705d5cbf11851b"
end
head do
url "https://github.com/libass/libass.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "pkgconf" => :build
depends_on "freetype"
depends_on "fribidi"
depends_on "harfbuzz"
depends_on "libunibreak"
on_linux do
depends_on "fontconfig"
end
on_intel do
depends_on "nasm" => :build
end
def install
# libass uses coretext on macOS, fontconfig on Linux
args = OS.mac? ? ["--disable-fontconfig"] : []
system "autoreconf", "--force", "--install", "--verbose" if build.head?
system "./configure", *args, *std_configure_args
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~CPP
#include "ass/ass.h"
int main() {
ASS_Library *library;
ASS_Renderer *renderer;
library = ass_library_init();
if (library) {
renderer = ass_renderer_init(library);
if (renderer) {
ass_renderer_done(renderer);
ass_library_done(library);
return 0;
}
else {
ass_library_done(library);
return 1;
}
}
else {
return 1;
}
}
CPP
system ENV.cc, "test.cpp", "-I#{include}", "-L#{lib}", "-lass", "-o", "test"
system "./test"
end
end