Skip to content

Instantly share code, notes, and snippets.

@kscottz
Created February 2, 2012 16:10
Show Gist options
  • Select an option

  • Save kscottz/1724277 to your computer and use it in GitHub Desktop.

Select an option

Save kscottz/1724277 to your computer and use it in GitHub Desktop.
require 'formula'
class Opencv < Formula
url 'https://code.ros.org/svn/opencv/trunk/opencv', :using=>:svn
version "2.3.1"
homepage 'http://opencv.willowgarage.com/wiki/'
head 'https://code.ros.org/svn/opencv/trunk'
md5 "a121861848851c5a37e491f0b61cf3fb"
depends_on 'cmake' => :build
depends_on 'pkg-config' => :build
depends_on 'libtiff' => :optional
depends_on 'jasper' => :optional
depends_on 'tbb' => :optional
# Can also depend on ffmpeg, but this pulls in a lot of extra stuff that
# you don't need unless you're doing video analysis, and some of it isn't
# in Homebrew anyway.
def options
[['--build32', 'Force a 32-bit build.']]
end
/Library/Frameworks/EPD64.framework/Versions/7.1/
def install
makefiles = "cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=#{prefix} ."
makefiles += " -DOPENCV_EXTRA_C_FLAGS='-arch i386 -m32'" if ARGV.include? '--build32'
makefiles += " -DPYTHON_EXECUTABLE:string='/Library/Frameworks/EPD64.framework/Versions/7.1/bin/python2.7'"
makefiles += " -DPYTHON_INCLUDE_DIR:string='/Library/Frameworks/EPD64.framework/Versions/7.1/include/python2.7'"
makefiles += " -DPYTHON_LIBRARY:string='/Library/Frameworks/EPD64.framework/Versions/7.1/lib/libpython2.7.dylib'"
makefiles += " -DPYTHON_PACKAGES_PATH:string='/Library/Frameworks/EPD64.framework/Versions/7.1/lib/python2.7/site-packages'"
system makefiles
system "make"
system "make install"
end
def caveats; <<-EOS.undent
The OpenCV Python module will not work until you edit your PYTHONPATH like so:
export PYTHONPATH="#{HOMEBREW_PREFIX}/lib/python2.6/site-packages/:$PYTHONPATH"
To make this permanent, put it in your shell's profile (e.g. ~/.profile).
EOS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment