Initial commit contains ebuild for xf86-video-openchrome driver and modified ebuilds for
[openchrome.git] / media-video / mplayer / mplayer-1.0_rc2_p25993-r1.ebuild
blobe37ce1f64fa5f037113359ac588a28314b1998d5
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_p25993-r1.ebuild,v 1.1 2008/02/23 13:22:55 beandog Exp $
5 inherit eutils flag-o-matic multilib
7 RESTRICT="strip"
8 IUSE="3dnow 3dnowext a52 aac aalib alsa altivec amrnb amrwb arts bidi bl bindist
9 color-console cddb cdio cdparanoia cpudetection custom-cflags debug dga doc dts dvb directfb dvd dv enca encode esd fbcon ftp gif ggi gtk iconv ipv6 jack joystick jpeg kernel_linux ladspa libcaca lirc live lzo mad md5sum mmx mmxext mp2 mp3
10 musepack nas nemesi unicode vorbis opengl openal oss png pnm pulseaudio
11 quicktime radio rar real rtc samba sdl speex srt sse sse2 ssse3 svga teletext
12 tga theora tivo truetype v4l v4l2 vidix win32codecs X x264 xanim xinerama
13 xscreensaver xv xvid xvmc zoran"
15 VIDEO_CARDS="s3virge mga openchrome tdfx vesa"
17 for x in ${VIDEO_CARDS}; do
18 IUSE="${IUSE} video_cards_${x}"
19 done
21 BLUV="1.7"
22 SVGV="1.9.17"
23 AMR_URI="http://www.3gpp.org/ftp/Specs/archive"
24 SRC_URI="mirror://gentoo/${P}.tar.bz2
25 !truetype? ( mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
26 mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
27 mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2 )
28 !iconv? ( mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
29 mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2
30 mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2 )
31 gtk? ( mirror://mplayer/Skin/Blue-${BLUV}.tar.bz2 )
32 svga? ( http://mplayerhq.hu/~alex/svgalib_helper-${SVGV}-mplayer.tar.bz2 )"
34 DESCRIPTION="Media Player for Linux"
35 HOMEPAGE="http://www.mplayerhq.hu/"
37 RDEPEND="sys-libs/ncurses
38 !bindist? (
39 x86? (
40 win32codecs? ( media-libs/win32codecs )
41 real? ( media-libs/win32codecs
42 media-video/realplayer )
44 amd64? ( real? ( media-libs/amd64codecs ) )
46 aalib? ( media-libs/aalib )
47 alsa? ( media-libs/alsa-lib )
48 amrnb? ( media-libs/amrnb )
49 amrwb? ( media-libs/amrwb )
50 arts? ( kde-base/arts )
51 openal? ( media-libs/openal )
52 bidi? ( dev-libs/fribidi )
53 cdio? ( dev-libs/libcdio )
54 cdparanoia? ( media-sound/cdparanoia )
55 directfb? ( dev-libs/DirectFB )
56 dts? ( media-libs/libdca )
57 dv? ( media-libs/libdv )
58 dvb? ( media-tv/linuxtv-dvb-headers )
59 encode? (
60 aac? ( media-libs/faac )
61 mp2? ( media-sound/twolame )
62 mp3? ( media-sound/lame )
63 x264? ( media-libs/x264-svn )
65 esd? ( media-sound/esound )
66 enca? ( app-i18n/enca )
67 gif? ( media-libs/giflib )
68 ggi? ( media-libs/libggi
69 media-libs/libggiwmh )
70 gtk? ( media-libs/libpng
71 x11-libs/libXxf86vm
72 x11-libs/libXext
73 x11-libs/libXi
74 =x11-libs/gtk+-2* )
75 jpeg? ( media-libs/jpeg )
76 ladspa? ( media-libs/ladspa-sdk )
77 libcaca? ( media-libs/libcaca )
78 lirc? ( app-misc/lirc )
79 lzo? ( >=dev-libs/lzo-2 )
80 mad? ( media-libs/libmad )
81 musepack? ( >=media-libs/libmpcdec-1.2.2 )
82 nas? ( media-libs/nas )
83 opengl? ( virtual/opengl )
84 png? ( media-libs/libpng )
85 pnm? ( media-libs/netpbm )
86 pulseaudio? ( media-sound/pulseaudio )
87 samba? ( net-fs/samba )
88 sdl? ( media-libs/libsdl )
89 speex? ( >=media-libs/speex-1.1.7 )
90 srt? ( >=media-libs/freetype-2.1
91 media-libs/fontconfig )
92 svga? ( media-libs/svgalib )
93 theora? ( media-libs/libtheora )
94 live? ( >=media-plugins/live-2007.02.20 )
95 truetype? ( >=media-libs/freetype-2.1
96 media-libs/fontconfig )
97 vidix? ( x11-libs/libXxf86vm
98 x11-libs/libXext )
99 xanim? ( media-video/xanim )
100 xinerama? ( x11-libs/libXinerama
101 x11-libs/libXxf86vm
102 x11-libs/libXext )
103 xscreensaver? ( x11-libs/libXScrnSaver )
104 xv? ( x11-libs/libXv
105 x11-libs/libXxf86vm
106 x11-libs/libXext
107 xvmc? ( x11-libs/libXvMC ) )
108 xvid? ( media-libs/xvid )
109 X? ( x11-libs/libXxf86vm
110 x11-libs/libXext
113 DEPEND="${RDEPEND}
114 doc? ( >=app-text/docbook-sgml-dtd-4.1.2
115 app-text/docbook-xml-dtd
116 >=app-text/docbook-xml-simple-dtd-1.50.0
117 dev-libs/libxslt )
118 dga? ( x11-proto/xf86dgaproto )
119 xinerama? ( x11-proto/xineramaproto )
120 xv? ( x11-proto/videoproto
121 x11-proto/xf86vidmodeproto )
122 gtk? ( x11-proto/xextproto
123 x11-proto/xf86vidmodeproto )
124 X? ( x11-proto/xextproto
125 x11-proto/xf86vidmodeproto )
126 xscreensaver? ( x11-proto/scrnsaverproto )
127 iconv? ( virtual/libiconv )"
128 # Make sure the assembler USE flags are unmasked on amd64
129 # Remove this once default-linux/amd64/2006.1 is deprecated
130 DEPEND="${DEPEND} amd64? ( >=sys-apps/portage-2.1.2 )
131 mp2? ( >=sys-apps/portage-2.1.2 )"
133 SLOT="0"
134 LICENSE="GPL-2"
135 KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
137 pkg_setup() {
139 if [[ -n ${LINGUAS} ]]; then
140 elog "For MPlayer's language support, the configuration will"
141 elog "use your LINGUAS variable from /etc/make.conf. If you have more"
142 elog "than one language enabled, then the first one in the list will"
143 elog "be used to output the messages, if a translation is available."
144 elog "man pages will be created for all languages where translations"
145 elog "are also available."
148 if use x86 || use amd64; then
149 if ! use mmx; then
150 ewarn "You have the 'mmx' use flag disabled for this package, which"
151 ewarn "means that no CPU optimizations will be used at all."
152 ewarn "The build will either break or encode very slowly. Check your"
153 ewarn "/proc/cpuinfo for possible CPU optimization flags that"
154 ewarn "apply to this ebuild (mmx, mmxext, 3dnow, 3dnowext, sse, sse2,"
155 ewarn "pni/ssse3)."
161 src_unpack() {
162 unpack ${A}
164 if ! use truetype ; then
165 unpack font-arial-iso-8859-1.tar.bz2 \
166 font-arial-iso-8859-2.tar.bz2 \
167 font-arial-cp1250.tar.bz2
170 use gtk && unpack "Blue-${BLUV}.tar.bz2"
172 use svga && unpack "svgalib_helper-${SVGV}-mplayer.tar.bz2"
174 cd "${S}"
176 # Fix hppa compilation
177 use hppa && sed -i -e "s/-O4/-O1/" "${S}/configure"
179 if use svga; then
180 echo
181 einfo "Enabling vidix non-root mode."
182 einfo "(You need a proper svgalib_helper.o module for your kernel"
183 einfo "to actually use this)"
184 echo
186 mv "${WORKDIR}/svgalib_helper" "${S}/libdha"
189 # Fix polish spelling errors
190 [[ -n ${LINGUAS} ]] && sed -e 's:Zarządano:Zażądano:' -i help/help_mp-pl.h
193 src_compile() {
195 local myconf=" --disable-tv-bsdbt848 \
196 --disable-faad-external"
198 # broken upstream, won't work with recent kernels
199 myconf="${myconf} --disable-ivtv --disable-pvr"
201 # MPlayer reads in the LINGUAS variable from make.conf, and sets
202 # the languages accordingly. Some will have to be altered to match
203 # upstream's naming scheme.
204 [[ -n $LINGUAS ]] && LINGUAS=${LINGUAS/da/dk}
206 ################
207 #Optional features#
208 ###############
209 use bidi || myconf="${myconf} --disable-fribidi"
210 use bl && myconf="${myconf} --enable-bl"
211 use color-console && myconf="${myconf} --enable-color-console"
212 use enca || myconf="${myconf} --disable-enca"
213 use ftp || myconf="${myconf} --disable-ftp"
214 use nemesi || myconf="${myconf} --disable-nemesi"
215 use tivo || myconf="${myconf} --disable-vstream"
216 use xscreensaver || myconf="${myconf} --disable-xss"
218 # libcdio support: prefer libcdio over cdparanoia
219 # don't check for cddb w/cdio
220 if use cdio; then
221 myconf="${myconf} --disable-cdparanoia"
222 else
223 myconf="${myconf} --disable-libcdio"
224 use cdparanoia || myconf="${myconf} --disable-cdparanoia"
225 use cddb || myconf="${myconf} --disable-cddb"
228 # DVD support
229 # dvdread and libdvdcss are internal libs
230 # http://www.mplayerhq.hu/DOCS/HTML/en/dvd.html
231 # You can optionally use external dvdread support, but against
232 # upstream's suggestion. We don't.
233 if ! use dvd; then
234 myconf="${myconf} --disable-dvdnav --disable-dvdread"
235 use a52 || myconf="${myconf} --disable-liba52"
238 if use encode; then
239 use aac || myconf="${myconf} --disable-faac"
240 use dv || myconf="${myconf} --disable-libdv"
241 use x264 || myconf="${myconf} --disable-x264"
242 else
243 myconf="${myconf} --disable-mencoder --disable-libdv --disable-x264 \
244 --disable-faac"
247 # SRT (subtitles) requires freetype support
248 # freetype support requires iconv
249 # iconv optionally can use unicode
250 if ! use srt; then
251 myconf="${myconf} --disable-ass"
252 if ! use truetype; then
253 myconf="${myconf} --disable-freetype"
254 if ! use iconv; then
255 myconf="${myconf} --disable-iconv --charset=noconv"
259 use iconv && use unicode && myconf="${myconf} --charset=UTF-8"
261 use lirc || myconf="${myconf} --disable-lirc --disable-lircc"
262 myconf="${myconf} $(use_enable joystick)"
263 use ipv6 || myconf="${myconf} --disable-inet6"
264 use rar || myconf="${myconf} --disable-unrarexec"
265 use rtc || myconf="${myconf} --disable-rtc"
266 use samba || myconf="${myconf} --disable-smb"
268 # DVB / Video4Linux / Radio support
269 if { use dvb || use v4l || use v4l2 || use radio; }; then
270 use dvb || myconf="${myconf} --disable-dvb --disable-dvbhead"
271 use v4l || myconf="${myconf} --disable-tv-v4l1"
272 use v4l2 || myconf="${myconf} --disable-tv-v4l2"
273 use teletext || myconf="${myconf} --disable-tv-teletext"
274 if use radio && { use dvb || use v4l || use v4l2; }; then
275 myconf="${myconf} --enable-radio $(use_enable encode radio-capture)"
276 else
277 myconf="${myconf} --disable-radio-v4l2 --disable-radio-bsdbt848"
279 else
280 myconf="${myconf} --disable-tv --disable-tv-v4l1 --disable-tv-v4l2 \
281 --disable-radio --disable-radio-v4l2 --disable-radio-bsdbt848 \
282 --disable-dvb --disable-dvbhead --disable-tv-teletext"
285 #########
286 # Codecs #
287 ########
288 for x in gif jpeg live mad musepack pnm speex tga theora xanim xvid; do
289 use ${x} || myconf="${myconf} --disable-${x}"
290 done
291 use aac || myconf="${myconf} --disable-faad-internal"
292 use amrnb || myconf="${myconf} --disable-libamr_nb"
293 use amrwb || myconf="${myconf} --disable-libamr_wb"
294 use dts || myconf="${myconf} --disable-libdca"
295 ! use png && ! use gtk && myconf="${myconf} --disable-png"
296 use lzo || myconf="${myconf} --disable-liblzo"
297 use encode && use mp2 || myconf="${myconf} --disable-twolame \
298 --disable-toolame"
299 use mp3 || myconf="${myconf} --disable-mp3lib"
300 use quicktime || myconf="${myconf} --disable-qtx"
301 use vorbis || myconf="${myconf} --disable-libvorbis"
302 use xanim && myconf="${myconf} --xanimcodecsdir=/usr/lib/xanim/mods"
303 if use x86 || use amd64; then
304 # Real codec support, only available on x86, amd64
305 if use real && use x86; then
306 myconf="${myconf} --realcodecsdir=/opt/RealPlayer/codecs"
307 elif use real && use amd64; then
308 myconf="${myconf} --realcodecsdir=/usr/$(get_libdir)/codecs"
309 else
310 myconf="${myconf} --disable-real"
312 if ! use bindist && ! use real; then
313 myconf="${myconf} $(use_enable win32codecs win32dll)"
317 #############
318 # Video Output #
319 #############
320 for x in directfb ggi md5sum sdl xinerama; do
321 use ${x} || myconf="${myconf} --disable-${x}"
322 done
323 use aalib || myconf="${myconf} --disable-aa"
324 use dga || myconf="${myconf} --disable-dga1 --disable-dga2"
325 use fbcon || myconf="${myconf} --disable-fbdev"
326 use fbcon && use video_cards_s3virge && myconf="${myconf} --enable-s3fb"
327 use libcaca || myconf="${myconf} --disable-caca"
328 use opengl || myconf="${myconf} --disable-gl"
329 use video_cards_vesa || myconf="${myconf} --disable-vesa"
330 use vidix || myconf="${myconf} --disable-vidix-internal \
331 --disable-vidix-external \
332 --disable-vidix-pcidb"
333 use zoran || myconf="${myconf} --disable-zr"
335 # GTK gmplayer gui
336 myconf="${myconf} $(use_enable gtk gui)"
338 if use xv; then
339 if use xvmc; then
340 myconf="${myconf} --enable-xvmc --with-xvmclib=XvMCW"
341 if use video_cards_openchrome; then
342 epatch "${FILESDIR}"/mplayer-xvmc-vld.r24967.patch
344 else
345 myconf="${myconf} --disable-xvmc"
347 else
348 myconf="${myconf} --disable-xv --disable-xvmc"
351 if ! use kernel_linux && ! use video_cards_mga; then
352 myconf="${myconf} --disable-mga --disable-xmga"
355 if use video_cards_tdfx; then
356 myconf="${myconf} $(use_enable video_cards_tdfx tdfxvid) \
357 $(use_enable fbcon tdfxfb)"
358 else
359 myconf="${myconf} --disable-3dfx --disable-tdfxvid --disable-tdfxfb"
362 #############
363 # Audio Output #
364 #############
365 for x in alsa arts esd jack ladspa nas openal; do
366 use ${x} || myconf="${myconf} --disable-${x}"
367 done
368 use pulseaudio || myconf="${myconf} --disable-pulse"
369 if ! use radio; then
370 use oss || myconf="${myconf} --disable-ossaudio"
372 #################
373 # Advanced Options #
374 #################
375 # Platform specific flags, hardcoded on amd64 (see below)
376 if use x86 || use amd64 || use ppc; then
377 if use cpudetection || use bindist; then
378 myconf="${myconf} --enable-runtime-cpudetection"
381 if use mmx; then
382 for x in 3dnow 3dnowext mmxext sse sse2 ssse3; do
383 use ${x} || myconf="${myconf} --disable-${x}"
384 done
385 else
386 myconf="${myconf} --disable-mmx --disable-mmxext --disable-sse \
387 --disable-sse2 --disable-ssse3 --disable-3dnow \
388 --disable-3dnowext"
391 use debug && myconf="${myconf} --enable-debug=3"
393 myconf="${myconf} $(use_enable altivec)"
395 if use custom-cflags; then
396 # let's play the filtration game! MPlayer hates on all!
397 strip-flags
398 # ugly optimizations cause MPlayer to cry on x86 systems!
399 if use x86 || use x86-fbsd ; then
400 replace-flags -O* -O2
401 filter-flags -fPIC -fPIE
403 use debug || append-flags -fomit-frame-pointer
405 append-flags -D__STDC_LIMIT_MACROS
406 else
407 unset CFLAGS CXXFLAGS
410 myconf="--cc=$(tc-getCC) \
411 --host-cc=$(tc-getBUILD_CC) \
412 --prefix=/usr \
413 --confdir=/etc/mplayer \
414 --datadir=/usr/share/mplayer \
415 --libdir=/usr/$(get_libdir) \
416 --enable-menu \
417 --enable-network \
418 ${myconf}"
419 #echo "CFLAGS=\"${CFLAGS}\" ./configure ${myconf}"
420 CFLAGS="${CFLAGS}" ./configure ${myconf} || die "configure died"
422 emake || die "Failed to build MPlayer!"
423 use doc && make -C DOCS/xml html-chunked
426 src_install() {
428 make prefix="${D}/usr" \
429 BINDIR="${D}/usr/bin" \
430 LIBDIR="${D}/usr/$(get_libdir)" \
431 CONFDIR="${D}/etc/mplayer" \
432 DATADIR="${D}/usr/share/mplayer" \
433 MANDIR="${D}/usr/share/man" \
434 install || die "Failed to install MPlayer!"
436 dodoc AUTHORS Changelog README
437 # Install the documentation; DOCS is all mixed up not just html
438 if use doc ; then
439 find "${S}/DOCS" -type d | xargs -- chmod 0755
440 find "${S}/DOCS" -type f | xargs -- chmod 0644
441 cp -r "${S}/DOCS" "${D}/usr/share/doc/${PF}/" || die "cp docs died"
444 # Copy misc tools to documentation path, as they're not installed directly
445 # and yes, we are nuking the +x bit.
446 find "${S}/TOOLS" -type d | xargs -- chmod 0755
447 find "${S}/TOOLS" -type f | xargs -- chmod 0644
448 cp -r "${S}/TOOLS" "${D}/usr/share/doc/${PF}/" || die "cp docs died"
450 # Install the default Skin and Gnome menu entry
451 if use gtk; then
452 dodir /usr/share/mplayer/skins
453 cp -r "${WORKDIR}/Blue" \
454 "${D}/usr/share/mplayer/skins/default" || die "cp skins died"
456 # Fix the symlink
457 rm -rf "${D}/usr/bin/gmplayer"
458 dosym mplayer /usr/bin/gmplayer
461 if ! use srt && ! use truetype; then
462 dodir /usr/share/mplayer/fonts
463 local x=
464 # Do this generic, as the mplayer people like to change the structure
465 # of their zips ...
466 for x in $(find "${WORKDIR}/" -type d -name 'font-arial-*')
468 cp -pPR "${x}" "${D}/usr/share/mplayer/fonts"
469 done
470 # Fix the font symlink ...
471 rm -rf "${D}/usr/share/mplayer/font"
472 dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font
475 insinto /etc/mplayer
476 newins "${S}/etc/example.conf" mplayer.conf
478 if use srt || use truetype; then
479 cat >> "${D}/etc/mplayer/mplayer.conf" << EOT
480 fontconfig=1
481 subfont-osd-scale=4
482 subfont-text-scale=3
486 dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf
488 dobin "${D}/usr/share/doc/${PF}/TOOLS/midentify"
490 insinto /usr/share/mplayer
491 doins "${S}/etc/input.conf"
492 doins "${S}/etc/menu.conf"
495 pkg_preinst() {
497 if [[ -d ${ROOT}/usr/share/mplayer/Skin/default ]]
498 then
499 rm -rf "${ROOT}/usr/share/mplayer/Skin/default"
503 pkg_postrm() {
505 # Cleanup stale symlinks
506 if [ -L "${ROOT}/usr/share/mplayer/font" -a \
507 ! -e "${ROOT}/usr/share/mplayer/font" ]
508 then
509 rm -f "${ROOT}/usr/share/mplayer/font"
512 if [ -L "${ROOT}/usr/share/mplayer/subfont.ttf" -a \
513 ! -e "${ROOT}/usr/share/mplayer/subfont.ttf" ]
514 then
515 rm -f "${ROOT}/usr/share/mplayer/subfont.ttf"