/[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.4 - (hide annotations) (download)
Thu May 10 03:28:37 2012 UTC (5 years, 4 months ago) by jer
Branch: MAIN
Changes since 1.3: +3 -4 lines
Stable for HPPA (bug #408555).

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

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

  ViewVC Help
Powered by ViewVC 1.1.20