Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/mpv/, profiles/
Date: Tue, 22 Dec 2020 22:47:39
Message-Id: 1608677243.38f482f13643da903ebf3ee87ea58d7196b5423a.marecki@gentoo
1 commit: 38f482f13643da903ebf3ee87ea58d7196b5423a
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 22 22:44:28 2020 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 22 22:47:23 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38f482f1
7
8 media-video/mpv: migrate to lua-single.eclass
9
10 Compatibility as per upstream build scripts. Said scripts do support
11 specifying which Lua implementation to use, not directly by specifying
12 the pkgconfig module name though - some variable mangling has been
13 required. Still, it works.
14
15 Closes: https://bugs.gentoo.org/752765
16 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
17
18 media-video/mpv/mpv-0.33.0-r100.ebuild | 358 +++++++++++++++++++++++++++++++++
19 profiles/package.mask | 1 +
20 2 files changed, 359 insertions(+)
21
22 diff --git a/media-video/mpv/mpv-0.33.0-r100.ebuild b/media-video/mpv/mpv-0.33.0-r100.ebuild
23 new file mode 100644
24 index 00000000000..599cc169b9d
25 --- /dev/null
26 +++ b/media-video/mpv/mpv-0.33.0-r100.ebuild
27 @@ -0,0 +1,358 @@
28 +# Copyright 1999-2020 Gentoo Authors
29 +# Distributed under the terms of the GNU General Public License v2
30 +
31 +EAPI=7
32 +
33 +LUA_COMPAT=( lua5-{1..2} luajit )
34 +PYTHON_COMPAT=( python3_{7..9} )
35 +PYTHON_REQ_USE='threads(+)'
36 +
37 +WAF_PV=2.0.9
38 +
39 +inherit bash-completion-r1 flag-o-matic lua-single pax-utils python-r1 toolchain-funcs waf-utils xdg-utils
40 +
41 +DESCRIPTION="Media player based on MPlayer and mplayer2"
42 +HOMEPAGE="https://mpv.io/ https://github.com/mpv-player/mpv"
43 +
44 +if [[ ${PV} != *9999* ]]; then
45 + SRC_URI="https://github.com/mpv-player/mpv/archive/v${PV}.tar.gz -> ${P}.tar.gz"
46 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86 ~amd64-linux"
47 + DOCS=( RELEASE_NOTES )
48 +else
49 + EGIT_REPO_URI="https://github.com/mpv-player/mpv.git"
50 + inherit git-r3
51 + DOCS=(); SRC_URI=""
52 +fi
53 +SRC_URI+=" https://waf.io/waf-${WAF_PV}"
54 +DOCS+=( README.md DOCS/{client-api,interface}-changes.rst )
55 +
56 +# See Copyright in sources and Gentoo bug 506946. Waf is BSD, libmpv is ISC.
57 +LICENSE="LGPL-2.1+ GPL-2+ BSD ISC"
58 +SLOT="0"
59 +IUSE="+alsa aqua archive bluray cdda +cli coreaudio cplugins cuda debug doc drm dvb
60 + dvd +egl gamepad gbm +iconv jack javascript jpeg lcms libcaca libmpv +lua
61 + openal +opengl pulseaudio raspberry-pi rubberband sdl
62 + selinux test tools +uchardet vaapi vdpau vulkan wayland +X +xv zlib zimg"
63 +
64 +REQUIRED_USE="
65 + || ( cli libmpv )
66 + aqua? ( opengl )
67 + cuda? ( opengl )
68 + egl? ( || ( gbm X wayland ) )
69 + gamepad? ( sdl )
70 + gbm? ( drm egl opengl )
71 + lcms? ( opengl )
72 + lua? ( ${LUA_REQUIRED_USE} )
73 + opengl? ( || ( aqua egl X raspberry-pi !cli ) )
74 + raspberry-pi? ( opengl )
75 + test? ( opengl )
76 + tools? ( cli )
77 + uchardet? ( iconv )
78 + vaapi? ( || ( gbm X wayland ) )
79 + vdpau? ( X )
80 + vulkan? ( || ( X wayland ) )
81 + wayland? ( egl )
82 + X? ( egl? ( opengl ) )
83 + xv? ( X )
84 + ${PYTHON_REQUIRED_USE}
85 +"
86 +
87 +RESTRICT="!test? ( test )"
88 +
89 +COMMON_DEPEND="
90 + >=media-video/ffmpeg-4.0:0=[encode,threads,vaapi?,vdpau?]
91 + alsa? ( >=media-libs/alsa-lib-1.0.18 )
92 + archive? ( >=app-arch/libarchive-3.4.0:= )
93 + bluray? ( >=media-libs/libbluray-0.3.0:= )
94 + cdda? ( dev-libs/libcdio-paranoia
95 + dev-libs/libcdio:= )
96 + drm? ( x11-libs/libdrm )
97 + dvd? (
98 + >=media-libs/libdvdnav-4.2.0:=
99 + >=media-libs/libdvdread-4.1.0:=
100 + )
101 + egl? ( media-libs/mesa[egl,gbm(-)?,wayland(-)?] )
102 + gamepad? ( media-libs/libsdl2 )
103 + iconv? (
104 + virtual/libiconv
105 + uchardet? ( app-i18n/uchardet )
106 + )
107 + jack? ( virtual/jack )
108 + javascript? ( >=dev-lang/mujs-1.0.0 )
109 + jpeg? ( virtual/jpeg:0 )
110 + lcms? ( >=media-libs/lcms-2.6:2 )
111 + >=media-libs/libass-0.12.1:=[fontconfig,harfbuzz(+)]
112 + virtual/ttf-fonts
113 + libcaca? ( >=media-libs/libcaca-0.99_beta18 )
114 + lua? ( ${LUA_DEPS} )
115 + openal? ( >=media-libs/openal-1.13 )
116 + pulseaudio? ( media-sound/pulseaudio )
117 + raspberry-pi? ( >=media-libs/raspberrypi-userland-0_pre20160305-r1 )
118 + rubberband? ( >=media-libs/rubberband-1.8.0 )
119 + sdl? ( media-libs/libsdl2[sound,threads,video] )
120 + vaapi? ( x11-libs/libva:=[drm?,X?,wayland?] )
121 + vdpau? ( x11-libs/libvdpau )
122 + vulkan? (
123 + media-libs/libplacebo:=[vulkan]
124 + media-libs/shaderc
125 + )
126 + wayland? (
127 + >=dev-libs/wayland-1.6.0
128 + >=dev-libs/wayland-protocols-1.14
129 + >=x11-libs/libxkbcommon-0.3.0
130 + )
131 + X? (
132 + x11-libs/libX11
133 + x11-libs/libXScrnSaver
134 + x11-libs/libXext
135 + x11-libs/libXinerama
136 + x11-libs/libXrandr
137 + opengl? (
138 + x11-libs/libXdamage
139 + virtual/opengl
140 + )
141 + xv? ( x11-libs/libXv )
142 + )
143 + zlib? ( sys-libs/zlib )
144 + zimg? ( >=media-libs/zimg-2.9.2 )
145 +"
146 +DEPEND="${COMMON_DEPEND}
147 + ${PYTHON_DEPS}
148 + cuda? ( >=media-libs/nv-codec-headers-8.2.15.7 )
149 + dvb? ( virtual/linuxtv-dvb-headers )
150 +"
151 +RDEPEND="${COMMON_DEPEND}
152 + cuda? ( x11-drivers/nvidia-drivers[X] )
153 + selinux? ( sec-policy/selinux-mplayer )
154 + tools? ( ${PYTHON_DEPS} )
155 +"
156 +BDEPEND="dev-python/docutils
157 + virtual/pkgconfig
158 + test? ( >=dev-util/cmocka-1.0.0 )
159 +"
160 +
161 +pkg_setup() {
162 + use lua && lua-single_pkg_setup
163 +}
164 +
165 +src_prepare() {
166 + cp "${DISTDIR}/waf-${WAF_PV}" "${S}"/waf || die
167 + chmod +x "${S}"/waf || die
168 + default
169 +}
170 +
171 +src_configure() {
172 + python_setup
173 + tc-export CC PKG_CONFIG AR
174 +
175 + if use raspberry-pi; then
176 + append-cflags -I"${SYSROOT%/}${EPREFIX}/opt/vc/include"
177 + append-ldflags -L"${SYSROOT%/}${EPREFIX}/opt/vc/lib"
178 + fi
179 +
180 + local mywafargs=(
181 + --confdir="${EPREFIX}/etc/${PN}"
182 +
183 + $(usex cli '' '--disable-cplayer')
184 + $(use_enable libmpv libmpv-shared)
185 +
186 + --disable-libmpv-static
187 + --disable-static-build
188 + # See deep down below for build-date.
189 + --disable-optimize # Don't add '-O2' to CFLAGS.
190 + $(usex debug '' '--disable-debug-build')
191 +
192 + $(use_enable doc html-build)
193 + --disable-pdf-build
194 + --enable-manpage-build
195 + $(use_enable cplugins)
196 + $(use_enable test)
197 +
198 + $(use_enable iconv)
199 + $(use_enable lua)
200 + $(use_enable javascript)
201 + $(use_enable zlib)
202 + $(use_enable bluray libbluray)
203 + $(use_enable dvd dvdnav)
204 + $(use_enable cdda)
205 + $(use_enable uchardet)
206 + $(use_enable rubberband)
207 + $(use_enable lcms lcms2)
208 + --disable-vapoursynth # Only available in overlays.
209 + $(use_enable archive libarchive)
210 +
211 + --enable-libavdevice
212 +
213 + # Audio outputs:
214 + $(use_enable sdl sdl2) # Listed under audio, but also includes video.
215 + $(use_enable pulseaudio pulse)
216 + $(use_enable jack)
217 + $(use_enable openal)
218 + --disable-opensles
219 + $(use_enable alsa)
220 + $(use_enable coreaudio)
221 +
222 + # Video outputs:
223 + $(use_enable aqua cocoa)
224 + $(use_enable drm)
225 + $(use_enable gbm)
226 + $(use_enable wayland wayland-scanner)
227 + $(use_enable wayland wayland-protocols)
228 + $(use_enable wayland)
229 + $(use_enable X x11)
230 + $(use_enable xv)
231 + $(usex opengl "$(use_enable aqua gl-cocoa)" '--disable-gl-cocoa')
232 + $(usex opengl "$(use_enable X gl-x11)" '--disable-gl-x11')
233 + $(usex egl "$(use_enable X egl-x11)" '--disable-egl-x11')
234 + $(usex egl "$(use_enable gbm egl-drm)" '--disable-egl-drm')
235 + $(usex opengl "$(use_enable wayland gl-wayland)" '--disable-gl-wayland')
236 + $(use_enable vdpau)
237 + $(usex vdpau "$(use_enable opengl vdpau-gl-x11)" '--disable-vdpau-gl-x11')
238 + $(use_enable vaapi) # See below for vaapi-glx, vaapi-x-egl.
239 + $(usex vaapi "$(use_enable X vaapi-x11)" '--disable-vaapi-x11')
240 + $(usex vaapi "$(use_enable wayland vaapi-wayland)" '--disable-vaapi-wayland')
241 + $(usex vaapi "$(use_enable gbm vaapi-drm)" '--disable-vaapi-drm')
242 + $(use_enable libcaca caca)
243 + $(use_enable jpeg)
244 + $(use_enable vulkan shaderc)
245 + $(use_enable vulkan libplacebo)
246 + $(use_enable raspberry-pi rpi)
247 + $(usex libmpv "$(use_enable opengl plain-gl)" '--disable-plain-gl')
248 + $(usex opengl '' '--disable-gl')
249 + $(use_enable vulkan)
250 + $(use_enable gamepad sdl2-gamepad)
251 +
252 + # HWaccels:
253 + # Automagic Video Toolbox HW acceleration. See Gentoo bug 577332.
254 + $(use_enable cuda cuda-hwaccel)
255 + $(use_enable cuda cuda-interop)
256 +
257 + # TV features:
258 + $(use_enable dvb dvbin)
259 +
260 + # Miscellaneous features:
261 + $(use_enable zimg)
262 + )
263 + if use lua; then
264 + if use lua_single_target_luajit; then
265 + mywafargs+=( --lua="luajit" )
266 + else
267 + # Because it would be too simple to just let the user directly
268 + # specify the package name to check, wouldn't it.
269 + mywafargs+=( --lua="$(ver_rs 1 '' $(ver_cut 1-2 $(lua_get_version)))" )
270 + fi
271 + fi
272 +
273 + if use vaapi && use X; then
274 + mywafargs+=(
275 + $(use_enable egl vaapi-x-egl)
276 + )
277 + fi
278 +
279 + # Not for us
280 + mywafargs+=(
281 + --disable-android
282 + --disable-egl-android
283 + --disable-uwp
284 + --disable-audiounit
285 + --disable-macos-media-player
286 + --disable-wasapi
287 + --disable-ios-gl
288 + --disable-macos-touchbar
289 + --disable-macos-cocoa-cb
290 + --disable-tvos
291 + --disable-egl-angle-win32
292 + )
293 +
294 + mywafargs+=(
295 + --bashdir="$(get_bashcompdir)"
296 + --zshdir="${EPREFIX}"/usr/share/zsh/site-functions
297 +)
298 +
299 + # Create reproducible non-live builds.
300 + [[ ${PV} != *9999* ]] && mywafargs+=(--disable-build-date)
301 +
302 + waf-utils_src_configure "${mywafargs[@]}"
303 +}
304 +
305 +src_install() {
306 + waf-utils_src_install
307 +
308 + if use lua; then
309 + insinto /usr/share/${PN}
310 + doins -r TOOLS/lua
311 + fi
312 +
313 + if use cli && use lua_single_target_luajit; then
314 + pax-mark -m "${ED}"usr/bin/${PN}
315 + fi
316 +
317 + if use tools; then
318 + dobin TOOLS/{mpv_identify.sh,umpv}
319 + newbin TOOLS/idet.sh mpv_idet.sh
320 + python_replicate_script "${ED}"usr/bin/umpv
321 + fi
322 +}
323 +
324 +pkg_postinst() {
325 + local rv softvol_0_18_1=0 osc_0_21_0=0 txtsubs_0_24_0=0 opengl_0_25_0=0
326 +
327 + for rv in ${REPLACING_VERSIONS}; do
328 + ver_test ${rv} -lt 0.18.1 && softvol_0_18_1=1
329 + ver_test ${rv} -lt 0.21.0 && osc_0_21_0=1
330 + ver_test ${rv} -lt 0.24.0 && txtsubs_0_24_0=1
331 + ver_test ${rv} -lt 0.25.0 && ! use opengl && opengl_0_25_0=1
332 + done
333 +
334 + if [[ ${softvol_0_18_1} -eq 1 ]]; then
335 + elog "Since version 0.18.1 the software volume control is always enabled."
336 + elog "This means that volume controls don't change the system volume,"
337 + elog "e.g. per-application volume with PulseAudio."
338 + elog "If you want to restore the previous behaviour, please refer to"
339 + elog
340 + elog "https://wiki.gentoo.org/wiki/Mpv#Volume_in_0.18.1"
341 + elog
342 + fi
343 +
344 + if [[ ${osc_0_21_0} -eq 1 ]]; then
345 + elog "In version 0.21.0 the default OSC layout was changed."
346 + elog "If you want to restore the previous layout, please refer to"
347 + elog
348 + elog "https://wiki.gentoo.org/wiki/Mpv#OSC_in_0.21.0"
349 + elog
350 + fi
351 +
352 + if [[ ${txtsubs_0_24_0} -eq 1 ]]; then
353 + elog "Since version 0.24.0 subtitles with .txt extension aren't autoloaded."
354 + elog "If you want to restore the previous behaviour, please refer to"
355 + elog
356 + elog "https://wiki.gentoo.org/wiki/Mpv#Subtitles_with_.txt_extension_in_0.24.0"
357 + elog
358 + fi
359 +
360 + if [[ ${opengl_0_25_0} -eq 1 ]]; then
361 + elog "Since version 0.25.0 the 'opengl' USE flag is mapped to"
362 + elog "the 'opengl' video output and no longer explicitly requires"
363 + elog "X11 or Mac OS Aqua. Consider enabling the 'opengl' USE flag."
364 + fi
365 +
366 + elog "If you want URL support, please install net-misc/youtube-dl."
367 +
368 + xdg_icon_cache_update
369 + xdg_desktop_database_update
370 +}
371 +
372 +pkg_postrm() {
373 + xdg_icon_cache_update
374 + xdg_desktop_database_update
375 +}
376 +
377 +src_test() {
378 + cd "${S}"/build/test || die
379 + local test
380 + for test in *; do
381 + if [[ -x ${test} ]]; then
382 + ./"${test}" || die "Test suite failed"
383 + fi
384 + done
385 +}
386
387 diff --git a/profiles/package.mask b/profiles/package.mask
388 index a516bab7a4c..d586857aa8e 100644
389 --- a/profiles/package.mask
390 +++ b/profiles/package.mask
391 @@ -551,6 +551,7 @@ kde-apps/kdebase-meta:5
392 >=media-sound/aqualung-1.1-r100
393 >=media-sound/csound-6.15.0-r100
394 >=media-video/aegisub-3.2.2_p20160518-r100
395 +>=media-video/mpv-0.33.0-r100
396 >=media-video/obs-studio-25.0.8-r100
397 >=media-video/vlc-3.0.11.1-r100
398 >=net-analyzer/rrdtool-1.7.2-r100