homebrew-core/Formula/blockhash.rb

42 lines
1.6 KiB
Ruby

class Blockhash < Formula
desc "Perceptual image hash calculation tool"
homepage "https://github.com/commonsmachinery/blockhash"
url "https://github.com/commonsmachinery/blockhash/archive/v0.3.1.tar.gz"
sha256 "56e8d2fecf2c7658c9f8b32bfb2d29fdd0d0535ddb3082e44b45a5da705aca86"
license "MIT"
revision 1
head "https://github.com/commonsmachinery/blockhash.git"
bottle do
cellar :any
sha256 "e5b78f0c14faf009da78d00c1b31700837bd14c42be49d5609cf2f584678006a" => :catalina
sha256 "d9580b0bade98b0d083d3838b1b7078894b6d3d56e758628a050345a1ddf526b" => :mojave
sha256 "fdba183a92f5cfea8db07f626ccf13993bc59dec11ee2e402b063133da33f2eb" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "imagemagick"
depends_on :macos # Due to Python 2
resource "testdata" do
url "https://raw.githubusercontent.com/commonsmachinery/blockhash/ce08b465b658c4e886d49ec33361cee767f86db6/testdata/clipper_ship.jpg"
sha256 "a9f6858876adadc83c8551b664632a9cf669c2aea4fec0c09d81171cc3b8a97f"
end
def install
system "./waf", "configure", "--prefix=#{prefix}"
# pkg-config adds -fopenmp flag during configuring
# This fails the build on system clang, and OpenMP is not used in blockhash
inreplace "build/c4che/_cache.py", "-fopenmp", ""
system "./waf"
system "./waf", "install"
end
test do
resource("testdata").stage testpath
hash = "00007ff07ff07fe07fe67ff07560600077fe701e7f5e000079fd40410001ffff"
result = shell_output("#{bin}/blockhash #{testpath}/clipper_ship.jpg")
assert_match hash, result
end
end