99 lines
2.7 KiB
Ruby
99 lines
2.7 KiB
Ruby
class Mkvtoolnix < Formula
|
|
desc "Matroska media files manipulation tools"
|
|
homepage "https://mkvtoolnix.download/"
|
|
url "https://mkvtoolnix.download/sources/mkvtoolnix-29.0.0.tar.xz"
|
|
sha256 "54eb5f88fe3c9c7b5df77f80b0dfcac7695c19a8226f8ba52be8ad15ba0975d3"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "09e29dd31108d98403b040e0111325bfcbc0ce3c769f4f6c2cced937c7dca351" => :mojave
|
|
sha256 "2474e21291e00e02e36664646b3d82fd5ee9353201a7c923f719d7027ce42a44" => :high_sierra
|
|
sha256 "0734d811efd73a8934e2b1ef26ca4cee9a219cc038b218637927c15ee2fabcc1" => :sierra
|
|
end
|
|
|
|
head do
|
|
url "https://gitlab.com/mbunkus/mkvtoolnix.git"
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
option "with-qt", "Build with Qt GUI"
|
|
|
|
deprecated_option "with-qt5" => "with-qt"
|
|
|
|
depends_on "docbook-xsl" => :build
|
|
depends_on "fmt" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "pugixml" => :build
|
|
depends_on "ruby" => :build if MacOS.version <= :mountain_lion
|
|
depends_on "boost"
|
|
depends_on "flac"
|
|
depends_on "libebml"
|
|
depends_on "libmagic"
|
|
depends_on "libmatroska"
|
|
depends_on "libogg"
|
|
depends_on "libvorbis"
|
|
depends_on "gettext" => :optional
|
|
depends_on "qt" => :optional
|
|
depends_on "cmark" if build.with? "qt"
|
|
|
|
needs :cxx11
|
|
|
|
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!
|
|
|
|
args = %W[
|
|
--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}
|
|
]
|
|
|
|
if build.with?("qt")
|
|
qt = Formula["qt"]
|
|
|
|
args << "--with-moc=#{qt.opt_bin}/moc"
|
|
args << "--with-uic=#{qt.opt_bin}/uic"
|
|
args << "--with-rcc=#{qt.opt_bin}/rcc"
|
|
args << "--enable-qt"
|
|
else
|
|
args << "--disable-qt"
|
|
end
|
|
|
|
system "./autogen.sh" if build.head?
|
|
|
|
system "./configure", *args
|
|
|
|
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
|