Permalink
Browse files

New Formula: avidemux3

This formula builds avidemux3, a video editing program that is
being developed on the 2.6_branch_mean from their svn.  It will
build both the CLI and the Qt4 app versions of this program.

Problems: none

EDIT: Builds on Lion now with the recent OpenGL patches upstream.
EDIT: Needs checking on SL.
EDIT: Build multicore except for ffmpeg.  Patch to find plugins.
EDIT: Plugin patch merged upstream.
EDIT: added pluginSettings patch inline.  Fixed debug cflags.
EDIT: plugiSettings patch merged upstream and removed.
EDIT: clang inline C99 patch added.  Optimize at -03 for speed.
EDIT: Switched main url to gitorious, as berlios svn is offline.
EDIT: Put svn berlios link into a devel block for testing.
EDIT: fixed up the debug flags for optimization & make -j1.
EDIT: minor adjustments to the formula, use buildpath
EDIT: remove patch for bitbuffer merged upstream, thx!
EDIT: remove force llvm.  It works with clang now too. thx!
EDIT: change to std_cmake_args.
EDIT: add deps on aften and fribidi
EDIT: adjust optimization to use HB standard -Os.
EDIT: fix for std_cmake_args not needing .split anymore.
EDIT: fix for new ffmpeg-0.11 needs `make -j1 install` too.
EDIT: add new dependency on two-lame due to internal code removal.
EDIT: remove the -Werror using inreplace.
EDIT: add a new dep on sqlite.
EDIT: add dep on :x11 for freetype when using XQuartz.
EDIT: Add 2.6.0 stable and 2.6svn as HEAD.
EDIT: Add the qt dep... bite the bullet.
EDIT: Really add the qt dep this time.
EDIT: Switch to new DSL option style and replace ARGVs.
  • Loading branch information...
1 parent 7ca31d5 commit b25f93fc498f1e838a98b075dad715dd84c85c57 Nibbles 2bits committed with nibbles 2bits Dec 8, 2011
Showing with 113 additions and 0 deletions.
  1. +113 −0 Library/Formula/avidemux3.rb
@@ -0,0 +1,113 @@
+require 'formula'
+
+class Avidemux3 < Formula
+ homepage 'http://developer.berlios.de/projects/avidemux/'
+ url 'http://downloads.sourceforge.net/avidemux/avidemux_2.6.0.tar.gz'
+ sha1 'd886d61eab70f7b1972c0ebdeeeb7d2ba8c30cbf'
+
+ head 'git://gitorious.org/avidemux2-6/avidemux2-6.git'
+
+ depends_on 'pkg-config' => :build
+ depends_on 'cmake' => :build
+ depends_on 'yasm' => :build
+ depends_on 'qt' => :build
+ depends_on 'aften' => :recommended
+ depends_on 'faac' => :recommended
+ depends_on 'faad2' => :recommended
+ depends_on 'fribidi' => :recommended
+ depends_on 'gettext' => :recommended
+ depends_on 'libdca' => :recommended
+ depends_on 'libvorbis' => :recommended
+ depends_on 'libvpx' => :optional
+ depends_on 'lame' => :recommended
+ depends_on 'opencore-amr' => :optional
+ depends_on 'sqlite' => :recommended
+ depends_on 'two-lame' => :recommended
+ depends_on 'xvid' => :recommended
+ depends_on 'x264' => :recommended
+
+ option 'with-debug', 'Enable debug build and disable optimization'
+
+ def process(blddir, srcdir, dflag)
+ gettext = Formula.factory('gettext')
+ mkdir blddir do
+ args = std_cmake_args + %W[
+ -DCMAKE_PREFIX_PATH=#{gettext.prefix}
+ -DAVIDEMUX_SOURCE_DIR=#{buildpath}
+ ]
+ if build.include? 'with-debug' then
+ args << '-DCMAKE_BUILD_TYPE=Debug'
+ args << '-DCMAKE_VERBOSE_MAKEFILE=true'
+ args << '-DCMAKE_C_FLAGS_DEBUG=-ggdb3' unless ENV.compiler == :clang
+ args << '-DCMAKE_CXX_FLAGS_DEBUG=-ggdb3' unless ENV.compiler == :clang
+ end
+ args << dflag if dflag != ''
+ args << srcdir
+ system "cmake", *args
+ if blddir == 'buildCor' then
+ system 'make -j1' # their internal ffmpeg needs this
+ system 'make -j1 install'
+ else
+ system 'make'
+ system 'make install'
+ end
+ end
+ end
+
+
+
+ def install
+ ENV.remove_from_cflags '-w ' # allow warnings for now.
+ if build.include? 'with-debug'
+ ENV.deparallelize # helps reading stdout.
+ (ENV.compiler == :clang) ? ENV.Og : ENV.O2 # optimize debug properly
+ end
+ # Avidemux is coded to use the .svn or .git directory to find its revision,
+ # but neither vcs copies those during clone from the cache to the stagedir.
+ # Modify cmake/admMainChecks.cmake to look in the Homebrew cache.
+ if build.head?
+ inreplace 'cmake/admMainChecks.cmake',
+ 'admGetRevision( ${AVIDEMUX_TOP_SOURCE_DIR} ADM_SUBVERSION)',
+ "admGetRevision(\"#{cached_download}\" ADM_SUBVERSION)"
+ end
+
+ # (build directory, source location, cmake variable)
+ process( 'buildCor', '../avidemux_core', '-DSDL=OFF' )
+ process( 'buildGui', '../avidemux/qt4', '-DSDL=OFF' )
+ process( 'buildCli', '../avidemux/cli', '-DSDL=OFF' )
+ process( 'buildPlugCor', '../avidemux_plugins', '-DPLUGIN_UI=COMMON' )
+ process( 'buildPlugGui', '../avidemux_plugins', '-DPLUGIN_UI=QT4' )
+ process( 'buildPlugCli', '../avidemux_plugins', '-DPLUGIN_UI=CLI' )
+
+
+ # g++ links the core applications against unversioned dylibs
+ # from an internal ffmpeg, even though CMake specifies versioned
+ # dylibs. CMake then installs the versioned ffmpeg dylibs only.
+ # This patch creates the missing symlinks for unversioned libs.
+ # * The lib version numbers are either one or two digits.
+ # * The version numbers change every couple of months.
+ # * So this finds the file first, then makes a symlink.
+ # * The result of this code is a command like this:
+ # ln_sf lib+'libADM6avcodec.53.dylib', lib+'libADM6avcodec.dylib'
+
+ ffpref = 'libADM6'
+ ffsuff = '.dylib'
+ %w[ avcodec avformat avutil postproc swscale ].each do |fflib|
+ ffpat = ffpref+fflib+'.{?,??}'+ffsuff
+ ffpat = lib+ffpat
+ nonver = ffpref+fflib+ffsuff
+ nonver = lib+nonver
+ hasver = Dir[ffpat]
+ ln_sf hasver.to_s, nonver.to_s
+ end
+ end
+
+ def caveats
+ <<-EOS.undent
+ The command line interface is called avidemux_cli.
+ The Qt gui is called avidemux, but no formal app is created in /Applications.
+ You would start it here in a terminal if you decide to run that.
+ All the programs are in your path by default.
+ EOS
+ end
+end

0 comments on commit b25f93f

Please sign in to comment.