60 lines
1.9 KiB
Ruby
60 lines
1.9 KiB
Ruby
class Leptonica < Formula
|
|
desc "Image processing and image analysis library"
|
|
homepage "http://www.leptonica.org/"
|
|
url "https://github.com/DanBloomberg/leptonica/releases/download/1.74.4/leptonica-1.74.4.tar.gz"
|
|
mirror "http://www.leptonica.org/source/leptonica-1.74.4.tar.gz"
|
|
sha256 "29c35426a416bf454413c6fec24c24a0b633e26144a17e98351b6dffaa4a833b"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "824ca9ea9a3c6a0908f576288cf392244e0cab32835a3b01c8d125c8195ae476" => :sierra
|
|
sha256 "e567de6c8cb4caabe45b61e314fa482e8792bc1c3719755760ee55a694096716" => :el_capitan
|
|
sha256 "b1b8d75b21f7512dabd7cf665dbda4977bf1b34cc61bdc0daa23748a9c072208" => :yosemite
|
|
end
|
|
|
|
depends_on "libpng" => :recommended
|
|
depends_on "jpeg" => :recommended
|
|
depends_on "libtiff" => :recommended
|
|
depends_on "giflib" => :optional
|
|
depends_on "openjpeg" => :optional
|
|
depends_on "webp" => :optional
|
|
depends_on "pkg-config" => :build
|
|
|
|
conflicts_with "osxutils",
|
|
:because => "both leptonica and osxutils ship a `fileinfo` executable."
|
|
|
|
def install
|
|
args = %W[
|
|
--disable-dependency-tracking
|
|
--prefix=#{prefix}
|
|
]
|
|
|
|
%w[libpng jpeg libtiff giflib].each do |dep|
|
|
args << "--without-#{dep}" if build.without?(dep)
|
|
end
|
|
%w[openjpeg webp].each do |dep|
|
|
args << "--with-lib#{dep}" if build.with?(dep)
|
|
args << "--without-lib#{dep}" if build.without?(dep)
|
|
end
|
|
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cpp").write <<-EOS
|
|
#include <iostream>
|
|
#include <leptonica/allheaders.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
std::fprintf(stdout, "%d.%d.%d", LIBLEPT_MAJOR_VERSION, LIBLEPT_MINOR_VERSION, LIBLEPT_PATCH_VERSION);
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
flags = ["-I#{include}/leptonica"] + ENV.cflags.to_s.split
|
|
system ENV.cxx, "test.cpp", *flags
|
|
assert_equal version.to_s, `./a.out`
|
|
end
|
|
end
|