homebrew-core/Formula/mkvtoolnix.rb

97 lines
3.2 KiB
Ruby

class Mkvtoolnix < Formula
desc "Matroska media files manipulation tools"
homepage "https://mkvtoolnix.download/"
url "https://mkvtoolnix.download/sources/mkvtoolnix-69.0.0.tar.xz"
mirror "https://fossies.org/linux/misc/mkvtoolnix-69.0.0.tar.xz"
sha256 "8bad39de495be6e77346cffb4c334c5195edec1a2d79a27ba01b7a372db180aa"
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: "c3fefc7f780138b7fd60e3acbd3051dc135060197a2e1969ad8363c020abe14e"
sha256 cellar: :any, arm64_big_sur: "952ae59439c970e29fd465b2389ead5acd858216d32298ce1a178be4eb041989"
sha256 cellar: :any, monterey: "5487b77b0100ef14889d7a32b495b297209071952b4b44e1a33e94d389d65bf1"
sha256 cellar: :any, big_sur: "291a34f9adead5f193dd2b3f53d3ec5808fc3cb6a43d47004b2e592f8fdea8c7"
sha256 cellar: :any, catalina: "636e4bb2d8233193d1f9c952ba2d46a4919bb5526964420c87f320c646421f59"
sha256 x86_64_linux: "8ae23a2588b6d3b4a582a27e75c99a1d51bd76677195ea98d3ecb648fa0b994f"
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