]> git.sesse.net Git - vlc/blob - vlc.ebuild
* Dramatically improved the ebuild.
[vlc] / vlc.ebuild
1 ###############################################################################
2 # vlc.ebuild: A Gentoo ebuild for vlc
3 ###############################################################################
4 # Copyright (C) 2003 VideoLAN
5 # $Id: vlc.ebuild,v 1.5 2003/06/14 21:06:30 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 matrox svga fbcon esd kde X alsa ggi oggvorbis gnome xv oss sdl fbcon aalib slp truetype v4l xvid lirc wxwindows"
24
25 # Change these to correspond with the
26 # unpacked dirnames of the CVS snapshots.
27 PFFMPEG=ffmpeg-20030612
28 PLIBMPEG2=mpeg2dec-20030612
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 SRC_URI="http://www.videolan.org/pub/videolan/${PN}/${PV}/${P}.tar.bz2
38                  http://www.videolan.org/pub/testing/contrib/mpeg2dec-20030612.tar.bz2
39                  http://www.videolan.org/pub/testing/contrib/ffmpeg-20030612.tar.bz2"
40
41 HOMEPAGE="http://www.videolan.org/vlc"
42
43 SLOT="0"
44 LICENSE="GPL-2"
45 KEYWORDS="~x86 ~ppc"
46
47 DEPEND="X? ( virtual/x11 )
48         nls? ( sys-devel/gettext )
49         qt? ( x11-libs/qt )
50         dvd? ( >=media-libs/libdvdread-0.9.3
51                 >=media-libs/libdvdcss-1.2.6
52                 >=media-libs/libdvdplay-1.0.1 )
53         sdl? ( >=media-libs/libsdl-1.2.5 )
54         esd? ( >=media-sound/esound-0.2.22 )
55         ggi? ( >=media-libs/libggi-2.0_beta3 )
56         gtk? ( =x11-libs/gtk+-1.2* )
57         kde? ( kde-base/kdelibs )
58         arts? ( kde-base/kdelibs )
59         gnome? ( >=gnome-base/gnome-libs-1.4.1.2-r1 )
60         ncurses? ( sys-libs/ncurses )
61         oggvorbis? ( >=media-libs/libvorbis-1.0 
62                      >=media-libs/libogg-1.0 )
63         alsa? ( >=media-libs/alsa-lib-0.9_rc2 )
64         aalib? ( >=media-libs/aalib-1.4_rc4-r2 )
65         xvid? ( >=media-libs/xvid-0.9.1 )
66         slp? ( >=net-libs/openslp-1.0.10 )
67         truetype? ( >=media-libs/freetype-2.1.4 )
68         lirc? ( app-misc/lirc )
69         wxwindows? ( >=x11-libs/wxGTK-2.4.0 )
70         >=media-libs/libdvbpsi-0.1.2
71         >=media-sound/mad-0.14.2b
72         >=media-libs/a52dec-0.7.4"
73 # other optional libraries
74 #       >=media-libs/flac-1.1.0
75 #       >=media-libs/faad2-1.2
76 #       >=media-libs/libdv-0.98
77
78 # not in gentoo
79 #       tarkin
80 #       theora
81 #       tremor
82
83 # get kde and arts paths
84 if [ -n "`use kde`" -o -n "`use arts`" ]; then
85     inherit kde-functions
86     set-kdedir 3
87     # $KDEDIR is now set to arts/kdelibs location
88 fi
89
90 src_unpack() {
91         
92         unpack ${A}
93         cd ${S}
94
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 || myconf="${myconf} --disable-x11"
153
154         use xv || myconf="${myconf} --disable-xvideo"
155
156         use ggi && myconf="${myconf} --enable-ggi"
157
158         use 3dfx && myconf="${myconf} --enable-glide"
159
160         use matrox && myconf="${myconf} --enable-mga"
161
162         use svga && myconf="${myconf} --enable-svgalib"
163
164         use sdl || myconf="${myconf} --disable-sdl"
165
166         use fbcon || myconf="${myconf} --disable-fb"
167
168         use aalib && myconf="${myconf} --enable-aa"
169
170         use dvd \
171                 && myconf="${myconf} --enable-dvdread" \
172                 || myconf="${myconf} \
173                         --disable-dvd \
174                         --disable-dvdread \
175                         --disable-dvdplay \
176                         --disable-vcd"
177
178         use alsa && myconf="${myconf} --enable-alsa"
179
180         use oss || myconf="${myconf} --disable-oss"
181
182         use esd && myconf="${myconf} --enable-esd"
183
184         use arts && myconf="${myconf} --enable-arts"
185
186         use nls || myconf="${myconf} --disable-nls"
187
188         # the current gtk2 and gnome2 are prelimenary frameworks
189         use gtk \
190                 && myconf="${myconf} --disable-gtk2" \
191                 || myconf="${myconf} --disable-gtk --disable-gtk2"
192
193         use gnome && myconf="${myconf} --enable-gnome --disable-gnome2"
194
195         use kde && myconf="${myconf} --enable-kde"
196
197         use qt && myconf="${myconf} --enable-qt"
198
199         use ncurses && myconf="${myconf} --enable-ncurses"
200
201         use oggvorbis || myconf="${myconf} --disable-vorbis --disable-ogg"
202
203         use lirc && myconf="${myconf} --enable-lirc"
204
205         use slp || myconf="${myconf} --disable-slp"
206
207         # xvid is a local USE var, see /usr/portage/profiles/use.local.desc for more details
208         use xvid && myconf="${myconf} --enable-xvid"
209
210         # v4l is a local USE var, see /usr/portage/profiles/use.local.desc for more details
211         use v4l && myconf="${myconf} --enable-v4l"
212
213         # wxwindows is a local USE var. already enabled by default, but depends on wxGTK
214
215         # vlc uses its own ultraoptimizaed CXXFLAGS
216         # and forcing custom ones generally fails building
217         export CXXFLAGS=""
218         export CFLAGS=""
219         export WANT_AUTOCONF_2_5=1
220         export WANT_AUTOMAKE_1_6=1
221
222         myconf="${myconf} --enable-ffmpeg --with-ffmpeg-tree=${SFFMPEG} \
223                 --enable-libmpeg2 --with-libmpeg2-tree=${SLIBMPEG2} \
224                 --enable-dvbpsi \
225                 --enable-release \
226                 --enable-mad \
227                 --enable-a52"
228
229         ewarn ${myconf}
230         econf ${myconf} || die "configure of VLC failed"
231
232         # parallel make doesn't work with our complicated makefile
233         # this is also the reason as why you shouldn't run autoconf
234         # or automake yourself. (or bootstrap for that matter)
235         make || die "make of VLC failed"
236 }
237
238 src_install() {
239         
240         einstall || die "make install failed"
241
242         dodoc ABOUT-NLS AUTHORS COPYING ChangeLog HACKING INSTALL* \
243         MAINTAINERS NEWS README* MODULES THANKS
244
245 }