homebrew-core/Formula/mkvtoolnix.rb

94 lines
3.2 KiB
Ruby

class Mkvtoolnix < Formula
desc "Matroska media files manipulation tools"
homepage "https://mkvtoolnix.download/"
url "https://mkvtoolnix.download/sources/mkvtoolnix-70.0.0.tar.xz"
mirror "https://fossies.org/linux/misc/mkvtoolnix-70.0.0.tar.xz"
sha256 "64324b7ee6b4aa6fab5f517ca93667d12260a4ea92ea80b97575beda3a91693a"
license "GPL-2.0-or-later"
revision 2
livecheck do
url "https://mkvtoolnix.download/sources/"
regex(/href=.*?mkvtoolnix[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_monterey: "1df92980074c1de39228d0351c7b81493550df2b4accc0142fa6a8a0a7df3987"
sha256 cellar: :any, arm64_big_sur: "f114401dc3881e554d1fcbf61df12f4b89bf405070557342f7e7efd5515e5afc"
sha256 cellar: :any, monterey: "3e053c6d6adb2d5090503d8c52df1d9502657bb3b97a54b849c9658f089a3183"
sha256 cellar: :any, big_sur: "318553244c3ecb42c837237b8fe1fcbfc5fd0afa98c8f567864d0e3f6d350b8f"
sha256 cellar: :any, catalina: "7a4ccb6f535ea8132e4561cd1771efdfd833e24f2990d4abb6a255efc8869684"
sha256 x86_64_linux: "9286d5379aadec32a6fd22357988914795d3364bec2796029c58a58e8c9e359b"
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
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