homebrew-core/Formula/libbluray.rb
2019-07-26 11:35:42 +08:00

55 lines
1.7 KiB
Ruby

class Libbluray < Formula
desc "Blu-Ray disc playback library for media players like VLC"
homepage "https://www.videolan.org/developers/libbluray.html"
url "https://download.videolan.org/pub/videolan/libbluray/1.1.2/libbluray-1.1.2.tar.bz2"
sha256 "a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42"
bottle do
cellar :any
sha256 "25de56ece940908d1be482b234b5c6fc5ec2bc8d24aaf9c75d67718ea5770605" => :mojave
sha256 "152dd759f3c3170eecf59f095c6b8dde3a9fc8dcf317846b50fbd85644bc3296" => :high_sierra
sha256 "de230a76a5a163cf704b150ebcb2c1347bb64a41c5f68b0487ae83dbf48c13ac" => :sierra
end
head do
url "https://git.videolan.org/git/libbluray.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "ant" => :build
depends_on :java => ["1.8", :build]
depends_on "pkg-config" => :build
depends_on "fontconfig"
depends_on "freetype"
def install
# Need to set JAVA_HOME manually since ant overrides 1.8 with 1.8+
cmd = Language::Java.java_home_cmd("1.8")
ENV["JAVA_HOME"] = Utils.popen_read(cmd).chomp
# https://mailman.videolan.org/pipermail/libbluray-devel/2014-April/001401.html
ENV.append_to_cflags "-D_DARWIN_C_SOURCE"
args = %W[--prefix=#{prefix} --disable-dependency-tracking]
system "./bootstrap" if build.head?
system "./configure", *args
system "make"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <libbluray/bluray.h>
int main(void) {
BLURAY *bluray = bd_init();
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lbluray", "-o", "test"
system "./test"
end
end