Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/mpv/, media-video/mpv/files/
Date: Sat, 04 Feb 2017 21:25:30
Message-Id: 1486243492.7ebdf748b6c4e9869c6c984093153e14614ba19d.soap@gentoo
1 commit: 7ebdf748b6c4e9869c6c984093153e14614ba19d
2 Author: Ilya Tumaykin <itumaykin <AT> gmail <DOT> com>
3 AuthorDate: Thu Feb 2 15:05:49 2017 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 4 21:24:52 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ebdf748
7
8 media-video/mpv: revbump to 0.23.0-r1 to sync with 9999
9
10 Among other things this brings cuda support to non-live ebuilds.
11
12 Package-Manager: Portage-2.3.3, Repoman-2.3.1
13
14 ...-pkgconfig-for-raspberrypi-compiler-flags.patch | 97 ++++++
15 media-video/mpv/mpv-0.23.0-r1.ebuild | 378 +++++++++++++++++++++
16 2 files changed, 475 insertions(+)
17
18 diff --git a/media-video/mpv/files/mpv-rely-on-pkgconfig-for-raspberrypi-compiler-flags.patch b/media-video/mpv/files/mpv-rely-on-pkgconfig-for-raspberrypi-compiler-flags.patch
19 new file mode 100644
20 index 00000000..1545743
21 --- /dev/null
22 +++ b/media-video/mpv/files/mpv-rely-on-pkgconfig-for-raspberrypi-compiler-flags.patch
23 @@ -0,0 +1,97 @@
24 +commit ea40fa36eef15384b4c0218fb102f92f5cd1cdff
25 +Author: Ilya Tumaykin <itumaykin@×××××.com>
26 +Date: Fri Jan 27 21:20:29 2017 +0300
27 +
28 +build: rpi: rely on pkgconfig for compiler flags
29 +
30 +Upstream provides pkgconfig files for quite some time now [1,2].
31 +Use them to determine the required flags instead of hard coding.
32 +
33 +This makes cross-compilation easy, which I dare to say is important for
34 +many raspberry-pi users. This also prevents picking libEGL and libGLESv2
35 +from mesa when they are present, which can happen with the current code.
36 +
37 +Good distros should put these pkgconfig files into default pkg-config
38 +search path or populate PKG_CONFIG_PATH for users. However, be nice to
39 +everybody and manually look into '/opt/vc/lib/pkgconfig' just in case.
40 +Hence the PKG_CONFIG_PATH mangling.
41 +
42 +[1]: https://github.com/raspberrypi/userland/issues/245
43 +[2]: https://github.com/raspberrypi/userland/commit/05d60a01d53dca363bb4286594db1826ffff8762
44 +
45 +diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py
46 +index 50a16ce26..bf8e5a0b0 100644
47 +--- a/waftools/checks/custom.py
48 ++++ b/waftools/checks/custom.py
49 +@@ -4,7 +4,7 @@ from waflib import Utils
50 + import os
51 +
52 + __all__ = ["check_pthreads", "check_iconv", "check_lua", "check_oss_4front",
53 +- "check_cocoa", "check_openal"]
54 ++ "check_cocoa", "check_openal", "check_rpi"]
55 +
56 + pthreads_program = load_fragment('pthreads.c')
57 +
58 +@@ -127,3 +127,29 @@ def check_openal(ctx, dependency_identifier):
59 + if fn(ctx, dependency_identifier):
60 + return True
61 + return False
62 ++
63 ++def check_rpi(ctx, dependency_identifier):
64 ++ # We need MMAL/bcm_host/dispmanx APIs.
65 ++ # Upstream keeps pkgconfig files in '/opt/vc/lib/pkgconfig'.
66 ++ # See https://github.com/raspberrypi/userland/issues/245
67 ++ # PKG_CONFIG_SYSROOT_DIR helps with cross compilation.
68 ++ prev_pkg_path = os.getenv('PKG_CONFIG_PATH', '')
69 ++ os.environ['PKG_CONFIG_PATH'] = os.pathsep.join(
70 ++ filter(None, [os.path.join(os.getenv('PKG_CONFIG_SYSROOT_DIR', '/'),
71 ++ 'opt/vc/lib/pkgconfig'),
72 ++ prev_pkg_path]))
73 ++
74 ++ checks = [
75 ++ check_pkg_config('bcm_host', uselib_store='bcm_host'),
76 ++ check_pkg_config('egl'),
77 ++ check_pkg_config('glesv2'),
78 ++ check_cc(lib=['mmal_core', 'mmal_util', 'mmal_vc_client'], use=['bcm_host']),
79 ++ # We still need all OpenGL symbols, because the vo_opengl code is
80 ++ # generic and supports anything from GLES2/OpenGL 2.1 to OpenGL 4 core.
81 ++ check_statement('GL/gl.h', '(void)GL_RGB32F'), # arbitrary OpenGL 3.0 symbol
82 ++ check_statement('GL/gl.h', '(void)GL_LUMINANCE16') # arbitrary OpenGL legacy-only symbol
83 ++ ]
84 ++
85 ++ ret = all((fn(ctx, dependency_identifier) for fn in checks))
86 ++ os.environ['PKG_CONFIG_PATH'] = prev_pkg_path
87 ++ return ret
88 +diff --git a/wscript b/wscript
89 +index 81a048df5..ab853e7ad 100644
90 +--- a/wscript
91 ++++ b/wscript
92 +@@ -738,27 +738,9 @@ video_output_features = [
93 + 'desc': 'Android support',
94 + 'func': check_statement('android/api-level.h', '(void)__ANDROID__'), # arbitrary android-specific header
95 + }, {
96 +- # We need MMAL/bcm_host/dispmanx APIs. Also, most RPI distros require
97 +- # every project to hardcode the paths to the include directories. Also,
98 +- # these headers are so broken that they spam tons of warnings by merely
99 +- # including them (compensate with -isystem and -fgnu89-inline).
100 + 'name': '--rpi',
101 + 'desc': 'Raspberry Pi support',
102 +- 'func': compose_checks(
103 +- check_cc(cflags="-isystem/opt/vc/include/ "+
104 +- "-isystem/opt/vc/include/interface/vcos/pthreads " +
105 +- "-isystem/opt/vc/include/interface/vmcs_host/linux " +
106 +- "-fgnu89-inline",
107 +- linkflags="-L/opt/vc/lib",
108 +- header_name="bcm_host.h",
109 +- lib=['mmal_core', 'mmal_util', 'mmal_vc_client', 'bcm_host']),
110 +- # We still need all OpenGL symbols, because the vo_opengl code is
111 +- # generic and supports anything from GLES2/OpenGL 2.1 to OpenGL 4 core.
112 +- check_cc(lib="EGL"),
113 +- check_cc(lib="GLESv2"),
114 +- check_statement('GL/gl.h', '(void)GL_RGB32F'), # arbitrary OpenGL 3.0 symbol
115 +- check_statement('GL/gl.h', '(void)GL_LUMINANCE16') # arbitrary OpenGL legacy-only symbol
116 +- ),
117 ++ 'func': check_rpi,
118 + }, {
119 + 'name': '--standard-gl',
120 + 'desc': 'Desktop standard OpenGL support',
121
122 diff --git a/media-video/mpv/mpv-0.23.0-r1.ebuild b/media-video/mpv/mpv-0.23.0-r1.ebuild
123 new file mode 100644
124 index 00000000..e24ca42
125 --- /dev/null
126 +++ b/media-video/mpv/mpv-0.23.0-r1.ebuild
127 @@ -0,0 +1,378 @@
128 +# Copyright 1999-2017 Gentoo Foundation
129 +# Distributed under the terms of the GNU General Public License v2
130 +# $Id$
131 +
132 +EAPI=6
133 +
134 +PYTHON_COMPAT=( python{2_7,3_4,3_5} )
135 +PYTHON_REQ_USE='threads(+)'
136 +
137 +WAF_PV=1.8.12
138 +
139 +inherit gnome2-utils pax-utils python-r1 toolchain-funcs versionator waf-utils xdg-utils
140 +
141 +DESCRIPTION="Media player based on MPlayer and mplayer2"
142 +HOMEPAGE="https://mpv.io/"
143 +
144 +if [[ ${PV} != *9999* ]]; then
145 + SRC_URI="https://github.com/mpv-player/mpv/archive/v${PV}.tar.gz -> ${P}.tar.gz"
146 + KEYWORDS="~amd64 ~x86 ~amd64-linux"
147 + DOCS=( RELEASE_NOTES )
148 +else
149 + EGIT_REPO_URI=( {https,git}://github.com/mpv-player/mpv.git )
150 + inherit git-r3
151 +fi
152 +SRC_URI+=" https://waf.io/waf-${WAF_PV}"
153 +DOCS+=( README.md )
154 +
155 +# See Copyright in sources and Gentoo bug 506946. Waf is BSD, libmpv is ISC.
156 +LICENSE="GPL-2+ BSD ISC"
157 +SLOT="0"
158 +IUSE="+alsa aqua archive bluray cdda +cli coreaudio cuda doc drm dvb dvd +egl
159 + encode gbm +iconv jack jpeg lcms +libass libav libcaca libmpv +lua luajit
160 + openal +opengl oss pulseaudio raspberry-pi rubberband samba sdl selinux
161 + test tools +uchardet v4l vaapi vdpau vf-dlopen wayland +X xinerama
162 + +xscreensaver +xv zsh-completion"
163 +IUSE+=" cpu_flags_x86_sse4_1"
164 +
165 +REQUIRED_USE="
166 + || ( cli libmpv )
167 + aqua? ( opengl )
168 + cuda? ( !libav || ( opengl egl ) )
169 + egl? ( || ( gbm X wayland ) )
170 + gbm? ( drm egl )
171 + lcms? ( || ( opengl egl ) )
172 + luajit? ( lua )
173 + opengl? ( || ( aqua X !cli? ( libmpv ) ) )
174 + test? ( || ( opengl egl ) )
175 + tools? ( cli )
176 + uchardet? ( iconv )
177 + v4l? ( || ( alsa oss ) )
178 + vaapi? ( || ( gbm X wayland ) )
179 + vdpau? ( X )
180 + wayland? ( egl )
181 + xinerama? ( X )
182 + xscreensaver? ( X )
183 + xv? ( X )
184 + zsh-completion? ( cli )
185 +"
186 +
187 +COMMON_DEPEND="
188 + !libav? ( >=media-video/ffmpeg-3.2.2:0=[encode?,threads,vaapi?,vdpau?] )
189 + libav? ( >=media-video/libav-12:0=[encode?,threads,vaapi?,vdpau?] )
190 + sys-libs/zlib
191 + alsa? ( >=media-libs/alsa-lib-1.0.18 )
192 + archive? ( >=app-arch/libarchive-3.0.0:= )
193 + bluray? ( >=media-libs/libbluray-0.3.0 )
194 + cdda? ( dev-libs/libcdio-paranoia )
195 + cuda? ( >=media-video/ffmpeg-3.3:0 )
196 + drm? ( x11-libs/libdrm )
197 + dvd? (
198 + >=media-libs/libdvdnav-4.2.0
199 + >=media-libs/libdvdread-4.1.0
200 + )
201 + egl? ( media-libs/mesa[egl,gbm(-)?,wayland(-)?] )
202 + iconv? (
203 + virtual/libiconv
204 + uchardet? ( dev-libs/uchardet )
205 + )
206 + jack? ( virtual/jack )
207 + jpeg? ( virtual/jpeg:0 )
208 + lcms? ( >=media-libs/lcms-2.6:2 )
209 + libass? (
210 + >=media-libs/libass-0.12.1:=[fontconfig,harfbuzz]
211 + virtual/ttf-fonts
212 + )
213 + libcaca? ( >=media-libs/libcaca-0.99_beta18 )
214 + lua? (
215 + !luajit? ( <dev-lang/lua-5.3:= )
216 + luajit? ( dev-lang/luajit:2 )
217 + )
218 + openal? ( >=media-libs/openal-1.13 )
219 + opengl? ( X? ( virtual/opengl ) )
220 + pulseaudio? ( media-sound/pulseaudio )
221 + raspberry-pi? (
222 + >=media-libs/raspberrypi-userland-0_pre20160305-r1
223 + virtual/opengl
224 + )
225 + rubberband? ( >=media-libs/rubberband-1.8.0 )
226 + samba? ( net-fs/samba[smbclient(+)] )
227 + sdl? ( media-libs/libsdl2[sound,threads,video,X?,wayland?] )
228 + v4l? ( media-libs/libv4l )
229 + vaapi? ( >=x11-libs/libva-1.4.0[drm?,X?,wayland?] )
230 + vdpau? ( >=x11-libs/libvdpau-0.2 )
231 + wayland? (
232 + >=dev-libs/wayland-1.6.0
233 + >=x11-libs/libxkbcommon-0.3.0
234 + )
235 + X? (
236 + x11-libs/libX11
237 + x11-libs/libXext
238 + >=x11-libs/libXrandr-1.2.0
239 + opengl? ( x11-libs/libXdamage )
240 + xinerama? ( x11-libs/libXinerama )
241 + xscreensaver? ( x11-libs/libXScrnSaver )
242 + xv? ( x11-libs/libXv )
243 + )
244 +"
245 +DEPEND="${COMMON_DEPEND}
246 + ${PYTHON_DEPS}
247 + dev-python/docutils
248 + virtual/pkgconfig
249 + doc? ( dev-python/rst2pdf )
250 + dvb? ( virtual/linuxtv-dvb-headers )
251 + test? ( >=dev-util/cmocka-1.0.0 )
252 + v4l? ( virtual/os-headers )
253 + zsh-completion? ( dev-lang/perl )
254 +"
255 +RDEPEND="${COMMON_DEPEND}
256 + cuda? ( x11-drivers/nvidia-drivers[X] )
257 + selinux? ( sec-policy/selinux-mplayer )
258 + tools? ( ${PYTHON_DEPS} )
259 +"
260 +
261 +PATCHES=(
262 + "${FILESDIR}/${PN}-0.19.0-make-ffmpeg-version-check-non-fatal.patch"
263 + "${FILESDIR}/${PN}-0.23.0-make-libavdevice-check-accept-libav.patch"
264 + "${FILESDIR}/${PN}-rely-on-pkgconfig-for-raspberrypi-compiler-flags.patch"
265 +)
266 +
267 +mpv_check_compiler() {
268 + if [[ ${MERGE_TYPE} != "binary" ]]; then
269 + if tc-is-gcc && ( [[ $(gcc-major-version) -lt 4 ]] || \
270 + ( [[ $(gcc-major-version) -eq 4 ]] && [[ $(gcc-minor-version) -lt 5 ]] ) ); then
271 + die "${PN} requires GCC>=4.5."
272 + fi
273 + if ( use opengl || use egl ) && ! tc-has-tls; then
274 + die "Your compiler lacks C++11 TLS support. Use GCC>=4.8 or Clang>=3.3."
275 + fi
276 + if use vaapi && use cpu_flags_x86_sse4_1 && ! tc-is-gcc; then
277 + die "${PN} requires GCC for SSE4.1 intrinsics."
278 + fi
279 + fi
280 +}
281 +
282 +pkg_pretend() {
283 + mpv_check_compiler
284 +}
285 +
286 +pkg_setup() {
287 + mpv_check_compiler
288 + [[ ${MERGE_TYPE} != "binary" ]] && python_setup
289 +}
290 +
291 +src_prepare() {
292 + cp "${DISTDIR}/waf-${WAF_PV}" "${S}"/waf || die
293 + chmod +x "${S}"/waf || die
294 + default_src_prepare
295 +}
296 +
297 +src_configure() {
298 + tc-export CC PKG_CONFIG AR
299 +
300 + if tc-is-cross-compiler && use raspberry-pi; then
301 + export EXTRA_PKG_CONFIG_LIBDIR="${SYSROOT%/}${EPREFIX}/opt/vc/lib/pkgconfig"
302 + # Drop next line when Gentoo bug 607344 is fixed or if you fixed it locally.
303 + die "${PN} can't be cross built with raspberry-pi USE enabled. See Gentoo bug 607344."
304 + fi
305 +
306 + local mywafargs=(
307 + --confdir="${EPREFIX}/etc/${PN}"
308 + --docdir="${EPREFIX}/usr/share/doc/${PF}"
309 + --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
310 +
311 + $(usex cli '' '--disable-cplayer')
312 + $(use_enable libmpv libmpv-shared)
313 +
314 + # See deep down below for build-date.
315 + --disable-libmpv-static
316 + --disable-static-build
317 + --disable-optimize # Don't add '-O2' to CFLAGS.
318 + --disable-debug-build # Don't add '-g' to CFLAGS.
319 + --enable-html-build
320 +
321 + $(use_enable doc pdf-build)
322 + $(use_enable vf-dlopen vf-dlopen-filters)
323 + $(use_enable zsh-completion zsh-comp)
324 + $(use_enable test)
325 +
326 + $(use_enable iconv)
327 + $(use_enable samba libsmbclient)
328 + $(use_enable lua)
329 + $(usex luajit '--lua=luajit' '')
330 + $(use_enable libass)
331 + $(use_enable libass libass-osd)
332 + $(use_enable encode encoding)
333 + $(use_enable bluray libbluray)
334 + $(use_enable dvd dvdread)
335 + $(use_enable dvd dvdnav)
336 + $(use_enable cdda)
337 + $(use_enable uchardet)
338 + $(use_enable rubberband)
339 + $(use_enable lcms lcms2)
340 + --disable-vapoursynth # Only available in overlays.
341 + --disable-vapoursynth-lazy
342 + $(use_enable archive libarchive)
343 +
344 + --enable-libavdevice
345 +
346 + # Audio outputs:
347 + $(use_enable sdl sdl2) # Listed under audio, but also includes video.
348 + --disable-sdl1
349 + $(use_enable oss oss-audio)
350 + --disable-rsound # Only available in overlays.
351 + --disable-sndio # Only available in overlays.
352 + $(use_enable pulseaudio pulse)
353 + $(use_enable jack)
354 + $(use_enable openal)
355 + --disable-opensles
356 + $(use_enable alsa)
357 + $(use_enable coreaudio)
358 +
359 + # Video outputs:
360 + $(use_enable aqua cocoa)
361 + $(use_enable drm)
362 + $(use_enable gbm)
363 + $(use_enable wayland)
364 + $(use_enable X x11)
365 + $(use_enable xscreensaver xss)
366 + $(use_enable X xext)
367 + $(use_enable xv)
368 + $(use_enable xinerama)
369 + $(use_enable X xrandr)
370 + $(usex opengl "$(use_enable aqua gl-cocoa)" '--disable-gl-cocoa')
371 + $(usex opengl "$(use_enable X gl-x11)" '--disable-gl-x11')
372 + $(usex egl "$(use_enable X egl-x11)" '--disable-egl-x11')
373 + $(usex egl "$(use_enable gbm egl-drm)" '--disable-egl-drm')
374 + $(use_enable wayland gl-wayland)
375 + $(use_enable vdpau)
376 + $(usex vdpau "$(use_enable opengl vdpau-gl-x11)" '--disable-vdpau-gl-x11')
377 + $(use_enable vaapi) # See below for vaapi-glx, vaapi-x-egl.
378 + $(usex vaapi "$(use_enable X vaapi-x11)" '--disable-vaapi-x11')
379 + $(usex vaapi "$(use_enable wayland vaapi-wayland)" '--disable-vaapi-wayland')
380 + $(usex vaapi "$(use_enable gbm vaapi-drm)" '--disable-vaapi-drm')
381 + $(use_enable libcaca caca)
382 + $(use_enable jpeg)
383 + --disable-android
384 + $(use_enable raspberry-pi rpi)
385 + $(usex opengl "$(use_enable !aqua standard-gl)" '--disable-standard-gl')
386 + --disable-ios-gl
387 + $(usex libmpv "$(use_enable opengl plain-gl)" '--disable-plain-gl')
388 + --disable-mali-fbdev # Only available in overlays.
389 +
390 + # HWaccels:
391 + # Automagic Video Toolbox HW acceleration. See Gentoo bug 577332.
392 + $(use_enable vaapi vaapi-hwaccel)
393 + $(use_enable vdpau vdpau-hwaccel)
394 + $(use_enable cuda cuda-hwaccel)
395 +
396 + # TV features:
397 + $(use_enable v4l tv)
398 + $(use_enable v4l tv-v4l2)
399 + $(use_enable v4l libv4l2)
400 + $(use_enable v4l audio-input)
401 + $(use_enable dvb dvbin)
402 +
403 + # Miscellaneous features:
404 + --disable-apple-remote # Needs testing first. See Gentoo bug 577332.
405 + )
406 +
407 + if use vaapi && use X; then
408 + mywafargs+=(
409 + $(use_enable opengl vaapi-glx)
410 + $(use_enable egl vaapi-x-egl)
411 + )
412 + fi
413 +
414 + if ! use egl && ! use opengl && ! use raspberry-pi; then
415 + mywafargs+=(--disable-gl)
416 + fi
417 +
418 + # Create reproducible non-live builds.
419 + [[ ${PV} != *9999* ]] && mywafargs+=(--disable-build-date)
420 +
421 + waf-utils_src_configure "${mywafargs[@]}"
422 +}
423 +
424 +src_install() {
425 + waf-utils_src_install
426 +
427 + if use lua; then
428 + insinto /usr/share/${PN}
429 + doins -r TOOLS/lua
430 + fi
431 +
432 + if use cli && use luajit; then
433 + pax-mark -m "${ED}"usr/bin/${PN}
434 + fi
435 +
436 + if use tools; then
437 + dobin TOOLS/{mpv_identify.sh,umpv}
438 + newbin TOOLS/idet.sh mpv_idet.sh
439 + python_replicate_script "${ED}"usr/bin/umpv
440 + fi
441 +}
442 +
443 +pkg_preinst() {
444 + gnome2_icon_savelist
445 +}
446 +
447 +pkg_postinst() {
448 + local rv softvol_0_18_1=0 osc_0_21_0=0
449 +
450 + for rv in ${REPLACING_VERSIONS}; do
451 + version_compare ${rv} 0.18.1
452 + [[ $? -eq 1 ]] && softvol_0_18_1=1
453 + version_compare ${rv} 0.21.0
454 + [[ $? -eq 1 ]] && osc_0_21_0=1
455 + done
456 +
457 + if [[ ${softvol_0_18_1} -eq 1 ]]; then
458 + elog "Since version 0.18.1 the software volume control is always enabled."
459 + elog "This means that volume controls don't change the system volume,"
460 + elog "e.g. per-application volume with PulseAudio."
461 + elog "If you want to restore the previous behaviour, please refer to"
462 + elog
463 + elog "https://wiki.gentoo.org/wiki/Mpv#Volume_in_0.18.1"
464 + elog
465 + fi
466 +
467 + if [[ ${osc_0_21_0} -eq 1 ]]; then
468 + elog "In version 0.21.0 the default OSC layout was changed."
469 + elog "If you want to restore the previous layout, please refer to"
470 + elog
471 + elog "https://wiki.gentoo.org/wiki/Mpv#OSC_in_0.21.0"
472 + elog
473 + fi
474 +
475 + # bash-completion < 2.3-r1 already installs (mostly broken) mpv completion.
476 + if use cli && ! has_version '<app-shells/bash-completion-2.3-r1' && \
477 + ! has_version 'app-shells/mpv-bash-completion'; then
478 + elog "If you want to have command-line completion via bash-completion,"
479 + elog "please install app-shells/mpv-bash-completion."
480 + fi
481 +
482 + if use cli && [[ -n ${REPLACING_VERSIONS} ]] && \
483 + has_version 'app-shells/mpv-bash-completion'; then
484 + elog "If command-line completion doesn't work after mpv update,"
485 + elog "please rebuild app-shells/mpv-bash-completion."
486 + fi
487 +
488 + gnome2_icon_cache_update
489 + xdg_desktop_database_update
490 +}
491 +
492 +pkg_postrm() {
493 + gnome2_icon_cache_update
494 + xdg_desktop_database_update
495 +}
496 +
497 +src_test() {
498 + cd "${S}"/build/test || die
499 + local test
500 + for test in *; do
501 + if [[ -x ${test} ]]; then
502 + ./"${test}" || die "Test suite failed"
503 + fi
504 + done
505 +}