Permalink
547 lines (460 sloc) 21.1 KB
# -*- 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 waf 1.0
# Please revbump mpv whenever ffmpeg{,-devel} is updated!
github.setup mpv-player mpv 0.28.2 v
categories multimedia
license GPL-2+
maintainers {ionic @Ionic}
platforms darwin
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 http://www.mpv.io/
set waf_version 1.9.8
set waf_distfile waf-${waf_version}
set mpv_distfile ${distfiles}
master_sites-append https://waf.io/:waf
distfiles-append ${waf_distfile}:waf
extract.only-delete ${waf_distfile}
checksums ${mpv_distfile} \
rmd160 f74e0471685be85fafbb6548362997f146ff11a3 \
sha256 9cac0613be59f766f5635da5380b0782d0141c9471c55815e8a1ddc9f2cb0b24 \
size 2982853 \
${waf_distfile} \
rmd160 d1a5d0e0f42a0101f5832abb33cd71018505405f \
sha256 167dc42bab6d5bd823b798af195420319cb5c9b571e00db7d83df2a0fe1f4dbf \
size 100685
installs_libs no
depends_build port:pkgconfig
depends_lib path:lib/libavcodec.dylib:ffmpeg \
path:bin/perl:perl5 \
port:libiconv \
port:zlib \
port:libass \
port:libbluray \
port:lcms2
universal_variant no
default_variants +bundle +network +osd +rubberband +opengl +dvd +audiocd +libarchive
# Current waf doesn't support --nocache anymore. Set by PortGroup.
configure.args-delete --nocache
# I'd *really* love to see what's going on in waf, but even the continue-on-failure option
# makes waf bail out on the first optional component that was not found (which will always
# happen, especially since tests for Win32 are bound to fail on other platforms...)
#configure.args-append -vvv -kk
# Default configuration options. Mostly macOS specific.
# We cannot use --enable-cplayer here. Only --disable-cplayer
# is recognized. Boo!
configure.args-append --enable-manpage-build \
--enable-libass \
--enable-coreaudio \
--enable-cocoa \
--enable-cplugins \
--enable-zlib \
--disable-html-build \
--disable-videotoolbox-gl \
--disable-cuda-hwaccel \
--disable-opensles \
--disable-egl-drm \
--disable-egl-angle-lib \
--disable-egl-angle-win32 \
--disable-audiounit \
--disable-ios-gl \
--disable-mali-fbdev \
--disable-direct3d \
--disable-android \
--disable-rpi \
--disable-dvbin
# 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 --disable-pdf-build \
--disable-test \
--disable-clang-database \
--disable-debug-build \
--disable-libsmbclient \
--disable-libass-osd \
--disable-dvdread \
--disable-dvdnav \
--disable-cdda \
--disable-vapoursynth \
--disable-vapoursynth-lazy \
--disable-libarchive \
--disable-rubberband \
--disable-pulse \
--disable-jack \
--disable-openal \
--disable-gl-cocoa \
--disable-x11 \
--disable-xv \
--disable-gl-x11 \
--disable-egl-x11 \
--disable-caca \
--disable-jpeg \
--disable-tv \
--disable-lua \
--disable-apple-remote \
--disable-gl \
--disable-zsh-comp \
--disable-javascript \
--disable-uchardet
# 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
build.args-append -v
platform macosx {
if {${os.major} > 10} {
# Force recent enough Xcode.
# We have to compile with the compiler provided by Xcode/CLT
# due to only it shipping libarclite on 10.7 and knowing where
# it is.
# Could "emulate" the same behavior by using MacPorts' clang
# and appending -L/usr/lib/arc/ to CFLAGS/CXXFLAGS on 10.7,
# but I don't particularly like that idea (yet.)
# 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}
# Force recent enough SDK.
if {[vercmp ${configure.sdk_version} 10.8] < 0} {
configure.sdk_version 10.8
}
# Force clang compiler as installed by Xcode's CLT's... hopefully.
compiler.blacklist-append *gcc* cc macports-*
configure.args-replace --disable-apple-remote \
--enable-apple-remote
}
if {${os.major} <= 10 || ${configure.build_arch} ne "x86_64"} {
# Disable Cocoa output.
# Users on old systems will need to embrace X11.
configure.args-replace --enable-cocoa \
--disable-cocoa
default_variants-append +x11
}
}
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}/config (only for your current user)
and adjust it to your needs.
If you previously had your configuration file in
* ~/.${name}/config
please migrate it to
* ~/.config/${name}/config
which is the location preferred by upstream.
}]
# VideotoolBox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay".
# It provides support for H264, H263, MPEG1, MPEG2 and MPEG4.
if {${os.major} > 11} {
configure.args-delete --disable-videotoolbox-gl
configure.args-append --enable-videotoolbox-gl
}
# It looks like mpv expects a CUDA API version 7050 or higher, which might mean >= 7.0.50.
# If that's the case, only 10.9+ have support for that.
# Current ffmpeg expects a CUDA version of 8.0.14.2 or higher, which is only available
# for 10.11+.
# Also, it might be necessary to have the CUDA SDK installed before installing ffmpeg.
# Let's hope for the best, for now.
if {${os.major} > 14} {
configure.args-replace --disable-cuda-hwaccel \
--enable-cuda-hwaccel
}
if {${os.major} > 11} {
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.
}
} else {
notes-append {
Sadly, your system is incapable of utilizing mpv's hardware decoding features.
The example config file will not include a hardware decoding option.\
Consult ``man mpv'' for further information.
}
}
# Shared build fixes for 10.6 and 10.7.
if {${os.major} < 12} {
patchfiles-append patch-misc-import-CoreVideo.diff
}
# Make mpv work as good as possible on 10.6 and below. No Cocoa support, instead concentrate
# on getting the OpenGL output to work via X11.
# Also fix some other minor compile issues only manifesting on 10.6 and below along the way.
if {${os.major} < 11} {
patchfiles-append patch-wscript-support-older-GCC.diff \
patch-misc-add-strnlen.diff \
patch-waftools_detections_compiler.py-support-older-GCC.diff \
patch-audio_out_ao_coreaudio_exclusive.c-compile-fix.diff \
patch-video_out_opengl_video.c-fix-compile-warnings.diff \
patch-audio_out_ao_coreaudio_utils.c-add-missing-header-for-getpid.diff \
patch-video_out_opengl_common.h-guard-GL3-stuff.diff \
patch-video_out_vo_opengl.c-guard-GL3-and-backport-old-behavior.diff \
patch-video_out_opengl_common.c-hide-GL320-section.diff \
patch-video_out_opengl_common.c-hide-GL3-timer-functions.diff \
patch-video_out_opengl_video.c-remove-timer-functionality.diff \
patch-video_out_opengl_video.c-hide-pbo-texture-upload.diff
notes-append {
On systems older than Lion (10.7) or on architectures other than x86_64, Cocoa output support is not available.
The X11 backend should have been enabled automatically.
}
}
post-extract {
xinstall -m 0644 -W "${filespath}" config-maintainer "${worksrcpath}/TOOLS/"
}
pre-configure {
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} ne "x86_64"} {
reinplace -W "${worksrcpath}/TOOLS" "s/@@BACKEND@@/x11/" config-maintainer
} else {
reinplace -W "${worksrcpath}/TOOLS" "s/@@BACKEND@@/cocoa/" config-maintainer
}
}
}
# Shameless copy from ipe-tools.
set python.versions {27 36}
# Remove after 07-30-2018.
dict set python.legacy_versions 35 36
set python.default_version 27
set python.version ""
# Create python variants.
foreach ver ${python.versions} {
set variant_line {variant python${ver} description }
append variant_line " {Use python${ver} to 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 }
append variant_line " {Legacy variant for python${legacy_ver} mapping to python${replace_ver}}"
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}
}
}
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."
}
post-patch {
set python_ver_dot [join [split ${python.version} {}] "."]
reinplace -W "${worksrcpath}" "s|'rst2man'|'rst2man-${python_ver_dot}'|" wscript
}
post-extract {
xinstall -m 0644 -W "${distpath}" "${waf_distfile}" "${worksrcpath}/waf"
}
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 "disable" flags with
# "enable" flags in order to make the waf build system error out in case
# a feature cannot be used/found. Problems like that indicate a missing
# runtime dependency.
variant bundle description {Enable the optional macOS bundle of mpv} {
post-build {
system -W "${worksrcpath}" "${waf.python} TOOLS/osxbundle.py -s build/mpv"
}
post-destroot {
xinstall -d -m 0755 ${destroot}${applications_dir}
move ${worksrcpath}/build/mpv.app ${destroot}${applications_dir}
}
}
variant screenshot description {Enable optional screenshot support} {
depends_lib-append path:lib/libjpeg.dylib:jpeg
configure.args-replace --disable-jpeg \
--enable-jpeg
}
variant network description {Enable networking support via youtube-dl (supports wide variety of pages)} {
depends_run-append port:youtube-dl
}
variant dvd description {Enable DVD and DeCSS support} {
depends_lib-append port:libdvdread \
port:libdvdnav
configure.args-replace --disable-dvdread \
--enable-dvdread
configure.args-replace --disable-dvdnav \
--enable-dvdnav
}
variant audiocd description {Enable Audio CD support via libcdio-paranoia} {
depends_lib-append port:libcdio-paranoia
configure.args-replace --disable-cdda \
--enable-cdda
}
variant libarchive description {Enable transparent handling of Zip files and other compressed formats} {
depends_lib-append port:libarchive
configure.args-replace --disable-libarchive \
--enable-libarchive
}
# Remove after 07-30-2018
variant enca requires uchardet description {Legacy compatibility variant for enable encoding support via ENCA. Will be removed soon.} {
notes-append {
You have enabled the legacy enca variant.
Upstream removed support for ENCA in version 0.23.0 in favor of uchardet.
The uchardet variant has been enabled automatically.
}
}
variant rubberband description {Enable support for the Rubber Band library, adding audio pitch and speed control} {
depends_lib-append port:rubberband
configure.args-replace --disable-rubberband \
--enable-rubberband
}
variant pulseaudio description {Enable PulseAudio support} {
depends_lib-append port:pulseaudio
configure.args-replace --disable-pulse \
--enable-pulse
}
variant jack description {Enable Jack Audio Connection Kit support} {
depends_lib-append port:jack
configure.args-replace --disable-jack \
--enable-jack
}
# TODO: switch that to openal-soft? Leave it as-is?
variant openal description {Enable OpenAL support} {
depends_lib-append port:openal
configure.args-replace --disable-openal \
--enable-openal
}
variant x11 {
depends_lib-append port:xorg-libXext \
port:xorg-libXScrnSaver \
port:xorg-libXinerama \
port:xorg-libXv \
port:xorg-libXrandr
configure.args-delete --disable-x11 \
--disable-xv
configure.args-append --enable-x11 \
--enable-xv
}
variant opengl description {Enable OpenGL output support. Both the CoreVideo and X11 (GLX) outputs are supported} {
if {${os.platform} eq "darwin" && ${os.major} > 10} {
configure.args-replace --disable-gl-cocoa \
--enable-gl-cocoa
}
configure.args-replace --disable-gl \
--enable-gl
if {[variant_isset x11]} {
depends_lib-append port:mesa
configure.args-replace --disable-gl-x11 \
--enable-gl-x11
# FIXME: add EGL? Leave it disabled? Test!
# As far as testing went, EGL is not available on macOS yet.
#configure.args-replace --disable-egl-x11 \
# --enable-egl-x11
}
}
variant caca description {Enable animated ASCII art video output} {
depends_lib-append port:libcaca
configure.args-replace --disable-caca \
--enable-caca
}
variant osd description {Enable onscreen display and TrueType font support} {
depends_lib-append port:lua52
configure.args-delete --disable-lua \
--disable-libass-osd
configure.args-append --enable-lua \
--lua=52fbsd \
--enable-libass-osd
}
variant smb description {Enable Samba support} {
depends_lib-append path:lib/pkgconfig/smbclient.pc:samba3
configure.args-replace --disable-libsmbclient \
--enable-libsmbclient
}
variant debug description {Compile with debugging symbols} {
configure.args-replace --disable-debug-build \
--enable-debug-build
}
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 --disable-pdf-build \
--enable-pdf-build
}
variant zsh description {Enable/install zsh completion support} {
depends_lib-append path:${prefix}/bin/zsh:zsh
configure.args-replace --disable-zsh-comp \
--enable-zsh-comp
}
#variant javascript description {Enable JavaScript support via mujs} {
# depends_lib-append port:mujs
# configure.args-replace --disable-javascript \
# --enable-javascript
#}
variant uchardet description {Enable the uchardet encoding detector} {
depends_lib-append port:uchardet
configure.args-replace --disable-uchardet \
--enable-uchardet
}