homebrew-core/Formula/libbluray.rb
2018-08-21 23:07:09 +02:00

57 lines
1.9 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.0.2/libbluray-1.0.2.tar.bz2"
sha256 "6d9e7c4e416f664c330d9fa5a05ad79a3fb39b95adfc3fd6910cbed503b7aeff"
bottle do
cellar :any
sha256 "96994d9c93ce3eb746a96a158d427059ba7832a42602200290d7236a22ab8e0a" => :mojave
sha256 "5bca035002a063c9c99a08e3e15f0f15ebac30a94dce6e57116b7d8d44d690c2" => :high_sierra
sha256 "af79492225913a9b9be4653fa8f755183c8775c4be95458fd2a2f9dbb967a9c3" => :sierra
sha256 "d07c0b951f2a4a43e1ca3c349ecac84e7916fc7806100191fba8316b3d1973d5" => :el_capitan
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" => :recommended
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]
args << "--without-freetype" if build.without? "freetype"
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