1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/media-video/mplayer/mplayer-1.0_rc2_p28058-r1.ebuild,v 1.7 2008/12/20 15:09:06 klausman Exp $
7 inherit eutils flag-o-matic multilib
9 # Ugly hack, feel free to fix
10 MPLAYER_REVISION=28058
12 IUSE="3dnow 3dnowext +a52 +aac -aalib +alsa altivec amrnb amrwb -arts +ass bidi bl
13 bindist cddb cdio cdparanoia -cpudetection -custom-cflags -custom-cpuopts debug
14 dga dirac doc dts dvb directfb +dvd dvdnav dv dxr3 enca +encode esd -fbcon ftp -gif ggi
15 -gtk iconv ipv6 jack joystick -jpeg kernel_linux ladspa -libcaca lirc live lzo
16 +mad -md5sum +mmx mmxext mng mp2 +mp3 musepack nas nemesi opengl
17 openal oss -png -pnm pulseaudio -pvr +quicktime radio -rar real rtc -samba schroedinger sdl
18 speex sse sse2 ssse3 svga teletext tga +theora +truetype unicode v4l v4l2
19 vidix +vorbis win32codecs +X x264 xanim xinerama +xscreensaver +xv xvid xvmc zoran"
21 VIDEO_CARDS="s3virge mga tdfx vesa"
23 for x in ${VIDEO_CARDS}; do
24 IUSE="${IUSE} video_cards_${x}"
29 AMR_URI="http://www.3gpp.org/ftp/Specs/archive"
30 SRC_URI="mirror://gentoo/${P}.tar.bz2
31 !truetype? ( mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
32 mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
33 mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2 )
34 !iconv? ( mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
35 mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
36 mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2 )
37 gtk? ( mirror://mplayer/Skin/Blue-${BLUV}.tar.bz2 )
38 svga? ( http://mplayerhq.hu/~alex/svgalib_helper-${SVGV}-mplayer.tar.bz2 )"
40 DESCRIPTION="Media Player for Linux"
41 HOMEPAGE="http://www.mplayerhq.hu/"
43 RDEPEND="sys-libs/ncurses
46 win32codecs? ( media-libs/win32codecs )
47 real? ( media-libs/win32codecs
48 media-libs/realcodecs )
50 amd64? ( real? ( media-libs/amd64codecs ) )
52 aalib? ( media-libs/aalib )
53 alsa? ( media-libs/alsa-lib )
54 amrnb? ( media-libs/amrnb )
55 amrwb? ( media-libs/amrwb )
56 arts? ( kde-base/arts )
57 ass? ( >=media-libs/freetype-2.1
58 media-libs/fontconfig )
59 openal? ( media-libs/openal )
60 bidi? ( dev-libs/fribidi )
61 cdio? ( dev-libs/libcdio )
62 cdparanoia? ( media-sound/cdparanoia )
63 dirac? ( >=media-video/dirac-0.10.0 )
64 directfb? ( dev-libs/DirectFB )
65 dga? ( x11-libs/libXxf86dga )
66 dts? ( media-libs/libdca )
67 dvdnav? ( >=media-libs/libdvdnav-4.1.3
68 >=media-libs/libdvdread-4.1.3 )
69 dv? ( media-libs/libdv )
70 dvb? ( media-tv/linuxtv-dvb-headers )
72 aac? ( media-libs/faac )
73 mp2? ( media-sound/twolame )
74 mp3? ( media-sound/lame )
75 x264? ( >=media-libs/x264-0.0.20080406 )
77 esd? ( media-sound/esound )
78 enca? ( app-i18n/enca )
79 gif? ( media-libs/giflib )
80 ggi? ( media-libs/libggi
81 media-libs/libggiwmh )
82 gtk? ( media-libs/libpng
87 jpeg? ( media-libs/jpeg )
88 ladspa? ( media-libs/ladspa-sdk )
89 libcaca? ( media-libs/libcaca )
90 lirc? ( app-misc/lirc )
91 lzo? ( >=dev-libs/lzo-2 )
92 mad? ( media-libs/libmad )
93 mng? ( media-libs/libmng )
94 musepack? ( >=media-libs/libmpcdec-1.2.2 )
95 nas? ( media-libs/nas )
96 opengl? ( virtual/opengl )
97 png? ( media-libs/libpng )
98 pnm? ( media-libs/netpbm )
99 pulseaudio? ( media-sound/pulseaudio )
100 samba? ( net-fs/samba )
101 schroedinger? ( media-libs/schroedinger )
102 sdl? ( media-libs/libsdl )
103 speex? ( >=media-libs/speex-1.1.7 )
104 svga? ( media-libs/svgalib )
105 theora? ( media-libs/libtheora )
106 live? ( >=media-plugins/live-2007.02.20 )
107 truetype? ( >=media-libs/freetype-2.1
108 media-libs/fontconfig )
109 vidix? ( x11-libs/libXxf86vm
111 xanim? ( media-video/xanim )
112 xinerama? ( x11-libs/libXinerama
115 xscreensaver? ( x11-libs/libXScrnSaver )
119 xvmc? ( x11-libs/libXvMC ) )
120 xvid? ( media-libs/xvid )
121 X? ( x11-libs/libXxf86vm
126 doc? ( dev-libs/libxslt )
127 dga? ( x11-proto/xf86dgaproto )
128 dxr3? ( media-video/em8300-libraries )
129 xinerama? ( x11-proto/xineramaproto )
130 xv? ( x11-proto/videoproto
131 x11-proto/xf86vidmodeproto )
132 gtk? ( x11-proto/xextproto
133 x11-proto/xf86vidmodeproto )
134 X? ( x11-proto/xextproto
135 x11-proto/xf86vidmodeproto )
136 xscreensaver? ( x11-proto/scrnsaverproto )
137 iconv? ( virtual/libiconv )"
138 # Make sure the assembler USE flags are unmasked on amd64
139 # Remove this once default-linux/amd64/2006.1 is deprecated
140 DEPEND="${DEPEND} amd64? ( >=sys-apps/portage-2.1.2 )
141 mp2? ( >=sys-apps/portage-2.1.2 )"
145 KEYWORDS="alpha amd64 hppa ~ia64 ~mips ppc ppc64 ~sparc x86 ~x86-fbsd"
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."
198 if ! use truetype ; then
199 unpack font-arial-iso-8859-1.tar.bz2 \
200 font-arial-iso-8859-2.tar.bz2 \
201 font-arial-cp1250.tar.bz2
204 use gtk && unpack "Blue-${BLUV}.tar.bz2"
206 use svga && unpack "svgalib_helper-${SVGV}-mplayer.tar.bz2"
210 # Fix sparc compilation, bug 241110
211 epatch "${FILESDIR}/mplayer-libavcodec.patch"
213 # Fix x264 compilation, bug 240347
214 epatch "${FILESDIR}/mplayer-1.0_rc2_p27725-libx264.patch"
216 # Security bug 251017
217 epatch "${FILESDIR}"/mplayer-1.0_rc2_p28058-demux_vqf.patch
219 # Add ASS support to mencoder
220 epatch "${FILESDIR}/mplayer-1.0_rc2_p27725-ass.patch"
223 sed -i s/UNKNOWN/${MPLAYER_REVISION}/ "${S}/version.sh"
225 # Fix hppa compilation
226 use hppa && sed -i -e "s/-O4/-O1/" "${S}/configure"
230 einfo "Enabling vidix non-root mode."
231 einfo "(You need a proper svgalib_helper.o module for your kernel"
232 einfo "to actually use this)"
235 mv "${WORKDIR}/svgalib_helper" "${S}/libdha"
238 # Fix polish spelling errors
239 [[ -n ${LINGUAS} ]] && sed -e 's:ZarzÄ
\85dano:ZażÄ
\85dano:' -i help/help_mp-pl.h
244 local myconf=" --disable-tv-bsdbt848 \
247 # broken upstream, won't work with recent kernels
248 myconf="${myconf} --disable-ivtv"
250 # MPlayer reads in the LINGUAS variable from make.conf, and sets
251 # the languages accordingly. Some will have to be altered to match
252 # upstream's naming scheme.
253 [[ -n $LINGUAS ]] && LINGUAS=${LINGUAS/da/dk}
258 use ass || myconf="${myconf} --disable-ass"
259 use bidi || myconf="${myconf} --disable-fribidi"
260 use bl && myconf="${myconf} --enable-bl"
261 use enca || myconf="${myconf} --disable-enca"
262 use encode || myconf="${myconf} --disable-mencoder"
263 use ftp || myconf="${myconf} --disable-ftp"
264 use nemesi || myconf="${myconf} --disable-nemesi"
265 use xscreensaver || myconf="${myconf} --disable-xss"
267 # libcdio support: prefer libcdio over cdparanoia
268 # don't check for cddb w/cdio
270 myconf="${myconf} --disable-cdparanoia"
272 myconf="${myconf} --disable-libcdio"
273 use cdparanoia || myconf="${myconf} --disable-cdparanoia"
274 use cddb || myconf="${myconf} --disable-cddb"
278 # dvdread and libdvdcss are internal libs
279 # http://www.mplayerhq.hu/DOCS/HTML/en/dvd.html
280 # You can optionally use external dvdread/dvdnav support.
282 myconf="${myconf} --with-dvdread-config=/usr/bin/dvdread-config \
283 --with-dvdnav-config=/usr/bin/dvdnav-config \
284 --disable-dvdread-internal"
285 elif ! use dvd && ! use dvdread; then
286 myconf="${myconf} --disable-dvdnav --disable-dvdread"
287 use a52 || myconf="${myconf} --disable-liba52 \
288 --disable-liba52-internal"
291 # SRT (subtitles) requires freetype support
292 # freetype support requires iconv
293 # iconv optionally can use unicode
295 if ! use truetype; then
296 myconf="${myconf} --disable-freetype"
298 myconf="${myconf} --disable-iconv --charset=noconv"
302 use iconv && use unicode && myconf="${myconf} --charset=UTF-8"
304 use lirc || myconf="${myconf} --disable-lirc --disable-lircc"
305 myconf="${myconf} $(use_enable joystick)"
306 use ipv6 || myconf="${myconf} --disable-inet6"
307 use rar || myconf="${myconf} --disable-unrarexec"
308 use rtc || myconf="${myconf} --disable-rtc"
309 use samba || myconf="${myconf} --disable-smb"
311 # DVB / Video4Linux / Radio support
312 if { use dvb || use v4l || use v4l2 || use pvr || use radio; }; then
313 use dvb || myconf="${myconf} --disable-dvb --disable-dvbhead"
314 use pvr || myconf="${myconf} --disable-pvr"
315 use v4l || myconf="${myconf} --disable-tv-v4l1"
316 use v4l2 || myconf="${myconf} --disable-tv-v4l2"
317 use teletext || myconf="${myconf} --disable-tv-teletext"
318 if use radio && { use dvb || use v4l || use v4l2; }; then
319 myconf="${myconf} --enable-radio $(use_enable encode radio-capture)"
321 myconf="${myconf} --disable-radio-v4l2 --disable-radio-bsdbt848"
324 myconf="${myconf} --disable-tv --disable-tv-v4l1 --disable-tv-v4l2 \
325 --disable-radio --disable-radio-v4l2 --disable-radio-bsdbt848 \
326 --disable-dvb --disable-dvbhead --disable-tv-teletext \
327 --disable-v4l2 --disable-pvr"
333 for x in gif jpeg live mad musepack pnm speex tga theora xanim; do
334 use ${x} || myconf="${myconf} --disable-${x}"
336 for x in dirac schroedinger ; do
337 use ${x} || myconf="${myconf} --disable-lib${x}-lavc"
339 use aac || myconf="${myconf} --disable-faac --disable-faac-lavc"
340 use amrnb || myconf="${myconf} --disable-libamr_nb"
341 use amrwb || myconf="${myconf} --disable-libamr_wb"
342 use dts || myconf="${myconf} --disable-libdca"
343 use dv || myconf="${myconf} --disable-libdv"
344 ! use png && ! use gtk && myconf="${myconf} --disable-png"
345 use lzo || myconf="${myconf} --disable-liblzo"
346 use encode && use mp2 || myconf="${myconf} --disable-twolame \
348 use mp3 || myconf="${myconf} --disable-mp3lame --disable-mp3lame-lavc"
349 use vorbis || myconf="${myconf} --disable-libvorbis"
350 use x264 || myconf="${myconf} --disable-x264 --disable-x264-lavc"
351 use xanim && myconf="${myconf} --xanimcodecsdir=/usr/lib/xanim/mods"
352 use xvid || myconf="${myconf} --disable-xvid --disable-xvid-lavc"
354 # Real codec support, only available on x86, amd64
355 if use real && use x86; then
356 myconf="${myconf} --realcodecsdir=/opt/RealPlayer/codecs"
357 elif use real && use amd64; then
358 myconf="${myconf} --realcodecsdir=/usr/$(get_libdir)/codecs"
360 myconf="${myconf} --disable-real"
362 if ! use bindist && ! use real; then
363 myconf="${myconf} $(use_enable win32codecs win32dll)"
366 if ! use x86 || ! use win32codecs; then
367 use quicktime || myconf="${myconf} --disable-qtx"
373 for x in directfb ggi md5sum sdl xinerama; do
374 use ${x} || myconf="${myconf} --disable-${x}"
376 use aalib || myconf="${myconf} --disable-aa"
377 use dga || myconf="${myconf} --disable-dga1 --disable-dga2"
378 use fbcon || myconf="${myconf} --disable-fbdev"
379 use fbcon && use video_cards_s3virge && myconf="${myconf} --enable-s3fb"
380 use libcaca || myconf="${myconf} --disable-caca"
381 use opengl || myconf="${myconf} --disable-gl"
382 use video_cards_vesa || myconf="${myconf} --disable-vesa"
383 use vidix || myconf="${myconf} --disable-vidix \
384 --disable-vidix-pcidb"
385 use zoran || myconf="${myconf} --disable-zr"
387 # MPlayer incorrectly looks for DXR3 support, so forcibly enable
388 # if requested. See bug 223587
389 myconf="${myconf} $(use_enable dxr3)"
392 myconf="${myconf} $(use_enable gtk gui)"
396 myconf="${myconf} --enable-xvmc --with-xvmclib=XvMCW"
398 myconf="${myconf} --disable-xvmc"
401 myconf="${myconf} --disable-xv --disable-xvmc"
404 if ! use kernel_linux && ! use video_cards_mga; then
405 myconf="${myconf} --disable-mga --disable-xmga"
408 if use video_cards_tdfx; then
409 myconf="${myconf} $(use_enable video_cards_tdfx tdfxvid) \
410 $(use_enable fbcon tdfxfb)"
412 myconf="${myconf} --disable-3dfx --disable-tdfxvid --disable-tdfxfb"
418 for x in alsa arts esd jack ladspa nas openal; do
419 use ${x} || myconf="${myconf} --disable-${x}"
421 use pulseaudio || myconf="${myconf} --disable-pulse"
423 use oss || myconf="${myconf} --disable-ossaudio"
428 # Platform specific flags, hardcoded on amd64 (see below)
429 if use cpudetection || use bindist; then
430 myconf="${myconf} --enable-runtime-cpudetection"
433 # Turning off CPU optimizations usually will break the build.
434 # However, this use flag, if enabled, will allow users to completely
435 # specify which ones to use. If disabled, mplayer will automatically
436 # enable all CPU optimizations that the host build supports.
437 if use custom-cpuopts; then
438 for x in 3dnow 3dnowext mmx mmxext sse sse2 ssse3; do
439 myconf="${myconf} $(use_enable $x)"
443 use debug && myconf="${myconf} --enable-debug=3"
445 myconf="${myconf} $(use_enable altivec)"
447 if use custom-cflags; then
448 # let's play the filtration game! MPlayer hates on all!
450 # ugly optimizations cause MPlayer to cry on x86 systems!
451 if use x86 || use x86-fbsd ; then
452 replace-flags -O* -O2
453 filter-flags -fPIC -fPIE
455 use debug || append-flags -fomit-frame-pointer
457 append-flags -D__STDC_LIMIT_MACROS
459 unset CFLAGS CXXFLAGS
462 myconf="--cc=$(tc-getCC) \
463 --host-cc=$(tc-getBUILD_CC) \
465 --confdir=/etc/mplayer \
466 --datadir=/usr/share/mplayer \
467 --libdir=/usr/$(get_libdir) \
472 #echo "CFLAGS=\"${CFLAGS}\" ./configure ${myconf}"
473 CFLAGS="${CFLAGS}" ./configure ${myconf} || die "configure died"
475 emake || die "Failed to build MPlayer!"
476 use doc && make -C DOCS/xml html-chunked
481 make prefix="${D}/usr" \
482 BINDIR="${D}/usr/bin" \
483 LIBDIR="${D}/usr/$(get_libdir)" \
484 CONFDIR="${D}/etc/mplayer" \
485 DATADIR="${D}/usr/share/mplayer" \
486 MANDIR="${D}/usr/share/man" \
488 install || die "Failed to install MPlayer!"
490 dodoc AUTHORS Changelog README etc/codecs.conf
491 # Install the documentation; DOCS is all mixed up not just html
493 find "${S}/DOCS" -type d | xargs -- chmod 0755
494 find "${S}/DOCS" -type f | xargs -- chmod 0644
495 cp -r "${S}/DOCS" "${D}/usr/share/doc/${PF}/" || die "cp docs died"
498 # Copy misc tools to documentation path, as they're not installed directly
499 # and yes, we are nuking the +x bit.
500 find "${S}/TOOLS" -type d | xargs -- chmod 0755
501 find "${S}/TOOLS" -type f | xargs -- chmod 0644
502 cp -r "${S}/TOOLS" "${D}/usr/share/doc/${PF}/" || die "cp docs died"
504 # Install the default Skin and Gnome menu entry
506 dodir /usr/share/mplayer/skins
507 cp -r "${WORKDIR}/Blue" \
508 "${D}/usr/share/mplayer/skins/default" || die "cp skins died"
511 rm -rf "${D}/usr/bin/gmplayer"
512 dosym mplayer /usr/bin/gmplayer
515 if ! use ass && ! use truetype; then
516 dodir /usr/share/mplayer/fonts
518 # Do this generic, as the mplayer people like to change the structure
520 for x in $(find "${WORKDIR}/" -type d -name 'font-arial-*')
522 cp -pPR "${x}" "${D}/usr/share/mplayer/fonts"
524 # Fix the font symlink ...
525 rm -rf "${D}/usr/share/mplayer/font"
526 dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
530 newins "${S}/etc/example.conf" mplayer.conf
532 if use ass || use truetype; then
533 cat >> "${D}/etc/mplayer/mplayer.conf" << EOT
540 dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
542 newbin "${S}/TOOLS/midentify.sh" midentify
544 insinto /usr/share/mplayer
545 doins "${S}/etc/input.conf"
546 doins "${S}/etc/menu.conf"
551 if [[ -d ${ROOT}/usr/share/mplayer/Skin/default ]]
553 rm -rf "${ROOT}/usr/share/mplayer/Skin/default"
559 # Cleanup stale symlinks
560 if [ -L "${ROOT}/usr/share/mplayer/font" -a \
561 ! -e "${ROOT}/usr/share/mplayer/font" ]
563 rm -f "${ROOT}/usr/share/mplayer/font"
566 if [ -L "${ROOT}/usr/share/mplayer/subfont.ttf" -a \
567 ! -e "${ROOT}/usr/share/mplayer/subfont.ttf" ]
569 rm -f "${ROOT}/usr/share/mplayer/subfont.ttf"