homebrew-core/Formula/mkvtoolnix.rb

98 lines
3.2 KiB
Ruby

class Mkvtoolnix < Formula
desc "Matroska media files manipulation tools"
homepage "https://mkvtoolnix.download/"
url "https://mkvtoolnix.download/sources/mkvtoolnix-65.0.0.tar.xz"
mirror "https://fossies.org/linux/misc/mkvtoolnix-65.0.0.tar.xz"
sha256 "0dddc9cc1bae26ceaac3a184482c50e6bb8add2d62e06ef08b55f9f0108bb92e"
license "GPL-2.0-or-later"
revision 1
livecheck do
url "https://mkvtoolnix.download/sources/"
regex(/href=.*?mkvtoolnix[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_monterey: "f04937c8612752449bbdec4f41eafac01dc8346aa1942f0bf131780693456961"
sha256 cellar: :any, arm64_big_sur: "f79a78f57842a866e6a8fd9200905ed5cd8822198680e9e446d95add1a0f6883"
sha256 cellar: :any, monterey: "dc8b3af50ae769fd1cff138c016215c099678f8b28ccc0de5c4f66915329d8b9"
sha256 cellar: :any, big_sur: "1aa6d6fe7d35f8a1b4dbe6c1d3313ab2013719332eca8e7a2c3e012914738f9c"
sha256 cellar: :any, catalina: "36ee4b81254407045f6fbba70292275e4501981315382b31b9c68a157d6d1d5a"
sha256 x86_64_linux: "3b22f46e2c820da1b379127b2b5a1299dd03d76ae137a3b353bfe212cf8ac1d8"
end
head do
url "https://gitlab.com/mbunkus/mkvtoolnix.git", branch: "main"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "docbook-xsl" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "flac"
depends_on "fmt"
depends_on "gettext"
depends_on "gmp"
depends_on "libebml"
depends_on "libmatroska"
depends_on "libogg"
depends_on "libvorbis"
# https://mkvtoolnix.download/downloads.html#macosx
depends_on macos: :catalina # C++17
depends_on "nlohmann-json"
depends_on "pugixml"
depends_on "qt"
depends_on "utf8cpp"
uses_from_macos "libxslt" => :build
uses_from_macos "ruby" => :build
on_linux do
depends_on "gcc" => :build
end
fails_with gcc: "5"
def install
ENV.cxx11
features = %w[flac gmp libebml 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 << "#{Formula["utf8cpp"].opt_include}/utf8cpp;"
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-gui"
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