summaryrefslogtreecommitdiff
blob: fbf378c888ec0e6d563f024ae15f406acbfa160e (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/ffmpeg/ffmpeg-0.4.9_pre1-r1.ebuild,v 1.1 2005/05/04 01:13:37 j4rg0n Exp $

inherit eutils flag-o-matic gcc

# TODO: --enablea52bin breaks compile

DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec."
HOMEPAGE="http://ffmpeg.sourceforge.net/"
MY_P=${P/_/-}
S=${WORKDIR}/${MY_P}
SRC_URI="mirror://sourceforge/ffmpeg/${MY_P}.tar.gz"

LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~x86 ~ppc ~sparc ~alpha ~amd64 ~ia64 ~ppc64 ~arm ~mips ~hppa ~ppc-macos"
IUSE="altivec debug doc dvd encode aac imlib mmx oggvorbis sdl static truetype"

DEPEND="encode? ( >=media-sound/lame-3.92 )
	oggvorbis? ( >=media-libs/libvorbis-1.0-r1 )
	doc? ( >=app-text/texi2html-1.64 )
	aac? ( >=media-libs/faad2-1.1
	       !alpha? ( >=media-libs/faac-1.23 ) )
	dvd? ( >=media-libs/a52dec-0.7.4 )
	sdl? ( >=media-libs/libsdl-1.2.5 )
	imlib? ( >=media-libs/imlib2-1.0.6 )
	truetype? ( >=media-libs/freetype-2.1.2 )
	!<media-video/mplayer-1.0_pre3-r1"

src_unpack() {
	unpack ${A} || die
	cd ${S}

	# for some reason it tries to #include <X11/Xlib.h>,b ut doesn't use it
	sed -i s:\#define\ HAVE_X11:\#define\ HAVE_LINUX: ffplay.c

	if use ppc-macos; then
		sed -i s:SLIBSUF=".so":SLIBSUF=".dylib": configure
		epatch ${FILESDIR}/${PN}-osx.patch
		sed -i -e 's:\$<:\$< -L../libavcodec -lavcodec -L../libavformat -lavformat:g' vhook/Makefile
		use oggvorbis && sed -i -e 's:ifeq ($(CPU),Darwin):ifeq ($(CPU),Darwin)\
	LDFLAGS+=-logg:' libavformat/Makefile
	fi

	#this will allow ffmpeg to be compiled with gcc-3.4.x fixing bug #49383
	if [ "`gcc-major-version`" -ge "3" -a "`gcc-minor-version`" -ge "4" ]
	then
		einfo "Compiler used: gcc-3.4.x Applying patch conditionally."
		epatch ${FILESDIR}/0.4.8-gcc3.4-magicF2W.patch
	fi
}

src_compile() {
	filter-flags -fforce-addr -fPIC
	# fixes bug #16281
	use alpha && append-flags -fPIC
	use amd64 && append-flags -fPIC
	use hppa && append-flags -fPIC
	use ppc && append-flags -fPIC
	use ppc-macos && append-flags -fno-common

	local myconf
	#myconf="${myconf} --disable-opts --enable-pp --enable-shared-pp"
	myconf="${myconf} --disable-opts --enable-pp --enable-gpl"
	use mmx || myconf="${myconf} --disable-mmx"
	use encode && myconf="${myconf} --enable-mp3lame"
	use oggvorbis && myconf="${myconf} --enable-vorbis"
	use aac && myconf="${myconf} --enable-faad --enable-faadbin"
	if ! use alpha; then
	    use aac && myconf="${myconf} --enable-faac"
	fi
	use dvd && myconf="${myconf} --enable-a52"
	use static || myconf="${myconf} --enable-shared"
	use sdl || myconf="${myconf} --disable-ffplay"
	use debug || myconf="${myconf} --disable-debug"
	use altivec || myconf="${myconf} --disable-altivec"

# Using --enable-a52bin breaks the compile
	#use dvd && myconf="${myconf} --enable-a52 --enable-a52bin"

	./configure ${myconf} \
		--prefix=/usr || die "./configure failed."
	make || die "make failed."
	use doc && make -C doc all

	filter-flags -momit-leaf-frame-pointer
	# fixes bug #45576
	./configure ${myconf} \
		--prefix=/usr || die "./configure failed."
	# Build libpostproc
	cd ${S}/libavcodec/libpostproc
	make || die "Failed to build libpostproc.a!"
	make SHARED_PP="yes" || die "Failed to build libpostproc.so!"
}

src_install() {
	make \
		DESTDIR=${D} \
		prefix=${D}/usr \
		bindir=${D}/usr/bin \
		mandir=${D}/usr/share/man \
		infodir=${D}/usr/share/info \
		install || die

	dodoc COPYING CREDITS Changelog INSTALL README
	docinto doc
	dodoc doc/TODO doc/*.html doc/*.texi
	insinto /etc
	doins doc/ffserver.conf

	# Install libpostproc ...
	cd ${S}/libavcodec/libpostproc
	make prefix=${D}/usr \
		install || die "Failed to install libpostproc.a!"
	make prefix=${D}/usr \
		SHARED_PP="yes" \
		install || die "Failed to install libpostproc.so!"
	cd ${S}
	# Some stuff like transcode can use this one.
	dolib ${S}/libavcodec/libpostproc/libpostproc.a

	preplib /usr
}

# FEATURES=maketest breakes the compile
src_test() { :; }