From 8ff193e2d24fbb3a194a440f3b4365284c8a1932 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 14 Nov 2024 21:11:20 +0800 Subject: [PATCH] mpv-legacy: move to meson etc. --- multimedia/mpv-legacy/Portfile | 363 ++++++++---------- .../mpv-legacy/files/patch-fix-GL-search.diff | 11 + .../mpv-legacy/files/patch-fix-environ.diff | 32 ++ multimedia/mpv-legacy/files/patch-python.diff | 11 + 4 files changed, 224 insertions(+), 193 deletions(-) create mode 100644 multimedia/mpv-legacy/files/patch-fix-GL-search.diff create mode 100644 multimedia/mpv-legacy/files/patch-fix-environ.diff create mode 100644 multimedia/mpv-legacy/files/patch-python.diff diff --git a/multimedia/mpv-legacy/Portfile b/multimedia/mpv-legacy/Portfile index d562cdc323337..6714a72d41fad 100644 --- a/multimedia/mpv-legacy/Portfile +++ b/multimedia/mpv-legacy/Portfile @@ -5,14 +5,15 @@ PortGroup compiler_blacklist_versions 1.0 PortGroup conflicts_build 1.0 PortGroup github 1.0 PortGroup legacysupport 1.1 -PortGroup waf 1.0 +PortGroup meson 1.0 # Please revbump mpv whenever ffmpeg{,-devel} is updated! name mpv-legacy github.setup mpv-player mpv 0.36.0 v conflicts mpv -revision 1 +revision 2 categories multimedia +platforms {darwin < 12} license GPL-2+ maintainers {@barracuda156 gmail.com:vital.had} openmaintainer @@ -25,33 +26,24 @@ long_description {*}${description} It plays most MPEG/VOB, AVI, Ogg/OGM, and even H.264 movies. homepage https://www.mpv.io -set waf_version 2.0.23 -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 9ff58a63048d9a18d233e40cdb4b529031086a54 \ +checksums rmd160 9ff58a63048d9a18d233e40cdb4b529031086a54 \ sha256 8e6fed056d6981a165bfbb6c6391109a81078aa8be94f1fbb7c95cb5587d446e \ - size 3409580 \ - ${waf_distfile} \ - rmd160 6af5d2bc4c80d5a21045ea031344005cbcb7a512 \ - sha256 28a2e4583314a162cfcbffefb8a9202c1d7869040d30b5852da479b76d9c0491 \ - size 105122 + size 3409580 -installs_libs no +if {![variant_isset libmpv]} { + installs_libs no +} set real_name mpv +set ffmpeg_ver 6 + depends_build-append path:bin/pkg-config:pkgconfig configure.pkg_config_path-prepend \ - ${prefix}/libexec/ffmpeg6/lib/pkgconfig + ${prefix}/libexec/ffmpeg${ffmpeg_ver}/lib/pkgconfig -depends_lib-append port:ffmpeg6 \ +depends_lib-append port:ffmpeg${ffmpeg_ver} \ port:lcms2 \ path:lib/pkgconfig/libass.pc:libass \ port:libiconv \ @@ -60,7 +52,7 @@ depends_lib-append port:ffmpeg6 \ port:zlib # Build system is a bit handicapped and cannot link correctly otherwise: -conflicts_build ffmpeg ffmpeg-devel +conflicts_build ffmpeg # mpv(18616,0xf0185000) malloc: *** error for object 0xe26e600: # incorrect checksum for freed object - object was probably modified after being freed. @@ -68,8 +60,11 @@ legacysupport.redirect_bins ${real_name} universal_variant no -# network is removed from defaults due to a build conflict with ffmpeg4. -default_variants +audiocd +bluray +dvd +libarchive +osd +opengl +sdl2 +default_variants +audiocd +bluray +dvd +libarchive +libmpv +osd +opengl +sdl2 + +if {![variant_isset network]} { + default_variants-append +ytdlp +} platform darwin { default_variants-append +rubberband @@ -89,60 +84,85 @@ platform darwin { } } -# Current waf doesn't support --nocache anymore. Set by PortGroup. -configure.post_args-delete --nocache - -configure.args-append --enable-cocoa \ - --enable-cplugins \ - --enable-manpage-build \ - --enable-swift \ - --enable-zimg \ - --enable-zlib \ - --disable-android \ - --disable-audiounit \ - --disable-coreaudio \ - --disable-cuda-hwaccel \ - --disable-direct3d \ - --disable-dvbin \ - --disable-egl-angle-lib \ - --disable-egl-angle-win32 \ - --disable-egl-drm \ - --disable-html-build \ - --disable-ios-gl \ - --disable-opensles \ - --disable-plain-gl \ - --disable-rpi \ - --disable-videotoolbox-gl - # 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-caca \ - --disable-cdda \ - --disable-clang-database \ - --disable-debug-build \ - --disable-dvdnav \ - --disable-egl-x11 \ - --disable-gl \ - --disable-gl-cocoa \ - --disable-gl-x11 \ - --disable-jack \ - --disable-javascript \ - --disable-jpeg \ - --disable-libarchive \ - --disable-libbluray \ - --disable-libplacebo \ - --disable-lua \ - --disable-openal \ - --disable-pdf-build \ - --disable-pulse \ - --disable-rubberband \ - --disable-tv \ - --disable-uchardet \ - --disable-vapoursynth \ - --disable-x11 \ - --disable-xv + +# Misc build settings +configure.args-append --buildtype=release \ + -Dandroid-media-ndk=disabled \ + -Dcdda=disabled \ + -Dcplugins=disabled \ + -Dcuda-hwaccel=disabled \ + -Ddvbin=disabled \ + -Ddvdnav=disabled \ + -Dhtml-build=disabled \ + -Diconv=enabled \ + -Djavascript=disabled \ + -Djpeg=disabled \ + -Dlcms2=enabled \ + -Dlibarchive=disabled \ + -Dlibavdevice=disabled \ + -Dlibbluray=disabled \ + -Dlibmpv=false \ + -Dlua=disabled \ + -Dmanpage-build=disabled \ + -Dpdf-build=disabled \ + -Dpthread-debug=disabled \ + -Drubberband=disabled \ + -Duchardet=disabled \ + -Duwp=disabled \ + -Dvapoursynth=disabled \ + -Dvulkan=disabled \ + -Dsdl2=disabled \ + -Dtests=false \ + -Dzimg=enabled \ + -Dzlib=enabled + +# Mac-specific settings +configure.args-append -Daudiounit=disabled \ + -Dcocoa=disabled \ + -Dgl-cocoa=disabled \ + -Dios-gl=disabled \ + -Dmacos-cocoa-cb=disabled \ + -Dmacos-media-player=disabled \ + -Dswift-build=disabled \ + -Dvideotoolbox-gl=disabled + +# Audio +configure.args-append -Dalsa=disabled \ + -Dcoreaudio=disabled \ + -Djack=disabled \ + -Dopenal=disabled \ + -Dopensles=disabled \ + -Dpipewire=disabled \ + -Dpulse=disabled \ + -Dsdl2-audio=disabled \ + -Dsndio=disabled + +# Video +configure.args-append -Dcaca=disabled \ + -Dd3d11=disabled \ + -Ddirect3d=disabled \ + -Ddmabuf-wayland=disabled \ + -Ddrm=disabled \ + -Degl=disabled \ + -Degl-angle-lib=disabled \ + -Degl-angle-win32=disabled \ + -Degl-drm=disabled \ + -Degl-wayland=disabled \ + -Degl-x11=disabled \ + -Dgbm=disabled \ + -Dgl=disabled \ + -Dgl-x11=disabled \ + -Dlibplacebo=disabled \ + -Dplain-gl=enabled \ + -Dsdl2-video=disabled \ + -Dvulkan=disabled \ + -Dwayland=disabled \ + -Dx11=disabled \ + -Dxv=disabled # Fix picking up the correct talloc version. # -isystem has the added benefit of moving the include @@ -152,7 +172,9 @@ configure.args-append --disable-caca \ # directory.) configure.cppflags-replace -I${prefix}/include -isystem${prefix}/include -build.args-append -v +# ao_coreaudio_exclusive.c:133:32: error: passing argument 3 of 'AudioObjectRemovePropertyListener' +# from incompatible pointer type [-Wincompatible-pointer-types] +configure.cflags-append -Wno-error=incompatible-pointer-types # Clear CPATH and LIBRARY_PATH because a ncurses include file # conflicts with the one in MacPorts. It doesn't matter much anyway @@ -161,38 +183,18 @@ build.args-append -v compiler.cpath compiler.library_path -patchfiles-append patch-apple_utils.c-should-be-included-for-Darwin.diff +patchfiles-append patch-apple_utils.c-should-be-included-for-Darwin.diff \ + patch-fix-environ.diff \ + patch-fix-GL-search.diff \ + patch-python.diff 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-* - } - - if {${os.major} <= 14 || ${configure.build_arch} ni [list x86_64 arm64]} { + if {${os.major} > 14} { # Disable Cocoa output. # Users on old systems will need to embrace X11. - configure.args-replace --enable-cocoa \ - --disable-cocoa - + configure.args-replace -Dcocoa=disabled \ + -Dcocoa=enabled + } else { default_variants-append +x11 } } @@ -214,19 +216,11 @@ platform darwin { which is the location preferred by upstream. }] - # cocoa-cb backend requires Swift 5 or 4 support, which is only available - # in Xcode 9.1 onwards. - # From version 0.34.0 Swift 4.1 (Xcode 9.3+) or later is required - if {[vercmp ${xcodeversion} 9.3] < 0} { - configure.args-replace --enable-swift \ - --disable-swift - } - # VideotoolBox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay". # It provides support for H265, H264, H263, MPEG1, MPEG2 and MPEG4. if {${os.major} > 14} { - configure.args-delete --disable-videotoolbox-gl - configure.args-append --enable-videotoolbox-gl + configure.args-replace -Dvideotoolbox-gl=disabled \ + -Dvideotoolbox-gl=enabled } if {${os.major} > 11} { @@ -247,15 +241,9 @@ platform darwin { compiler.blacklist-append \ {clang < 700} - # Should eliminate most swift (module) related problems - if {[vercmp ${xcodeversion} 9.1] >= 0 || ${os.major} >= 16} { - use_xcode yes - } - # Shared build fixes for 10.6 and 10.7. if {${os.major} < 12} { patchfiles-append patch-misc-import-CoreVideo.diff - patchfiles-append patch-waftools-detection-compiler-py-no-tautological.diff } # Make mpv work as good as possible on 10.6 and below. No Cocoa support, instead concentrate @@ -263,7 +251,6 @@ platform darwin { # Also fix some other minor compile issues only manifesting on 10.6 and below along the way. if {${os.major} < 11} { patchfiles-append patch-audio_out_ao_coreaudio_utils.c-add-missing-header-for-getpid.diff - patchfiles-append patch-waftools_detections_compiler.py-support-older-GCC.diff notes-append { On systems older than Lion (10.7) or on architectures other than x86_64, Cocoa output support is not available.\ @@ -327,14 +314,10 @@ platform darwin { } # Shameless copy from ipe-tools. -set python.versions {38 39 310 311} -dict set python.legacy_versions 37 38 -# 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 311 +set python.versions {39 310 311 312} +dict set python.legacy_versions 38 39 + +set python.default_version 312 set python.version "" # Create python variants. @@ -347,7 +330,6 @@ foreach ver ${python.versions} { if {${ver} == ${over}} { continue } - append variant_line " conflicts python${over}" } @@ -370,7 +352,6 @@ dict for {legacy_ver replace_ver} ${python.legacy_versions} { if {${legacy_ver} == ${over} || ${replace_ver} == ${over}} { continue } - append variant_line " conflicts python${over}" } @@ -391,12 +372,10 @@ if {${variant_none}} { } # Set ${python.version} to the currently active variant. -# And let waf use the same python version as 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] - waf.python_branch ${python_branch} } } @@ -405,13 +384,20 @@ if {[string length ${python.version}] == 0} { 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-patch { - set python_ver_dot [string index ${python.version} 0].[string range ${python.version} 1 end] - reinplace -W "${worksrcpath}" "s|'rst2man'|'rst2man-${python_ver_dot}'|" wscript -} + reinplace "s|@PYTHON@|${prefix}/bin/python${python_ver_dot}|" \ + ${worksrcpath}/meson.build -post-extract { - xinstall -m 0644 -W "${distpath}" "${waf_distfile}" "${worksrcpath}/waf" + fs-traverse f ${worksrcpath} { + if {[string match *.py ${f}]} { + ui_info "patching testpath: ${f}" + reinplace -q "s|/usr/bin/env python3|${prefix}/bin/python${python_ver_dot}|g" ${f} + } + } } post-destroot { @@ -453,14 +439,14 @@ variant bundle description {Enable the optional macOS bundle of mpv} { } variant coreaudio description {Enable CoreAudio support} { - configure.args-replace --disable-coreaudio \ - --enable-coreaudio + configure.args-replace -Dcoreaudio=disabled \ + -Dcoreaudio=enabled } variant screenshot description {Enable optional screenshot support} { depends_lib-append path:include/turbojpeg.h:libjpeg-turbo - configure.args-replace --disable-jpeg \ - --enable-jpeg + configure.args-replace -Djpeg=disabled \ + -Djpeg=enabled } variant network conflicts ytdlp description {Enable networking support via youtube-dl (supports wide variety of pages)} { @@ -475,7 +461,7 @@ variant bluray description {Enable Bluray and AACS/BD+ encryption support} { depends_lib-append port:libbluray depends_run-append port:libaacs \ port:libbdplus - configure.args-delete --disable-libbluray + configure.args-delete -Dlibbluray=disabled notes-append { To play Bluray discs with AACS encryption, decryption key database file "keydb.cfg" needs to be placed at: @@ -488,45 +474,45 @@ variant bluray description {Enable Bluray and AACS/BD+ encryption support} { variant dvd description {Enable DVD and DeCSS support} { depends_lib-append port:libdvdread \ port:libdvdnav - configure.args-replace --disable-dvdnav \ - --enable-dvdnav + 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 --disable-cdda \ - --enable-cdda + 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 --disable-libarchive \ - --enable-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 --disable-rubberband \ - --enable-rubberband + configure.args-replace -Drubberband=disabled \ + -Drubberband=enabled } variant pulseaudio description {Enable PulseAudio support} { depends_lib-append port:pulseaudio - configure.args-replace --disable-pulse \ - --enable-pulse + configure.args-replace -Dpulse=disabled \ + -Dpulse=enabled } variant jack description {Enable Jack Audio Connection Kit support} { depends_lib-append port:jack - configure.args-replace --disable-jack \ - --enable-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 --disable-openal \ - --enable-openal + configure.args-replace -Dopenal=disabled \ + -Dopenal=enabled } variant x11 { @@ -537,25 +523,23 @@ variant x11 { port:xorg-libXScrnSaver \ port:xorg-libXv - configure.args-delete --disable-x11 \ - --disable-xv - configure.args-append --enable-x11 \ - --enable-xv + configure.args-delete -Dx11=disabled \ + -Dxv=disabled + configure.args-append -Dx11=enabled \ + -Dxv=enabled } variant opengl description {Enable OpenGL output support. Both the CoreVideo and X11 (GLX) outputs are supported} { + configure.args-replace -Dgl=disabled \ + -Dgl=enabled if {${os.platform} eq "darwin" && ${os.major} > 14} { - configure.args-replace --disable-gl-cocoa \ - --enable-gl-cocoa + configure.args-replace -Dgl-cocoa=disabled \ + -Dgl-cocoa=enabled } - - 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 + configure.args-replace -Dgl-x11=disabled \ + -Dgl-x11=enabled # 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 \ @@ -566,33 +550,29 @@ variant opengl description {Enable OpenGL output support. Both the CoreVideo and variant sdl2 description {Enable SDL2 output} { depends_lib-append port:libsdl2 - configure.args-append --enable-sdl2 \ - --enable-sdl2-audio \ - --enable-sdl2-video + configure.args-delete -Dsdl2=disabled \ + -Dsdl2-audio=disabled \ + -Dsdl2-video=disabled + configure.args-append -Dsdl2=enabled \ + -Dsdl2-audio=enabled \ + -Dsdl2-video=enabled } variant caca description {Enable animated ASCII art video output} { depends_lib-append port:libcaca - configure.args-replace --disable-caca \ - --enable-caca + configure.args-replace -Dcaca=disabled \ + -Dcaca=enabled } variant osd description {Enable onscreen display and TrueType font support} { depends_lib-append port:lua52 - configure.args-delete --disable-lua - configure.args-append --enable-lua \ + configure.args-delete -Dlua=disabled \ + configure.args-append -Dlua=enabled \ --lua=52fbsd } -#variant smb description {Enable Samba support} { -# depends_lib-append path:lib/pkgconfig/smbclient.pc:samba3 -# configure.args-replace --disable-libsmbclient \ -# --enable-libsmbclient -#} -# Removed in 0.33.0 - variant debug description {Compile with debugging symbols} { - configure.args-delete --disable-debug-build + configure.args-delete -Dpthread-debug=disabled } variant printable_doc description {Generate printable documents (PDF help)} { @@ -600,24 +580,19 @@ variant printable_doc description {Generate printable documents (PDF help)} { depends_build-append port:rst2pdf \ port:py27-pdfrw \ port:py27-Pillow - configure.args-replace --disable-pdf-build \ - --enable-pdf-build + 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 --disable-javascript \ -# --enable-javascript -#} - variant uchardet description {Enable the uchardet encoding detector} { depends_lib-append port:uchardet - configure.args-replace --disable-uchardet \ - --enable-uchardet + configure.args-replace -Duchardet=disabled \ + -Duchardet=enabled } variant libmpv description {Enable the libmpv library} { - configure.args-append --enable-libmpv-shared + configure.args-replace -Dlibmpv=false \ + -Dlibmpv=true \ } if {![variant_isset bundle]} { @@ -626,3 +601,5 @@ if {![variant_isset bundle]} { system "${prefix}/bin/update-desktop-database ${prefix}/share/applications" } } + +livecheck none diff --git a/multimedia/mpv-legacy/files/patch-fix-GL-search.diff b/multimedia/mpv-legacy/files/patch-fix-GL-search.diff new file mode 100644 index 0000000000000..0117c9e016c70 --- /dev/null +++ b/multimedia/mpv-legacy/files/patch-fix-GL-search.diff @@ -0,0 +1,11 @@ +--- meson.build ++++ meson.build 2024-11-14 14:50:08.000000000 +0800 +@@ -1073,7 +1073,7 @@ + features += {'gl': false} + + GL = dependency('', required: false) +-if darwin ++if features['cocoa'] + GL = dependency('appleframeworks', modules: 'OpenGL', required: get_option('gl-cocoa')) + elif features['win32-desktop'] + GL = dependency('GL', required: get_option('gl-win32')) diff --git a/multimedia/mpv-legacy/files/patch-fix-environ.diff b/multimedia/mpv-legacy/files/patch-fix-environ.diff new file mode 100644 index 0000000000000..819c1c5ea5109 --- /dev/null +++ b/multimedia/mpv-legacy/files/patch-fix-environ.diff @@ -0,0 +1,32 @@ +--- osdep/subprocess-posix.c 2023-07-24 01:10:36.000000000 +0800 ++++ osdep/subprocess-posix.c 2024-11-13 04:32:01.000000000 +0800 +@@ -31,7 +31,12 @@ + #include "osdep/io.h" + #include "stream/stream.h" + ++#ifdef __APPLE__ ++#include ++#define environ (*_NSGetEnviron()) ++#else + extern char **environ; ++#endif + + #ifdef SIGRTMAX + #define SIGNAL_MAX SIGRTMAX + +--- player/lua.c 2023-07-24 01:10:36.000000000 +0800 ++++ player/lua.c 2024-11-13 04:44:10.000000000 +0800 +@@ -52,6 +52,13 @@ + #include "client.h" + #include "libmpv/client.h" + ++#ifdef __APPLE__ ++#include ++#define environ (*_NSGetEnviron()) ++#else ++extern char **environ; ++#endif ++ + // List of builtin modules and their contents as strings. + // All these are generated from player/lua/*.lua + static const char * const builtin_lua_scripts[][2] = { diff --git a/multimedia/mpv-legacy/files/patch-python.diff b/multimedia/mpv-legacy/files/patch-python.diff new file mode 100644 index 0000000000000..8cbeb8e381079 --- /dev/null +++ b/multimedia/mpv-legacy/files/patch-python.diff @@ -0,0 +1,11 @@ +--- meson.build ++++ meson.build 2024-11-14 15:06:36.000000000 +0800 +@@ -13,7 +13,7 @@ + + build_root = meson.project_build_root() + source_root = meson.project_source_root() +-python = find_program('python3') ++python = find_program('@PYTHON@') + + # ffmpeg + libavcodec = dependency('libavcodec', version: '>= 58.134.100')