blob: 4c7927ecae81b881bab2bab14fb1b1fb57e1bda4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  | 
require 'formula'
class Opencv <Formula
  url 'http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.2/OpenCV-2.2.0.tar.bz2'
  version "2.2"
  homepage 'http://opencv.willowgarage.com/wiki/'
  md5 '122c9ac793a46854ef2819fedbbd6b1b'
  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
  def install
    makefiles = "cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=#{prefix} ."
    makefiles += " -DOPENCV_EXTRA_C_FLAGS='-arch i386 -m32'" if ARGV.include? '--build32'
    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
  |