summaryrefslogtreecommitdiff
blob: 016980b3f077c1d1f445bd36d2102d94a2908578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Copyright 1999-2000 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Authors Bruce Locke <blocke@shivan.org>, Martin Schlemmer <azarah@gentoo.org>,
#         Donny Davies <woodchip@gentoo.org>

# Handle PREversions as well
MY_VERSION="`echo ${PV} |sed -e 's/_//'`"
S="${WORKDIR}/MPlayer-${MY_VERSION}"

# Only install Skin if GUI should be build (gtk as USE flag)
# NOTE: URC_URI="foo? ( ftp://ftp.foo.org/foo.tar.bz )" style will be used 
# when included in release portage
if [ "`use gtk`" ] ; then
	SRC_URI="ftp://mplayerhq.hu/MPlayer/releases/MPlayer-${MY_VERSION}.tar.bz2
		 ftp://mplayerhq.hu/MPlayer/releases/mp-arial-iso-8859-1.zip
		 ftp://mplayerhq.hu/MPlayer/Skin/default.tar.bz2"
else		  
        SRC_URI="ftp://mplayerhq.hu/MPlayer/releases/MPlayer-${MY_VERSION}.tar.bz2
                 ftp://mplayerhq.hu/MPlayer/releases/mp-arial-iso-8859-1.zip"
fi

DESCRIPTION="Media Player for Linux"
HOMEPAGE="http://www.mplayerhq.hu"

# Experimental USE flags dvd and decss
DEPEND="virtual/glibc
        dev-lang/nasm
        media-libs/win32codecs
	>=media-libs/divx4linux-20010824
        dvd? ( media-libs/libdvdread )
        decss? ( media-libs/libdvdcss )
	opengl? ( media-libs/mesa )
        sdl? ( media-libs/libsdl )
        ggi? ( media-libs/libggi )
        svga? ( media-libs/svgalib )
        X? ( virtual/x11 )
	gtk? ( >=x11-libs/gtk+-1.2.10-r4 )
        esd? ( media-sound/esound )
        alsa? ( media-libs/alsa-lib )
	ogg? ( media-libs/libogg )"

RDEPEND="virtual/glibc
        media-libs/win32codecs
        >=media-libs/divx4linux-20010824
        dvd? ( media-libs/libdvdread )
        decss? ( media-libs/libdvdcss )
	opengl? ( media-libs/mesa )
        sdl? ( media-libs/libsdl )
        ggi? ( media-libs/libggi )
        svga? ( media-libs/svgalib )
        X? ( virtual/x11 )
        gtk? ( >=x11-libs/gtk+-1.2.10-r4 )
	esd? ( media-sound/esound )
        alsa? ( media-libs/alsa-lib )
	ogg? ( media-libs/libogg )"


src_unpack() {

	unpack ${A}

	# Fix bug with the default Skin
	cd ${WORKDIR}/default
	patch <${FILESDIR}/default-skin.diff

}

src_compile() {

	local myconf
	use 3dnow  || myconf="${myconf} --disable-3dnow --disable-3dnowex"
	use mmx    || myconf="${myconf} --disable-mmx --disable-mmx2"
	use X      || myconf="${myconf} --disable-x11 --disable-xv"
	use gtk    && myconf="${myconf} --enable-gui"
	use oss    || myconf="${myconf} --disable-ossaudio"
	use nls    || myconf="${myconf} --disable-nls"
	use opengl || myconf="${myconf} --disable-gl"
	use sdl    || myconf="${myconf} --disable-sdl"
	use ggi    || myconf="${myconf} --disable-ggi"
	use sse    || myconf="${myconf} --disable-sse"
	use svga   || myconf="${myconf} --disable-svga"
	use alsa   || myconf="${myconf} --disable-alsa"
	use esd    || myconf="${myconf} --disable-esd"
	use ogg    || myconf="${myconf} --disable-oggvorbis"
	use decss  && myconf="${myconf} --enable-css"

	./configure --mandir=/usr/share/man --prefix=/usr --host=${CHOST} ${myconf} || die
	emake OPTFLAGS="${CFLAGS}" all || die
	
}

src_install() {

	make prefix=${D}/usr/share BINDIR=${D}/usr/bin install || die
	
	# MAN pages are already installed ...
	rm DOCS/*.1
	# Install the rest of the documentation
	dodir /usr/share/doc/${PF}
	cp -a DOCS/* ${D}/usr/share/doc/${PF}

	# Install the default Skin
	if [ "`use gtk`" ] ; then
		insinto /usr/share/mplayer/Skin/default
		doins ${WORKDIR}/default/*
		# Permissions is fried by default
		chmod a+rx ${D}/usr/share/mplayer/Skin/default/
		chmod a+r ${D}/usr/share/mplayer/Skin/default/*
	fi

	# Install the font used by OSD and the GUI
	dodir /usr/share/mplayer/fonts
	cp -a ${WORKDIR}/iso-8859-1/ ${D}/usr/share/mplayer/fonts
	dosym /usr/share/mplayer/fonts/iso-8859-1/arial-14/ /usr/share/mplayer/font

	# This tries setting up mplayer.conf automagically
	local video="sdl" audio="sdl"
	if [ "`use X`" ] ; then
		if [ "`use sdl`" ] ; then
			video="sdl"
		elif [ "`use ggi`" ] ; then
			video="ggi"
		elif [ "`use xv`" ] ; then
			video="xv"
                elif [ "`use dga`" ] ; then
                        video="dga"
		elif [ "`use opengl`" ] ; then
			video="gl"
		else
			video="x11"
		fi
	else
		if [ "`use fbcon`" ] ; then
			video="fbdev"
                elif [ "`use svga`" ] ; then
                        video="svga"
		elif [ "`use aalib`" ] ; then
			video="aa"
		fi
	fi
	if [ "`use sdl`" ] ; then
		audio="sdl"
	elif [ "`use alsa`" ] ; then
		audio="alsa"
	elif [ "`use oss`" ] ; then
		audio="oss"
	fi
	sed -e "s/vo=xv/vo=${video}/" -e "s/ao=oss/ao=${audio}/" -e 's/include =/#include =/' ${S}/etc/example.conf > ${T}/mplayer.conf

	insinto /etc
	doins ${T}/mplayer.conf 
	
	# Thanks goes to Mog for this one!
	insinto /usr/share/mplayer
	doins ${S}/etc/codecs.conf

}

pkg_postinst() {

	echo
	echo '######################################################################'
	echo '# MPlayer users that are going to use the GUI, please note the       #'
	echo '# following:                                                         #'
	echo '#                                                                    #'
	echo '#   The GUI works best with mplayer -vo xv -gui, but since there is  #'
	echo '#   no USE flag for XVideo, or for using the GUI, the autodetection  #'
	echo '#   process cannot detect this by default (SDL will be used rather). #'
	echo '#   So, if you setup supports XVideo (xvinfo should give output),    #'
	echo '#   maybe do something like:                                         #'
	echo '#                                                                    #'
	echo '#     echo "vo = xv" >~/.mplayer/config                              #'
	echo '#     echo "gui = 1" >>~/.mplayer/config                             #'
	echo '#                                                                    #'
	echo '#   after launching mplayer for the first time.                      #'
	echo '#                                                                    #'
	echo '# NB: the GUI needs "gtk" as USE flag to build.                      #'
	echo '######################################################################'
	echo

}