63 lines
2.3 KiB
Ruby
63 lines
2.3 KiB
Ruby
class Tesseract < Formula
|
|
desc "OCR (Optical Character Recognition) engine"
|
|
homepage "https://github.com/tesseract-ocr/"
|
|
url "https://github.com/tesseract-ocr/tesseract/archive/4.0.0.tar.gz"
|
|
sha256 "a1f5422ca49a32e5f35c54dee5112b11b99928fc9f4ee6695cdc6768d69f61dd"
|
|
head "https://github.com/tesseract-ocr/tesseract.git"
|
|
|
|
bottle do
|
|
rebuild 2
|
|
sha256 "cce4d46a711959e3e62bcadd7470bb5a8ead7a2ccf195b455891e51d7d13f64e" => :mojave
|
|
sha256 "f00c278d85fc9a42b6a7b88c994c13ddd3533e7a71a6229215fc53d02ec1d3c3" => :high_sierra
|
|
sha256 "05abf694ff3f7dee8c50ec255329558e7b5be0cc2ffd1661cfe2a637f6ccfeb2" => :sierra
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "autoconf-archive" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "leptonica"
|
|
depends_on "libtiff"
|
|
|
|
resource "tessdata" do
|
|
url "https://github.com/tesseract-ocr/tessdata_fast/archive/4.0.0.tar.gz"
|
|
sha256 "f1b71e97f27bafffb6a730ee66fd9dc021afc38f318fdc80a464a84a519227fe"
|
|
end
|
|
|
|
resource "eng" do
|
|
url "https://github.com/tesseract-ocr/tessdata_fast/raw/4.0.0/eng.traineddata"
|
|
sha256 "7d4322bd2a7749724879683fc3912cb542f19906c83bcc1a52132556427170b2"
|
|
end
|
|
|
|
resource "osd" do
|
|
url "https://github.com/tesseract-ocr/tessdata_fast/raw/4.0.0/osd.traineddata"
|
|
sha256 "9cf5d576fcc47564f11265841e5ca839001e7e6f38ff7f7aacf46d15a96b00ff"
|
|
end
|
|
|
|
resource "snum" do
|
|
url "https://github.com/USCDataScience/counterfeit-electronics-tesseract/raw/319a6eeacff181dad5c02f3e7a3aff804eaadeca/Training%20Tesseract/snum.traineddata"
|
|
sha256 "36f772980ff17c66a767f584a0d80bf2302a1afa585c01a226c1863afcea1392"
|
|
end
|
|
|
|
def install
|
|
# explicitly state leptonica header location, as the makefile defaults to /usr/local/include,
|
|
# which doesn't work for non-default homebrew location
|
|
ENV["LIBLEPT_HEADERSDIR"] = HOMEBREW_PREFIX/"include"
|
|
|
|
ENV.cxx11
|
|
|
|
system "./autogen.sh"
|
|
system "./configure", "--prefix=#{prefix}", "--disable-dependency-tracking"
|
|
|
|
system "make", "install"
|
|
|
|
resource("snum").stage { mv "snum.traineddata", share/"tessdata" }
|
|
resource("tessdata").stage { mv Dir["*"], share/"tessdata" }
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/tesseract -v 2>&1")
|
|
end
|
|
end
|