homebrew-core/Formula/libass.rb
2017-11-03 02:28:38 -07:00

74 lines
2.1 KiB
Ruby

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.14.0/libass-0.14.0.tar.xz"
sha256 "881f2382af48aead75b7a0e02e65d88c5ebd369fe46bc77d9270a94aa8fd38a2"
revision 1
bottle do
cellar :any
sha256 "2d8f9ced8b8d4d7327a79e86ddf80d01bfbb96e040a8ac56798d4e2513a26e90" => :high_sierra
sha256 "67f577f99f875a5f4998fb5d5cac85ba67dd39ef3b1b76037759fd64c86548bd" => :sierra
sha256 "f48697b75e514bc69f390803b1d7c8f748c9796ad332c4fdceebbc57402592a3" => :el_capitan
end
head do
url "https://github.com/libass/libass.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
option "with-fontconfig", "Disable CoreText backend in favor of the more traditional fontconfig"
depends_on "pkg-config" => :build
depends_on "nasm" => :build
depends_on "freetype"
depends_on "fribidi"
depends_on "harfbuzz" => :recommended
depends_on "fontconfig" => :optional
def install
args = %W[--disable-dependency-tracking --prefix=#{prefix}]
args << "--disable-harfbuzz" if build.without? "harfbuzz"
if build.with? "fontconfig"
args << "--disable-coretext"
else
args << "--disable-fontconfig"
end
system "autoreconf", "-i" if build.head?
system "./configure", *args
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#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;
}
}
EOS
system ENV.cc, "test.cpp", "-I#{include}", "-L#{lib}", "-lass", "-o", "test"
system "./test"
end
end