homebrew-core/Formula/libbluray.rb
2019-04-25 20:04:14 -04: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.1/libbluray-1.1.1.tar.bz2"
sha256 "106478a17c8bcac8c7b4174e7432b2bad5a1e6dd2926c4224791fd4669472338"
bottle do
cellar :any
sha256 "24eef45b0f6eb3bb19ae609d7dda031f590ef44520f541bd6d482ee65e4d31a8" => :mojave
sha256 "8e74d8a78290772617abed2a3f30faf97155af0fcb48127c5405dedd41e59b23" => :high_sierra
sha256 "78c069763126e0ededbdea942ba16d9cabdf5b48044eab6b80e8e26920b919ce" => :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