2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-10 00:06:52 +00:00
|
|
|
|
2011-11-09 20:02:42 +00:00
|
|
|
def ffplay?
|
|
|
|
ARGV.include? '--with-ffplay'
|
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Ffmpeg < Formula
|
2012-03-26 22:28:13 +00:00
|
|
|
url 'http://ffmpeg.org/releases/ffmpeg-0.10.2.tar.bz2'
|
2011-04-10 13:55:37 +00:00
|
|
|
homepage 'http://ffmpeg.org/'
|
2012-03-26 22:28:13 +00:00
|
|
|
sha1 '743f44a71f93b14c9b26ca2424b0da8457cef4be'
|
2010-07-13 14:54:47 +00:00
|
|
|
|
2011-04-10 13:55:37 +00:00
|
|
|
head 'git://git.videolan.org/ffmpeg.git'
|
2009-10-06 03:49:48 +00:00
|
|
|
|
2011-06-30 01:15:51 +00:00
|
|
|
depends_on 'yasm' => :build
|
2010-01-14 20:56:04 +00:00
|
|
|
depends_on 'x264' => :optional
|
|
|
|
depends_on 'faac' => :optional
|
|
|
|
depends_on 'lame' => :optional
|
2012-01-03 20:28:05 +00:00
|
|
|
depends_on 'rtmpdump' => :optional
|
2010-08-04 12:24:24 +00:00
|
|
|
depends_on 'theora' => :optional
|
2010-08-04 12:32:29 +00:00
|
|
|
depends_on 'libvorbis' => :optional
|
2010-08-04 12:24:24 +00:00
|
|
|
depends_on 'libogg' => :optional
|
2010-08-26 17:55:55 +00:00
|
|
|
depends_on 'libvpx' => :optional
|
2010-10-30 23:46:44 +00:00
|
|
|
depends_on 'xvid' => :optional
|
2011-12-05 22:11:07 +00:00
|
|
|
depends_on 'opencore-amr' => :optional
|
2012-02-27 15:56:33 +00:00
|
|
|
depends_on 'libass' => :optional
|
2009-09-10 00:06:52 +00:00
|
|
|
|
2011-11-09 20:02:42 +00:00
|
|
|
depends_on 'sdl' if ffplay?
|
2011-08-30 14:13:10 +00:00
|
|
|
|
2012-03-18 20:33:24 +00:00
|
|
|
fails_with :llvm do
|
|
|
|
cause 'Undefined symbols when linking libavfilter'
|
|
|
|
end
|
|
|
|
|
|
|
|
def options
|
|
|
|
[
|
|
|
|
["--with-tools", "Install additional FFmpeg tools."],
|
|
|
|
["--with-ffplay", "Build ffplay."]
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2009-09-10 00:06:52 +00:00
|
|
|
def install
|
2012-01-06 02:46:50 +00:00
|
|
|
ENV.x11
|
2011-06-30 01:15:51 +00:00
|
|
|
args = ["--prefix=#{prefix}",
|
2011-08-18 02:35:50 +00:00
|
|
|
"--enable-shared",
|
2010-08-14 17:05:39 +00:00
|
|
|
"--enable-gpl",
|
2011-06-30 01:15:51 +00:00
|
|
|
"--enable-version3",
|
|
|
|
"--enable-nonfree",
|
2011-09-24 01:05:58 +00:00
|
|
|
"--enable-hardcoded-tables",
|
2012-01-06 02:46:50 +00:00
|
|
|
"--enable-libfreetype",
|
2011-09-24 01:05:58 +00:00
|
|
|
"--cc=#{ENV.cc}"]
|
2010-08-14 17:05:39 +00:00
|
|
|
|
|
|
|
args << "--enable-libx264" if Formula.factory('x264').installed?
|
|
|
|
args << "--enable-libfaac" if Formula.factory('faac').installed?
|
|
|
|
args << "--enable-libmp3lame" if Formula.factory('lame').installed?
|
2012-01-03 20:28:05 +00:00
|
|
|
args << "--enable-librtmp" if Formula.factory('rtmpdump').installed?
|
2010-08-14 17:05:39 +00:00
|
|
|
args << "--enable-libtheora" if Formula.factory('theora').installed?
|
|
|
|
args << "--enable-libvorbis" if Formula.factory('libvorbis').installed?
|
2010-08-26 17:55:55 +00:00
|
|
|
args << "--enable-libvpx" if Formula.factory('libvpx').installed?
|
2010-10-30 23:46:44 +00:00
|
|
|
args << "--enable-libxvid" if Formula.factory('xvid').installed?
|
2012-01-26 04:25:58 +00:00
|
|
|
args << "--enable-libopencore-amrnb" if Formula.factory('opencore-amr').installed?
|
2011-12-05 22:11:07 +00:00
|
|
|
args << "--enable-libopencore-amrwb" if Formula.factory('opencore-amr').installed?
|
2012-02-27 15:56:33 +00:00
|
|
|
args << "--enable-libass" if Formula.factory('libass').installed?
|
2011-11-09 20:02:42 +00:00
|
|
|
args << "--disable-ffplay" unless ffplay?
|
2010-01-14 20:56:04 +00:00
|
|
|
|
2010-04-21 05:08:33 +00:00
|
|
|
# For 32-bit compilation under gcc 4.2, see:
|
|
|
|
# http://trac.macports.org/ticket/20938#comment:22
|
2012-01-04 20:09:18 +00:00
|
|
|
if MacOS.leopard? or Hardware.is_32_bit?
|
2010-04-21 05:08:33 +00:00
|
|
|
ENV.append_to_cflags "-mdynamic-no-pic"
|
|
|
|
end
|
|
|
|
|
2010-08-14 17:05:39 +00:00
|
|
|
system "./configure", *args
|
2010-01-14 20:56:04 +00:00
|
|
|
|
2011-03-18 17:30:47 +00:00
|
|
|
if MacOS.prefer_64_bit?
|
2010-08-08 04:04:37 +00:00
|
|
|
inreplace 'config.mak' do |s|
|
2010-01-14 20:56:04 +00:00
|
|
|
shflags = s.get_make_var 'SHFLAGS'
|
2011-04-10 13:55:37 +00:00
|
|
|
if shflags.gsub!(' -Wl,-read_only_relocs,suppress', '')
|
|
|
|
s.change_make_var! 'SHFLAGS', shflags
|
|
|
|
end
|
2010-01-14 20:56:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-09-10 00:06:52 +00:00
|
|
|
system "make install"
|
2011-08-30 14:13:10 +00:00
|
|
|
|
|
|
|
if ARGV.include? "--with-tools"
|
|
|
|
system "make alltools"
|
|
|
|
bin.install Dir['tools/*'].select {|f| File.executable? f}
|
|
|
|
end
|
2009-09-10 00:06:52 +00:00
|
|
|
end
|
2011-03-16 02:07:39 +00:00
|
|
|
|
2009-09-10 00:06:52 +00:00
|
|
|
end
|