1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 ESVN_REPO_URI
="svn://svn.mplayerhq.hu/mplayer/trunk"
9 inherit eutils flag-o-matic multilib subversion
11 IUSE
="3dnow 3dnowext +a52 +aac aalib +alsa altivec +amrnb +amrwb -arts +ass
12 bidi bindist bl +cddb +cdio cdparanoia -cpudetection -custom-cflags
13 -custom-cpuopts debug dga +dirac directfb doc +dts +dv dvb +dvd +dvdnav dxr3
14 +enca +encode esd +faac +faad fbcon +ftp +gif ggi -gtk +iconv ipv6 jack
15 joystick +jpeg kernel_linux ladspa libcaca lirc +live lzo +mad +md5sum
16 +mmx mmxext mng +mp2 +mp3 musepack nas +nemesi +network openal +opengl oss
17 +png +pnm pulseaudio -pvr +quicktime radio +rar +real -realcodecs +rtc
18 -samba +schroedinger +sdl +speex sse sse2 ssse3 svga teletext tga +theora
19 +tremor +truetype +unicode v4l v4l2 vdpau vidix +vorbis -win32codecs +X +x264
20 xanim xinerama +xscreensaver +xv +xvid +xvmc zoran"
22 VIDEO_CARDS
="s3virge mga tdfx nvidia vesa"
24 for x
in ${VIDEO_CARDS}; do
25 IUSE
="${IUSE} video_cards_${x}"
29 !truetype? ( 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 )
32 !iconv? ( mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
33 mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
34 mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2 )
35 gtk? ( mirror://mplayer/Skin/productive-1.0.tar.bz2 )
36 svga? ( mirror://mplayer/contrib/svgalib/svgalib_helper-1.9.17-mplayer.tar.bz2 )"
38 DESCRIPTION
="A very versatile media player"
39 HOMEPAGE
="http://www.mplayerhq.hu/"
41 RDEPEND
="sys-libs/ncurses
44 win32codecs? ( media-libs/win32codecs )
45 realcodecs? ( media-libs/win32codecs
46 media-libs/realcodecs )
48 amd64? ( realcodecs? ( media-libs/amd64codecs ) )
50 aalib? ( media-libs/aalib )
51 alsa? ( media-libs/alsa-lib )
52 amrnb? ( media-libs/amrnb )
53 amrwb? ( media-libs/amrwb )
54 arts? ( kde-base/arts )
55 ass? ( media-libs/freetype:2
56 media-libs/fontconfig )
57 openal? ( media-libs/openal )
58 bidi? ( dev-libs/fribidi )
59 cdio? ( dev-libs/libcdio )
60 cdparanoia? ( media-sound/cdparanoia )
61 dirac? ( media-video/dirac )
62 directfb? ( dev-libs/DirectFB )
63 dga? ( x11-libs/libXxf86dga )
64 dts? ( media-libs/libdca )
65 dv? ( media-libs/libdv )
66 dvb? ( media-tv/linuxtv-dvb-headers )
68 mp2? ( media-sound/twolame )
69 mp3? ( media-sound/lame )
70 faac? ( media-libs/faac )
71 x264? ( >=media-libs/x264-0.0.20081006 )
72 xvid? ( media-libs/xvid )
74 esd? ( media-sound/esound )
75 enca? ( app-i18n/enca )
76 faad? ( media-libs/faad2 )
77 gif? ( media-libs/giflib )
78 ggi? ( media-libs/libggi
79 media-libs/libggiwmh )
80 gtk? ( media-libs/libpng
85 jpeg? ( media-libs/jpeg )
86 ladspa? ( media-libs/ladspa-sdk )
87 libcaca? ( media-libs/libcaca )
88 lirc? ( app-misc/lirc )
89 lzo? ( >=dev-libs/lzo-2 )
90 mad? ( media-libs/libmad )
91 mng? ( media-libs/libmng )
92 musepack? ( >=media-libs/libmpcdec-1.2.2 )
93 nas? ( media-libs/nas )
94 opengl? ( virtual/opengl )
95 png? ( media-libs/libpng )
96 pnm? ( media-libs/netpbm )
97 pulseaudio? ( media-sound/pulseaudio )
98 rar? ( || ( app-arch/unrar
100 app-arch/unrar-gpl ) )
101 samba? ( net-fs/samba )
102 schroedinger? ( media-libs/schroedinger )
103 sdl? ( media-libs/libsdl )
104 speex? ( media-libs/speex )
105 svga? ( media-libs/svgalib )
106 theora? ( media-libs/libtheora )
107 live? ( >=media-plugins/live-2007.02.20 )
108 truetype? ( media-libs/freetype:2
109 media-libs/fontconfig )
110 vdpau? ( >=x11-drivers/nvidia-drivers-180.22 )
111 vidix? ( x11-libs/libXxf86vm
113 vorbis? ( media-libs/libvorbis )
114 xanim? ( media-video/xanim )
115 xinerama? ( x11-libs/libXinerama
118 xscreensaver? ( x11-libs/libXScrnSaver )
122 xvmc? ( x11-libs/libXvMC ) )
123 X? ( x11-libs/libXxf86vm
128 doc? ( dev-libs/libxslt )
129 dga? ( x11-proto/xf86dgaproto )
130 dxr3? ( media-video/em8300-libraries )
131 xinerama? ( x11-proto/xineramaproto )
132 xv? ( x11-proto/videoproto
133 x11-proto/xf86vidmodeproto )
134 gtk? ( x11-proto/xextproto
135 x11-proto/xf86vidmodeproto )
136 X? ( x11-proto/xextproto
137 x11-proto/xf86vidmodeproto )
138 xscreensaver? ( x11-proto/scrnsaverproto )
139 iconv? ( virtual/libiconv )"
149 if [[ -n ${LINGUAS} ]]; then
151 elog
"MPlayer's build system uses the LINGUAS variable for both"
152 elog
"output messages and which man pages to build. The first"
153 elog
"language in the LINGUAS variable will be used to display"
154 elog
"output messages. See bug #228799."
159 ewarn
"You've enabled the 'gtk' use flag which will build"
160 ewarn
"GMPlayer, which is no longer actively developed upstream"
161 ewarn
"and is not supported by Gentoo. There are alternatives"
162 ewarn
"for a GUI frontend: smplayer, gnome-mplayer and kmplayer."
165 if use cpudetection
; then
167 ewarn
"You've enabled the cpudetection flag. This feature is"
168 ewarn
"included mainly for people who want to use the same"
169 ewarn
"binary on another system with a different CPU architecture."
170 ewarn
"MPlayer will already detect your CPU settings by default at"
171 ewarn
"buildtime; this flag is used for runtime detection."
172 ewarn
"You won't need this turned on if you are only building"
173 ewarn
"mplayer for this system. Also, if your compile fails, try"
174 ewarn
"disabling this use flag."
177 if use custom-cpuopts
; then
179 ewarn
"You are using the custom-cpuopts flag which will"
180 ewarn
"specifically allow you to enable / disable certain"
181 ewarn
"CPU optimizations."
183 ewarn
"Most desktop users won't need this functionality, but it"
184 ewarn
"is included for corner cases like cross-compiling and"
185 ewarn
"certain profiles. If unsure, disable this flag and MPlayer"
186 ewarn
"will automatically detect and use your available CPU"
187 ewarn
"optimizations."
189 ewarn
"Using this flag means your build is unsupported, so"
190 ewarn
"please make sure your CPU optimization use flags (3dnow"
191 ewarn
"3dnowext mmx mmxext sse sse2 ssse3) are properly set."
196 subversion_src_unpack
199 if ! use truetype
; then
200 unpack font-arial-iso-8859-1.
tar.bz2 \
201 font-arial-iso-8859-2.
tar.bz2 \
202 font-arial-cp1250.
tar.bz2
205 use gtk
&& unpack productive-1.0.
tar.bz2
207 use svga
&& unpack
"svgalib_helper-1.9.17-mplayer.tar.bz2"
209 # For Version Branding
210 cd "${ESVN_STORE_DIR}/${ESVN_CO_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/}"
215 epatch
"${FILESDIR}"/disable-version-rebranding-2009-01.
patch
217 # Fix hppa compilation
218 use hppa
&& sed -i -e "s/-O4/-O1/" "${S}/configure"
222 einfo
"Enabling vidix non-root mode."
223 einfo
"(You need a proper svgalib_helper.o module for your kernel"
224 einfo
"to actually use this)"
227 mv "${WORKDIR}/svgalib_helper" "${S}/libdha"
230 # Fix polish spelling errors
231 [[ -n ${LINGUAS} ]] && sed -e 's:Zarządano:Zażądano:' -i help
/help_mp-pl.h
238 # MPlayer reads in the LINGUAS variable from make.conf, and sets
239 # the languages accordingly. Some will have to be altered to match
240 # upstream's naming scheme.
241 [[ -n $LINGUAS ]] && LINGUAS
="${LINGUAS/da/dk}"
243 # mplayer ebuild uses "use foo || --disable-foo" to forcibly disable
244 # compilation in almost every situation. The reason for this is
245 # because if --enable is used, it will force the build of that option,
246 # regardless of whether the dependency is available or not.
251 myconf
="${myconf} --enable-menu"
252 myconf
="${myconf} $(use_enable network)"
253 use ass || myconf
="${myconf} --disable-ass"
254 use bidi || myconf
="${myconf} --disable-fribidi"
255 use bl
&& myconf
="${myconf} --enable-bl"
256 use enca || myconf
="${myconf} --disable-enca"
257 use encode || myconf
="${myconf} --disable-mencoder"
258 use
ftp || myconf
="${myconf} --disable-ftp"
259 use ipv6 || myconf
="${myconf} --disable-inet6"
260 use lirc || myconf
="${myconf} --disable-lirc --disable-lircc"
261 use nemesi || myconf
="${myconf} --disable-nemesi"
262 use rar || myconf
="${myconf} --disable-unrarexec"
263 use rtc || myconf
="${myconf} --disable-rtc"
264 use samba || myconf
="${myconf} --disable-smb"
265 use xscreensaver || myconf
="${myconf} --disable-xss"
266 myconf
="${myconf} $(use_enable joystick)"
268 # libcdio support: prefer libcdio over cdparanoia
269 # don't check for cddb w/cdio
271 myconf
="${myconf} --disable-cdparanoia"
273 myconf
="${myconf} --disable-libcdio"
274 use cdparanoia || myconf
="${myconf} --disable-cdparanoia"
275 use cddb || myconf
="${myconf} --disable-cddb"
279 # DVD read, navigation support
282 # dvdread - accessing a DVD
283 # dvdnav - navigation of menus
285 # internal dvdread and dvdnav use flags enable internal
286 # versions of the libraries, which are snapshots of the fork.
288 # Only check for disabled a52 use flag inside the DVD check,
289 # since many users were getting confused why there was no
293 use dvdnav || myconf
="${myconf} --disable-dvdnav"
295 myconf
="${myconf} --disable-dvdnav --disable-dvdread \
296 --disable-dvdread-internal --disable-libdvdcss-internal"
297 use a52 || myconf
="${myconf} --disable-liba52-internal"
304 # SRT/ASS/SSA (subtitles) requires freetype support
305 # freetype support requires iconv
306 # iconv optionally can use unicode
308 if ! use truetype
; then
309 myconf
="${myconf} --disable-freetype"
311 myconf
="${myconf} --disable-iconv --charset=noconv"
315 use
iconv && use unicode
&& myconf
="${myconf} --charset=UTF-8"
318 # DVB / Video4Linux / Radio support
320 myconf
="${myconf} --disable-tv-bsdbt848"
321 # broken upstream, won't work with recent kernels
322 myconf
="${myconf} --disable-ivtv"
323 if { use dvb || use v4l || use v4l2 || use pvr || use radio
; }; then
324 use dvb || myconf
="${myconf} --disable-dvb --disable-dvbhead"
325 use pvr || myconf
="${myconf} --disable-pvr"
326 use v4l || myconf
="${myconf} --disable-tv-v4l1"
327 use v4l2 || myconf
="${myconf} --disable-tv-v4l2"
328 use teletext || myconf
="${myconf} --disable-tv-teletext"
329 if use radio
&& { use dvb || use v4l || use v4l2
; }; then
330 myconf
="${myconf} --enable-radio $(use_enable encode radio-capture)"
332 myconf
="${myconf} --disable-radio-v4l2 --disable-radio-bsdbt848"
335 myconf
="${myconf} --disable-tv --disable-tv-v4l1 --disable-tv-v4l2 \
336 --disable-radio --disable-radio-v4l2 --disable-radio-bsdbt848 \
337 --disable-dvb --disable-dvbhead --disable-tv-teletext \
338 --disable-v4l2 --disable-pvr"
344 # Won't work with external liba52
345 myconf
="${myconf} --disable-liba52"
347 use aac || myconf
="${myconf} --disable-faad-internal"
348 use amrnb || myconf
="${myconf} --disable-libamr_nb"
349 use amrwb || myconf
="${myconf} --disable-libamr_wb"
350 use dirac || myconf
="${myconf} --disable-libdirac-lavc"
351 use dts || myconf
="${myconf} --disable-libdca"
352 use dv || myconf
="${myconf} --disable-libdv"
353 use faad || myconf
="${myconf} --disable-faad"
354 use lzo || myconf
="${myconf} --disable-liblzo"
355 use mp3 || myconf
="${myconf} --disable-mp3lame --disable-mp3lame-lavc \
357 use schroedinger || myconf
="${myconf} --disable-libschroedinger-lavc"
358 use xanim
&& myconf
="${myconf} --xanimcodecsdir=/usr/lib/xanim/mods"
359 ! use png
&& ! use gtk
&& myconf
="${myconf} --disable-png"
360 for x
in gif jpeg live mad mng musepack pnm speex tga theora xanim
; do
361 use
${x} || myconf="${myconf} --disable-${x}"
363 if use vorbis || use tremor; then
364 use tremor || myconf="${myconf} --disable-tremor-internal"
365 use vorbis || myconf="${myconf} --disable-libvorbis"
367 myconf="${myconf} --disable-tremor-internal --disable-tremor \
372 use aac || myconf="${myconf} --disable-faac-lavc"
373 use faac || myconf="${myconf} --disable-faac"
374 use x264 || myconf="${myconf} --disable-x264"
375 use xvid || myconf="${myconf} --disable-xvid"
376 use mp2 || myconf="${myconf} --disable-twolame --disable-toolame"
378 myconf="${myconf} --disable-faac-lavc --disable-faac --disable-x264 \
379 --disable-xvid --disable-x264-lavc --disable-xvid-lavc \
380 --disable-twolame --disable-toolame"
387 if ! use x86 || ! use win32codecs; then
388 use quicktime || myconf="${myconf} --disable-qtx"
395 # Realplayer support shows up in four places:
396 # - libavcodec (internal)
398 # - realcodecs (win32codecs libs)
399 # - realcodecs (realplayer libs)
403 use real || myconf="${myconf} --disable-real"
405 # Real binary codec support only available on x86, amd64
406 if use realcodecs; then
407 use x86 && myconf="${myconf} \
408 --realcodecsdir=/opt
/RealPlayer
/codecs
"
409 use amd64 && myconf="${myconf} \
410 --realcodecsdir=/usr
/$
(get_libdir
)/codecs
"
411 elif ! use bindist; then
412 myconf="${myconf} $
(use_enable win32codecs win32dll
)"
418 for x in directfb ggi md5sum sdl xinerama; do
419 use ${x} || myconf="${myconf} --disable-${x}"
421 use aalib || myconf
="${myconf} --disable-aa"
422 use dga || myconf
="${myconf} --disable-dga1 --disable-dga2"
423 use fbcon || myconf
="${myconf} --disable-fbdev"
424 use fbcon
&& use video_cards_s3virge
&& myconf
="${myconf} --enable-s3fb"
425 use libcaca || myconf
="${myconf} --disable-caca"
426 use opengl || myconf
="${myconf} --disable-gl"
427 use video_cards_vesa || myconf
="${myconf} --disable-vesa"
428 use video_cards_nvidia
&& use vdpau || myconf
="${myconf} --disable-vdpau"
429 use vidix || myconf
="${myconf} --disable-vidix --disable-vidix-pcidb"
430 use zoran || myconf
="${myconf} --disable-zr"
432 # MPlayer incorrectly looks for DXR3 support, so forcibly enable
433 # if requested. See bug 223587
434 myconf
="${myconf} $(use_enable dxr3)"
437 # Unsupported by Gentoo, upstream has dropped development
438 myconf
="${myconf} $(use_enable gtk gui)"
442 myconf
="${myconf} --enable-xvmc --with-xvmclib=XvMCW"
444 myconf
="${myconf} --disable-xvmc"
447 myconf
="${myconf} --disable-xv --disable-xvmc"
450 if ! use kernel_linux
&& ! use video_cards_mga
; then
451 myconf
="${myconf} --disable-mga --disable-xmga"
454 if use video_cards_tdfx
; then
455 myconf
="${myconf} $(use_enable video_cards_tdfx tdfxvid) \
456 $(use_enable fbcon tdfxfb)"
458 myconf
="${myconf} --disable-3dfx --disable-tdfxvid --disable-tdfxfb"
464 for x
in alsa arts esd jack ladspa nas openal
; do
465 use
${x} || myconf="${myconf} --disable-${x}"
467 use pulseaudio || myconf="${myconf} --disable-pulse"
469 use oss || myconf="${myconf} --disable-ossaudio"
475 # Platform specific flags, hardcoded on amd64 (see below)
476 if use cpudetection; then
477 myconf="${myconf} --enable-runtime-cpudetection"
480 # Turning off CPU optimizations usually will break the build.
481 # However, this use flag, if enabled, will allow users to completely
482 # specify which ones to use. If disabled, mplayer will automatically
483 # enable all CPU optimizations that the host build supports.
484 if use custom-cpuopts; then
485 for x in 3dnow 3dnowext mmx mmxext sse sse2 ssse3; do
486 myconf="${myconf} $
(use_enable
$x)"
490 use debug && myconf="${myconf} --enable-debug=3"
492 myconf="${myconf} $
(use_enable altivec
)"
494 if use custom-cflags; then
495 # ugly optimizations cause MPlayer to cry on x86 systems!
496 if use x86 || use x86-fbsd ; then
497 replace-flags -O* -O2
498 filter-flags -fPIC -fPIE
500 use debug || append-flags -fomit-frame-pointer
502 append-flags -D__STDC_LIMIT_MACROS
504 unset CFLAGS CXXFLAGS
507 myconf="--cc=$
(tc-getCC
) \
508 --host-cc=$
(tc-getBUILD_CC
) \
510 --confdir=/etc
/mplayer \
511 --datadir=/usr
/share
/mplayer \
512 --libdir=/usr
/$
(get_libdir
) \
515 #echo "CFLAGS
=\"${CFLAGS}\" .
/configure
${myconf}"
516 CFLAGS="${CFLAGS}" ./configure ${myconf} || die "configure died
"
518 emake || die "Failed to build MPlayer
!"
519 use doc && make -C DOCS/xml html-chunked
524 make prefix="${D}/usr
" \
525 BINDIR="${D}/usr
/bin
" \
526 LIBDIR="${D}/usr
/$
(get_libdir
)" \
527 CONFDIR="${D}/etc
/mplayer
" \
528 DATADIR="${D}/usr
/share
/mplayer
" \
529 MANDIR="${D}/usr
/share
/man
" \
531 install || die "Failed to
install MPlayer
!"
533 dodoc AUTHORS Changelog Copyright README etc/codecs.conf
536 dodoc DOCS/tech/{*.txt,MAINTAINERS,mpsub.sub,playtree,TODO,wishlist}
537 docinto tech/realcodecs/
538 dodoc DOCS/tech/realcodecs/*
539 docinto tech/mirrors/
540 dodoc DOCS/tech/mirrors/*
544 docinto TOOLS/realcodecs/
545 dodoc TOOLS/realcodecs/*
548 dodir /usr/share/mplayer/skins
549 cp -r "${WORKDIR}/productive
" \
550 "${D}/usr
/share
/mplayer
/skins
/default
" || die "cp skins died
"
553 rm -rf "${D}/usr
/bin
/gmplayer
"
554 dosym mplayer /usr/bin/gmplayer
557 if ! use ass && ! use truetype; then
558 dodir /usr/share/mplayer/fonts
560 # Do this generic, as the mplayer people like to change the structure
562 for x in $(find "${WORKDIR}/" -type d -name 'font-arial-*')
564 cp -pPR "${x}" "${D}/usr
/share
/mplayer
/fonts
"
566 # Fix the font symlink ...
567 rm -rf "${D}/usr
/share
/mplayer
/font
"
568 dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
572 newins "${S}/etc
/example.conf
" mplayer.conf
574 if use ass || use truetype; then
575 cat >> "${D}/etc
/mplayer
/mplayer.conf
" << EOT
584 cat >> "${D}/etc
/mplayer
/mplayer.conf
" << EOT
585 unrarexec=/usr/bin/unrar
589 dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
591 newbin "${S}/TOOLS
/midentify.sh
" midentify
593 insinto /usr/share/mplayer
594 doins "${S}/etc
/input.conf
"
595 doins "${S}/etc
/menu.conf
"
600 if [[ -d ${ROOT}/usr/share/mplayer/Skin/default ]]
602 rm -rf "${ROOT}/usr
/share
/mplayer
/Skin
/default
"
608 # Cleanup stale symlinks
609 if [ -L "${ROOT}/usr
/share
/mplayer
/font
" -a \
610 ! -e "${ROOT}/usr
/share
/mplayer
/font
" ]
612 rm -f "${ROOT}/usr
/share
/mplayer
/font
"
615 if [ -L "${ROOT}/usr
/share
/mplayer
/subfont.ttf
" -a \
616 ! -e "${ROOT}/usr
/share
/mplayer
/subfont.ttf
" ]
618 rm -f "${ROOT}/usr
/share
/mplayer
/subfont.ttf
"