2010-05-18 19:21:25 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Leptonica < Formula
|
2011-03-28 00:10:04 +00:00
|
|
|
homepage 'http://www.leptonica.org/'
|
2014-07-02 21:18:51 +00:00
|
|
|
url 'http://www.leptonica.org/source/leptonica-1.71.tar.gz'
|
2014-07-08 21:36:59 +00:00
|
|
|
sha1 '1ee59b06fd6c6402876f46c26c21b17ffd3c9b6b'
|
2014-05-20 18:39:41 +00:00
|
|
|
|
2014-07-03 09:41:06 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2014-07-08 23:35:21 +00:00
|
|
|
revision 1
|
|
|
|
sha1 "ad82e1ecacdee2428e2c7426198969db363a09c5" => :mavericks
|
|
|
|
sha1 "971d13992a410a6d4907cb4c964151ae5cd5ffe2" => :mountain_lion
|
|
|
|
sha1 "9e58252edeb5ef713a24fe89a154cd25ec98b0a9" => :lion
|
2014-07-03 09:41:06 +00:00
|
|
|
end
|
|
|
|
|
2014-03-23 02:51:41 +00:00
|
|
|
depends_on 'libpng' => :recommended
|
2013-02-01 00:24:57 +00:00
|
|
|
depends_on 'jpeg' => :recommended
|
|
|
|
depends_on 'libtiff' => :optional
|
2014-05-20 18:39:41 +00:00
|
|
|
depends_on 'pkg-config' => :build
|
2011-10-21 02:46:31 +00:00
|
|
|
|
2013-09-03 00:16:46 +00:00
|
|
|
conflicts_with 'osxutils',
|
|
|
|
:because => "both leptonica and osxutils ship a `fileinfo` executable."
|
|
|
|
|
2010-05-18 19:21:25 +00:00
|
|
|
def install
|
2014-04-27 21:47:47 +00:00
|
|
|
args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--prefix=#{prefix}
|
|
|
|
]
|
|
|
|
|
|
|
|
%w[libpng jpeg libtiff].each do |dep|
|
|
|
|
args << "--without-#{dep}" if build.without?(dep)
|
|
|
|
end
|
|
|
|
|
|
|
|
system "./configure", *args
|
2010-05-18 19:21:25 +00:00
|
|
|
system "make install"
|
|
|
|
end
|
2012-03-11 20:36:14 +00:00
|
|
|
|
2014-02-23 21:31:41 +00:00
|
|
|
test do
|
2014-05-20 18:39:41 +00:00
|
|
|
(testpath/"test.cpp").write <<-EOS
|
|
|
|
#include <iostream>
|
|
|
|
#include <leptonica/allheaders.h>
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
std::fprintf(stdout, "%d.%d", LIBLEPT_MAJOR_VERSION, LIBLEPT_MINOR_VERSION);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
2014-07-08 23:59:21 +00:00
|
|
|
|
|
|
|
flags = ["-I#{include}/leptonica"] + ENV.cflags.to_s.split
|
|
|
|
system ENV.cxx, "test.cpp", *flags
|
2014-07-02 21:18:51 +00:00
|
|
|
assert_equal version.to_s, `./a.out`
|
2012-09-02 08:00:24 +00:00
|
|
|
end
|
|
|
|
end
|