homebrew-core/Formula/libbluray.rb
Issy Long b911f6222c libbluray: Add uses_from_macos libxml2
- It's useful pushing these upstream to Homebrew/homebrew-core as
  there's fewer dependencies for us to maintain in
  Homebrew/linuxbrew-core.
2019-11-24 20:16:37 +00:00

61 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.1.2/libbluray-1.1.2.tar.bz2"
sha256 "a3dd452239b100dc9da0d01b30e1692693e2a332a7d29917bf84bb10ea7c0b42"
bottle do
cellar :any
rebuild 1
sha256 "02450f9c05b48ec198c967ef34b109002c9d9f2c496ef8876f3779e451ed2271" => :catalina
sha256 "cf27d6ba0b4e169785801140ba11fb47e78040f26b5af9e2279bc808e5b62bc3" => :mojave
sha256 "1566fcca5871d636404d2517dba45f6c287ab8dd5c9ffc8b9b09dc1bf2af0e18" => :high_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"
uses_from_macos "libxml2"
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"
# Work around Xcode 11 clang bug
# https://code.videolan.org/videolan/libbluray/issues/20
ENV.append_to_cflags "-fno-stack-check" if DevelopmentTools.clang_build_version >= 1010
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