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_p27725-r1.ebuild,v 1.12 2008/12/13 22:29:35 bluebird Exp $
7 inherit eutils flag-o-matic multilib
9 # Ugly hack, feel free to fix
10 MPLAYER_REVISION=27725
12 IUSE="3dnow 3dnowext +a52 aac -aalib +alsa altivec amrnb amrwb -arts bidi bl
13 bindist cddb cdio cdparanoia -cpudetection -custom-cflags -custom-cpuopts debug
14 dga dirac doc dts dvb directfb +dvd 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 mp2 +mp3 musepack nas nemesi +vorbis opengl
17 openal oss -png -pnm pulseaudio -pvr quicktime radio -rar real rtc -samba schroedinger sdl
18 speex srt sse sse2 ssse3 svga teletext tga +theora +truetype unicode v4l v4l2 vidix win32codecs +X x264 xanim xinerama +xscreensaver +xv xvid xvmc zoran"
20 VIDEO_CARDS="s3virge mga tdfx vesa"
22 for x in ${VIDEO_CARDS}; do
23 IUSE="${IUSE} video_cards_${x}"
28 AMR_URI="http://www.3gpp.org/ftp/Specs/archive"
29 SRC_URI="mirror://gentoo/${P}.tar.bz2
30 !truetype? ( mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
31 mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
32 mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2 )
33 !iconv? ( mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
34 mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
35 mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2 )
36 gtk? ( mirror://mplayer/Skin/Blue-${BLUV}.tar.bz2 )
37 svga? ( http://mplayerhq.hu/~alex/svgalib_helper-${SVGV}-mplayer.tar.bz2 )"
39 DESCRIPTION="Media Player for Linux"
40 HOMEPAGE="http://www.mplayerhq.hu/"
42 RDEPEND="sys-libs/ncurses
45 win32codecs? ( media-libs/win32codecs )
46 real? ( media-libs/win32codecs
47 media-video/realplayer )
49 amd64? ( real? ( media-libs/amd64codecs ) )
51 aalib? ( media-libs/aalib )
52 alsa? ( media-libs/alsa-lib )
53 amrnb? ( media-libs/amrnb )
54 amrwb? ( media-libs/amrwb )
55 arts? ( kde-base/arts )
56 openal? ( media-libs/openal )
57 bidi? ( dev-libs/fribidi )
58 cdio? ( dev-libs/libcdio )
59 cdparanoia? ( media-sound/cdparanoia )
60 dirac? ( >=media-video/dirac-0.10.0 )
61 directfb? ( dev-libs/DirectFB )
62 dga? ( x11-libs/libXxf86dga )
63 dts? ( media-libs/libdca )
64 dv? ( media-libs/libdv )
65 dvb? ( media-tv/linuxtv-dvb-headers )
67 aac? ( media-libs/faac )
68 mp2? ( media-sound/twolame )
69 mp3? ( media-sound/lame )
70 x264? ( >=media-libs/x264-0.0.20080406 )
72 esd? ( media-sound/esound )
73 enca? ( app-i18n/enca )
74 gif? ( media-libs/giflib )
75 ggi? ( media-libs/libggi
76 media-libs/libggiwmh )
77 gtk? ( media-libs/libpng
82 jpeg? ( media-libs/jpeg )
83 ladspa? ( media-libs/ladspa-sdk )
84 libcaca? ( media-libs/libcaca )
85 lirc? ( app-misc/lirc )
86 lzo? ( >=dev-libs/lzo-2 )
87 mad? ( media-libs/libmad )
88 musepack? ( >=media-libs/libmpcdec-1.2.2 )
89 nas? ( media-libs/nas )
90 opengl? ( virtual/opengl )
91 png? ( media-libs/libpng )
92 pnm? ( media-libs/netpbm )
93 pulseaudio? ( media-sound/pulseaudio )
94 samba? ( net-fs/samba )
95 schroedinger? ( media-libs/schroedinger )
96 sdl? ( media-libs/libsdl )
97 speex? ( >=media-libs/speex-1.1.7 )
98 srt? ( >=media-libs/freetype-2.1
99 media-libs/fontconfig )
100 svga? ( media-libs/svgalib )
101 theora? ( media-libs/libtheora )
102 live? ( >=media-plugins/live-2007.02.20 )
103 truetype? ( >=media-libs/freetype-2.1
104 media-libs/fontconfig )
105 vidix? ( x11-libs/libXxf86vm
107 xanim? ( media-video/xanim )
108 xinerama? ( x11-libs/libXinerama
111 xscreensaver? ( x11-libs/libXScrnSaver )
115 xvmc? ( x11-libs/libXvMC ) )
116 xvid? ( media-libs/xvid )
117 X? ( x11-libs/libXxf86vm
122 doc? ( >=app-text/docbook-sgml-dtd-4.1.2
123 app-text/docbook-xml-dtd
124 >=app-text/docbook-xml-simple-dtd-1.50.0
126 dga? ( x11-proto/xf86dgaproto )
127 dxr3? ( media-video/em8300-libraries )
128 xinerama? ( x11-proto/xineramaproto )
129 xv? ( x11-proto/videoproto
130 x11-proto/xf86vidmodeproto )
131 gtk? ( x11-proto/xextproto
132 x11-proto/xf86vidmodeproto )
133 X? ( x11-proto/xextproto
134 x11-proto/xf86vidmodeproto )
135 xscreensaver? ( x11-proto/scrnsaverproto )
136 iconv? ( virtual/libiconv )"
137 # Make sure the assembler USE flags are unmasked on amd64
138 # Remove this once default-linux/amd64/2006.1 is deprecated
139 DEPEND="${DEPEND} amd64? ( >=sys-apps/portage-2.1.2 )
140 mp2? ( >=sys-apps/portage-2.1.2 )"
144 KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd"
148 if [[ -n ${LINGUAS} ]]; then
150 elog "MPlayer's build system uses the LINGUAS variable for both"
151 elog "output messages and which man pages to build. The first"
152 elog "language in the LINGUAS variable will be used to display"
153 elog "output messages. See bug #228799."
158 ewarn "You've enabled the 'gtk' use flag which will build"
159 ewarn "GMPlayer, which is no longer actively developed upstream"
160 ewarn "and is not supported by Gentoo. There are alternatives"
161 ewarn "for a GUI frontend: smplayer, gnome-mplayer and kmplayer."
164 if use cpudetection; then
166 ewarn "You've enabled the cpudetection flag. This feature is"
167 ewarn "included mainly for people who want to use the same"
168 ewarn "binary on another system with a different CPU architecture."
169 ewarn "MPlayer will already detect your CPU settings by default at"
170 ewarn "buildtime; this flag is used for runtime detection."
171 ewarn "You won't need this turned on if you are only building"
172 ewarn "mplayer for this system. Also, if your compile fails, try"
173 ewarn "disabling this use flag."
176 if use custom-cpuopts; then
178 ewarn "You are using the custom-cpuopts flag which will"
179 ewarn "specifically allow you to enable / disable certain"
180 ewarn "CPU optimizations."
182 ewarn "Most desktop users won't need this functionality, but it"
183 ewarn "is included for corner cases like cross-compiling and"
184 ewarn "certain profiles. If unsure, disable this flag and MPlayer"
185 ewarn "will automatically detect and use your available CPU"
186 ewarn "optimizations."
188 ewarn "Using this flag means your build is unsupported, so"
189 ewarn "please make sure your CPU optimization use flags (3dnow"
190 ewarn "3dnowext mmx mmxext sse sse2 ssse3) are properly set."
197 if ! use truetype ; then
198 unpack font-arial-iso-8859-1.tar.bz2 \
199 font-arial-iso-8859-2.tar.bz2 \
200 font-arial-cp1250.tar.bz2
203 use gtk && unpack "Blue-${BLUV}.tar.bz2"
205 use svga && unpack "svgalib_helper-${SVGV}-mplayer.tar.bz2"
209 # Fix sparc compilation, bug 241110
210 epatch "${FILESDIR}/mplayer-libmpeg2.patch"
211 epatch "${FILESDIR}/mplayer-libavcodec.patch"
213 # Fix x264 compilation, bug 240347
214 epatch "${FILESDIR}/mplayer-1.0_rc2_p27725-libx264.patch"
216 # Add ASS support to mencoder
217 epatch "${FILESDIR}/mplayer-1.0_rc2_p27725-ass.patch"
220 sed -i s/UNKNOWN/${MPLAYER_REVISION}/ "${S}/version.sh"
222 # Fix hppa compilation
223 use hppa && sed -i -e "s/-O4/-O1/" "${S}/configure"
227 einfo "Enabling vidix non-root mode."
228 einfo "(You need a proper svgalib_helper.o module for your kernel"
229 einfo "to actually use this)"
232 mv "${WORKDIR}/svgalib_helper" "${S}/libdha"
235 # Fix polish spelling errors
236 [[ -n ${LINGUAS} ]] && sed -e 's:ZarzÄ
\85dano:ZażÄ
\85dano:' -i help/help_mp-pl.h
241 local myconf=" --disable-tv-bsdbt848 \
244 # broken upstream, won't work with recent kernels
245 myconf="${myconf} --disable-ivtv"
247 # MPlayer reads in the LINGUAS variable from make.conf, and sets
248 # the languages accordingly. Some will have to be altered to match
249 # upstream's naming scheme.
250 [[ -n $LINGUAS ]] && LINGUAS=${LINGUAS/da/dk}
255 use bidi || myconf="${myconf} --disable-fribidi"
256 use bl && myconf="${myconf} --enable-bl"
257 use enca || myconf="${myconf} --disable-enca"
258 use encode || myconf="${myconf} --disable-mencoder"
259 use ftp || myconf="${myconf} --disable-ftp"
260 use nemesi || myconf="${myconf} --disable-nemesi"
261 use xscreensaver || myconf="${myconf} --disable-xss"
263 # libcdio support: prefer libcdio over cdparanoia
264 # don't check for cddb w/cdio
266 myconf="${myconf} --disable-cdparanoia"
268 myconf="${myconf} --disable-libcdio"
269 use cdparanoia || myconf="${myconf} --disable-cdparanoia"
270 use cddb || myconf="${myconf} --disable-cddb"
274 # dvdread and libdvdcss are internal libs
275 # http://www.mplayerhq.hu/DOCS/HTML/en/dvd.html
276 # You can optionally use external dvdread support, but against
277 # upstream's suggestion. We don't.
279 myconf="${myconf} --disable-dvdnav --disable-dvdread"
280 use a52 || myconf="${myconf} --disable-liba52 \
281 --disable-liba52-internal"
284 # SRT (subtitles) requires freetype support
285 # freetype support requires iconv
286 # iconv optionally can use unicode
288 myconf="${myconf} --disable-ass"
289 if ! use truetype; then
290 myconf="${myconf} --disable-freetype"
292 myconf="${myconf} --disable-iconv --charset=noconv"
296 use iconv && use unicode && myconf="${myconf} --charset=UTF-8"
298 use lirc || myconf="${myconf} --disable-lirc --disable-lircc"
299 myconf="${myconf} $(use_enable joystick)"
300 use ipv6 || myconf="${myconf} --disable-inet6"
301 use rar || myconf="${myconf} --disable-unrarexec"
302 use rtc || myconf="${myconf} --disable-rtc"
303 use samba || myconf="${myconf} --disable-smb"
305 # DVB / Video4Linux / Radio support
306 if { use dvb || use v4l || use v4l2 || use pvr || use radio; }; then
307 use dvb || myconf="${myconf} --disable-dvb --disable-dvbhead"
308 use pvr || myconf="${myconf} --disable-pvr"
309 use v4l || myconf="${myconf} --disable-tv-v4l1"
310 use v4l2 || myconf="${myconf} --disable-tv-v4l2"
311 use teletext || myconf="${myconf} --disable-tv-teletext"
312 if use radio && { use dvb || use v4l || use v4l2; }; then
313 myconf="${myconf} --enable-radio $(use_enable encode radio-capture)"
315 myconf="${myconf} --disable-radio-v4l2 --disable-radio-bsdbt848"
318 myconf="${myconf} --disable-tv --disable-tv-v4l1 --disable-tv-v4l2 \
319 --disable-radio --disable-radio-v4l2 --disable-radio-bsdbt848 \
320 --disable-dvb --disable-dvbhead --disable-tv-teletext \
321 --disable-v4l2 --disable-pvr"
327 for x in gif jpeg live mad musepack pnm speex tga theora xanim; do
328 use ${x} || myconf="${myconf} --disable-${x}"
330 for x in dirac schroedinger ; do
331 use ${x} || myconf="${myconf} --disable-lib${x}-lavc"
333 use aac || myconf="${myconf} --disable-faac --disable-faac-lavc"
334 use amrnb || myconf="${myconf} --disable-libamr_nb"
335 use amrwb || myconf="${myconf} --disable-libamr_wb"
336 use dts || myconf="${myconf} --disable-libdca"
337 use dv || myconf="${myconf} --disable-libdv"
338 ! use png && ! use gtk && myconf="${myconf} --disable-png"
339 use lzo || myconf="${myconf} --disable-liblzo"
340 use encode && use mp2 || myconf="${myconf} --disable-twolame \
342 use mp3 || myconf="${myconf} --disable-mp3lame --disable-mp3lame-lavc"
343 use vorbis || myconf="${myconf} --disable-libvorbis"
344 use x264 || myconf="${myconf} --disable-x264 --disable-x264-lavc"
345 use xanim && myconf="${myconf} --xanimcodecsdir=/usr/lib/xanim/mods"
346 use xvid || myconf="${myconf} --disable-xvid --disable-xvid-lavc"
348 # Real codec support, only available on x86, amd64
349 if use real && use x86; then
350 myconf="${myconf} --realcodecsdir=/opt/RealPlayer/codecs"
351 elif use real && use amd64; then
352 myconf="${myconf} --realcodecsdir=/usr/$(get_libdir)/codecs"
354 myconf="${myconf} --disable-real"
356 if ! use bindist && ! use real; then
357 myconf="${myconf} $(use_enable win32codecs win32dll)"
360 if ! use x86 || ! use win32codecs; then
361 use quicktime || myconf="${myconf} --disable-qtx"
367 for x in directfb ggi md5sum sdl xinerama; do
368 use ${x} || myconf="${myconf} --disable-${x}"
370 use aalib || myconf="${myconf} --disable-aa"
371 use dga || myconf="${myconf} --disable-dga1 --disable-dga2"
372 use fbcon || myconf="${myconf} --disable-fbdev"
373 use fbcon && use video_cards_s3virge && myconf="${myconf} --enable-s3fb"
374 use libcaca || myconf="${myconf} --disable-caca"
375 use opengl || myconf="${myconf} --disable-gl"
376 use video_cards_vesa || myconf="${myconf} --disable-vesa"
377 use vidix || myconf="${myconf} --disable-vidix \
378 --disable-vidix-pcidb"
379 use zoran || myconf="${myconf} --disable-zr"
381 # MPlayer incorrectly looks for DXR3 support, so forcibly enable
382 # if requested. See bug 223587
383 myconf="${myconf} $(use_enable dxr3)"
386 myconf="${myconf} $(use_enable gtk gui)"
390 myconf="${myconf} --enable-xvmc --with-xvmclib=XvMCW"
392 myconf="${myconf} --disable-xvmc"
395 myconf="${myconf} --disable-xv --disable-xvmc"
398 if ! use kernel_linux && ! use video_cards_mga; then
399 myconf="${myconf} --disable-mga --disable-xmga"
402 if use video_cards_tdfx; then
403 myconf="${myconf} $(use_enable video_cards_tdfx tdfxvid) \
404 $(use_enable fbcon tdfxfb)"
406 myconf="${myconf} --disable-3dfx --disable-tdfxvid --disable-tdfxfb"
412 for x in alsa arts esd jack ladspa nas openal; do
413 use ${x} || myconf="${myconf} --disable-${x}"
415 use pulseaudio || myconf="${myconf} --disable-pulse"
417 use oss || myconf="${myconf} --disable-ossaudio"
422 # Platform specific flags, hardcoded on amd64 (see below)
423 if use cpudetection || use bindist; then
424 myconf="${myconf} --enable-runtime-cpudetection"
427 # Turning off CPU optimizations usually will break the build.
428 # However, this use flag, if enabled, will allow users to completely
429 # specify which ones to use. If disabled, mplayer will automatically
430 # enable all CPU optimizations that the host build supports.
431 if use custom-cpuopts; then
432 for x in 3dnow 3dnowext mmx mmxext sse sse2 ssse3; do
433 myconf="${myconf} $(use_enable $x)"
437 use debug && myconf="${myconf} --enable-debug=3"
439 myconf="${myconf} $(use_enable altivec)"
441 if use custom-cflags; then
442 # let's play the filtration game! MPlayer hates on all!
444 # ugly optimizations cause MPlayer to cry on x86 systems!
445 if use x86 || use x86-fbsd ; then
446 replace-flags -O* -O2
447 filter-flags -fPIC -fPIE
449 use debug || append-flags -fomit-frame-pointer
451 append-flags -D__STDC_LIMIT_MACROS
453 unset CFLAGS CXXFLAGS
456 myconf="--cc=$(tc-getCC) \
457 --host-cc=$(tc-getBUILD_CC) \
459 --confdir=/etc/mplayer \
460 --datadir=/usr/share/mplayer \
461 --libdir=/usr/$(get_libdir) \
465 #echo "CFLAGS=\"${CFLAGS}\" ./configure ${myconf}"
466 CFLAGS="${CFLAGS}" ./configure ${myconf} || die "configure died"
468 emake || die "Failed to build MPlayer!"
469 use doc && make -C DOCS/xml html-chunked
474 make prefix="${D}/usr" \
475 BINDIR="${D}/usr/bin" \
476 LIBDIR="${D}/usr/$(get_libdir)" \
477 CONFDIR="${D}/etc/mplayer" \
478 DATADIR="${D}/usr/share/mplayer" \
479 MANDIR="${D}/usr/share/man" \
481 install || die "Failed to install MPlayer!"
483 dodoc AUTHORS Changelog README etc/codecs.conf
484 # Install the documentation; DOCS is all mixed up not just html
486 find "${S}/DOCS" -type d | xargs -- chmod 0755
487 find "${S}/DOCS" -type f | xargs -- chmod 0644
488 cp -r "${S}/DOCS" "${D}/usr/share/doc/${PF}/" || die "cp docs died"
491 # Copy misc tools to documentation path, as they're not installed directly
492 # and yes, we are nuking the +x bit.
493 find "${S}/TOOLS" -type d | xargs -- chmod 0755
494 find "${S}/TOOLS" -type f | xargs -- chmod 0644
495 cp -r "${S}/TOOLS" "${D}/usr/share/doc/${PF}/" || die "cp docs died"
497 # Install the default Skin and Gnome menu entry
499 dodir /usr/share/mplayer/skins
500 cp -r "${WORKDIR}/Blue" \
501 "${D}/usr/share/mplayer/skins/default" || die "cp skins died"
504 rm -rf "${D}/usr/bin/gmplayer"
505 dosym mplayer /usr/bin/gmplayer
508 if ! use srt && ! use truetype; then
509 dodir /usr/share/mplayer/fonts
511 # Do this generic, as the mplayer people like to change the structure
513 for x in $(find "${WORKDIR}/" -type d -name 'font-arial-*')
515 cp -pPR "${x}" "${D}/usr/share/mplayer/fonts"
517 # Fix the font symlink ...
518 rm -rf "${D}/usr/share/mplayer/font"
519 dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
523 newins "${S}/etc/example.conf" mplayer.conf
525 if use srt || use truetype; then
526 cat >> "${D}/etc/mplayer/mplayer.conf" << EOT
533 dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
535 newbin "${S}/TOOLS/midentify.sh" midentify
537 insinto /usr/share/mplayer
538 doins "${S}/etc/input.conf"
539 doins "${S}/etc/menu.conf"
544 if [[ -d ${ROOT}/usr/share/mplayer/Skin/default ]]
546 rm -rf "${ROOT}/usr/share/mplayer/Skin/default"
552 # Cleanup stale symlinks
553 if [ -L "${ROOT}/usr/share/mplayer/font" -a \
554 ! -e "${ROOT}/usr/share/mplayer/font" ]
556 rm -f "${ROOT}/usr/share/mplayer/font"
559 if [ -L "${ROOT}/usr/share/mplayer/subfont.ttf" -a \
560 ! -e "${ROOT}/usr/share/mplayer/subfont.ttf" ]
562 rm -f "${ROOT}/usr/share/mplayer/subfont.ttf"