2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-10 00:06:52 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Ffmpeg < Formula
|
2011-04-10 13:55:37 +00:00
|
|
|
url 'http://ffmpeg.org/releases/ffmpeg-0.6.2.tar.bz2'
|
|
|
|
homepage 'http://ffmpeg.org/'
|
|
|
|
sha1 'd4e464d4111971b9cef10be7a1efa3677a899338'
|
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
|
|
|
|
2010-01-14 20:56:04 +00:00
|
|
|
depends_on 'x264' => :optional
|
|
|
|
depends_on 'faac' => :optional
|
|
|
|
depends_on 'faad2' => :optional
|
|
|
|
depends_on 'lame' => :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
|
2009-09-10 00:06:52 +00:00
|
|
|
|
|
|
|
def install
|
2010-08-14 17:05:39 +00:00
|
|
|
args = ["--disable-debug",
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--enable-shared",
|
|
|
|
"--enable-pthreads",
|
|
|
|
"--enable-nonfree",
|
|
|
|
"--enable-gpl",
|
2010-08-08 04:04:37 +00:00
|
|
|
"--disable-indev=jack"]
|
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?
|
|
|
|
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?
|
2010-01-14 20:56:04 +00:00
|
|
|
|
2010-11-18 11:13:05 +00:00
|
|
|
unless ARGV.build_head?
|
|
|
|
args << "--enable-libfaad" if Formula.factory('faad2').installed?
|
|
|
|
end
|
|
|
|
|
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
|
2011-04-08 18:16:37 +00:00
|
|
|
if MacOS.snow_leopard? and 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
|
|
|
|
|
2011-03-16 02:07:39 +00:00
|
|
|
write_version_file if ARGV.build_head?
|
|
|
|
|
2009-09-10 00:06:52 +00:00
|
|
|
system "make install"
|
|
|
|
end
|
2011-03-16 02:07:39 +00:00
|
|
|
|
|
|
|
# Makefile expects to run in git repo and generate a version number
|
2011-04-10 13:55:37 +00:00
|
|
|
# with 'git describe' command (see version.sh) but Homebrew build
|
2011-03-16 02:07:39 +00:00
|
|
|
# runs in temp copy created via git checkout-index, so 'git describe'
|
|
|
|
# does not work. Work around by writing VERSION file in build directory
|
|
|
|
# to be picked up by version.sh. Note that VERSION file will already
|
|
|
|
# exist in release versions, so this only applies to git HEAD builds.
|
|
|
|
def write_version_file
|
|
|
|
return if File.exists?("VERSION")
|
|
|
|
git_tag = "UNKNOWN"
|
|
|
|
Dir.chdir(cached_download) do
|
2011-04-10 13:55:37 +00:00
|
|
|
ver = `./version.sh`.chomp
|
|
|
|
if not $?.success? or ver == "UNKNOWN"
|
|
|
|
# fall back to git
|
|
|
|
ver = `git describe --tags --match N --always`.chomp
|
|
|
|
if not $?.success?
|
|
|
|
opoo "Could not determine build version from git repository - set to #{git_tag}"
|
|
|
|
else
|
|
|
|
git_tag = "git-#{ver}"
|
|
|
|
end
|
2011-03-16 02:07:39 +00:00
|
|
|
else
|
2011-04-10 13:55:37 +00:00
|
|
|
git_tag = ver
|
2011-03-16 02:07:39 +00:00
|
|
|
end
|
|
|
|
end
|
2011-04-10 13:55:37 +00:00
|
|
|
File.open("VERSION","w") {|f| f.puts git_tag}
|
2011-03-16 02:07:39 +00:00
|
|
|
end
|
|
|
|
|
2009-09-10 00:06:52 +00:00
|
|
|
end
|