]> git.sesse.net Git - vlc/blob - vlc.ebuild
* m4/vlc.m4: Looks like POSIX shell reduces "`eval echo '$'FOO`" to "" even
[vlc] / vlc.ebuild
1 ###############################################################################
2 # vlc.ebuild: A Gentoo ebuild for vlc
3 ###############################################################################
4 # Copyright (C) 2003 VideoLAN
5 # $Id: vlc.ebuild,v 1.12 2003/07/10 00:47:42 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 # Instructions: http://wiki.videolan.org/index.php/Linux%20Gentoo
24 # Some of the ideas in this ebuild are derived from the official Gentoo ebuild
25 # Thanks to the Gentoo Team for supporting us.
26 ###############################################################################
27
28 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 imlib matroska dvb pvr"
29
30 # Change these to correspond with the
31 # unpacked dirnames of the CVS snapshots.
32 PFFMPEG=ffmpeg-20030622
33 PLIBMPEG2=mpeg2dec-20030612
34
35 S=${WORKDIR}/${P}
36 SFFMPEG=${WORKDIR}/${PFFMPEG}
37 SLIBMPEG2=${WORKDIR}/${PLIBMPEG2}
38
39 DESCRIPTION="VLC media player - Video player and streamer"
40 SRC_URI="http://www.videolan.org/pub/${PN}/${PV}/${P}.tar.bz2
41                  http://www.videolan.org/pub/${PN}/${PV}/contrib/mpeg2dec-20030612.tar.bz2
42                  http://www.videolan.org/pub/${PN}/${PV}/contrib/ffmpeg-20030622.tar.bz2"
43
44 HOMEPAGE="http://www.videolan.org/vlc"
45
46 SLOT="0"
47 LICENSE="GPL-2"
48 KEYWORDS="~x86 ~ppc ~sparc ~alpha ~mips ~hppa"
49
50 DEPEND="X? ( virtual/x11 )
51         nls? ( sys-devel/gettext )
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         xvid? ( >=media-libs/xvid-0.9.1 )
69         slp? ( >=net-libs/openslp-1.0.10 )
70         truetype? ( >=media-libs/freetype-2.1.4 )
71         lirc? ( app-misc/lirc )
72         imlib? ( >=media-libs/imlib2-1.0.6 )
73         wxwindows? ( >=x11-libs/wxGTK-2.4.0 )
74         matroska? ( media-libs/libmatroska )
75         dvb? ( media-libs/libdvb 
76                 media-tv/linuxtv-dvb )
77         >=media-libs/libdvbpsi-0.1.2
78         >=media-sound/mad-0.14.2b
79         >=media-libs/faad2-1.1
80         >=media-libs/a52dec-0.7.4
81         >=media-libs/flac-1.1.0"
82
83 # Missing support for
84 #       tarkin
85 #       theora
86 #       tremor
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
100         # if qt3 is installed, patch vlc to work with it instead of qt2
101         ( use qt || use kde ) && ( \
102         if [ ${QTDIR} = "/usr/qt/3" ]
103         then
104                 cp configure configure.orig
105                 sed -e "s:-lkfile::" configure.orig > configure
106
107                 cd ${S}/modules/gui/kde
108                 cp interface.h interface.h.orig
109                 sed -e "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 -e 's:\("vlc preferences", true, false, \)\("Save\):\1(KGuiItem)\2:' \
114                         preferences.cpp.orig > preferences.cpp
115         fi
116         )
117
118         # Change the location of the glide headers
119         cd ${S}
120         cp configure configure.orig
121         sed -e "s:/usr/include/glide:/usr/include/glide3:" configure.orig > configure
122         
123         # patch libmpeg2
124         cd ${SLIBMPEG2}
125         cp configure configure.orig
126         sed -e 's:OPT_CFLAGS=\"$CFLAGS -mcpu=.*\":OPT_CFLAGS=\"$CFLAGS\":g' \
127                 configure.orig > configure
128
129 }
130
131 src_compile(){
132         # configure and building of libmpeg2
133         cd ${SLIBMPEG2}
134         econf --disable-sdl --without-x \
135                 || die "./configure of libmpeg2 failed"
136         
137         emake || make || die "make of libmpeg2 failed"
138
139         # configure and building of ffmpeg
140         cd ${SFFMPEG}
141         myconf=""
142         use mmx || myconf="--disable-mmx"
143
144         ./configure ${myconf} \
145                 --disable-mp3lame \
146                 --disable-vorbis || die "./configure of ffmpeg failed"
147         
148         cd libavcodec
149         make || die "make of ffmpeg failed"
150         cd libpostproc
151         make || die "make of libpostproc failed"
152
153         # Configure and build VLC
154         cd ${S}
155         myconf=""
156
157         use X || myconf="${myconf} --disable-x11"
158
159         use xv || myconf="${myconf} --disable-xvideo"
160
161         use ggi && myconf="${myconf} --enable-ggi"
162
163         use 3dfx && myconf="${myconf} --enable-glide"
164
165         use matrox && myconf="${myconf} --enable-mga"
166
167         use svga && myconf="${myconf} --enable-svgalib"
168
169         use sdl || myconf="${myconf} --disable-sdl"
170
171         use fbcon || myconf="${myconf} --disable-fb"
172
173         use aalib && myconf="${myconf} --enable-aa"
174
175         use dvd \
176                 && myconf="${myconf} --enable-dvdread" \
177                 || myconf="${myconf} \
178                         --disable-dvd \
179                         --disable-dvdread \
180                         --disable-dvdplay \
181                         --disable-vcd"
182
183         use alsa && myconf="${myconf} --enable-alsa"
184
185         use oss || myconf="${myconf} --disable-oss"
186
187         use esd && myconf="${myconf} --enable-esd"
188
189         use arts && myconf="${myconf} --enable-arts"
190
191         use nls || myconf="${myconf} --disable-nls"
192
193         # the current gtk2 and gnome2 are prelimenary frameworks
194         use gtk \
195                 && myconf="${myconf} --disable-gtk2" \
196                 || myconf="${myconf} --disable-gtk --disable-gtk2"
197
198         use gnome && myconf="${myconf} --enable-gnome --disable-gnome2"
199
200         use kde && myconf="${myconf} --enable-kde"
201
202         use qt && myconf="${myconf} --enable-qt"
203
204         use ncurses && myconf="${myconf} --enable-ncurses"
205
206         use oggvorbis || myconf="${myconf} --disable-vorbis --disable-ogg"
207
208         use lirc && myconf="${myconf} --enable-lirc"
209
210         use slp || myconf="${myconf} --disable-slp"
211
212         use truetype && myconf="${myconf} --enable-freetype"
213
214         # xvid is a local USE var, see /usr/portage/profiles/use.local.desc for more details
215         use xvid && myconf="${myconf} --enable-xvid"
216
217         # v4l is a local USE var, see /usr/portage/profiles/use.local.desc for more details
218         use v4l && myconf="${myconf} --enable-v4l"
219
220         # wxwindows is a local USE var. already enabled by default, but depends on wxGTK
221         # but if we use wxwindows and imlib, then we can also use skins
222         (use imlib && use wxwindows) && myconf="${myconf} --enable-skins"
223
224         # matroska is a local USE var. 
225         # http://forums.gentoo.org/viewtopic.php?t=63722&highlight=matroska
226         use matroska && myconf="${myconf} --enable-mkv"
227
228         use dvb && myconf="${myconf} --enable-satellite"
229
230         # pvr is a local USE var, see /usr/portage/profiles/use.local.desc for more details
231         use pvr && myconf="${myconf} --enable-pvr"
232
233         # vlc uses its own ultraoptimizaed CXXFLAGS
234         # and forcing custom ones generally fails building
235         export CXXFLAGS=""
236         export CFLAGS=""
237         export WANT_AUTOCONF_2_5=1
238         export WANT_AUTOMAKE_1_6=1
239
240         # Avoid timestamp skews with autotools
241         touch configure.ac
242         touch aclocal.m4
243         touch configure
244         touch config.h.in
245         touch `find . -name Makefile.in`
246
247         myconf="${myconf} --enable-ffmpeg --with-ffmpeg-tree=${SFFMPEG} \
248                 --enable-libmpeg2 --with-libmpeg2-tree=${SLIBMPEG2} \
249                 --enable-dvbpsi \
250                 --enable-release \
251                 --enable-mad \
252                 --enable-faad \
253                 --enable-flac \
254                 --enable-a52"
255
256         ewarn ${myconf}
257         econf ${myconf} || die "configure of VLC failed"
258
259         # parallel make doesn't work with our complicated makefile
260         # this is also the reason as why you shouldn't run autoconf
261         # or automake yourself. (or bootstrap for that matter)
262         make || die "make of VLC failed"
263 }
264
265 src_install() {
266         
267         einstall || die "make install failed"
268
269         dodoc ABOUT-NLS AUTHORS COPYING ChangeLog HACKING INSTALL* \
270         MAINTAINERS NEWS README* MODULES THANKS doc/ChangeLog-*
271
272 }