-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathPortfile
515 lines (435 loc) · 19.5 KB
/
Portfile
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup github 1.0
PortGroup meson 1.0
PortGroup compiler_blacklist_versions 1.0
PortGroup legacysupport 1.1
PortGroup active_variants 1.1
# Please revbump mpv whenever linked ffmpeg is updated!
github.setup mpv-player mpv 0.40.0 v
github.tarball_from archive
conflicts mpv-legacy
revision 2
categories multimedia
license GPL-2+
maintainers {ionic @Ionic} {i0ntempest @i0ntempest} openmaintainer
platforms {darwin >= 19}
description mpv is a movie player based on MPlayer and mplayer2.
long_description {*}${description} It plays most MPEG/VOB, AVI, Ogg/OGM, \
VIVO, ASF/WMA/WMV, QT/MOV/MP4, RealMedia, Matroska, \
NUT, NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files, \
supported by many native, XAnim, and Win32 DLL codecs. \
You can watch VideoCD, SVCD, DVD, 3ivx, DivX 3/4/5, WMV \
and even H.264 movies.
homepage https://www.mpv.io
checksums rmd160 104f8b309b77f111e297f1c461fad09a9fdedb16 \
sha256 10a0f4654f62140a6dd4d380dcf0bbdbdcf6e697556863dc499c296182f081a3 \
size 3561474
installs_libs no
set ffmpeg_ver 7
depends_build-append port:pkgconfig
depends_lib port:ffmpeg${ffmpeg_ver} \
path:bin/perl:perl5 \
port:libiconv \
port:zlib \
path:lib/pkgconfig/libass.pc:libass \
port:lcms2 \
port:libplacebo
universal_variant no
default_variants +osd +opengl +bluray +dvd +audiocd +libarchive +libmpv
if {![variant_isset network]} {
default_variants-append \
+network_ytdlp
}
platform darwin {
default_variants-append \
+bundle +rubberband
}
configure.args-append --buildtype=release \
-Dmanpage-build=enabled \
-Dcoreaudio=enabled \
-Dcocoa=enabled \
-Dcplugins=enabled \
-Dzlib=enabled \
-Dswift-build=enabled \
-Dhtml-build=disabled \
-Dvideotoolbox-gl=enabled \
-Dcuda-hwaccel=disabled \
-Dopensles=disabled \
-Degl-drm=disabled \
-Degl-angle-lib=disabled \
-Degl-angle-win32=disabled \
-Daudiounit=disabled \
-Dios-gl=disabled \
-Ddirect3d=disabled \
-Dandroid-media-ndk=disabled \
-Ddvbin=disabled \
-Dlibmpv=false
# mpv autodetects many support libs. To prevent undeclared
# dependencies, explicitly disable everything optional first.
# This list should be expanded each time the port is updated
# to a new version, disabling any newly added options.
configure.args-append -Dcaca=disabled \
-Dcdda=disabled \
-Dpthread-debug=disabled \
-Ddvdnav=disabled \
-Degl-x11=disabled \
-Dgl=disabled \
-Dgl-cocoa=disabled \
-Dvulkan=disabled \
-Dgl-x11=disabled \
-Djack=disabled \
-Djavascript=disabled \
-Djpeg=disabled \
-Dlibarchive=disabled \
-Dlibbluray=disabled \
-Dlua=disabled \
-Dopenal=disabled \
-Dpdf-build=disabled \
-Dpulse=disabled \
-Drubberband=disabled \
-Duchardet=disabled \
-Dvapoursynth=disabled \
-Dx11=disabled \
-Dxv=disabled
configure.pkg_config_path-prepend \
${prefix}/libexec/ffmpeg${ffmpeg_ver}/lib/pkgconfig
# Fix picking up the correct talloc version.
# -isystem has the added benefit of moving the include
# directory specified to the end of the include path list.
# This will help the build system respect custom include
# paths correctly (i.e., searching them before the MP include
# directory.)
configure.cppflags-replace \
-I${prefix}/include \
-isystem${prefix}/include
# Clear CPATH and LIBRARY_PATH because a ncurses include file
# conflicts with the one in MacPorts. It doesn't matter much anyway
# because the swift module in mpv doesn't have any dependencies to
# link against.
compiler.cpath
compiler.library_path
platform macosx {
# Force recent enough Xcode.
# Keep using the "system compiler" for now. Also means one less
# dependency on recent systems, so yay.
PortGroup xcodeversion 1.0
minimum_xcodeversions {11 4.4}
use_xcode yes
}
platform darwin {
notes-append [subst {
The maintainer ships his personal config file in
* ${prefix}/share/doc/${name}/examples/config-maintainer.
You are strongly encouraged to copy this file to either
* ${prefix}/etc/${name}/${name}.conf (globally for all users of the system) or
* ~/.config/${name}/mpv.conf (only for your current user)
and adjust it to your needs.
If you previously had your configuration file in
* ~/.${name}/config or ~/.config/${name}/config
please migrate it to
* ~/.config/${name}/mpv.conf
which is the location preferred by upstream.
}]
notes-append {
This config file already defines the necessary video output settings to make\
use of the hardware acceleration features provided by your operating system.
}
# C11 atomics is mandatory from version 0.33.0
compiler.c_standard 2011
compiler.blacklist-append \
{clang < 700} *gcc* cc macports-*
# Fix youtube-dl hook for streaming youtube videos
patchfiles-append \
patch-youtubedl-edl-track-error.diff
# revert swift compiler to `swift` for Xcode or CLT v14-
# See https://github.com/mpv-player/mpv/issues/15591
if {(${use_xcode} && [vercmp ${xcodeversion} 15] < 0) || [vercmp ${xcodecltversion} 15] < 0} {
patchfiles-append \
patch-8d20b72653-revert.patch
}
post-extract {
xinstall -m 0644 -W "${filespath}" config-maintainer "${worksrcpath}/TOOLS/"
}
pre-configure {
if {${use_xcode}} {
set sdks_dir ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs
set sdks [glob -directory ${sdks_dir} MacOSX*.sdk]
configure.sdkroot [lindex [lsort -command vercmp ${sdks}] end]
}
if {${configure.sdkroot} ne ""} {
configure.sdk_version [exec /usr/libexec/PlistBuddy -c Print:ProductVersion ${configure.sdkroot}/System/Library/CoreServices/SystemVersion.plist]
}
if {[llength [split ${configure.sdk_version} .]] < 2} {
configure.sdk_version ${configure.sdk_version}.0
}
configure.env-append \
MACOS_SDK=${configure.sdkroot} \
MACOS_SDK_VERSION=${configure.sdk_version}
if {[variant_isset network]} {
reinplace -W "${worksrcpath}/TOOLS" "s/@@NETWORK@@//" config-maintainer
} else {
reinplace -W "${worksrcpath}/TOOLS" "/@@NETWORK@@/d" config-maintainer
}
if {${os.major} > 11} {
reinplace -W "${worksrcpath}/TOOLS" "s/@@HWDEC@@//" config-maintainer
} else {
reinplace -W "${worksrcpath}/TOOLS" "/@@HWDEC@@/d" config-maintainer
}
if {${os.major} > 12} {
reinplace -W "${worksrcpath}/TOOLS" "s/@@HWDEC_CUDA@@//" config-maintainer
} else {
reinplace -W "${worksrcpath}/TOOLS" "/@@HWDEC_CUDA@@/d" config-maintainer
}
if {${os.major} < 11 || ${configure.build_arch} ni [list x86_64 arm64]} {
reinplace -W "${worksrcpath}/TOOLS" "/@@VO@@/d" config-maintainer
reinplace -W "${worksrcpath}/TOOLS" "s/@@BACKEND@@/x11/" config-maintainer
} else {
reinplace -W "${worksrcpath}/TOOLS" "s/@@VO@@//" config-maintainer
reinplace -W "${worksrcpath}/TOOLS" "/@@BACKEND@@/d" config-maintainer
}
}
}
# Shameless copy from ipe-tools.
set python.versions {39 310 311 312 313}
dict set python.legacy_versions 38 39
# After Python 3.9 is released, and mpv can be built with it,
# replace with the above lines with the following:
#set python.versions {27 39}
#dict set python.legacy_versions 38 39
set python.default_version 313
set python.version ""
# Create python variants.
foreach ver ${python.versions} {
set variant_line {variant python${ver} description }
set python_branch [string index $ver 0].[string range $ver 1 end]
append variant_line " {Use Python ${python_branch} to build ${name} and generate man pages}"
foreach over ${python.versions} {
if {${ver} == ${over}} {
continue
}
append variant_line " conflicts python${over}"
}
append variant_line " {
depends_build-append port:py${ver}-docutils
license_noconflict py${ver}-docutils
}"
eval $variant_line
}
# Create legacy python variants, mapping to the replacement version.
dict for {legacy_ver replace_ver} ${python.legacy_versions} {
set variant_line {variant python${legacy_ver} description }
set legacy_branch [join [split ${legacy_ver} {}] "."]
set replace_branch [join [split ${replace_ver} {}] "."]
append variant_line " {Legacy variant for Python ${legacy_branch} mapping to Python ${replace_branch}}"
append variant_line " requires python${replace_ver}"
foreach over ${python.versions} {
if {${legacy_ver} == ${over} || ${replace_ver} == ${over}} {
continue
}
append variant_line " conflicts python${over}"
}
append variant_line " { }"
eval $variant_line
}
# Set default python variant.
set variant_none true
foreach ver ${python.versions} {
if {[variant_isset python${ver}]} {
set variant_none [expr $variant_none && ![variant_isset python${ver}]]
}
}
if {${variant_none}} {
default_variants-append "+python${python.default_version}"
}
# Set ${python.version} to the currently active variant.
foreach ver ${python.versions} {
if {[variant_isset python${ver}]} {
set python.version ${ver}
set python_branch [string index ${python.version} 0].[string range ${python.version} 1 end]
}
}
if {[string length ${python.version}] == 0} {
ui_error "No python variant selected. You must select at least one. The highest value will be used."
error "Select a python variant."
}
set python_ver_dot [string index ${python.version} 0].[string range ${python.version} 1 end]
meson.native.binaries-append \
rst2man=${prefix}/bin/rst2man-${python_ver_dot}
post-destroot {
# Since we don't have conffiles handling, install mpv.conf as mpv.conf.example
# to not overwrite this file on each (re-)build.
file rename ${worksrcpath}/etc/mpv.conf ${worksrcpath}/etc/mpv.conf.example
xinstall -d -m 0755 ${destroot}${prefix}/etc/${name}
foreach etcfile {encoding-profiles.conf mpv.conf.example input.conf} {
xinstall -m 0644 ${worksrcpath}/etc/${etcfile} \
${destroot}${prefix}/etc/${name}/${etcfile}
}
xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}/examples
copy {*}[glob ${worksrcpath}/TOOLS/lua ${worksrcpath}/TOOLS/*.pl \
${worksrcpath}/TOOLS/*.sh ${worksrcpath}/TOOLS/*.py \
${worksrcpath}/TOOLS/umpv ${worksrcpath}/TOOLS/lib] \
${destroot}${prefix}/share/doc/${name}/examples
if {${os.platform} eq "darwin"} {
xinstall -m 0644 ${worksrcpath}/TOOLS/config-maintainer \
${destroot}${prefix}/share/doc/${name}/examples
}
}
# When enabling features, make sure to replace the "disabled" flags with
# "enabled" flags in order to make the meson build system error out in case
# a feature cannot be used/found. Problems like that indicate a missing
# runtime dependency.
variant screenshot description {Enable optional screenshot support} {
depends_lib-append path:include/turbojpeg.h:libjpeg-turbo
configure.args-replace -Djpeg=disabled \
-Djpeg=enabled
}
variant network conflicts network_ytdlp description {Enable networking support via youtube-dl (supports wide variety of pages)} {
depends_run-append port:youtube-dl
}
variant network_ytdlp conflicts network description {Enable networking support via yt-dlp instead of youtube-dl (supports wide variety of pages)} {
depends_run-append port:yt-dlp
}
variant bluray description {Enable Bluray and AACS/BD+ encryption support} {
depends_lib-append port:libbluray
depends_run-append port:libaacs \
port:libbdplus
configure.args-replace -Dlibbluray=disabled \
-Dlibbluray=enabled
notes-append {
To play Bluray discs with AACS encryption, decryption key database file "keydb.cfg" needs to be placed at:
* ~/Library/Preferences/aacs/ (on macOS, or)
* ~/.config/aacs/ (on other darwin).
You can easily find this file on the internet.
}
}
variant dvd description {Enable DVD and DeCSS support} {
depends_lib-append port:libdvdread \
port:libdvdnav
configure.args-replace -Ddvdnav=disabled \
-Ddvdnav=enabled
}
variant audiocd description {Enable Audio CD support via libcdio-paranoia} {
depends_lib-append port:libcdio-paranoia
configure.args-replace -Dcdda=disabled \
-Dcdda=enabled
}
variant libarchive description {Enable transparent handling of Zip files and other compressed formats} {
depends_lib-append port:libarchive
configure.args-replace -Dlibarchive=disabled \
-Dlibarchive=enabled
}
variant rubberband description {Enable support for the Rubber Band library, adding audio pitch and speed control} {
depends_lib-append port:rubberband
configure.args-replace -Drubberband-disabled \
-Drubberband-enabled
}
variant vapoursynth description {} {
depends_lib-append port:vapoursynth
configure.args-replace -Dvapoursynth=disabled \
-Dvapoursynth=enabled
}
variant pulseaudio description {Enable PulseAudio support} {
depends_lib-append port:pulseaudio
configure.args-replace -Dpulse=disabled \
-Dpulse=enabled
}
variant jack description {Enable Jack Audio Connection Kit support} {
depends_lib-append port:jack
configure.args-replace -Djack=disabled \
-Djack=enabled
}
# TODO: switch that to openal-soft? Leave it as-is?
variant openal description {Enable OpenAL support} {
depends_lib-append port:openal
configure.args-replace -Dopenal=disabled \
-Dopenal=enabled
}
variant x11 {
depends_lib-append port:xorg-libXext \
port:xorg-libXScrnSaver \
port:xorg-libXinerama \
port:xorg-libXv \
port:xorg-libXrandr \
port:xorg-libXpresent
configure.args-replace --Dx11=disabled \
--Dx11=enabled
configure.args-replace --Dxv=disabled \
--Dxv=enabled
}
variant opengl description {Enable OpenGL output support. Both the CoreVideo and X11 (GLX) outputs are supported} {
platform darwin {
configure.args-replace -Dgl-cocoa=disabled \
-Dgl-cocoa=enabled
}
configure.args-replace -Dgl=disabled \
-Dgl=enabled
if {[variant_isset x11]} {
depends_lib-append port:mesa
configure.args-replace -Dgl-x11=disabled \
-Dgl-x11=enabled
require_active_variants libplacebo opengl
# FIXME: add EGL? Leave it disabled? Test!
# As far as testing went, EGL is not available on macOS yet.
#configure.args-replace -Degl-x11=disabled \
# -Degl-x11=enabled
}
}
variant vulkan description {Enable Vulkan output support} {
depends_build-append \
port:vulkan-headers
depends_lib-append port:vulkan-loader
configure.args-replace \
-Dvulkan=disabled \
-Dvulkan=enabled
require_active_variants libplacebo vulkan
}
variant caca description {Enable animated ASCII art video output} {
depends_lib-append port:libcaca
configure.args-replace -Dcaca=disabled \
-Dcaca=enabled
}
variant osd description {Enable onscreen display and TrueType font support} {
depends_lib-append port:lua52
configure.args-replace -Dlua=disabled \
-Dlua=lua5.2
}
variant debug description {Compile with debugging symbols} {
configure.args-replace --buildtype=release \
--buildtype=debug
configure.args-replace -Dpthread-debug=disabled \
-Dpthread-debug=enabled
}
variant printable_doc description {Generate printable documents (PDF help)} {
# py27-pdfrw and py27-Pillow are needed by rst2pdf.
depends_build-append port:rst2pdf \
port:py27-pdfrw \
port:py27-Pillow
configure.args-replace -Dpdf-build=disabled \
-Dpdf-build=enabled
}
#variant javascript description {Enable JavaScript support via mujs} {
# depends_lib-append port:mujs
# configure.args-replace -Djavascript=disabled \
# -Djavascript=enabled
#}
variant uchardet description {Enable the uchardet encoding detector} {
depends_lib-append port:uchardet
configure.args-replace -Duchardet=disabled \
-Duchardet=enabled
}
variant libmpv description {Enable the libmpv library} {
configure.args-replace -Dlibmpv=false \
-Dlibmpv=true
}
variant bundle description {Enable the optional macOS bundle of mpv} {
post-build {
# Avoid Game Mode auto activation on macOS 14
system -W ${worksrcpath}/TOOLS/osxbundle/mpv.app/Contents/ "/usr/libexec/PlistBuddy -c \"Delete :LSApplicationCategoryType\" Info.plist"
system -W ${worksrcpath} "${prefix}/bin/python${python_branch} TOOLS/osxbundle.py -s ${build.dir}/mpv"
}
post-destroot {
xinstall -d -m 0755 ${destroot}${applications_dir}
copy ${build.dir}/mpv.app ${destroot}${applications_dir}
}
}