class Mkvtoolnix < Formula desc "Matroska media files manipulation tools" homepage "https://www.bunkus.org/videotools/mkvtoolnix/" url "https://www.bunkus.org/videotools/mkvtoolnix/sources/mkvtoolnix-11.0.0.tar.xz" sha256 "bb642e1eb2c402c4f93a962f41a1832c99ee5b782f1596dc20f996e9a4aa426d" bottle do sha256 "4b4c35a04678e4ff4743da68f4453434679ad961256623395fd7fc58d42460ee" => :sierra sha256 "da0e9335e6fb8f47f8034de0222f000b27af2e59569ac2daf5d62ed57d253d95" => :el_capitan sha256 "41a631e5bd8e255b8d2bfbc53a03e77e4fd738910893caa8189654ea10b6de62" => :yosemite end head do url "https://github.com/mbunkus/mkvtoolnix.git" depends_on "automake" => :build depends_on "autoconf" => :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 "pkg-config" => :build depends_on "pugixml" => :build depends_on :ruby => ["1.9", :build] depends_on "boost" depends_on "libebml" depends_on "libmatroska" depends_on "libogg" depends_on "libvorbis" depends_on "flac" => :recommended depends_on "libmagic" => :recommended depends_on "qt" => :optional depends_on "gettext" => :optional needs :cxx11 def install ENV.cxx11 features = %w[libogg libvorbis libebml libmatroska] features << "flac" if build.with? "flac" features << "libmagic" if build.with? "libmagic" 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.undent 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