homebrew-core/Formula/mkvtoolnix.rb
2019-08-24 23:36:04 +08: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-37.0.0.tar.xz"
sha256 "3d421af5307243591b726427a2c1a9c3cb496e8a5003362b5069558fc2488d64"
bottle do
cellar :any
sha256 "74cef751010d76b51d30a369cf23f67a3e168e7b913d1fa683f4005293661b67" => :mojave
sha256 "9726b93eabba679b266212d52c2ace3a7ff42d057e5fe20b3db252fe22b2d764" => :high_sierra
sha256 "0b3f7b48e7f54e99d6117d2e4af3e995f43943bcbf42f5527ff6d6a0a6d8f0c0" => :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