homebrew-core/Formula/mkvtoolnix.rb

92 lines
3.0 KiB
Ruby

class Mkvtoolnix < Formula
desc "Matroska media files manipulation tools"
homepage "https://mkvtoolnix.download/"
url "https://mkvtoolnix.download/sources/mkvtoolnix-71.1.0.tar.xz"
mirror "https://fossies.org/linux/misc/mkvtoolnix-71.1.0.tar.xz"
sha256 "153443e583c29ca9016879dc558503b426494c47934ef8a32265adcb52cfca47"
license "GPL-2.0-or-later"
livecheck do
url "https://mkvtoolnix.download/sources/"
regex(/href=.*?mkvtoolnix[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_monterey: "47fbf6292b21cd544b173155c0942131bb95a799c0982a7151b9afb38ecd0b3d"
sha256 cellar: :any, arm64_big_sur: "c765e99a54991f700b70aac2c5f34ab7516230abb80560d6de0110d438ae6f01"
sha256 cellar: :any, monterey: "8974095f1b4c0a6926ac49a11cf8a51bf890baea4aa152d134165327bee2e97a"
sha256 cellar: :any, big_sur: "053316de00025b7502c0982aff542bc05c3af71a2020806eb75db7f16596ac59"
sha256 cellar: :any, catalina: "d6413986aa3d2f364533921ff8ba1273ee1b46e90772e7ef6f38c50d7dbfad4a"
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