homebrew-core/Formula/mkvtoolnix.rb
2019-11-10 13:56:33 -05:00

72 lines
2.3 KiB
Ruby

class Mkvtoolnix < Formula
desc "Matroska media files manipulation tools"
homepage "https://mkvtoolnix.download/"
url "https://mkvtoolnix.download/sources/mkvtoolnix-40.0.0.tar.xz"
sha256 "f9248c9a137aa12e46c573d56de7f7da50864e2e4b18b88af21c84f49c21a336"
bottle do
cellar :any
sha256 "536271928c7ace583a5a05891cef742b9046ed0bbf42b23c4956b96b0e207666" => :catalina
sha256 "c9ef62cf8b5ec71b2a5ebd7439ea407bab8c575c36c8451e4707cd908b8e362f" => :mojave
sha256 "2488118f270bfc8b0057f4efe92cebb08f75fa977c4a587d8939bd24f83328c8" => :high_sierra
end
head do
url "https://gitlab.com/mbunkus/mkvtoolnix.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "docbook-xsl" => :build
depends_on "fmt" => :build
depends_on "pkg-config" => :build
depends_on "pugixml" => :build
depends_on "boost"
depends_on "flac"
depends_on "gettext"
depends_on "libebml"
depends_on "libmagic"
depends_on "libmatroska"
depends_on "libogg"
depends_on "libvorbis"
def install
ENV.cxx11
features = %w[flac libebml libmagic libmatroska libogg libvorbis]
extra_includes = ""
extra_libs = ""
features.each do |feature|
extra_includes << "#{Formula[feature].opt_include};"
extra_libs << "#{Formula[feature].opt_lib};"
end
extra_includes.chop!
extra_libs.chop!
system "./autogen.sh" if build.head?
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--with-boost=#{Formula["boost"].opt_prefix}",
"--with-docbook-xsl-root=#{Formula["docbook-xsl"].opt_prefix}/docbook-xsl",
"--with-extra-includes=#{extra_includes}",
"--with-extra-libs=#{extra_libs}",
"--disable-qt"
system "rake", "-j#{ENV.make_jobs}"
system "rake", "install"
end
test do
mkv_path = testpath/"Great.Movie.mkv"
sub_path = testpath/"subtitles.srt"
sub_path.write <<~EOS
1
00:00:10,500 --> 00:00:13,000
Homebrew
EOS
system "#{bin}/mkvmerge", "-o", mkv_path, sub_path
system "#{bin}/mkvinfo", mkv_path
system "#{bin}/mkvextract", "tracks", mkv_path, "0:#{sub_path}"
end
end