source: trunk/dports/multimedia/mpv/Portfile

Last change on this file was 153258, checked in by ionic@…, 14 months ago

multimedia/mpv: update to 0.20.0. Fixes: #52114.

Changes:

  • Drop dependency upon ossp-uuid. Was probably unneeded to begin with.
  • Update sample config file - some options were renamed or removed.
  • Refresh and rework patches, mostly more generic now. Use MAC_OS_X_VERSION_MAX_ALLOWED instead of MAC_OS_X_VERSION_MIN_REQUIRED.
  • Add new patches (sadly, supporting OS X 10.7 and below is becoming increasingly difficult.)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 18.9 KB
Line 
1# -*- 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
2# $Id: Portfile 153258 2016-09-28 08:32:48Z ryandesign@macports.org $
3
4PortSystem              1.0
5PortGroup               github 1.0
6PortGroup               waf 1.0
7
8# Please revbump mpv whenever ffmpeg{,-devel} is updated!
9github.setup            mpv-player mpv 0.20.0 v
10revision                0
11categories              multimedia
12license                 GPL-2+
13maintainers             ionic
14platforms               darwin
15
16description             mpv is a movie player based on MPlayer and mplayer2.
17long_description        ${description} It plays most MPEG/VOB, AVI, Ogg/OGM, \
18                        VIVO, ASF/WMA/WMV, QT/MOV/MP4, RealMedia, Matroska, \
19                        NUT, NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files, \
20                        supported by many native, XAnim, and Win32 DLL codecs. \
21                        You can watch VideoCD, SVCD, DVD, 3ivx, DivX 3/4/5, WMV \
22                        and even H.264 movies.
23homepage                http://www.mpv.io/
24
25set waf_version         1.8.12
26set waf_distfile        waf-${waf_version}
27set mpv_distfile        ${distfiles}
28master_sites-append     http://ftp.waf.io/pub/release:waf
29distfiles-append        ${waf_distfile}:waf
30
31extract.only-delete     ${waf_distfile}
32
33checksums               ${mpv_distfile} \
34                        rmd160  41466df9f6aa69eb31dcd1651b14def189b782da \
35                        sha256  1a8a98cf4785206fa27387f752af0bdc1e303fe2e0a5d5be306123c6151ced08 \
36                        ${waf_distfile} \
37                        rmd160  bb1dcd10a0c336a5497bb1247a301c27f997078c \
38                        sha256  01bf2beab2106d1558800c8709bc2c8e496d3da4a2ca343fe091f22fca60c98b
39
40depends_build           path:bin/pkg-config:pkgconfig
41depends_lib             path:lib/libavcodec.dylib:ffmpeg \
42                        path:bin/perl:perl5 \
43                        port:libiconv \
44                        port:zlib \
45                        port:libass \
46                        port:libbluray \
47                        port:lcms2
48
49universal_variant       no
50
51default_variants        +bundle +network +osd +rubberband +opengl +dvd +audiocd +libarchive
52
53# Current waf doesn't support --nocache anymore. Set by PortGroup.
54configure.args-delete   --nocache
55
56# Default configuration options. Mostly macOS specific.
57# We cannot use --enable-cplayer here. Only --disable-cplayer
58# is recognized. Boo!
59configure.args-append   --enable-manpage-build \
60                        --enable-libass \
61                        --enable-coreaudio \
62                        --enable-cocoa \
63                        --disable-html-build \
64                        --disable-videotoolbox-hwaccel \
65                        --disable-videotoolbox-gl \
66                        --disable-opensles \
67                        --disable-egl-drm
68
69# mpv autodetects many support libs. To prevent undeclared
70# dependencies, explicitly disable everything optional first.
71# This list should be expanded each time the port is updated to a
72# new version, disabling any newly added options.
73configure.args-append   --disable-pdf-build \
74                        --disable-test \
75                        --disable-clang-database \
76                        --disable-debug-build \
77                        --disable-libsmbclient \
78                        --disable-libass-osd \
79                        --disable-dvdread \
80                        --disable-dvdnav \
81                        --disable-cdda \
82                        --disable-vapoursynth \
83                        --disable-vapoursynth-lazy \
84                        --disable-libarchive \
85                        --disable-enca \
86                        --disable-rubberband \
87                        --disable-pulse \
88                        --disable-jack \
89                        --disable-openal \
90                        --disable-gl-cocoa \
91                        --disable-x11 \
92                        --disable-xss \
93                        --disable-xext \
94                        --disable-xv \
95                        --disable-gl-x11 \
96                        --disable-egl-x11 \
97                        --disable-xinerama \
98                        --disable-xrandr \
99                        --disable-caca \
100                        --disable-jpeg \
101                        --disable-tv \
102                        --disable-lua \
103                        --disable-apple-remote \
104                        --disable-gl
105
106# Fix picking up the correct talloc version.
107# -isystem has the added benefit of moving the include
108# directory specified to the end of the include path list.
109# This will help the build system respect custom include
110# paths correctly (i.e., searching them before the MP include
111# directory.)
112configure.cppflags-replace  -I${prefix}/include -isystem${prefix}/include
113
114build.args-append           -v
115
116platform macosx {
117    if {${os.major} > 10} {
118        # Force recent enough Xcode.
119        # We have to compile with the compiler provided by Xcode/CLT
120        # due to only it shipping libarclite on 10.7 and knowing where
121        # it is.
122        # Could "emulate" the same behavior by using MacPort's clang
123        # and appending -L/usr/lib/arc/ to CFLAGS/CXXFLAGS on 10.7,
124        # but I don't particularly like that idea (yet.)
125        # Keep using the "system compiler" for now. Also means one less
126        # dependency on recent systems, so yay.
127        PortGroup                   xcodeversion 1.0
128        minimum_xcodeversions       {11 4.4}
129
130        # Force clang compiler as installed by Xcode's CLT's... hopefully.
131        compiler.blacklist-append   *gcc* cc macports-*
132    } else {
133        # clang is required to build mpv.
134        # Part of getting mpv to work on SL -- c.f. #44662
135        # We'll keep this at clang 3.4, because this is the last version
136        # not requiring a C++11 ABI. Older systems will need this
137        # port to bootstrap a newer clang version in a somewhat
138        # complicated process. Hence, let's assume clang 3.4 will be
139        # available for quite some time and only pull that in. It
140        # should be new enough for compiling mpv (for now.)
141        compiler.blacklist-append   *gcc* cc
142
143        compiler.fallback-delete    macports-clang-3.4
144        compiler.fallback-append    macports-clang-3.4
145
146        # Reorder list, move older or unknown versions to the end.
147        compiler.fallback-delete    clang macports-clang-3.3
148        compiler.fallback-append    clang macports-clang-3.3
149    }
150
151    configure.args-replace  --disable-apple-remote \
152                            --enable-apple-remote
153}
154
155platform darwin {
156    notes-append [subst {
157                    The maintainer ships his personal config file in
158                    * ${prefix}/share/examples/${name}/config-maintainer.
159
160                    You are strongly encouraged to copy this file to either
161                    * ${prefix}/etc/${name}/${name}.conf (globally for all users of the system) or
162                    * ~/.${name}/config (only for your current user)
163                    and adjust it to your needs.
164    }]
165
166    # VideotoolBox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay".
167    # It provides support for H264, H263, MPEG1, MPEG2 and MPEG4.
168    if {${os.major} > 11} {
169        configure.args-delete   --disable-videotoolbox-hwaccel \
170                                --disable-videotoolbox-gl
171        configure.args-append   --enable-videotoolbox-hwaccel \
172                                --enable-videotoolbox-gl
173    }
174
175    if {${os.major} > 11} {
176        notes-append {
177                        This config file already defines the necessary video output settings to make \
178                        use of the hardware acceleration features provided by your operating system.
179        }
180    } else {
181        notes-append {
182                        Sadly, your system is incapable of utilizing mpv's hardware decoding features.
183
184                        Please make sure to edit the file after copying and replace the "vo=" line with \
185                        options suited for your system or mpv won't work as expected. \
186                        Consult ``man mpv'' for further information.
187        }
188    }
189
190    # Shared build fixes for 10.6 and 10.7.
191    if {${os.major} < 12} {
192        patchfiles-append   patch-misc-import-CoreVideo.diff
193    }
194
195    # Versions 10.6 and below don't support XCode 4, which is required for ARCLite.
196    # We will have to patch mpv for unofficial Cocoa support.
197    # Also fix some other minor compile issues only manifesting on 10.6 and below along the way.
198    if {${os.major} < 11} {
199        patchfiles-append   patch-waftools_checks_custom.py-disable-libarclite.diff \
200                            patch-misc-add-strnlen.diff \
201                            patch-audio_out_ao_coreaudio_exclusive.c-compile-fix.diff \
202                            patch-video_out_cocoa_events_view.h-remove-NSDraggingDestination-protocol.diff \
203                            patch-video_out_cocoa_events_view.m-replace-convertRectFromScreen-with-convertScreenToBase.diff \
204                            patch-video_out_cocoa_video_view.m-replace-convertRectToBacking-with-userSpaceScaleFactor.diff \
205                            patch-video_out_cocoa_events_view.m-replace-convertPointToBacking-with-userSpaceScaleFactor.diff \
206                            patch-video_out_cocoa_window.m-fullscreen-fixes.diff \
207                            patch-video_out_cocoa_common.m-define-constants.diff \
208                            patch-video_out_cocoa_common.m-port-lightsensor.diff \
209                            patch-video_out_opengl_context_cocoa.c-hardcode-OpenGL-2.diff \
210                            patch-video_out_opengl_video.c-fix-compile-warnings.diff \
211                            patch-osdep_macosx_compat.h-fix-YES-NO-macro-warnings.diff \
212                            patch-osdep_macosx_compat.m-add-subscripting-implementation.diff \
213                            patch-audio_out_ao_coreaudio_utils.c-add-missing-header-for-getpid.diff \
214                            patch-video_out_opengl_common.h-guard-GL3-stuff.diff \
215                            patch-video_out_vo_opengl.c-guard-GL3-and-backport-old-behavior.diff \
216                            patch-video_out_opengl_common.c-hide-GL320-section.diff \
217                            patch-video_out_opengl_common.c-hide-GL3-timer-functions.diff \
218                            patch-video_out_opengl_video.c-remove-timer-functionality.diff \
219                            patch-video_out_opengl_utils.c-hide-pbo-texture-upload.diff
220
221        notes-append {
222                        On systems older than Lion (10.7), Cocoa output support is currently \
223                        being patched by the MacPorts maintainer to make it work.
224
225                        It is known to be broken.
226
227                        Please do not expect it to work or be bug free.
228        }
229    }
230
231    post-extract {
232        xinstall -m 0644 -W "${filespath}" config-maintainer "${worksrcpath}/TOOLS/"
233    }
234
235    pre-configure {
236        if {[variant_isset network]} {
237            reinplace -W "${worksrcpath}/TOOLS" "s|@@NETWORK@@||" config-maintainer
238        } else {
239            reinplace -W "${worksrcpath}/TOOLS" "|@@NETWORK@@|d" config-maintainer
240        }
241    }
242}
243
244
245# Shameless copy from ipe-tools.
246set python.versions         {27 35}
247set python.default_version  27
248set python.version          ""
249
250# Create python variants.
251foreach ver ${python.versions} {
252    set variant_line {variant python${ver} description }
253    append variant_line " {Use python${ver} to generate man pages}"
254
255    foreach over ${python.versions} {
256        if {${ver} == ${over}} {
257            continue
258        }
259
260        append variant_line " conflicts python${over}"
261    }
262
263    append variant_line " { depends_build-append port:py${ver}-docutils }"
264    eval $variant_line
265}
266
267# Set default python variant.
268set variant_none true
269foreach ver ${python.versions} {
270    if {[variant_isset python${ver}]} {
271        set variant_none [expr $variant_none && ![variant_isset python${ver}]]
272    }
273}
274
275if {${variant_none}} {
276    default_variants-append "+python${python.default_version}"
277}
278
279# Set ${python.version} to the currently active variant.
280foreach ver ${python.versions} {
281    if {[variant_isset python${ver}]} {
282        set python.version ${ver}
283    }
284}
285
286if {[string length ${python.version}] == 0} {
287    ui_error "No python variant selected. You must select at least one. The highest value will be used."
288    error "Select a python variant."
289}
290
291post-patch {
292    set python_ver_dot [join [split ${python.version} {}] "."]
293    reinplace -W "${worksrcpath}" "s|'rst2man'|'rst2man-${python_ver_dot}'|" wscript
294}
295
296post-extract {
297    xinstall -m 0644 -W "${distpath}" "${waf_distfile}" "${worksrcpath}/waf"
298}
299
300post-destroot {
301    xinstall -d -m 0755 ${destroot}${prefix}/etc/${name}
302    foreach etcfile {encoding-profiles.conf mpv.conf input.conf} {
303        xinstall -m 0644 ${worksrcpath}/etc/${etcfile} \
304            ${destroot}${prefix}/etc/${name}/${etcfile}
305    }
306    xinstall -d -m 0755 ${destroot}${prefix}/share/examples/${name}
307    copy {*}[glob ${worksrcpath}/TOOLS/lua ${worksrcpath}/TOOLS/*.pl \
308                  ${worksrcpath}/TOOLS/*.sh ${worksrcpath}/TOOLS/*.py \
309                  ${worksrcpath}/TOOLS/umpv ${worksrcpath}/TOOLS/lib] \
310         ${destroot}${prefix}/share/examples/${name}
311
312    if {${os.platform} eq "darwin"} {
313        xinstall -m 0644 ${worksrcpath}/TOOLS/config-maintainer \
314                         ${destroot}${prefix}/share/examples/${name}/
315    }
316}
317
318
319# When enabling features, make sure to replace the "disable" flags with
320# "enable" flags in order to make the waf build system error out in case
321# a feature cannot be used/found. Problems like that indicate a missing
322# runtime dependency.
323
324variant bundle description {Enable the optional macOS bundle of mpv} {
325    post-build {
326        system -W "${worksrcpath}" "${waf.python} TOOLS/osxbundle.py -s build/mpv"
327    }
328
329    post-destroot {
330        xinstall -d -m 0755 ${destroot}${applications_dir}
331        move ${worksrcpath}/build/mpv.app ${destroot}${applications_dir}
332    }
333}
334
335variant screenshot description {Enable optional screenshot support} {
336    depends_lib-append      path:lib/libjpeg.dylib:jpeg
337    configure.args-replace  --disable-jpeg \
338                            --enable-jpeg
339}
340
341variant network description {Enable networking support via youtube-dl (supports wide variety of pages)} {
342    depends_run-append      port:youtube-dl
343}
344
345variant dvd description {Enable DVD and DeCSS support} {
346    depends_lib-append      port:libdvdread \
347                            port:libdvdnav
348    configure.args-replace  --disable-dvdread \
349                            --enable-dvdread
350    configure.args-replace  --disable-dvdnav \
351                            --enable-dvdnav
352}
353
354variant audiocd description {Enable Audio CD support via libcdio-paranoia} {
355    depends_lib-append      port:libcdio-paranoia
356    configure.args-replace   --disable-cdda \
357                             --enable-cdda
358}
359
360variant libarchive description {Enable transparent handling of Zip files and other compressed formats} {
361    depends_lib-append      port:libarchive
362    configure.args-replace  --disable-libarchive \
363                            --enable-libarchive
364}
365
366variant enca description {Enable encoding support via ENCA} {
367    depends_lib-append      port:enca
368    configure.args-replace  --disable-enca \
369                            --enable-enca
370}
371
372variant rubberband description {Enable support for the Rubber Band library, adding audio pitch and speed control} {
373    depends_lib-append      port:rubberband
374    configure.args-replace  --disable-rubberband \
375                            --enable-rubberband
376}
377
378variant pulseaudio description {Enable PulseAudio support} {
379    depends_lib-append      port:pulseaudio
380    configure.args-replace  --disable-pulse \
381                            --enable-pulse
382}
383
384variant jack description {Enable Jack Audio Connection Kit support} {
385    depends_lib-append      port:jack
386    configure.args-replace  --disable-jack \
387                            --enable-jack
388}
389
390# TODO: switch that to openal-soft? Leave it as-is?
391variant openal description {Enable OpenAL support} {
392    depends_lib-append      port:openal
393    configure.args-replace  --disable-openal \
394                            --enable-openal
395}
396
397variant x11 {
398    depends_lib-append      port:xorg-libXext \
399                            port:xorg-libXScrnSaver \
400                            port:xorg-libXinerama \
401                            port:xorg-libXv \
402                            port:xorg-libXrandr
403
404    configure.args-delete   --disable-x11 \
405                            --disable-xss \
406                            --disable-xext \
407                            --disable-xinerama \
408                            --disable-xv \
409                            --disable-xrandr
410    configure.args-append   --enable-x11 \
411                            --enable-xss \
412                            --enable-xext \
413                            --enable-xv \
414                            --enable-xinerama \
415                            --enable-xrandr
416}
417
418variant opengl description {Enable glx output support.  Both the CoreVideo and X11 outputs are supported} {
419    configure.args-replace  --disable-gl-cocoa \
420                            --enable-gl-cocoa
421    configure.args-replace  --disable-gl \
422                            --enable-gl
423
424    if {[variant_isset x11]} {
425        depends_lib-append      port:mesa
426        configure.args-replace  --disable-gl-x11 \
427                                --enable-gl-x11
428        # FIXME: add EGL? Leave it disabled? Test!
429        # As far as testing went, EGL is not available on macOS yet.
430        #configure.args-replace  --disable-egl-x11 \
431        #                        --enable-egl-x11
432    }
433}
434
435variant caca description {Enable animated ASCII art video output} {
436    depends_lib-append      port:libcaca
437    configure.args-replace  --disable-caca \
438                            --enable-caca
439}
440
441variant osd description {Enable onscreen display and TrueType font support} {
442    depends_lib-append      port:lua52
443    configure.args-delete   --disable-lua \
444                            --disable-libass-osd
445    configure.args-append   --enable-lua \
446                            --lua=52fbsd \
447                            --enable-libass-osd
448}
449
450variant smb description {Enable Samba support} {
451    depends_lib-append      path:lib/pkgconfig/smbclient.pc:samba3
452    configure.args-replace  --disable-libsmbclient \
453                            --enable-libsmbclient
454}
455
456variant debug description {Compile with debugging symbols} {
457    configure.args-replace  --disable-debug-build \
458                            --enable-debug-build
459}
460
461variant printable_doc description {Generate printable documents (PDF help)} {
462    # py27-pdfrw and py27-Pillow are needed by rst2pdf.
463    depends_build-append    port:rst2pdf \
464                            port:py27-pdfrw \
465                            port:py27-Pillow
466    configure.args-replace  --disable-pdf-build \
467                            --enable-pdf-build
468}
Note: See TracBrowser for help on using the repository browser.