1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 EGIT_REPO_URI="git://git.videolan.org/ffmpeg.git"
8 ESVN_REPO_URI="svn://svn.mplayerhq.hu/mplayer/trunk"
9 [[ ${PV} = *9999* ]] && SVN_ECLASS="subversion git-2" || SVN_ECLASS=""
11 inherit toolchain-funcs eutils flag-o-matic multilib base ${SVN_ECLASS}
13 IUSE="cpu_flags_x86_3dnow cpu_flags_x86_3dnowext a52 aalib +alsa altivec aqua bidi bl bluray
14 bs2b cddb +cdio cdparanoia cpudetection debug dga
15 directfb doc dts dv dvb +dvd +dvdnav +enca +encode faac faad fbcon
16 ftp gif ggi gsm +iconv ipv6 jack joystick jpeg jpeg2k kernel_linux ladspa
17 +libass libcaca libmpeg2 lirc live lzo mad md5sum +cpu_flags_x86_mmx cpu_flags_x86_mmxext mng mp3 nas
18 +network nut openal opengl +osdmenu oss png pnm pulseaudio pvr
19 radio rar rtc rtmp samba selinux +shm sdl speex cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_ssse3
20 tga theora tremor +truetype toolame twolame +unicode v4l vdpau vidix
21 vorbis +X x264 xanim xinerama +xscreensaver +xv xvid xvmc zoran"
23 VIDEO_CARDS="s3virge mga tdfx"
24 for x in ${VIDEO_CARDS}; do
25 IUSE+=" video_cards_${x}"
29 mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
30 mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
31 mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2
33 if [[ ${PV} == *9999* ]]; then
35 elif [ "${PV%_rc*}" = "${PV}" -a "${PV%_pre*}" = "${PV}" ]; then
37 S="${WORKDIR}/${MY_P}"
38 RELEASE_URI="mirror://mplayer/releases/${MY_P}.tar.xz"
40 RELEASE_URI="mirror://gentoo/${P}.tar.xz"
42 SRC_URI="${RELEASE_URI}
43 !truetype? ( ${FONT_URI} )"
45 DESCRIPTION="Media Player for Linux"
46 HOMEPAGE="http://www.mplayerhq.hu/"
51 >=media-libs/freetype-2.2.1:2
57 # Rar: althrought -gpl version is nice, it cant do most functions normal rars can
58 # nemesi? ( net-libs/libnemesi )
63 >=media-video/ffmpeg-2.0:0=[vdpau?]
64 a52? ( media-libs/a52dec )
65 aalib? ( media-libs/aalib )
66 alsa? ( media-libs/alsa-lib )
67 bidi? ( dev-libs/fribidi )
68 bluray? ( >=media-libs/libbluray-0.2.1 )
69 bs2b? ( media-libs/libbs2b )
70 cdio? ( dev-libs/libcdio )
71 cdparanoia? ( !cdio? ( media-sound/cdparanoia ) )
72 dga? ( x11-libs/libXxf86dga )
73 directfb? ( dev-libs/DirectFB )
74 dts? ( media-libs/libdca )
75 dv? ( media-libs/libdv )
76 dvb? ( virtual/linuxtv-dvb-headers )
77 dvd? ( >=media-libs/libdvdread-4.1.3 )
78 dvdnav? ( >=media-libs/libdvdnav-4.1.3 )
80 !twolame? ( toolame? ( media-sound/toolame ) )
81 twolame? ( media-sound/twolame )
82 faac? ( media-libs/faac )
83 mp3? ( media-sound/lame )
84 x264? ( >=media-libs/x264-0.0.20100423:= )
85 xvid? ( media-libs/xvid )
87 enca? ( app-i18n/enca )
88 faad? ( media-libs/faad2 )
89 ggi? ( media-libs/libggi media-libs/libggiwmh )
90 gif? ( media-libs/giflib )
91 gsm? ( media-sound/gsm )
92 iconv? ( virtual/libiconv )
93 jack? ( media-sound/jack-audio-connection-kit )
94 jpeg? ( virtual/jpeg:0 )
95 jpeg2k? ( media-libs/openjpeg:0 )
96 ladspa? ( media-libs/ladspa-sdk )
97 libass? ( >=media-libs/libass-0.9.10:=[enca?] )
98 libcaca? ( media-libs/libcaca )
99 libmpeg2? ( media-libs/libmpeg2 )
100 lirc? ( app-misc/lirc )
101 live? ( media-plugins/live )
102 lzo? ( >=dev-libs/lzo-2 )
103 mad? ( media-libs/libmad )
104 mng? ( media-libs/libmng:= )
105 mp3? ( media-sound/mpg123 )
106 nas? ( media-libs/nas )
107 nut? ( >=media-libs/libnut-661 )
108 openal? ( media-libs/openal )
109 opengl? ( virtual/opengl )
110 png? ( media-libs/libpng:0= )
111 pnm? ( media-libs/netpbm )
112 pulseaudio? ( media-sound/pulseaudio )
119 rtmp? ( media-video/rtmpdump )
120 samba? ( net-fs/samba )
121 sdl? ( media-libs/libsdl )
122 speex? ( media-libs/speex )
123 theora? ( media-libs/libtheora[encode?] )
124 tremor? ( media-libs/tremor )
125 truetype? ( ${FONT_RDEPS} )
126 vdpau? ( x11-libs/libvdpau )
127 vorbis? ( !tremor? ( media-libs/libvorbis ) )
129 xanim? ( media-video/xanim )
130 xinerama? ( x11-libs/libXinerama )
131 xscreensaver? ( x11-libs/libXScrnSaver )
132 xv? ( x11-libs/libXv )
133 xvmc? ( x11-libs/libXvMC )
138 x11-proto/xf86vidmodeproto
140 ASM_DEP="dev-lang/yasm"
143 dga? ( x11-proto/xf86dgaproto )
145 xinerama? ( x11-proto/xineramaproto )
146 xscreensaver? ( x11-proto/scrnsaverproto )
147 amd64? ( ${ASM_DEP} )
149 dev-libs/libxslt app-text/docbook-xml-dtd
150 app-text/docbook-xsl-stylesheets
153 x86-fbsd? ( ${ASM_DEP} )
156 selinux? ( sec-policy/selinux-mplayer )
161 if [[ ${PV} != *9999* ]]; then
162 KEYWORDS="alpha amd64 arm hppa ppc ppc64 sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
164 KEYWORDS="alpha amd64 arm hppa ppc ppc64 sparc"
167 # faac codecs are nonfree
168 # libcdio support: prefer libcdio over cdparanoia and don't check for cddb w/cdio
169 # dvd navigation requires dvd read support
170 # ass and freetype font require iconv and ass requires freetype fonts
171 # unicode transformations are usefull only with iconv
172 # radio requires oss or alsa backend
173 # xvmc requires xvideo support
189 RESTRICT="faac? ( bindist )"
192 # Work with pulseaudio-6, bug #549680, https://trac.mplayerhq.hu/ticket/2241
193 "${FILESDIR}"/${PN}-1.2_pre20150214-pulseaudio-6.0.patch
197 if [[ ${PV} == *9999* ]]; then
199 elog "This is a live ebuild which installs the latest from upstream's"
200 elog "subversion repository, and is unsupported by Gentoo."
201 elog "Everything but bugs in the ebuild itself will be ignored."
205 if use cpudetection; then
207 ewarn "You've enabled the cpudetection flag. This feature is"
208 ewarn "included mainly for people who want to use the same"
209 ewarn "binary on another system with a different CPU architecture."
210 ewarn "MPlayer will already detect your CPU settings by default at"
211 ewarn "buildtime; this flag is used for runtime detection."
212 ewarn "You won't need this turned on if you are only building"
213 ewarn "mplayer for this system. Also, if your compile fails, try"
214 ewarn "disabling this use flag."
217 if has_version 'media-video/libav' ; then
218 ewarn "Please note that upstream uses media-video/ffmpeg."
219 ewarn "media-video/libav should be fine in theory but if you"
220 ewarn "experience any problem, try to move to media-video/ffmpeg."
225 if [[ ${PV} = *9999* ]]; then
226 subversion_src_unpack
228 rm -rf "${WORKDIR}/${P}/ffmpeg/"
229 ( S="${WORKDIR}/${P}/ffmpeg/" git-2_src_unpack )
234 if [[ ${PV} = *9999* ]] || [[ "${PV%_rc*}" = "${PV}" ]]; then
236 cp "${FILESDIR}/dump_ffmpeg.sh" . || die
237 chmod +x dump_ffmpeg.sh
238 ./dump_ffmpeg.sh || die
241 if ! use truetype; then
242 unpack font-arial-iso-8859-1.tar.bz2 \
243 font-arial-iso-8859-2.tar.bz2 \
244 font-arial-cp1250.tar.bz2
249 local svf=snapshot_version
250 if [[ ${PV} = *9999* ]]; then
251 # Set SVN version manually
253 printf "${ESVN_WC_REVISION}" > $svf
255 if [ ! -f VERSION ] ; then
256 [ -f "$svf" ] || die "Missing ${svf}. Did you generate your snapshot with prepare_mplayer.sh?"
258 printf "SVN-r${sv} (Gentoo)" > VERSION
261 # fix path to bash executable in configure scripts
262 sed -i -e "1c\#!${EPREFIX}/bin/bash" configure version.sh || die
266 # Use sane default for >=virtual/udev-197
267 sed -i -e '/default_dvd_device/s:/dev/dvd:/dev/cdrom:' configure || die
275 [[ -n $LINGUAS ]] && LINGUAS="${LINGUAS/da/dk}"
276 [[ -n $LINGUAS ]] && LINGUAS="${LINGUAS/zh/zh_CN}" #482968
278 # mplayer ebuild uses "use foo || --disable-foo" to forcibly disable
279 # compilation in almost every situation. The reason for this is
280 # because if --enable is used, it will force the build of that option,
281 # regardless of whether the dependency is available or not.
286 # disable svga since we don't want it
287 # disable arts since we don't have kde3
288 # always disable internal ass
289 # disable opus and ilbc since it only controls support in internal
290 # ffmpeg which we do not use
292 --disable-svga --disable-svgalib_helper
293 --disable-ass-internal
298 $(use_enable network networking)
299 $(use_enable joystick)
301 uses="bl bluray enca ftp rtc" # nemesi <- not working with in-tree ebuild
302 myconf+=" --disable-nemesi" # nemesi automagic disable
304 use ${i} || myconf+=" --disable-${i}"
306 use bidi || myconf+=" --disable-fribidi"
307 use ipv6 || myconf+=" --disable-inet6"
308 use libass || myconf+=" --disable-ass"
309 use nut || myconf+=" --disable-libnut"
310 use rar || myconf+=" --disable-unrarexec"
311 use samba || myconf+=" --disable-smb"
312 use lirc || myconf+=" --disable-lirc --disable-lircc --disable-apple-ir"
314 # libcdio support: prefer libcdio over cdparanoia
315 # don't check for cddb w/cdio
317 myconf+=" --disable-cdparanoia"
319 myconf+=" --disable-libcdio"
320 use cdparanoia || myconf+=" --disable-cdparanoia"
321 use cddb || myconf+=" --disable-cddb"
324 ################################
325 # DVD read, navigation support #
326 ################################
328 # dvdread - accessing a DVD
329 # dvdnav - navigation of menus
330 use dvd || myconf+=" --disable-dvdread"
331 use dvdnav || myconf+=" --disable-dvdnav"
337 # SRT/ASS/SSA (subtitles) requires freetype support
338 # freetype support requires iconv
339 # iconv optionally can use unicode
340 use truetype || myconf+=" --disable-freetype"
341 use iconv || myconf+=" --disable-iconv --charset=noconv"
342 use iconv && use unicode && myconf+=" --charset=UTF-8"
344 #####################################
345 # DVB / Video4Linux / Radio support #
346 #####################################
347 myconf+=" --disable-tv-bsdbt848"
348 # broken upstream, won't work with recent kernels
349 myconf+=" --disable-ivtv"
350 # gone since linux-headers-2.6.38
351 myconf+=" --disable-tv-v4l1"
352 if { use dvb || use v4l || use pvr || use radio; }; then
353 use dvb || myconf+=" --disable-dvb"
354 use pvr || myconf+=" --disable-pvr"
355 use v4l || myconf+=" --disable-tv-v4l2"
356 if use radio && { use dvb || use v4l; }; then
359 $(use_enable encode radio-capture)
364 --disable-radio-bsdbt848
373 --disable-radio-bsdbt848
382 myconf+=" --disable-musepack" # Use internal musepack codecs for SV7 and SV8 support
383 myconf+=" --disable-libmpeg2-internal" # always use system media-libs/libmpeg2
384 use dts || myconf+=" --disable-libdca"
391 uses="a52 bs2b dv gsm lzo rtmp vorbis"
393 use ${i} || myconf+=" --disable-lib${i}"
396 uses="faad gif jpeg libmpeg2 live mad mng png pnm speex tga theora tremor xanim"
398 use ${i} || myconf+=" --disable-${i}"
400 use jpeg2k || myconf+=" --disable-libopenjpeg"
403 uses="faac x264 xvid toolame twolame"
406 use ${i} || myconf+=" --disable-${i}"
409 myconf+=" --disable-mencoder"
411 myconf+=" --disable-${i}"
412 use ${i} && elog "Useflag \"${i}\" will only be useful for encoding, i.e., with \"encode\" useflag enabled."
419 myconf+=" --disable-qtx --disable-real --disable-win32dll"
424 uses="directfb md5sum sdl"
426 use ${i} || myconf+=" --disable-${i}"
428 use aalib || myconf+=" --disable-aa"
429 use fbcon || myconf+=" --disable-fbdev"
430 use fbcon && use video_cards_s3virge && myconf+=" --enable-s3fb"
431 use libcaca || myconf+=" --disable-caca"
432 use zoran || myconf+=" --disable-zr"
434 if ! use kernel_linux || ! use video_cards_mga; then
435 myconf+=" --disable-mga --disable-xmga"
438 if use video_cards_tdfx; then
440 $(use_enable video_cards_tdfx tdfxvid)
441 $(use_enable fbcon tdfxfb)
451 # sun card, disable by default, see bug #258729
452 myconf+=" --disable-xvr100"
457 myconf+=" --disable-esd"
458 uses="alsa jack ladspa nas openal"
460 use ${i} || myconf+=" --disable-${i}"
462 use pulseaudio || myconf+=" --disable-pulse"
464 use oss || myconf+=" --disable-ossaudio"
470 # Platform specific flags, hardcoded on amd64 (see below)
471 use cpudetection && myconf+=" --enable-runtime-cpudetection"
473 uses="3dnow 3dnowext mmx mmxext sse sse2 ssse3"
475 myconf+=" $(use_enable cpu_flags_x86_${i} ${i})"
480 myconf+=" $(use_enable ${i})"
483 use debug && myconf+=" --enable-debug=3"
485 if use x86 && gcc-specs-pie; then
486 filter-flags -fPIC -fPIE
487 append-ldflags -nopie
490 ###########################
491 # X enabled configuration #
492 ###########################
493 myconf+=" --disable-gui"
494 myconf+=" --disable-vesa"
495 uses="ggi vdpau xinerama xv"
497 use ${i} || myconf+=" --disable-${i}"
499 use dga || myconf+=" --disable-dga1 --disable-dga2"
500 use opengl || myconf+=" --disable-gl"
501 use osdmenu && myconf+=" --enable-menu"
502 use vidix || myconf+=" --disable-vidix --disable-vidix-pcidb"
503 use xscreensaver || myconf+=" --disable-xss"
504 use X || myconf+=" --disable-x11"
506 myconf+=" --enable-xvmc --with-xvmclib=XvMCW"
508 myconf+=" --disable-xvmc"
511 ############################
512 # OSX (aqua) configuration #
513 ############################
516 --enable-macosx-finder
517 --enable-macosx-bundle
523 --host-cc="$(tc-getBUILD_CC)" \
524 --prefix="${EPREFIX}/usr" \
525 --bindir="${EPREFIX}/usr/bin" \
526 --libdir="${EPREFIX}/usr/$(get_libdir)" \
527 --confdir="${EPREFIX}/etc/mplayer" \
528 --datadir="${EPREFIX}/usr/share/mplayer${namesuf}" \
529 --mandir="${EPREFIX}/usr/share/man" \
536 # Build only user-requested docs if they're available.
538 # select available languages from $LINGUAS
539 local ALLOWED_LINGUAS="cs de en es fr hu it pl ru zh_CN"
541 for i in ${LINGUAS} ; do
542 has ${i} ${ALLOWED_LINGUAS} && BUILT_DOCS+=" ${i}"
544 if [[ -z $BUILT_DOCS ]]; then
545 emake -j1 html-chunked
547 for i in ${BUILT_DOCS}; do
548 emake -j1 html-chunked-${i}
562 dodoc AUTHORS Changelog Copyright README etc/codecs.conf
565 dodoc DOCS/tech/{*.txt,MAINTAINERS,mpsub.sub,playtree,TODO,wishlist}
568 docinto tech/mirrors/
569 dodoc DOCS/tech/mirrors/*
573 dohtml -r "${S}"/DOCS/HTML/*
576 if ! use truetype; then
577 dodir /usr/share/mplayer/fonts
578 # Do this generic, as the mplayer people like to change the structure
580 for i in $(find "${WORKDIR}/" -type d -name 'font-arial-*'); do
581 cp -pPR "${i}" "${ED}/usr/share/mplayer/fonts"
583 # Fix the font symlink ...
584 rm -rf "${ED}/usr/share/mplayer/font"
585 dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
589 newins "${S}/etc/example.conf" mplayer.conf
590 cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
591 # Config options can be section specific, global
592 # options should go in the default section
595 doins "${S}/etc/input.conf"
597 doins "${S}/etc/menu.conf"
600 if use truetype; then
601 cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
610 cat >> "${ED}/etc/mplayer/mplayer.conf" << _EOF_
611 unrarexec=${EPREFIX}/usr/bin/unrar
615 dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
616 newbin "${S}/TOOLS/midentify.sh" midentify
620 [[ -d ${EROOT}/usr/share/mplayer/Skin/default ]] && \
621 rm -rf "${EROOT}/usr/share/mplayer/Skin/default"
625 # Cleanup stale symlinks
626 [ -L "${EROOT}/usr/share/mplayer/font" -a \
627 ! -e "${EROOT}/usr/share/mplayer/font" ] && \
628 rm -f "${EROOT}/usr/share/mplayer/font"
630 [ -L "${EROOT}/usr/share/mplayer/subfont.ttf" -a \
631 ! -e "${EROOT}/usr/share/mplayer/subfont.ttf" ] && \
632 rm -f "${EROOT}/usr/share/mplayer/subfont.ttf"