-
-
Notifications
You must be signed in to change notification settings - Fork 12.3k
/
mpv.rb
89 lines (77 loc) · 3.09 KB
/
mpv.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
class Mpv < Formula
desc "Media player based on MPlayer and mplayer2"
homepage "https://mpv.io"
url "https://github.com/mpv-player/mpv/archive/refs/tags/v0.35.1.tar.gz"
sha256 "41df981b7b84e33a2ef4478aaf81d6f4f5c8b9cd2c0d337ac142fc20b387d1a9"
license :cannot_represent
head "https://github.com/mpv-player/mpv.git", branch: "master"
bottle do
rebuild 2
sha256 arm64_ventura: "97d3eea7b6a202553b1a0ca2c105c8b3bfbd039988cc94d2da11c7a7c20cc71d"
sha256 arm64_monterey: "91faa31149eb24d146c10cd2e50be3304bdf92e23a25d990404be14313747b20"
sha256 arm64_big_sur: "651508e679ccac252746c09d799d2641347b8fc11c49c60e23f21950fb7e3f8a"
sha256 ventura: "600e189b9fc5647f6a0dd13ab8568453d8cbae7c0c96b7305f9669a9ab875b85"
sha256 monterey: "2941c3a054af7d9ab646bcb59cca728435f9cca5d5835d090a08dbbed90993d7"
sha256 big_sur: "93c1df95bd94e56161c083d9804527ccfcad8b5e3915b5328ef96c49241bd4f1"
sha256 x86_64_linux: "25bba077e85fd93be995b769fe809cc0368154ed214ac2391d43332ac850f78c"
end
depends_on "docutils" => :build
depends_on "meson" => :build
depends_on "pkg-config" => [:build, :test]
depends_on xcode: :build
depends_on "ffmpeg"
depends_on "jpeg-turbo"
depends_on "libarchive"
depends_on "libass"
depends_on "little-cms2"
depends_on "luajit"
depends_on "mujs"
depends_on "uchardet"
depends_on "vapoursynth"
depends_on "yt-dlp"
on_linux do
depends_on "alsa-lib"
end
def install
# LANG is unset by default on macOS and causes issues when calling getlocale
# or getdefaultlocale in docutils. Force the default c/posix locale since
# that's good enough for building the manpage.
ENV["LC_ALL"] = "C"
# force meson find ninja from homebrew
ENV["NINJA"] = Formula["ninja"].opt_bin/"ninja"
# libarchive is keg-only
ENV.prepend_path "PKG_CONFIG_PATH", Formula["libarchive"].opt_lib/"pkgconfig"
args = %W[
-Dhtml-build=enabled
-Djavascript=enabled
-Dlibmpv=true
-Dlua=luajit
-Dlibarchive=enabled
-Duchardet=enabled
--sysconfdir=#{pkgetc}
--datadir=#{pkgshare}
--mandir=#{man}
]
system "meson", "setup", "build", *args, *std_meson_args
system "meson", "compile", "-C", "build", "--verbose"
system "meson", "install", "-C", "build"
if OS.mac?
# `pkg-config --libs mpv` includes libarchive, but that package is
# keg-only so it needs to look for the pkgconfig file in libarchive's opt
# path.
libarchive = Formula["libarchive"].opt_prefix
inreplace lib/"pkgconfig/mpv.pc" do |s|
s.gsub!(/^Requires\.private:(.*)\blibarchive\b(.*?)(,.*)?$/,
"Requires.private:\\1#{libarchive}/lib/pkgconfig/libarchive.pc\\3")
end
end
bash_completion.install "etc/mpv.bash-completion" => "mpv"
zsh_completion.install "etc/_mpv.zsh" => "_mpv"
end
test do
system bin/"mpv", "--ao=null", "--vo=null", test_fixtures("test.wav")
assert_match "vapoursynth", shell_output(bin/"mpv --vf=help")
# Make sure `pkg-config` can parse `mpv.pc` after the `inreplace`.
system "pkg-config", "mpv"
end
end