logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

mpv-0.32.0-r3.ebuild (9742B)


  1. # Copyright 1999-2020 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python{3_7,3_8} )
  5. PYTHON_REQ_USE='threads(+)'
  6. WAF_PV=2.0.9
  7. inherit bash-completion-r1 eapi7-ver flag-o-matic gnome2-utils pax-utils python-r1 toolchain-funcs waf-utils xdg-utils
  8. DESCRIPTION="Media player based on MPlayer and mplayer2"
  9. HOMEPAGE="https://mpv.io/ https://github.com/mpv-player/mpv"
  10. if [[ ${PV} != *9999* ]]; then
  11. SRC_URI="https://github.com/mpv-player/mpv/archive/v${PV}.tar.gz -> ${P}.tar.gz"
  12. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86 ~amd64-linux"
  13. DOCS=( RELEASE_NOTES )
  14. else
  15. EGIT_REPO_URI="https://github.com/mpv-player/mpv.git"
  16. inherit git-r3
  17. DOCS=(); SRC_URI=""
  18. fi
  19. SRC_URI+=" https://waf.io/waf-${WAF_PV}"
  20. DOCS+=( README.md DOCS/{client-api,interface}-changes.rst )
  21. # See Copyright in sources and Gentoo bug 506946. Waf is BSD, libmpv is ISC.
  22. LICENSE="LGPL-2.1+ GPL-2+ BSD ISC samba? ( GPL-3+ )"
  23. SLOT="0"
  24. IUSE="+alsa aqua archive bluray cdda +cli coreaudio cplugins cuda debug doc drm dvb
  25. dvd +egl gamepad gbm +iconv jack javascript jpeg lcms +libass libcaca libmpv +lua
  26. luajit openal +opengl oss pulseaudio raspberry-pi rubberband samba sdl
  27. selinux sndio test tools +uchardet vaapi vdpau vulkan wayland +X +xv zlib zimg"
  28. REQUIRED_USE="
  29. || ( cli libmpv )
  30. aqua? ( opengl )
  31. cuda? ( opengl )
  32. egl? ( || ( gbm X wayland ) )
  33. gamepad? ( sdl )
  34. gbm? ( drm egl opengl )
  35. lcms? ( opengl )
  36. luajit? ( lua )
  37. opengl? ( || ( aqua egl X raspberry-pi !cli ) )
  38. raspberry-pi? ( opengl )
  39. test? ( opengl )
  40. tools? ( cli )
  41. uchardet? ( iconv )
  42. vaapi? ( || ( gbm X wayland ) )
  43. vdpau? ( X )
  44. vulkan? ( || ( X wayland ) )
  45. wayland? ( egl )
  46. X? ( egl? ( opengl ) )
  47. xv? ( X )
  48. ${PYTHON_REQUIRED_USE}
  49. "
  50. RESTRICT="!test? ( test )"
  51. COMMON_DEPEND="
  52. !!app-shells/mpv-bash-completion
  53. >=media-video/ffmpeg-4.0:0=[encode,threads,vaapi?,vdpau?]
  54. alsa? ( >=media-libs/alsa-lib-1.0.18 )
  55. archive? ( >=app-arch/libarchive-3.4.0:= )
  56. bluray? ( >=media-libs/libbluray-0.3.0:= )
  57. cdda? ( dev-libs/libcdio-paranoia
  58. dev-libs/libcdio:= )
  59. drm? ( x11-libs/libdrm )
  60. dvd? (
  61. >=media-libs/libdvdnav-4.2.0:=
  62. >=media-libs/libdvdread-4.1.0:=
  63. )
  64. egl? ( media-libs/mesa[egl(+),gbm(-)?,wayland(-)?] )
  65. gamepad? ( media-libs/libsdl2 )
  66. iconv? (
  67. virtual/libiconv
  68. uchardet? ( app-i18n/uchardet )
  69. )
  70. jack? ( virtual/jack )
  71. javascript? ( >=dev-lang/mujs-1.0.0 )
  72. jpeg? ( virtual/jpeg:0 )
  73. lcms? ( >=media-libs/lcms-2.6:2 )
  74. libass? (
  75. >=media-libs/libass-0.12.1:=[fontconfig,harfbuzz(+)]
  76. virtual/ttf-fonts
  77. )
  78. libcaca? ( >=media-libs/libcaca-0.99_beta18 )
  79. lua? (
  80. !luajit? ( <dev-lang/lua-5.3:= )
  81. luajit? ( dev-lang/luajit:2 )
  82. )
  83. openal? ( >=media-libs/openal-1.13 )
  84. pulseaudio? ( media-sound/pulseaudio )
  85. raspberry-pi? ( >=media-libs/raspberrypi-userland-0_pre20160305-r1 )
  86. rubberband? ( >=media-libs/rubberband-1.8.0 )
  87. samba? ( net-fs/samba )
  88. sdl? ( media-libs/libsdl2[sound,threads,video] )
  89. sndio? ( media-sound/sndio:= )
  90. vaapi? ( x11-libs/libva:=[drm?,X?,wayland?] )
  91. vdpau? ( x11-libs/libvdpau )
  92. vulkan? (
  93. media-libs/libplacebo:=[vulkan]
  94. media-libs/shaderc
  95. )
  96. wayland? (
  97. >=dev-libs/wayland-1.6.0
  98. >=dev-libs/wayland-protocols-1.14
  99. >=x11-libs/libxkbcommon-0.3.0
  100. )
  101. X? (
  102. x11-libs/libX11
  103. x11-libs/libXScrnSaver
  104. x11-libs/libXext
  105. x11-libs/libXinerama
  106. x11-libs/libXrandr
  107. opengl? (
  108. x11-libs/libXdamage
  109. virtual/opengl
  110. )
  111. xv? ( x11-libs/libXv )
  112. )
  113. zlib? ( sys-libs/zlib )
  114. zimg? ( >=media-libs/zimg-2.9.2 )
  115. "
  116. DEPEND="${COMMON_DEPEND}
  117. ${PYTHON_DEPS}
  118. virtual/pkgconfig
  119. dev-python/docutils
  120. cuda? ( >=media-libs/nv-codec-headers-8.2.15.7 )
  121. dvb? ( virtual/linuxtv-dvb-headers )
  122. test? ( >=dev-util/cmocka-1.0.0 )
  123. "
  124. RDEPEND="${COMMON_DEPEND}
  125. cuda? ( x11-drivers/nvidia-drivers[X] )
  126. selinux? ( sec-policy/selinux-mplayer )
  127. tools? ( ${PYTHON_DEPS} )
  128. "
  129. src_prepare() {
  130. cp "${DISTDIR}/waf-${WAF_PV}" "${S}"/waf || die
  131. chmod +x "${S}"/waf || die
  132. default
  133. }
  134. src_configure() {
  135. python_setup
  136. tc-export CC PKG_CONFIG AR
  137. if use raspberry-pi; then
  138. append-cflags -I"${SYSROOT%/}${EPREFIX}/opt/vc/include"
  139. append-ldflags -L"${SYSROOT%/}${EPREFIX}/opt/vc/lib"
  140. fi
  141. local mywafargs=(
  142. --confdir="${EPREFIX}/etc/${PN}"
  143. $(usex cli '' '--disable-cplayer')
  144. $(use_enable libmpv libmpv-shared)
  145. --disable-libmpv-static
  146. --disable-static-build
  147. # See deep down below for build-date.
  148. --disable-optimize # Don't add '-O2' to CFLAGS.
  149. $(usex debug '' '--disable-debug-build')
  150. $(use_enable doc html-build)
  151. --disable-pdf-build
  152. --enable-manpage-build
  153. $(use_enable cplugins)
  154. $(use_enable test)
  155. $(use_enable iconv)
  156. $(use_enable samba libsmbclient)
  157. $(use_enable lua)
  158. $(usex luajit '--lua=luajit' '')
  159. $(use_enable javascript)
  160. $(use_enable libass)
  161. $(use_enable libass libass-osd)
  162. $(use_enable zlib)
  163. $(use_enable bluray libbluray)
  164. $(use_enable dvd dvdnav)
  165. $(use_enable cdda)
  166. $(use_enable uchardet)
  167. $(use_enable rubberband)
  168. $(use_enable lcms lcms2)
  169. --disable-vapoursynth # Only available in overlays.
  170. $(use_enable archive libarchive)
  171. --enable-libavdevice
  172. # Audio outputs:
  173. $(use_enable sdl sdl2) # Listed under audio, but also includes video.
  174. $(use_enable oss oss-audio)
  175. --disable-rsound # Only available in overlays.
  176. $(use_enable sndio)
  177. $(use_enable pulseaudio pulse)
  178. $(use_enable jack)
  179. $(use_enable openal)
  180. --disable-opensles
  181. $(use_enable alsa)
  182. $(use_enable coreaudio)
  183. # Video outputs:
  184. $(use_enable aqua cocoa)
  185. $(use_enable drm)
  186. $(use_enable gbm)
  187. $(use_enable wayland wayland-scanner)
  188. $(use_enable wayland wayland-protocols)
  189. $(use_enable wayland)
  190. $(use_enable X x11)
  191. $(use_enable xv)
  192. $(usex opengl "$(use_enable aqua gl-cocoa)" '--disable-gl-cocoa')
  193. $(usex opengl "$(use_enable X gl-x11)" '--disable-gl-x11')
  194. $(usex egl "$(use_enable X egl-x11)" '--disable-egl-x11')
  195. $(usex egl "$(use_enable gbm egl-drm)" '--disable-egl-drm')
  196. $(usex opengl "$(use_enable wayland gl-wayland)" '--disable-gl-wayland')
  197. $(use_enable vdpau)
  198. $(usex vdpau "$(use_enable opengl vdpau-gl-x11)" '--disable-vdpau-gl-x11')
  199. $(use_enable vaapi) # See below for vaapi-glx, vaapi-x-egl.
  200. $(usex vaapi "$(use_enable X vaapi-x11)" '--disable-vaapi-x11')
  201. $(usex vaapi "$(use_enable wayland vaapi-wayland)" '--disable-vaapi-wayland')
  202. $(usex vaapi "$(use_enable gbm vaapi-drm)" '--disable-vaapi-drm')
  203. $(use_enable libcaca caca)
  204. $(use_enable jpeg)
  205. $(use_enable vulkan shaderc)
  206. $(use_enable vulkan libplacebo)
  207. $(use_enable raspberry-pi rpi)
  208. $(usex libmpv "$(use_enable opengl plain-gl)" '--disable-plain-gl')
  209. $(usex opengl '' '--disable-gl')
  210. $(use_enable vulkan)
  211. $(use_enable gamepad sdl2-gamepad)
  212. # HWaccels:
  213. # Automagic Video Toolbox HW acceleration. See Gentoo bug 577332.
  214. $(use_enable cuda cuda-hwaccel)
  215. $(use_enable cuda cuda-interop)
  216. # TV features:
  217. $(use_enable dvb dvbin)
  218. # Miscellaneous features:
  219. $(use_enable zimg)
  220. )
  221. if use vaapi && use X; then
  222. mywafargs+=(
  223. $(use_enable egl vaapi-x-egl)
  224. )
  225. fi
  226. # Not for us
  227. mywafargs+=(
  228. --disable-android
  229. --disable-egl-android
  230. --disable-uwp
  231. --disable-audiounit
  232. --disable-macos-media-player
  233. --disable-wasapi
  234. --disable-ios-gl
  235. --disable-macos-touchbar
  236. --disable-macos-cocoa-cb
  237. --disable-tvos
  238. --disable-egl-angle-win32
  239. )
  240. mywafargs+=(
  241. --bashdir="$(get_bashcompdir)"
  242. --zshdir="${EPREFIX}"/usr/share/zsh/site-functions
  243. )
  244. # Create reproducible non-live builds.
  245. [[ ${PV} != *9999* ]] && mywafargs+=(--disable-build-date)
  246. waf-utils_src_configure "${mywafargs[@]}"
  247. }
  248. src_install() {
  249. waf-utils_src_install
  250. if use lua; then
  251. insinto /usr/share/${PN}
  252. doins -r TOOLS/lua
  253. fi
  254. if use cli && use luajit; then
  255. pax-mark -m "${ED}"usr/bin/${PN}
  256. fi
  257. if use tools; then
  258. dobin TOOLS/{mpv_identify.sh,umpv}
  259. newbin TOOLS/idet.sh mpv_idet.sh
  260. python_replicate_script "${ED}"usr/bin/umpv
  261. fi
  262. }
  263. pkg_postinst() {
  264. local rv softvol_0_18_1=0 osc_0_21_0=0 txtsubs_0_24_0=0 opengl_0_25_0=0
  265. for rv in ${REPLACING_VERSIONS}; do
  266. ver_test ${rv} -lt 0.18.1 && softvol_0_18_1=1
  267. ver_test ${rv} -lt 0.21.0 && osc_0_21_0=1
  268. ver_test ${rv} -lt 0.24.0 && txtsubs_0_24_0=1
  269. ver_test ${rv} -lt 0.25.0 && ! use opengl && opengl_0_25_0=1
  270. done
  271. if [[ ${softvol_0_18_1} -eq 1 ]]; then
  272. elog "Since version 0.18.1 the software volume control is always enabled."
  273. elog "This means that volume controls don't change the system volume,"
  274. elog "e.g. per-application volume with PulseAudio."
  275. elog "If you want to restore the previous behaviour, please refer to"
  276. elog
  277. elog "https://wiki.gentoo.org/wiki/Mpv#Volume_in_0.18.1"
  278. elog
  279. fi
  280. if [[ ${osc_0_21_0} -eq 1 ]]; then
  281. elog "In version 0.21.0 the default OSC layout was changed."
  282. elog "If you want to restore the previous layout, please refer to"
  283. elog
  284. elog "https://wiki.gentoo.org/wiki/Mpv#OSC_in_0.21.0"
  285. elog
  286. fi
  287. if [[ ${txtsubs_0_24_0} -eq 1 ]]; then
  288. elog "Since version 0.24.0 subtitles with .txt extension aren't autoloaded."
  289. elog "If you want to restore the previous behaviour, please refer to"
  290. elog
  291. elog "https://wiki.gentoo.org/wiki/Mpv#Subtitles_with_.txt_extension_in_0.24.0"
  292. elog
  293. fi
  294. if [[ ${opengl_0_25_0} -eq 1 ]]; then
  295. elog "Since version 0.25.0 the 'opengl' USE flag is mapped to"
  296. elog "the 'opengl' video output and no longer explicitly requires"
  297. elog "X11 or Mac OS Aqua. Consider enabling the 'opengl' USE flag."
  298. fi
  299. elog "If you want URL support, please install net-misc/youtube-dl."
  300. gnome2_icon_cache_update
  301. xdg_desktop_database_update
  302. }
  303. pkg_postrm() {
  304. gnome2_icon_cache_update
  305. xdg_desktop_database_update
  306. }
  307. src_test() {
  308. cd "${S}"/build/test || die
  309. local test
  310. for test in *; do
  311. if [[ -x ${test} ]]; then
  312. ./"${test}" || die "Test suite failed"
  313. fi
  314. done
  315. }