-
Notifications
You must be signed in to change notification settings - Fork 15
/
mpv-iina.rb
89 lines (71 loc) · 2.57 KB
/
mpv-iina.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
# Last check with upstream: 03fb1acf8d1c5417b8079eb68b2104a1296bc665
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/m/mpv.rb
class MpvIina < Formula
desc "Media player based on MPlayer and mplayer2"
homepage "https://mpv.io"
head "https://github.com/iina/mpv.git", :branch => "iina-release/1.4.0"
keg_only "it is intended to only be used for building IINA. This formula is not recommended for daily use"
depends_on "docutils" => :build
depends_on "meson" => :build
depends_on "pkg-config" => [:build, :test]
depends_on xcode: :build
depends_on "ffmpeg-iina"
depends_on "jpeg-turbo"
depends_on "libarchive"
depends_on "libass"
depends_on "libplacebo"
depends_on "little-cms2"
depends_on "luajit"
depends_on "libbluray"
depends_on "libsamplerate"
depends_on "vulkan-loader"
depends_on "zimg"
# depends_on "molten-vk"
uses_from_macos "zlib"
depends_on "mujs"
depends_on "uchardet"
# depends_on "vapoursynth"
depends_on "yt-dlp"
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=disabled
-Djavascript=enabled
-Dlibmpv=true
-Dlua=luajit
-Dlibarchive=enabled
-Duchardet=enabled
-Dlibbluray=enabled
-Dcplayer=false
-Dmanpage-build=disabled
-Dmacos-touchbar=disabled
-Dmacos-media-player=disabled
-Dmacos-cocoa-cb=disabled
--sysconfdir=#{pkgetc}
--datadir=#{pkgshare}
]
system "meson", "setup", "build", *args, *std_meson_args
system "meson", "compile", "-C", "build", "--verbose"
system "meson", "install", "-C", "build"
# `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
test do
system bin/"mpv", "--ao=null", test_fixtures("test.wav")
# Make sure `pkg-config` can parse `mpv.pc` after the `inreplace`.
system "pkg-config", "mpv"
end
end