media-video/mpv: sync live

Closes: https://github.com/gentoo/gentoo/pull/28162
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
Ionen Wolkens
2022-11-06 18:28:43 -05:00
parent 6d12bd1af3
commit edcc8441e0

View File

@@ -3,108 +3,51 @@
EAPI=8
LUA_COMPAT=( lua5-{1..2} luajit )
LUA_COMPAT=( lua5-1 luajit )
PYTHON_COMPAT=( python3_{8..11} )
PYTHON_REQ_USE='threads(+)'
inherit edo flag-o-matic lua-single meson optfeature pax-utils python-single-r1 xdg
inherit edo flag-o-matic lua-single optfeature meson pax-utils python-single-r1 toolchain-funcs xdg
DESCRIPTION="Media player based on MPlayer and mplayer2"
HOMEPAGE="https://mpv.io/ https://github.com/mpv-player/mpv"
if [[ ${PV} == *9999* ]]; then
EGIT_REPO_URI="https://github.com/mpv-player/mpv.git"
if [[ ${PV} == 9999 ]]; then
inherit git-r3
DOCS=()
EGIT_REPO_URI="https://github.com/mpv-player/mpv.git"
else
SRC_URI="https://github.com/mpv-player/mpv/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux"
DOCS=( RELEASE_NOTES )
HASH_MPV=c416a38ef227067ef7b81b9650a13157300cdfbe
SRC_URI="https://github.com/mpv-player/mpv/archive/${HASH_MPV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${HASH_MPV}"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux"
fi
DOCS+=( README.md DOCS/{client-api,interface}-changes.rst )
# See Copyright in sources and Gentoo bug #506946. libmpv is ISC.
# See https://github.com/mpv-player/mpv/blob/6265724f3331e3dee8d9ec2b6639def5004a5fa2/Copyright which
# says other files may be BSD/MIT/ISC.
LICENSE="LGPL-2.1+ GPL-2+ BSD MIT ISC"
SLOT="0"
IUSE="+alsa aqua archive bluray cdda +cli coreaudio cplugins debug doc drm dvb
dvd +egl gamepad gbm +iconv jack javascript jpeg lcms libcaca libmpv +lua
mmal nvenc openal +opengl pipewire pulseaudio raspberry-pi rubberband sdl
selinux sndio test tools +uchardet vaapi vdpau +vector vulkan wayland +X +xv zlib zimg"
DESCRIPTION="Media player for the command line"
HOMEPAGE="https://mpv.io/"
LICENSE="LGPL-2.1+ GPL-2+ BSD ISC MIT" #506946
SLOT="0/2" # soname
IUSE="
+X +alsa aqua archive bluray cdda +cli coreaudio debug drm dvb
dvd +egl gamepad +iconv jack javascript jpeg lcms libcaca libmpv
+libplacebo +lua mmal nvenc openal opengl pipewire pulseaudio
raspberry-pi rubberband sdl selinux sndio test tools +uchardet
vaapi vdpau +vector vulkan wayland +xv zimg zlib"
REQUIRED_USE="
${PYTHON_REQUIRED_USE}
|| ( cli libmpv )
aqua? ( opengl )
egl? ( || ( gbm X wayland ) )
gamepad? ( sdl )
gbm? ( drm egl opengl )
lcms? ( opengl )
egl? ( || ( X drm wayland ) )
libplacebo? ( || ( egl opengl vulkan ) )
lua? ( ${LUA_REQUIRED_USE} )
nvenc? ( opengl )
opengl? ( || ( aqua egl X raspberry-pi !cli ) )
raspberry-pi? ( opengl )
test? ( opengl )
nvenc? ( || ( egl opengl vulkan ) )
opengl? ( || ( X aqua ) )
test? ( cli )
tools? ( cli )
uchardet? ( iconv )
vaapi? ( || ( gbm X wayland ) )
vaapi? ( || ( X egl libplacebo wayland ) )
vdpau? ( X )
vulkan? ( || ( X wayland ) )
wayland? ( egl )
X? ( egl? ( opengl ) )
xv? ( X )
${PYTHON_REQUIRED_USE}
"
vulkan? ( || ( X wayland ) libplacebo )
xv? ( X )"
RESTRICT="!test? ( test )"
COMMON_DEPEND="
>=media-video/ffmpeg-4.0:0=[encode,threads,vaapi?,vdpau?]
alsa? ( >=media-libs/alsa-lib-1.0.18 )
archive? ( >=app-arch/libarchive-3.4.0:= )
bluray? ( >=media-libs/libbluray-0.3.0:= )
cdda? ( dev-libs/libcdio-paranoia
dev-libs/libcdio:= )
drm? ( x11-libs/libdrm )
dvd? (
>=media-libs/libdvdnav-4.2.0:=
>=media-libs/libdvdread-4.1.0:=
)
egl? ( media-libs/mesa[egl(+),gbm(+)?,wayland(-)?] )
gamepad? ( media-libs/libsdl2 )
iconv? (
virtual/libiconv
uchardet? ( app-i18n/uchardet )
)
jack? ( virtual/jack )
javascript? ( >=dev-lang/mujs-1.0.0 )
jpeg? ( media-libs/libjpeg-turbo:= )
lcms? ( >=media-libs/lcms-2.6:2 )
>=media-libs/libass-0.12.1:=[fontconfig,harfbuzz(+)]
virtual/ttf-fonts
libcaca? ( >=media-libs/libcaca-0.99_beta18 )
lua? ( ${LUA_DEPS} )
openal? ( >=media-libs/openal-1.13 )
pulseaudio? ( media-libs/libpulse )
pipewire? ( media-video/pipewire:= )
raspberry-pi? ( >=media-libs/raspberrypi-userland-0_pre20160305-r1 )
rubberband? ( >=media-libs/rubberband-1.8.0 )
sdl? ( media-libs/libsdl2[sound,threads,video] )
sndio? ( media-sound/sndio )
vaapi? ( media-libs/libva:=[drm(+)?,X?,wayland?] )
vdpau? ( x11-libs/libvdpau )
vulkan? (
>=media-libs/libplacebo-4.192.1:=[vulkan]
media-libs/shaderc
)
wayland? (
>=dev-libs/wayland-1.6.0
>=dev-libs/wayland-protocols-1.14
>=x11-libs/libxkbcommon-0.3.0
)
media-libs/libass:=[fontconfig]
media-video/ffmpeg:=[encode,threads,vaapi?,vdpau?]
X? (
x11-libs/libX11
x11-libs/libXScrnSaver
@@ -112,176 +55,202 @@ COMMON_DEPEND="
x11-libs/libXinerama
x11-libs/libXpresent
x11-libs/libXrandr
opengl? (
x11-libs/libXdamage
virtual/opengl
)
xv? ( x11-libs/libXv )
)
zlib? ( sys-libs/zlib )
zimg? ( >=media-libs/zimg-2.9.2 )
"
DEPEND="${COMMON_DEPEND}
dvb? ( virtual/linuxtv-dvb-headers )
nvenc? ( >=media-libs/nv-codec-headers-8.2.15.7 )
"
RDEPEND="${COMMON_DEPEND}
nvenc? ( x11-drivers/nvidia-drivers[X] )
alsa? ( media-libs/alsa-lib )
archive? ( app-arch/libarchive:= )
bluray? ( media-libs/libbluray:= )
cdda? (
dev-libs/libcdio-paranoia:=
dev-libs/libcdio:=
)
drm? (
media-libs/mesa[gbm(+)]
x11-libs/libdrm
)
dvd? (
media-libs/libdvdnav
media-libs/libdvdread:=
)
egl? ( media-libs/libglvnd )
gamepad? ( media-libs/libsdl2[joystick] )
iconv? (
virtual/libiconv
uchardet? ( app-i18n/uchardet )
)
jack? ( virtual/jack )
javascript? ( dev-lang/mujs:= )
jpeg? ( media-libs/libjpeg-turbo:= )
lcms? ( media-libs/lcms:2 )
libcaca? ( media-libs/libcaca )
libplacebo? (
>=media-libs/libplacebo-4.202:=[opengl?,vulkan?]
egl? ( media-libs/libplacebo[opengl] )
)
lua? ( ${LUA_DEPS} )
openal? ( media-libs/openal )
opengl? ( media-libs/libglvnd[X?] )
pipewire? ( media-video/pipewire:= )
pulseaudio? ( media-libs/libpulse )
raspberry-pi? ( media-libs/raspberrypi-userland )
rubberband? ( media-libs/rubberband )
sdl? ( media-libs/libsdl2[sound,threads,video] )
sndio? ( media-sound/sndio:= )
vaapi? ( media-libs/libva:=[X?,drm(+)?,wayland?] )
vdpau? ( x11-libs/libvdpau )
vulkan? (
media-libs/shaderc
media-libs/vulkan-loader[X?,wayland?]
)
wayland? (
dev-libs/wayland
dev-libs/wayland-protocols
x11-libs/libxkbcommon
)
zimg? ( media-libs/zimg )
zlib? ( sys-libs/zlib:= )"
RDEPEND="
${COMMON_DEPEND}
selinux? ( sec-policy/selinux-mplayer )
tools? ( ${PYTHON_DEPS} )
"
BDEPEND="dev-python/docutils
tools? ( ${PYTHON_DEPS} )"
DEPEND="
${COMMON_DEPEND}
X? ( x11-base/xorg-proto )
dvb? ( virtual/linuxtv-dvb-headers )
nvenc? ( media-libs/nv-codec-headers )
wayland? ( dev-libs/wayland-protocols )"
BDEPEND="
${PYTHON_DEPS}
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PN}-9999-docdir.patch
)
cli? ( dev-python/docutils )
wayland? ( dev-util/wayland-scanner )"
pkg_setup() {
use lua && lua-single_pkg_setup
use tools && python-single-r1_pkg_setup
python-single-r1_pkg_setup
}
src_prepare() {
default
[[ ${PV} == 9999 ]] || sed -i "s/UNKNOWN/${HASH_MPV::11}/" VERSION || die
sed -i "s/'rst2html/&.py/" meson.build || die
}
src_configure() {
tc-export CC PKG_CONFIG AR
if use !debug; then
if use test; then
einfo "Skipping -DNDEBUG due to USE=test"
else
append-cppflags -DNDEBUG # treated specially
fi
fi
if use raspberry-pi; then
append-cflags -I"${ESYSROOT}/opt/vc/include"
append-ldflags -L"${ESYSROOT}/opt/vc/lib"
append-cflags -I"${ESYSROOT}"/opt/vc/include
append-ldflags -L"${ESYSROOT}"/opt/vc/lib
fi
if use debug && ! use test; then
append-cppflags -DNDEBUG
fi
mpv_feature_multi() {
local use set
for use in ${1} ${2}; do
use ${use} || set=disabled
done
echo -D${3-${2}}=${set-enabled}
}
local emesonargs=(
-Dbuild-date=false
$(meson_use cli cplayer)
$(meson_use libmpv)
$(meson_use test tests)
$(meson_feature doc html-build)
-Dmanpage-build=enabled
$(meson_feature cli html-build)
$(meson_feature cli manpage-build)
-Dpdf-build=disabled
$(meson_feature cplugins)
-Dbuild-date=false
# misc options
$(meson_feature archive libarchive)
$(meson_feature bluray libbluray)
$(meson_feature cdda)
-Dcplugins=enabled
$(meson_feature dvb dvbin)
$(meson_feature dvd dvdnav)
$(meson_feature gamepad sdl2-gamepad)
$(meson_feature iconv)
$(meson_feature javascript)
$(meson_feature zlib)
$(meson_feature bluray libbluray)
$(meson_feature dvd dvdnav)
$(meson_feature cdda)
$(meson_feature uchardet)
$(meson_feature rubberband)
$(meson_feature lcms lcms2)
# Only available in overlays.
-Dvapoursynth=disabled
$(meson_feature vector)
$(meson_feature archive libarchive)
-Dlibavdevice=enabled
$(meson_feature lcms lcms2)
-Dlua=$(usex lua "${ELUA}" disabled)
$(meson_feature rubberband)
-Dsdl2=$(use gamepad || use sdl && echo enabled || echo disabled) #857156
$(meson_feature uchardet)
-Dvapoursynth=disabled # only available in overlays
$(meson_feature vector)
$(meson_feature zimg)
$(meson_feature zlib)
# Needed for either of the more specific audio or video options
# bug #857156
$(meson_feature sdl sdl2)
# Audio outputs:
$(meson_feature sdl sdl2-audio)
$(meson_feature pulseaudio pulse)
# audio output
$(meson_feature alsa)
$(meson_feature coreaudio)
$(meson_feature jack)
$(meson_feature openal)
$(meson_feature pipewire)
-Dopensles=disabled
$(meson_feature alsa)
$(meson_feature coreaudio)
$(meson_feature pulseaudio pulse)
$(meson_feature sdl sdl2-audio)
$(meson_feature sndio)
# Video outputs:
$(meson_feature sdl sdl2-video)
# video output
$(meson_feature X x11)
$(meson_feature aqua cocoa)
$(meson_feature drm)
$(meson_feature gbm)
$(meson_feature drm gbm)
$(meson_feature jpeg)
$(meson_feature libcaca caca)
$(meson_feature libplacebo)
$(meson_feature mmal rpi-mmal)
$(meson_feature sdl sdl2-video)
-Dsixel=disabled # TODO? needs keywording/testing
$(meson_feature wayland)
$(meson_feature X x11)
$(meson_feature xv)
$(meson_feature opengl gl)
$(usex opengl "$(meson_feature aqua gl-cocoa)" '-Dgl-cocoa=disabled')
$(usex opengl "$(meson_feature X gl-x11)" '-Dgl-x11=disabled')
-Dgl=$(use egl || use libmpv || use opengl || use raspberry-pi &&
echo enabled || echo disabled)
$(meson_feature egl)
$(usex egl "$(meson_feature X egl-x11)" "-Degl-x11=disabled")
$(usex egl "$(meson_feature gbm egl-drm)" "-Degl-drm=disabled")
$(usex opengl "$(meson_feature wayland egl-wayland)" '-Degl-wayland=disabled')
$(meson_feature vdpau)
$(usex vdpau "$(meson_feature opengl vdpau-gl-x11)" '-Dvdpau-gl-x11=disabled')
$(meson_feature vaapi) # See below for vaapi-glx, vaapi-x-egl.
$(usex vaapi "$(meson_feature X vaapi-x11)" "-Dvaapi-x11=disabled")
$(usex vaapi "$(meson_feature wayland vaapi-wayland)" "-Dvaapi-wayland=disabled")
$(usex vaapi "$(meson_feature gbm vaapi-drm)" "-Dvaapi-drm=disabled")
$(meson_feature libcaca caca)
$(meson_feature jpeg)
$(meson_feature vulkan shaderc)
$(meson_feature vulkan libplacebo)
$(mpv_feature_multi egl X egl-x11)
$(mpv_feature_multi egl drm egl-drm)
$(mpv_feature_multi egl wayland egl-wayland)
$(meson_feature libmpv plain-gl)
$(mpv_feature_multi opengl X gl-x11)
$(mpv_feature_multi opengl aqua gl-cocoa)
$(meson_feature raspberry-pi rpi)
$(meson_feature mmal rpi-mmal)
-Dsixel=disabled
-Dspirv-cross=disabled
$(usex libmpv "$(meson_feature opengl plain-gl)" "-Dplain-gl=disabled")
$(meson_feature opengl gl)
$(meson_feature vulkan)
$(meson_feature gamepad sdl2-gamepad)
$(meson_feature vulkan shaderc)
# HWaccels:
# Automagic Video Toolbox HW acceleration. See Gentoo bug 577332.
# hardware decoding
$(meson_feature nvenc cuda-hwaccel)
$(meson_feature nvenc cuda-interop)
# TV features:
$(meson_feature dvb dvbin)
$(meson_feature vaapi)
$(mpv_feature_multi vaapi X vaapi-x11)
$(mpv_feature_multi 'vaapi X' egl vaapi-x-egl)
$(mpv_feature_multi 'vaapi egl' drm vaapi-drm)
$(mpv_feature_multi 'vaapi egl' wayland vaapi-wayland)
# Miscellaneous features:
$(meson_feature zimg)
)
$(meson_feature vdpau)
$(mpv_feature_multi vdpau opengl vdpau-gl-x11)
if use lua; then
emesonargs+=( -Dlua="${ELUA}" )
else
emesonargs+=( -Dlua=disabled )
fi
if use vaapi && use X; then
emesonargs+=(
$(meson_feature egl vaapi-x-egl)
)
fi
# Not for us
emesonargs+=(
-Duwp=disabled
-Daudiounit=disabled
-Doss-audio=disabled
-Dwasapi=disabled
-Dd3d11=disabled
-Ddirect3d=disabled
$(mpv_feature_multi aqua opengl videotoolbox-gl)
)
meson_src_configure
}
src_test() {
# https://github.com/mpv-player/mpv/blob/master/DOCS/man/options.rst#debugging
edo "${BUILD_DIR}"/mpv --no-config -v --unittest=all-simple
}
@@ -291,10 +260,10 @@ src_install() {
if use lua; then
insinto /usr/share/${PN}
doins -r TOOLS/lua
fi
if use cli && use lua_single_target_luajit; then
pax-mark -m "${ED}"/usr/bin/${PN}
if use cli && use lua_single_target_luajit; then
pax-mark -m "${ED}"/usr/bin/${PN}
fi
fi
if use tools; then
@@ -302,52 +271,19 @@ src_install() {
newbin TOOLS/idet.sh mpv_idet.sh
python_fix_shebang "${ED}"/usr/bin/umpv
fi
if use cli; then
dodir /usr/share/doc/${PF}/html
mv "${ED}"/usr/share/doc/{mpv,${PF}/html}/mpv.html || die
mv "${ED}"/usr/share/doc/{mpv,${PF}/examples} || die
fi
local GLOBIGNORE=*/*build*:*/*policy*
dodoc RELEASE_NOTES DOCS/*.{md,rst}
}
pkg_postinst() {
local rv softvol_0_18_1=0 osc_0_21_0=0 txtsubs_0_24_0=0 opengl_0_25_0=0
for rv in ${REPLACING_VERSIONS}; do
ver_test ${rv} -lt 0.18.1 && softvol_0_18_1=1
ver_test ${rv} -lt 0.21.0 && osc_0_21_0=1
ver_test ${rv} -lt 0.24.0 && txtsubs_0_24_0=1
ver_test ${rv} -lt 0.25.0 && ! use opengl && opengl_0_25_0=1
done
if [[ ${softvol_0_18_1} -eq 1 ]]; then
elog "Since version 0.18.1 the software volume control is always enabled."
elog "This means that volume controls don't change the system volume,"
elog "e.g. per-application volume with PulseAudio."
elog "If you want to restore the previous behaviour, please refer to"
elog
elog "https://wiki.gentoo.org/wiki/Mpv#Volume_in_0.18.1"
elog
fi
if [[ ${osc_0_21_0} -eq 1 ]]; then
elog "In version 0.21.0 the default OSC layout was changed."
elog "If you want to restore the previous layout, please refer to"
elog
elog "https://wiki.gentoo.org/wiki/Mpv#OSC_in_0.21.0"
elog
fi
if [[ ${txtsubs_0_24_0} -eq 1 ]]; then
elog "Since version 0.24.0 subtitles with .txt extension aren't autoloaded."
elog "If you want to restore the previous behaviour, please refer to"
elog
elog "https://wiki.gentoo.org/wiki/Mpv#Subtitles_with_.txt_extension_in_0.24.0"
elog
fi
if [[ ${opengl_0_25_0} -eq 1 ]]; then
elog "Since version 0.25.0 the 'opengl' USE flag is mapped to"
elog "the 'opengl' video output and no longer explicitly requires"
elog "X11 or Mac OS Aqua. Consider enabling the 'opengl' USE flag."
fi
xdg_pkg_postinst
optfeature "URL support" net-misc/yt-dlp
xdg_icon_cache_update
xdg_desktop_database_update
}