/[gentoo-x86]/media-video/libav/libav-0.8.2.ebuild
Gentoo

Contents of /media-video/libav/libav-0.8.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Wed Jun 20 11:10:40 2012 UTC (2 years, 5 months ago) by scarabeus
Branch: MAIN
Changes since 1.9: +2 -2 lines
0.8.2 works on ppc64 stable too, so stabilise.

(Portage version: 2.2.0_alpha110/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/media-video/libav/libav-0.8.2.ebuild,v 1.9 2012/06/08 17:47:17 ranger Exp $
4
5 EAPI=4
6
7 if [[ ${PV} == *9999 ]] ; then
8 SCM="git-2"
9 EGIT_REPO_URI="git://git.libav.org/libav.git"
10 [[ ${PV%9999} != "" ]] && EGIT_BRANCH="release/${PV%.9999}"
11 fi
12
13 inherit eutils flag-o-matic multilib toolchain-funcs ${SCM}
14
15 DESCRIPTION="Complete solution to record, convert and stream audio and video."
16 HOMEPAGE="http://libav.org/"
17 if [[ ${PV} == *9999 ]] ; then
18 SRC_URI=""
19 elif [[ ${PV%_p*} != ${PV} ]] ; then # Gentoo snapshot
20 SRC_URI="http://dev.gentoo.org/~lu_zero/libav/${P}.tar.xz"
21 else # Official release
22 SRC_URI="http://${PN}.org/releases/${P}.tar.xz"
23 fi
24
25 LICENSE="LGPL-2.1 gpl? ( GPL-3 )"
26 SLOT="0"
27 [[ ${PV} == *9999 ]] || \
28 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
29 IUSE="+3dnow +3dnowext aac alsa altivec amr bindist +bzip2 cdio cpudetection
30 custom-cflags debug dirac doc +encode faac truetype frei0r +gpl gsm
31 +hardcoded-tables ieee1394 jack jpeg2k +mmx +mmxext mp3 network openssl
32 oss pic pulseaudio +qt-faststart rtmp schroedinger sdl speex ssl +ssse3
33 static-libs test theora threads v4l vaapi vdpau vorbis vpx X x264 xvid
34 +zlib"
35
36 CPU_FEATURES="3dnow:amd3dnow 3dnowext:amd3dnowext altivec avx mmx mmxext:mmx2 ssse3 vis neon iwmmxt"
37
38 for i in ${CPU_FEATURES}; do
39 IUSE="${IUSE} ${i%:*}"
40 done
41
42 RDEPEND="
43 !media-libs/libpostproc
44 !media-video/ffmpeg
45 alsa? ( media-libs/alsa-lib )
46 amr? ( media-libs/opencore-amr )
47 bzip2? ( app-arch/bzip2 )
48 cdio? ( dev-libs/libcdio )
49 dirac? ( media-video/dirac )
50 encode? (
51 aac? ( media-libs/vo-aacenc )
52 amr? ( media-libs/vo-amrwbenc )
53 faac? ( media-libs/faac )
54 mp3? ( >=media-sound/lame-3.98.3 )
55 theora? ( >=media-libs/libtheora-1.1.1[encode] media-libs/libogg )
56 vorbis? ( media-libs/libvorbis media-libs/libogg )
57 x264? ( >=media-libs/x264-0.0.20111017 )
58 xvid? ( >=media-libs/xvid-1.1.0 )
59 )
60 truetype? ( media-libs/freetype )
61 frei0r? ( media-plugins/frei0r-plugins )
62 gsm? ( >=media-sound/gsm-1.0.12-r1 )
63 ieee1394? ( media-libs/libdc1394 sys-libs/libraw1394 )
64 jack? ( media-sound/jack-audio-connection-kit )
65 jpeg2k? ( >=media-libs/openjpeg-1.3-r2 )
66 rtmp? ( >=media-video/rtmpdump-2.2f )
67 ssl? ( openssl? ( dev-libs/openssl )
68 !openssl? ( net-libs/gnutls ) )
69 sdl? ( >=media-libs/libsdl-1.2.13-r1[audio,video] )
70 schroedinger? ( media-libs/schroedinger )
71 speex? ( >=media-libs/speex-1.2_beta3 )
72 vaapi? ( x11-libs/libva )
73 vdpau? ( x11-libs/libvdpau )
74 vpx? ( >=media-libs/libvpx-0.9.6 )
75 X? ( x11-libs/libX11 x11-libs/libXext )
76 zlib? ( sys-libs/zlib )
77 "
78
79 DEPEND="${RDEPEND}
80 >=sys-devel/make-3.81
81 dirac? ( virtual/pkgconfig )
82 doc? ( app-text/texi2html )
83 mmx? ( dev-lang/yasm )
84 rtmp? ( virtual/pkgconfig )
85 schroedinger? ( virtual/pkgconfig )
86 test? ( net-misc/wget )
87 v4l? ( sys-kernel/linux-headers )
88 "
89
90 # faac can't be binary distributed
91 # openssl support marked as nonfree
92 # faac and aac are concurent implementations
93 # amr and aac require at least lgpl3
94 # x264 requires gpl2
95 REQUIRED_USE="bindist? ( !faac !openssl )
96 rtmp? ( network )
97 amr? ( gpl ) aac? ( gpl ) x264? ( gpl ) X? ( gpl )"
98
99 RESTRICT="test"
100
101 src_prepare() {
102 # if we have snapshot then we need to hardcode the version
103 if [[ ${PV%_p*} != ${PV} ]]; then
104 sed -i -e "s/UNKNOWN/DATE-${PV#*_pre}/" "${S}/version.sh" || die
105 fi
106 }
107
108 src_configure() {
109 local myconf="${EXTRA_LIBAV_CONF}"
110 local uses i
111
112 myconf+="
113 $(use_enable gpl)
114 $(use_enable gpl version3)
115 --enable-postproc
116 --enable-avfilter
117 "
118
119 # enabled by default
120 uses="debug doc network zlib"
121 for i in ${uses}; do
122 use ${i} || myconf+=" --disable-${i}"
123 done
124 use bzip2 || myconf+=" --disable-bzlib"
125 use sdl || myconf+=" --disable-avplay"
126
127 if use ssl; then
128 use openssl && myconf+=" --enable-openssl --enable-nonfree" \
129 || myconf+=" --enable-gnutls"
130 fi
131
132 use custom-cflags && myconf+=" --disable-optimizations"
133 use cpudetection && myconf+=" --enable-runtime-cpudetect"
134
135 #for i in h264_vdpau mpeg1_vdpau mpeg_vdpau vc1_vdpau wmv3_vdpau; do
136 # use video_cards_nvidia || myconf="${myconf} --disable-decoder=${i}"
137 # use vdpau || myconf="${myconf} --disable-decoder=${i}"
138 #done
139 use vdpau || myconf+=" --disable-vdpau"
140
141 use vaapi && myconf+=" --enable-vaapi"
142
143 # Encoders
144 if use encode; then
145 use mp3 && myconf+=" --enable-libmp3lame"
146 use amr && myconf+=" --enable-libvo-amrwbenc"
147 use faac && myconf+=" --enable-libfaac --enable-nonfree"
148 use aac && myconf+=" --enable-libvo-aacenc"
149 uses="theora vorbis x264 xvid"
150 for i in ${uses}; do
151 use ${i} && myconf+=" --enable-lib${i}"
152 done
153 else
154 myconf+=" --disable-encoders"
155 fi
156
157 # libavdevice options
158 use cdio && myconf+=" --enable-libcdio"
159 use ieee1394 && myconf+=" --enable-libdc1394"
160 use pulseaudio && myconf+=" --enable-libpulse"
161 # Indevs
162 # v4l1 is gone since linux-headers-2.6.38
163 myconf+=" --disable-indev=v4l"
164 use v4l || myconf+=" --disable-indev=v4l2"
165 for i in alsa oss jack; do
166 use ${i} || myconf+=" --disable-indev=${i}"
167 done
168 use X && myconf+=" --enable-x11grab"
169 # Outdevs
170 for i in alsa oss ; do
171 use ${i} || myconf+=" --disable-outdev=${i}"
172 done
173 # libavfilter options
174 use frei0r && myconf+=" --enable-frei0r"
175 use truetype && myconf+=" --enable-libfreetype"
176
177 # Threads; we only support pthread for now but ffmpeg supports more
178 use threads && myconf+=" --enable-pthreads"
179
180 # Decoders
181 use amr && myconf+=" --enable-libopencore-amrwb --enable-libopencore-amrnb"
182 uses="gsm dirac rtmp schroedinger speex vpx"
183 for i in ${uses}; do
184 use ${i} && myconf+=" --enable-lib${i}"
185 done
186 use jpeg2k && myconf+=" --enable-libopenjpeg"
187
188 # CPU features
189 for i in ${CPU_FEATURES}; do
190 use ${i%:*} || myconf+=" --disable-${i#*:}"
191 done
192
193 # pass the right -mfpu as extra
194 use neon && myconf+=" --extra-cflags=-mfpu=neon"
195
196 # disable mmx accelerated code if PIC is required
197 # as the provided asm decidedly is not PIC for x86.
198 if use pic && use x86 ; then
199 myconf+=" --disable-mmx --disable-mmx2"
200 fi
201
202 # Option to force building pic
203 use pic && myconf+=" --enable-pic"
204
205 # Try to get cpu type based on CFLAGS.
206 # Bug #172723
207 # We need to do this so that features of that CPU will be better used
208 # If they contain an unknown CPU it will not hurt since ffmpeg's configure
209 # will just ignore it.
210 for i in $(get-flag march) $(get-flag mcpu) $(get-flag mtune) ; do
211 [ "${i}" = "native" ] && i="host" # bug #273421
212 [[ ${i} = *-sse3 ]] && i="${i%-sse3}" # bug 283968
213 myconf+=" --cpu=${i}"
214 break
215 done
216
217 # cross compile support
218 if tc-is-cross-compiler ; then
219 myconf+=" --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}-"
220 case ${CHOST} in
221 *freebsd*)
222 myconf+=" --target-os=freebsd"
223 ;;
224 mingw32*)
225 myconf+=" --target-os=mingw32"
226 ;;
227 *linux*)
228 myconf+=" --target-os=linux"
229 ;;
230 esac
231 fi
232
233 # Misc stuff
234 use hardcoded-tables && myconf+=" --enable-hardcoded-tables"
235
236 # Specific workarounds for too-few-registers arch...
237 if [[ $(tc-arch) == "x86" ]]; then
238 filter-flags -fforce-addr -momit-leaf-frame-pointer
239 append-flags -fomit-frame-pointer
240 is-flag -O? || append-flags -O2
241 if use debug; then
242 # no need to warn about debug if not using debug flag
243 ewarn ""
244 ewarn "Debug information will be almost useless as the frame pointer is omitted."
245 ewarn "This makes debugging harder, so crashes that has no fixed behavior are"
246 ewarn "difficult to fix. Please have that in mind."
247 ewarn ""
248 fi
249 fi
250
251 cd "${S}"
252 ./configure \
253 --prefix="$EPREFIX"/usr \
254 --libdir="$EPREFIX"/usr/$(get_libdir) \
255 --shlibdir="$EPREFIX"/usr/$(get_libdir) \
256 --mandir="$EPREFIX"/usr/share/man \
257 --enable-shared \
258 --cc="$(tc-getCC)" \
259 $(use_enable static-libs static) \
260 ${myconf} || die
261 }
262
263 src_compile() {
264 emake
265
266 if use qt-faststart; then
267 tc-export CC
268 emake tools/qt-faststart
269 fi
270 }
271
272 src_install() {
273 emake DESTDIR="${D}" install install-man
274
275 dodoc Changelog README INSTALL
276 dodoc doc/*.txt
277 use doc && dodoc doc/*.html
278
279 if use qt-faststart; then
280 dobin tools/qt-faststart
281 fi
282
283 for i in $(usex sdl avplay "") $(usex network avserver "") avprobe; do
284 dosym ${i} /usr/bin/${i/av/ff}
285 done
286 }
287
288 pkg_postinst() {
289 elog "Please note that the programs formerly known as ffplay, ffserver"
290 elog "and ffprobe are now called avplay, avserver and avprobe."
291 elog
292 elog "ffmpeg had been replaced by the feature incompatible avconv thus"
293 elog "the legacy ffmpeg is provided for compatibility with older scripts"
294 }
295
296 src_test() {
297 local i tests
298 if use encode; then
299 tests="codectest lavftest seektest"
300 for i in ${tests}; do
301 LD_LIBRARY_PATH="${S}/libavcore:${S}/libpostproc:${S}/libswscale:${S}/libavcodec:${S}/libavdevice:${S}/libavfilter:${S}/libavformat:${S}/libavutil" \
302 emake ${i}
303 done
304 else
305 ewarn "Tests fail without USE=encode, skipping"
306 fi
307 }

  ViewVC Help
Powered by ViewVC 1.1.20