| 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/ffmpeg/ffmpeg-0.11.1.ebuild,v 1.4 2012/09/25 03:50:07 vapier Exp $
|
| 4 |
|
| 5 |
EAPI="4"
|
| 6 |
|
| 7 |
SCM=""
|
| 8 |
if [ "${PV#9999}" != "${PV}" ] ; then
|
| 9 |
SCM="git-2"
|
| 10 |
EGIT_REPO_URI="git://git.videolan.org/ffmpeg.git"
|
| 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. Includes libavcodec."
|
| 16 |
HOMEPAGE="http://ffmpeg.org/"
|
| 17 |
if [ "${PV#9999}" != "${PV}" ] ; then
|
| 18 |
SRC_URI=""
|
| 19 |
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
|
| 20 |
SRC_URI="mirror://gentoo/${P}.tar.bz2"
|
| 21 |
else # Release
|
| 22 |
SRC_URI="http://ffmpeg.org/releases/${P/_/-}.tar.bz2"
|
| 23 |
fi
|
| 24 |
FFMPEG_REVISION="${PV#*_p}"
|
| 25 |
|
| 26 |
LICENSE="GPL-2 amr? ( GPL-3 ) encode? ( aac? ( GPL-3 ) )"
|
| 27 |
SLOT="0"
|
| 28 |
if [ "${PV#9999}" = "${PV}" ] ; then
|
| 29 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
|
| 30 |
fi
|
| 31 |
IUSE="
|
| 32 |
aac aacplus alsa amr avresample bindist bluray +bzip2 cdio celt
|
| 33 |
cpudetection debug doc +encode faac fontconfig frei0r gnutls gsm
|
| 34 |
+hardcoded-tables ieee1394 jack jpeg2k libass libv4l modplug mp3 network
|
| 35 |
openal openssl oss pic pulseaudio rtmp schroedinger sdl speex static-libs
|
| 36 |
test theora threads truetype v4l vaapi vdpau vorbis vpx X x264 xvid +zlib
|
| 37 |
"
|
| 38 |
|
| 39 |
# String for CPU features in the useflag[:configure_option] form
|
| 40 |
# if :configure_option isn't set, it will use 'useflag' as configure option
|
| 41 |
CPU_FEATURES="3dnow:amd3dnow 3dnowext:amd3dnowext altivec avx mmx mmxext:mmx2 ssse3 vis neon"
|
| 42 |
|
| 43 |
for i in ${CPU_FEATURES}; do
|
| 44 |
IUSE="${IUSE} ${i%:*}"
|
| 45 |
done
|
| 46 |
|
| 47 |
FFTOOLS="aviocat cws2fws ffeval graph2dot ismindex pktdumper qt-faststart trasher"
|
| 48 |
|
| 49 |
for i in ${FFTOOLS}; do
|
| 50 |
IUSE="${IUSE} +fftools_$i"
|
| 51 |
done
|
| 52 |
|
| 53 |
RDEPEND="
|
| 54 |
alsa? ( media-libs/alsa-lib )
|
| 55 |
amr? ( media-libs/opencore-amr )
|
| 56 |
bluray? ( media-libs/libbluray )
|
| 57 |
bzip2? ( app-arch/bzip2 )
|
| 58 |
cdio? ( dev-libs/libcdio )
|
| 59 |
celt? ( >=media-libs/celt-0.11.1 )
|
| 60 |
encode? (
|
| 61 |
aac? ( media-libs/vo-aacenc )
|
| 62 |
aacplus? ( media-libs/libaacplus )
|
| 63 |
amr? ( media-libs/vo-amrwbenc )
|
| 64 |
faac? ( media-libs/faac )
|
| 65 |
mp3? ( >=media-sound/lame-3.98.3 )
|
| 66 |
theora? ( >=media-libs/libtheora-1.1.1[encode] media-libs/libogg )
|
| 67 |
x264? ( >=media-libs/x264-0.0.20111017 )
|
| 68 |
xvid? ( >=media-libs/xvid-1.1.0 )
|
| 69 |
)
|
| 70 |
fontconfig? ( media-libs/fontconfig )
|
| 71 |
frei0r? ( media-plugins/frei0r-plugins )
|
| 72 |
gnutls? ( >=net-libs/gnutls-2.12.16 )
|
| 73 |
gsm? ( >=media-sound/gsm-1.0.12-r1 )
|
| 74 |
ieee1394? ( media-libs/libdc1394 sys-libs/libraw1394 )
|
| 75 |
jack? ( media-sound/jack-audio-connection-kit )
|
| 76 |
jpeg2k? ( >=media-libs/openjpeg-1.3-r2 )
|
| 77 |
libass? ( media-libs/libass )
|
| 78 |
libv4l? ( media-libs/libv4l )
|
| 79 |
modplug? ( media-libs/libmodplug )
|
| 80 |
openal? ( >=media-libs/openal-1.1 )
|
| 81 |
pulseaudio? ( media-sound/pulseaudio )
|
| 82 |
rtmp? ( >=media-video/rtmpdump-2.2f )
|
| 83 |
sdl? ( >=media-libs/libsdl-1.2.13-r1[audio,video] )
|
| 84 |
schroedinger? ( media-libs/schroedinger )
|
| 85 |
speex? ( >=media-libs/speex-1.2_beta3 )
|
| 86 |
truetype? ( media-libs/freetype:2 )
|
| 87 |
vaapi? ( >=x11-libs/libva-0.32 )
|
| 88 |
vdpau? ( x11-libs/libvdpau )
|
| 89 |
vorbis? ( media-libs/libvorbis media-libs/libogg )
|
| 90 |
vpx? ( >=media-libs/libvpx-0.9.6 )
|
| 91 |
X? ( x11-libs/libX11 x11-libs/libXext x11-libs/libXfixes )
|
| 92 |
zlib? ( sys-libs/zlib )
|
| 93 |
!media-video/qt-faststart
|
| 94 |
!media-libs/libpostproc
|
| 95 |
"
|
| 96 |
|
| 97 |
DEPEND="${RDEPEND}
|
| 98 |
>=sys-devel/make-3.81
|
| 99 |
doc? ( app-text/texi2html )
|
| 100 |
fontconfig? ( virtual/pkgconfig )
|
| 101 |
gnutls? ( virtual/pkgconfig )
|
| 102 |
ieee1394? ( virtual/pkgconfig )
|
| 103 |
libv4l? ( virtual/pkgconfig )
|
| 104 |
mmx? ( dev-lang/yasm )
|
| 105 |
rtmp? ( virtual/pkgconfig )
|
| 106 |
schroedinger? ( virtual/pkgconfig )
|
| 107 |
test? ( net-misc/wget )
|
| 108 |
truetype? ( virtual/pkgconfig )
|
| 109 |
v4l? ( sys-kernel/linux-headers )
|
| 110 |
"
|
| 111 |
# faac is license-incompatible with ffmpeg
|
| 112 |
REQUIRED_USE="bindist? ( encode? ( !faac !aacplus ) !openssl )
|
| 113 |
libv4l? ( v4l )
|
| 114 |
fftools_cws2fws? ( zlib )
|
| 115 |
test? ( encode zlib )"
|
| 116 |
|
| 117 |
S=${WORKDIR}/${P/_/-}
|
| 118 |
|
| 119 |
src_prepare() {
|
| 120 |
if [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
|
| 121 |
export revision=git-N-${FFMPEG_REVISION}
|
| 122 |
fi
|
| 123 |
}
|
| 124 |
|
| 125 |
src_configure() {
|
| 126 |
local myconf="${EXTRA_FFMPEG_CONF}"
|
| 127 |
# Set to --enable-version3 if (L)GPL-3 is required
|
| 128 |
local version3=""
|
| 129 |
|
| 130 |
# enabled by default
|
| 131 |
for i in debug doc network vaapi vdpau zlib; do
|
| 132 |
use ${i} || myconf="${myconf} --disable-${i}"
|
| 133 |
done
|
| 134 |
use bzip2 || myconf="${myconf} --disable-bzlib"
|
| 135 |
use sdl || myconf="${myconf} --disable-ffplay"
|
| 136 |
|
| 137 |
use cpudetection && myconf="${myconf} --enable-runtime-cpudetect"
|
| 138 |
use openssl && myconf="${myconf} --enable-openssl --enable-nonfree"
|
| 139 |
for i in gnutls ; do
|
| 140 |
use $i && myconf="${myconf} --enable-$i"
|
| 141 |
done
|
| 142 |
|
| 143 |
# Encoders
|
| 144 |
if use encode
|
| 145 |
then
|
| 146 |
use mp3 && myconf="${myconf} --enable-libmp3lame"
|
| 147 |
use aac && { myconf="${myconf} --enable-libvo-aacenc" ; version3=" --enable-version3" ; }
|
| 148 |
use amr && { myconf="${myconf} --enable-libvo-amrwbenc" ; version3=" --enable-version3" ; }
|
| 149 |
for i in theora x264 xvid; do
|
| 150 |
use ${i} && myconf="${myconf} --enable-lib${i}"
|
| 151 |
done
|
| 152 |
use aacplus && myconf="${myconf} --enable-libaacplus --enable-nonfree"
|
| 153 |
use faac && myconf="${myconf} --enable-libfaac --enable-nonfree"
|
| 154 |
else
|
| 155 |
myconf="${myconf} --disable-encoders"
|
| 156 |
fi
|
| 157 |
|
| 158 |
# libavdevice options
|
| 159 |
use cdio && myconf="${myconf} --enable-libcdio"
|
| 160 |
use ieee1394 && myconf="${myconf} --enable-libdc1394"
|
| 161 |
use openal && myconf="${myconf} --enable-openal"
|
| 162 |
# Indevs
|
| 163 |
# v4l1 is gone since linux-headers-2.6.38
|
| 164 |
myconf="${myconf} --disable-indev=v4l"
|
| 165 |
use v4l || myconf="${myconf} --disable-indev=v4l2"
|
| 166 |
for i in alsa oss jack ; do
|
| 167 |
use ${i} || myconf="${myconf} --disable-indev=${i}"
|
| 168 |
done
|
| 169 |
use X && myconf="${myconf} --enable-x11grab"
|
| 170 |
use pulseaudio && myconf="${myconf} --enable-libpulse"
|
| 171 |
use libv4l && myconf="${myconf} --enable-libv4l2"
|
| 172 |
# Outdevs
|
| 173 |
for i in alsa oss sdl ; do
|
| 174 |
use ${i} || myconf="${myconf} --disable-outdev=${i}"
|
| 175 |
done
|
| 176 |
# libavfilter options
|
| 177 |
for i in frei0r fontconfig libass ; do
|
| 178 |
use ${i} && myconf="${myconf} --enable-${i}"
|
| 179 |
done
|
| 180 |
use truetype && myconf="${myconf} --enable-libfreetype"
|
| 181 |
|
| 182 |
# Threads; we only support pthread for now but ffmpeg supports more
|
| 183 |
use threads && myconf="${myconf} --enable-pthreads"
|
| 184 |
|
| 185 |
# Decoders
|
| 186 |
use amr && { myconf="${myconf} --enable-libopencore-amrwb --enable-libopencore-amrnb" ; version3=" --enable-version3" ; }
|
| 187 |
for i in bluray celt gsm modplug rtmp schroedinger speex vorbis vpx; do
|
| 188 |
use ${i} && myconf="${myconf} --enable-lib${i}"
|
| 189 |
done
|
| 190 |
use jpeg2k && myconf="${myconf} --enable-libopenjpeg"
|
| 191 |
|
| 192 |
# CPU features
|
| 193 |
for i in ${CPU_FEATURES}; do
|
| 194 |
use ${i%:*} || myconf="${myconf} --disable-${i#*:}"
|
| 195 |
done
|
| 196 |
if use pic ; then
|
| 197 |
myconf="${myconf} --enable-pic"
|
| 198 |
# disable asm code if PIC is required
|
| 199 |
# as the provided asm decidedly is not PIC for x86.
|
| 200 |
use x86 && myconf="${myconf} --disable-asm"
|
| 201 |
fi
|
| 202 |
[[ ${ABI} == "x32" ]] && myconf+=" --disable-asm" #427004
|
| 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 |
myconf="${myconf} --cpu=${i}"
|
| 212 |
break
|
| 213 |
done
|
| 214 |
|
| 215 |
# Mandatory configuration
|
| 216 |
myconf="
|
| 217 |
--enable-gpl
|
| 218 |
${version3}
|
| 219 |
--enable-postproc
|
| 220 |
--enable-avfilter
|
| 221 |
--disable-stripping
|
| 222 |
${myconf}"
|
| 223 |
|
| 224 |
# cross compile support
|
| 225 |
if tc-is-cross-compiler ; then
|
| 226 |
myconf="${myconf} --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}-"
|
| 227 |
case ${CHOST} in
|
| 228 |
*freebsd*)
|
| 229 |
myconf="${myconf} --target-os=freebsd"
|
| 230 |
;;
|
| 231 |
mingw32*)
|
| 232 |
myconf="${myconf} --target-os=mingw32"
|
| 233 |
;;
|
| 234 |
*linux*)
|
| 235 |
myconf="${myconf} --target-os=linux"
|
| 236 |
;;
|
| 237 |
esac
|
| 238 |
fi
|
| 239 |
|
| 240 |
# avresample support for libav compatibility
|
| 241 |
use avresample && myconf="${myconf} --enable-avresample"
|
| 242 |
|
| 243 |
# Misc stuff
|
| 244 |
use hardcoded-tables && myconf="${myconf} --enable-hardcoded-tables"
|
| 245 |
|
| 246 |
cd "${S}"
|
| 247 |
./configure \
|
| 248 |
--prefix="${EPREFIX}/usr" \
|
| 249 |
--libdir="${EPREFIX}/usr/$(get_libdir)" \
|
| 250 |
--shlibdir="${EPREFIX}/usr/$(get_libdir)" \
|
| 251 |
--mandir="${EPREFIX}/usr/share/man" \
|
| 252 |
--enable-shared \
|
| 253 |
--cc="$(tc-getCC)" \
|
| 254 |
--cxx="$(tc-getCXX)" \
|
| 255 |
--ar="$(tc-getAR)" \
|
| 256 |
--optflags="${CFLAGS}" \
|
| 257 |
--extra-cflags="${CFLAGS}" \
|
| 258 |
--extra-cxxflags="${CXXFLAGS}" \
|
| 259 |
$(use_enable static-libs static) \
|
| 260 |
${myconf} || die
|
| 261 |
}
|
| 262 |
|
| 263 |
src_compile() {
|
| 264 |
emake
|
| 265 |
|
| 266 |
for i in ${FFTOOLS} ; do
|
| 267 |
if use fftools_$i ; then
|
| 268 |
emake tools/$i
|
| 269 |
fi
|
| 270 |
done
|
| 271 |
}
|
| 272 |
|
| 273 |
src_install() {
|
| 274 |
emake DESTDIR="${D}" install install-man
|
| 275 |
|
| 276 |
dodoc Changelog README INSTALL
|
| 277 |
dodoc -r doc/*
|
| 278 |
|
| 279 |
for i in ${FFTOOLS} ; do
|
| 280 |
if use fftools_$i ; then
|
| 281 |
dobin tools/$i
|
| 282 |
fi
|
| 283 |
done
|
| 284 |
}
|
| 285 |
|
| 286 |
src_test() {
|
| 287 |
LD_LIBRARY_PATH="${S}/libpostproc:${S}/libswscale:${S}/libswresample:${S}/libavcodec:${S}/libavdevice:${S}/libavfilter:${S}/libavformat:${S}/libavutil" \
|
| 288 |
emake fate
|
| 289 |
}
|