aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/phash.rb
blob: 9987945994f7a7fa4175ec9b9779ce891830c389 (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
40
41
42
43
44
45
46
47
48
49
require 'formula'

class Phash < Formula
  homepage 'http://www.phash.org/'
  url 'http://phash.org/releases/pHash-0.9.6.tar.gz'
  sha1 '26f4c1e7ca6b77e6de2bdfce490b2736d4b63753'
  bottle do
    cellar :any
    sha1 "d5cd584f04669d06d1876704546bc56bc71aa754" => :mavericks
    sha1 "7a5320740e97de701e924c6c2dbeecb179438f1c" => :mountain_lion
    sha1 "9c8ecf5f7b7774cec34059f8a2e02d3d6644368e" => :lion
  end

  revision 1

  option "disable-image-hash", "Disable image hash"
  option "disable-video-hash", "Disable video hash"
  option "disable-audio-hash", "Disable audio hash"

  depends_on 'cimg' unless build.include? "disable-image-hash" and build.include? "disable-video-hash"
  depends_on 'ffmpeg' unless build.include? "disable-video-hash"

  unless build.include? "disable-audio-hash"
    depends_on 'libsndfile'
    depends_on 'libsamplerate'
    depends_on 'mpg123'
  end

  fails_with :clang do
    build 318
    cause "configure: WARNING: CImg.h: present but cannot be compiled"
  end

  def install
    args = %W[--disable-debug
              --disable-dependency-tracking
              --prefix=#{prefix}
              --enable-shared
            ]

    # disable specific hashes if specified as an option
    args << "--disable-image-hash" if build.include? "disable-image-hash"
    args << "--disable-video-hash" if build.include? "disable-video-hash"
    args << "--disable-audio-hash" if build.include? "disable-audio-hash"

    system "./configure", *args
    system "make install"
  end
end