-
-
Notifications
You must be signed in to change notification settings - Fork 12.3k
/
mpv.rb
123 lines (109 loc) · 3.8 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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.38.0.tar.gz"
sha256 "86d9ef40b6058732f67b46d0bbda24a074fae860b3eaae05bab3145041303066"
license :cannot_represent
revision 2
head "https://github.com/mpv-player/mpv.git", branch: "master"
bottle do
rebuild 1
sha256 arm64_sonoma: "4dbf5f21d142921fd15db9e065d9a8676c4a20c4970b38decc75a698aeb55013"
sha256 arm64_ventura: "d28db8e432434297ae11de44b9e1cd1f12dee57a2dee230b37ef04a82ffc532d"
sha256 arm64_monterey: "58a95b46e9b55f0739dc424a286a835f94ae02e1f29dccf97c03e6779870d2b1"
sha256 sonoma: "dee2503d155630932ab26f9296c9f2fbe02135df9e6eaa7e85b329edb03427ef"
sha256 ventura: "bcd8baa2f0376fb6979d5b5f690d04a250c3e4be6ed086c79d763f754e34f4de"
sha256 monterey: "bbedc9e4e1b95a0db432bb6ab040af1b10de8c48a9619803c95b311bc286fb55"
sha256 x86_64_linux: "3a1e0b8cc2f36392714bd044fae7066f54b353421c32c782a6f67a9736e4ffdc"
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 "libbluray"
depends_on "libplacebo"
depends_on "little-cms2"
depends_on "luajit"
depends_on "mujs"
depends_on "rubberband"
depends_on "uchardet"
depends_on "vapoursynth"
depends_on "vulkan-loader"
depends_on "yt-dlp"
depends_on "zimg"
uses_from_macos "zlib"
on_macos do
depends_on "molten-vk"
end
on_linux do
depends_on "alsa-lib"
depends_on "libdrm"
depends_on "libva"
depends_on "libvdpau"
depends_on "libx11"
depends_on "libxext"
depends_on "libxkbcommon"
depends_on "libxpresent"
depends_on "libxrandr"
depends_on "libxscrnsaver"
depends_on "libxv"
depends_on "mesa"
depends_on "pulseaudio"
depends_on "wayland"
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" if OS.mac?
args = %W[
-Dbuild-date=false
-Dhtml-build=enabled
-Djavascript=enabled
-Dlibmpv=true
-Dlua=luajit
-Dlibarchive=enabled
-Duchardet=enabled
-Dvulkan=enabled
--sysconfdir=#{pkgetc}
--datadir=#{pkgshare}
--mandir=#{man}
]
if OS.linux?
args += %w[
-Degl=enabled
-Dwayland=enabled
-Dx11=enabled
]
end
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