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
|
|
|
|
|
2012-06-14 17:01:27 +00:00
|
|
|
def openjpeg?
|
|
|
|
ARGV.include? '--with-openjpeg'
|
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Ffmpeg < Formula
|
2011-04-10 13:55:37 +00:00
|
|
|
homepage 'http://ffmpeg.org/'
|
2012-06-10 07:31:11 +00:00
|
|
|
url 'http://ffmpeg.org/releases/ffmpeg-0.11.1.tar.bz2'
|
|
|
|
sha1 'bf01742be60c2e6280371fc4189d5d28933f1a56'
|
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
|
2012-06-07 01:35:12 +00:00
|
|
|
depends_on :x11
|
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-05-14 01:14:05 +00:00
|
|
|
depends_on 'libvo-aacenc' => :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?
|
2012-06-14 17:01:27 +00:00
|
|
|
depends_on 'openjpeg' if openjpeg?
|
2011-08-30 14:13:10 +00:00
|
|
|
|
2012-03-18 20:33:24 +00:00
|
|
|
def options
|
|
|
|
[
|
|
|
|
["--with-tools", "Install additional FFmpeg tools."],
|
2012-06-14 17:01:27 +00:00
|
|
|
["--with-ffplay", "Build ffplay."],
|
|
|
|
["--with-openjpeg", "Use openjpeg for jpeg2000 support"]
|
2012-03-18 20:33:24 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2009-09-10 00:06:52 +00:00
|
|
|
def install
|
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
|
|
|
|
2012-05-02 23:42:59 +00:00
|
|
|
args << "--enable-libx264" if Formula.factory('x264').linked_keg.exist?
|
2012-05-03 18:33:43 +00:00
|
|
|
args << "--enable-libfaac" if Formula.factory('faac').linked_keg.exist?
|
|
|
|
args << "--enable-libmp3lame" if Formula.factory('lame').linked_keg.exist?
|
|
|
|
args << "--enable-librtmp" if Formula.factory('rtmpdump').linked_keg.exist?
|
|
|
|
args << "--enable-libtheora" if Formula.factory('theora').linked_keg.exist?
|
|
|
|
args << "--enable-libvorbis" if Formula.factory('libvorbis').linked_keg.exist?
|
|
|
|
args << "--enable-libvpx" if Formula.factory('libvpx').linked_keg.exist?
|
|
|
|
args << "--enable-libxvid" if Formula.factory('xvid').linked_keg.exist?
|
|
|
|
args << "--enable-libopencore-amrnb" if Formula.factory('opencore-amr').linked_keg.exist?
|
|
|
|
args << "--enable-libopencore-amrwb" if Formula.factory('opencore-amr').linked_keg.exist?
|
|
|
|
args << "--enable-libass" if Formula.factory('libass').linked_keg.exist?
|
2012-05-14 01:14:05 +00:00
|
|
|
args << "--enable-libvo-aacenc" if Formula.factory('libvo-aacenc').linked_keg.exist?
|
2011-11-09 20:02:42 +00:00
|
|
|
args << "--disable-ffplay" unless ffplay?
|
2012-06-14 17:01:27 +00:00
|
|
|
args << "--enable-libopenjpeg" if openjpeg?
|
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
|