c723df869695fed9abb6438def26a4fc93eaaba5
[vlc.git] / vlc.ebuild
1 ###############################################################################
2 # vlc.ebuild: A Gentoo ebuild for vlc
3 ###############################################################################
4 # Copyright (C) 2003 VideoLAN
5 # $Id: vlc.ebuild,v 1.3 2003/05/21 19:55:25 hartman Exp $
6 #
7 # Authors: Derk-Jan Hartman <thedj at users.sf.net>
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22 ###############################################################################
23 IUSE="arts qt ncurses dvd gtk nls 3dfx esd kde X alsa ggi oggvorbis gnome xv oss sdl fbcon aalib avi slp truetype"
24
25 # Change these to correspond with the
26 # unpacked dirnames of the CVS snapshots.
27 PFFMPEG=ffmpeg-cvs-2003-05-17
28 PLIBMPEG2=mpeg2dec-0.3.2-cvs
29
30 S=${WORKDIR}/${P}
31 SFFMPEG=${WORKDIR}/${PFFMPEG}
32 SLIBMPEG2=${WORKDIR}/${PLIBMPEG2}
33
34 DESCRIPTION="VLC media player - A videoplayer that plays DVD,
35              VCD, files and networkstreams o.a."
36
37 # Use the correct CVS snapshot links. 
38 SRC_URI="http://www.videolan.org/pub/testing/${P}/${P}.tar.bz2
39          http://www.videolan.org/pub/testing/contrib/ffmpeg-20030517.tar.bz2
40          http://www.videolan.org/pub/testing/contrib/mpeg2dec-20030418.tar.gz"
41
42 #SRC_URI="http://www.videolan.org/pub/videolan/${PN}/${PV}/${P}.tar.bz2
43 #                http://www.videolan.org/pub/videolan/${PN}/${PV}/contrib/libmpeg2.tar.gz
44 #                http://www.videolan.org/pub/videolan/${PN}/${PV}/contrib/ffmpeg.tar.gz"
45 HOMEPAGE="http://www.videolan.org"
46
47 SLOT="0"
48 LICENSE="GPL-2"
49 KEYWORDS="~x86 ~ppc"
50
51 DEPEND="X? ( virtual/x11 )
52         qt? ( x11-libs/qt )
53         dvd? ( >=media-libs/libdvdread-0.9.3
54                 >=media-libs/libdvdcss-1.2.6
55                 >=media-libs/libdvdplay-1.0.1 )
56         sdl? ( >=media-libs/libsdl-1.2.5 )
57         esd? ( >=media-sound/esound-0.2.22 )
58         ggi? ( >=media-libs/libggi-2.0_beta3 )
59         gtk? ( =x11-libs/gtk+-1.2* )
60         kde? ( kde-base/kdelibs )
61         arts? ( kde-base/kdelibs )
62         gnome? ( >=gnome-base/gnome-libs-1.4.1.2-r1 )
63         ncurses? ( sys-libs/ncurses )
64         oggvorbis? ( >=media-libs/libvorbis-1.0 
65                      >=media-libs/libogg-1.0 )
66         alsa? ( >=media-libs/alsa-lib-0.9_rc2 )
67         aalib? ( >=media-libs/aalib-1.4_rc4-r2 )
68         avi? ( >=media-libs/xvid-0.9.1 )
69         slp? ( >=net-libs/openslp-1.0.10 )
70         truetype? ( >=media-libs/freetype-2.1.4 )
71         >=media-sound/mad-0.14.2b
72         >=media-libs/a52dec-0.7.4
73         >=media-libs/faad2-1.1
74         >=media-libs/libdvbpsi-0.1.2"
75 # other optional libraries
76 #       >=media-libs/flac-1.1.0
77 #       >=media-libs/libdv-0.98
78 # wxwindows ought to be a USE variable, like all the others
79 #       >=x11-libs/wxGTK-2.4.0
80
81 # not in gentoo
82 #       tarkin
83 #       theora
84 #       tremor
85
86 RDEPEND="nls? ( sys-devel/gettext )"
87
88 # get kde and arts paths
89 if [ -n "`use kde`" -o -n "`use arts`" ]; then
90     inherit kde-functions
91     set-kdedir 3
92     # $KDEDIR is now set to arts/kdelibs location
93 fi
94
95 src_unpack() {
96         
97         unpack ${A}
98         cd ${S}
99         # if qt3 is installed, patch vlc to work with it instead of qt2
100         ( use qt || use kde ) && ( \
101         if [ ${QTDIR} = "/usr/qt/3" ]
102         then
103                 cp configure.ac configure.ac.orig
104                 sed "s:-lkfile::" \
105                         configure.ac.orig > configure.ac
106                 # adding configure.ac.in
107                 cp configure.ac.in configure.ac.in.orig
108                 sed "s:-lkfile::" \
109                         configure.ac.in.orig > configure.ac.in
110
111                 cd ${S}/modules/gui/kde
112                 cp interface.h interface.h.orig
113                 sed "s:\(#include <kmainwindow.h>\):\1\n#include <kstatusbar.h>:" \
114                         interface.h.orig > interface.h
115
116                 cp preferences.cpp preferences.cpp.orig
117                 sed 's:\("vlc preferences", true, false, \)\("Save\):\1(KGuiItem)\2:' \
118                         preferences.cpp.orig > preferences.cpp
119         fi
120         )
121         
122         # patch libmpeg2
123         cd ${SLIBMPEG2}
124         cp configure configure.orig
125         sed -e 's:OPT_CFLAGS=\"$CFLAGS -mcpu=.*\":OPT_CFLAGS=\"$CFLAGS\":g' \
126                 configure.orig > configure
127
128 }
129
130 src_compile(){
131         # configure and building of libmpeg2
132         cd ${SLIBMPEG2}
133         econf --disable-sdl --without-x \
134                 || die "./configure of libmpeg2 failed"
135         
136         emake || make || die "make of libmpeg2 failed"
137
138         # configure and building of ffmpeg
139         cd ${SFFMPEG}
140         myconf=""
141         use mmx || myconf="--disable-mmx"
142
143         ./configure ${myconf} \
144                 --disable-mp3lame \
145                 --disable-vorbis || die "./configure of ffmpeg failed"
146         
147         cd libavcodec
148         make || die "make of ffmpeg failed"
149         cd libpostproc
150         make || die "make of libpostproc failed"
151
152         # Configure and build VLC
153         cd ${S}
154         myconf=""
155         
156         use X \
157                 && myconf="${myconf} --enable-x11" \
158                 || myconf="${myconf} --disable-x11"
159
160         use xv \
161                 && myconf="${myconf} --enable-xvideo" \
162                 || myconf="${myconf} --diable-xvideo"
163                 
164         use qt \
165                 && myconf="${myconf} --enable-qt" \
166                 || myconf="${myconf} --disable-qt"
167         
168         use dvd \
169                 && myconf="${myconf} \
170                         --enable-dvd \
171                         --enable-dvdread \
172                         --enable-vcd" \
173                 || myconf="${myconf} \
174                         --disable-dvd \
175                         --disable-dvdread \
176                         --disable-vcd"
177         
178         use esd \
179                 && myconf="${myconf} --enable-esd" \
180                 || myconf="${myconf} --disable-esd"
181
182         use ggi \
183                 && myconf="${myconf} --enable-ggi" \
184                 || myconf="${myconf} --disable-ggi"
185         
186         # the current gtk2 and gnome2 are prelimenary frameworks
187         use gtk \
188                 && myconf="${myconf} --enable-gtk --disable-gtk2" \
189                 || myconf="${myconf} --disable-gtki --disable-gtk2"
190
191         use kde \
192                 && myconf="${myconf} --enable-kde" \
193                 || myconf="${myconf} --disable-kde"
194
195         use nls \
196                 || myconf="${myconf} --disable-nls"
197         
198         use 3dfx \
199                 && myconf="${myconf} --enable-glide" \
200                 || myconf="${myconf} --disable-glide"
201
202         use arts \
203                 && myconf="${myconf} --enable-arts" \
204                 || myconf="${myconf} --disable-arts"
205         
206         use gnome \
207                 && myconf="${myconf} --enable-gnome --disable-gnome2" \
208                 || myconf="${myconf} --disable-gnome --disable-gnome2"
209         
210         use ncurses \
211                 && myconf="${myconf} --enable-ncurses" \
212                 || myconf="${myconf} --disable-ncurses"
213         
214         use oggvorbis \
215                 && myconf="${myconf} --enable-vorbis --enable-ogg" \
216                 || myconf="${myconf} --disable-vorbis --disable-ogg"
217
218         use alsa \
219                 && myconf="${myconf} --enable-alsa" \
220                 || myconf="${myconf} --disable-alsa"
221                 
222         use oss \
223                 && myconf="${myconf} --enable-oss" \
224                 || myconf="${myconf} --disable-oss"
225
226         use sdl \
227                 && myconf="${myconf} --enable-sdl" \
228                 || myconf="${myconf} --disable-sdl"
229         
230         use fbcon \
231                 && myconf="${myconf} --enable-fb" \
232                 || myconf="${myconf} --disable-fb"
233
234         use aalib \
235                 && myconf="${myconf} --enable-aa" \
236                 || myconf="${myconf} --disable-aa"
237
238         # there is no xvid USE variable
239         # it is pretty reasonable that users with the avi USE variable
240         # want xvid too cq. not.
241         use avi \
242                 && myconf="${myconf} --enable-xvid" \
243                 || myconf="${myconf} --disable-xvid"
244
245         use slp \
246                 && myconf="${myconf} --enable-slp" \
247                 || myconf="${myconf} --disable-slp"
248
249         # vlc uses its own ultraoptimizaed CXXFLAGS
250         # and forcing custom ones generally fails building
251         export CXXFLAGS=""
252         export CFLAGS=""
253         export WANT_AUTOCONF_2_5=1
254         export WANT_AUTOMAKE_1_6=1
255
256         econf \
257                 --enable-ffmpeg --with-ffmpeg-tree=${SFFMPEG} \
258                 --enable-libmpeg2 --with-libmpeg2-tree=${SLIBMPEG2} \
259                 --with-sdl \
260                 --enable-release \
261                 --enable-mad \
262                 --enable-a52 \
263                 --enable-dvbpsi \
264                 ${myconf} || die "configure of VLC failed"
265
266         # parallel make doesn't work with our complicated makefile
267         # this is also the reason as why you shouldn't run autoconf
268         # or automake yourself. (or bootstrap for that matter)
269         make || die "make of VLC failed"
270 }
271
272 src_install() {
273         
274         einstall || die "make install failed"
275
276         dodoc ABOUT-NLS AUTHORS COPYING ChangeLog HACKING INSTALL* \
277         MAINTAINERS NEWS README* MODULES THANKS
278
279 }