6d31253c540e6a6df2622aa45941edefd40556e8
[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.1 2003/05/15 00:32:28 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-14
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/videolan/${PN}/${PV}/${P}.tar.bz2
39                  http://www.videolan.org/pub/videolan/${PN}/${PV}/contrib/libmpeg2.tar.gz
40                  http://www.videolan.org/pub/videolan/${PN}/${PV}/contrib/ffmpeg.tar.gz"
41 HOMEPAGE="http://www.videolan.org"
42
43 SLOT="0"
44 LICENSE="GPL-2"
45 KEYWORDS="~x86 ~ppc"
46
47 DEPEND="X? ( virtual/x11 )
48         qt? ( x11-libs/qt )
49         dvd? ( >=media-libs/libdvdread-0.9.3
50                 >=media-libs/libdvdcss-1.2.6
51                 >=media-libs/libdvdplay-1.0.1 )
52         sdl? ( >=media-libs/libsdl-1.2.5 )
53         esd? ( >=media-sound/esound-0.2.22 )
54         ggi? ( >=media-libs/libggi-2.0_beta3 )
55         gtk? ( =x11-libs/gtk+-1.2* )
56         kde? ( kde-base/kdelibs )
57         arts? ( kde-base/kdelibs )
58         gnome? ( >=gnome-base/gnome-libs-1.4.1.2-r1 )
59         ncurses? ( sys-libs/ncurses )
60         oggvorbis? ( >=media-libs/libvorbis-1.0 
61                      >=media-libs/libogg-1.0 )
62         alsa? ( >=media-libs/alsa-lib-0.9_rc2 )
63         aalib? ( >=media-libs/aalib-1.4_rc4-r2 )
64         avi? ( >=media-libs/xvid-0.9.1 )
65         slp? ( >=net-libs/openslp-1.0.10 )
66         truetype? ( >=media-libs/freetype-2.1.4 )
67         >=media-sound/mad-0.14.2b
68         >=media-libs/a52dec-0.7.4
69         >=media-libs/faad2-1.1
70         >=media-libs/libdvbpsi-0.1.2"
71 # other optional libraries
72 #       >=media-libs/flac-1.1.0
73 #       >=media-libs/libdv-0.98
74 # wxwindows ought to be a USE variable, like all the others
75 #       >=x11-libs/wxGTK-2.4.0
76
77 # not in gentoo
78 #       tarkin
79 #       theora
80 #       tremor
81
82 RDEPEND="nls? ( sys-devel/gettext )"
83
84 # get kde and arts paths
85 if [ -n "`use kde`" -o -n "`use arts`" ]; then
86     inherit kde-functions
87     set-kdedir 3
88     # $KDEDIR is now set to arts/kdelibs location
89 fi
90
91 src_unpack() {
92         
93         unpack ${A}
94         cd ${S}
95         # if qt3 is installed, patch vlc to work with it instead of qt2
96         ( use qt || use kde ) && ( \
97         if [ ${QTDIR} = "/usr/qt/3" ]
98         then
99                 cp configure.ac configure.ac.orig
100                 sed "s:-lkfile::" \
101                         configure.ac.orig > configure.ac
102                 # adding configure.ac.in
103                 cp configure.ac.in configure.ac.in.orig
104                 sed "s:-lkfile::" \
105                         configure.ac.in.orig > configure.ac.in
106
107                 cd ${S}/modules/gui/kde
108                 cp interface.h interface.h.orig
109                 sed "s:\(#include <kmainwindow.h>\):\1\n#include <kstatusbar.h>:" \
110                         interface.h.orig > interface.h
111
112                 cp preferences.cpp preferences.cpp.orig
113                 sed 's:\("vlc preferences", true, false, \)\("Save\):\1(KGuiItem)\2:' \
114                         preferences.cpp.orig > preferences.cpp
115         fi
116         )
117         
118         # patch libmpeg2
119         cd ${SLIBMPEG2}
120         cp configure configure.orig
121         sed -e 's:OPT_CFLAGS=\"$CFLAGS -mcpu=.*\":OPT_CFLAGS=\"$CFLAGS\":g' \
122                 configure.orig > configure
123
124 }
125
126 src_compile(){
127         # configure and building of libmpeg2
128         cd ${SLIBMPEG2}
129         econf --disable-sdl --without-x \
130                 || die "./configure of libmpeg2 failed"
131         
132         emake || make || die "make of libmpeg2 failed"
133
134         # configure and building of ffmpeg
135         cd ${SFFMPEG}
136         myconf=""
137         use mmx || myconf="--disable-mmx"
138
139         ./configure ${myconf} \
140                 --disable-mp3lame \
141                 --disable-vorbis || die "./configure of ffmpeg failed"
142         
143         cd libavcodec
144         make || die "make of ffmpeg failed"
145         cd libpostproc
146         make || die "make of libpostproc failed"
147
148         # Configure and build VLC
149         cd ${S}
150         myconf=""
151         
152         use X \
153                 && myconf="${myconf} --enable-x11" \
154                 || myconf="${myconf} --disable-x11"
155
156         use xv\
157                 && myconf="${myconf} --enable-xvideo" \
158                 || myconf="${myconf} --diable-xvideo"
159                 
160         use qt \
161                 && myconf="${myconf} --enable-qt" \
162                 || myconf="${myconf} --disable-qt"
163         
164         use dvd \
165                 && myconf="${myconf} \
166                         --enable-dvd \
167                         --enable-dvdread \
168                         --enable-vcd" \
169                 || myconf="${myconf} \
170                         --disable-dvd \
171                         --disable-dvdread \
172                         --disable-vcd"
173         
174         use esd \
175                 && myconf="${myconf} --enable-esd" \
176                 || myconf="${myconf} --disable-esd"
177
178         use ggi \
179                 && myconf="${myconf} --enable-ggi" \
180                 || myconf="${myconf} --disable-ggi"
181         
182         # the current gtk2 and gnome2 are prelimenary frameworks
183         use gtk \
184                 && myconf="${myconf} --enable-gtk --disable-gtk2" \
185                 || myconf="${myconf} --disable-gtki --disable-gtk2"
186
187         use kde \
188                 && myconf="${myconf} --enable-kde" \
189                 || myconf="${myconf} --disable-kde"
190
191         use nls \
192                 || myconf="${myconf} --disable-nls"
193         
194         use 3dfx \
195                 && myconf="${myconf} --enable-glide" \
196                 || myconf="${myconf} --disable-glide"
197
198         use arts \
199                 && myconf="${myconf} --enable-arts" \
200                 || myconf="${myconf} --disable-arts"
201         
202         use gnome \
203                 && myconf="${myconf} --enable-gnome --disable-gnome2" \
204                 || myconf="${myconf} --disable-gnome --disable-gnome2"
205         
206         use ncurses \
207                 && myconf="${myconf} --enable-ncurses" \
208                 || myconf="${myconf} --disable-ncurses"
209         
210         use oggvorbis \
211                 && myconf="${myconf} --enable-vorbis --enable-ogg" \
212                 || myconf="${myconf} --disable-vorbis --disable-ogg"
213
214         use alsa \
215                 && myconf="${myconf} --enable-alsa" \
216                 || myconf="${myconf} --disable-alsa"
217                 
218         use oss \
219                 && myconf="${myconf} --enable-oss" \
220                 || myconf="${myconf} --disable-oss"
221
222         use sdl \
223                 && myconf="${myconf} --enable-sdl" \
224                 || myconf="${myconf} --disable-sdl"
225         
226         use fbcon \
227                 && myconf="${myconf} --enable-fb" \
228                 || myconf="${myconf} --disable-fb"
229
230         use aalib \
231                 && myconf="${myconf} --enable-aa" \
232                 || myconf="${myconf} --disable-aa"
233
234         # there is no xvid USE variable
235         # it is pretty reasonable that users with the avi USE variable
236         # want xvid too cq. not.
237         use avi \
238                 && myconf="${myconf} --enable-xvid" \
239                 || myconf="${myconf} --disable-xvid"
240
241         use slp \
242                 && myconf="${myconf} --enable-slp" \
243                 || myconf="${myconf} --disable-slp"
244
245         # vlc uses its own ultraoptimizaed CXXFLAGS
246         # and forcing custom ones generally fails building
247         export CXXFLAGS=""
248         export CFLAGS=""
249         export WANT_AUTOCONF_2_5=1
250         export WANT_AUTOMAKE_1_6=1
251
252         econf \
253                 --enable-ffmpeg --with-ffmpeg-tree=${SFFMPEG} \
254                 --enable-libmpeg2 --with-libmpeg2-tree=${SLIBMPEG2} \
255                 --with-sdl \
256                 --enable-release \
257                 --enable-mad \
258                 --enable-a52 \
259                 --enable-dvbpsi \
260                 ${myconf} || die "configure of VLC failed"
261
262         # parallel make doesn't work with our complicated makefile
263         # this is also the reason as why you shouldn't run autoconf
264         # or automake yourself. (or bootstrap for that matter)
265         make || die "make of VLC failed"
266 }
267
268 src_install() {
269         
270         einstall || die "make install failed"
271
272         dodoc ABOUT-NLS AUTHORS COPYING ChangeLog HACKING INSTALL* \
273         MAINTAINERS NEWS README* MODULES THANKS
274
275 }