homebrew-core/Formula/vapoursynth-ocr.rb

47 lines
1.7 KiB
Ruby

class VapoursynthOcr < Formula
desc "VapourSynth filters - Tesseract OCR filter"
homepage "http://www.vapoursynth.com"
url "https://github.com/vapoursynth/vapoursynth/archive/R52.tar.gz"
sha256 "4d5dc7950f4357da695d29708bc98013bc3e0bd72fc5d697f8c91ce3c4a4b2ac"
license "ISC"
head "https://github.com/vapoursynth/vapoursynth.git"
bottle do
cellar :any
sha256 "823ad4d448f1ee19d8ba111a6e36a4ac3f1b0064cea6e3ab6e30c0a8f15c6a91" => :big_sur
sha256 "ace9bfac33026748bfe2a1465d9a58b597bd85f001153ce3952760889e9aff74" => :catalina
sha256 "268aed99192b8df1d673a6a64a0de4d8289c7a2316b19ed429b330ee3eb110b1" => :mojave
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "nasm" => :build
depends_on "pkg-config" => :build
depends_on "tesseract"
depends_on "vapoursynth"
def install
system "./autogen.sh"
inreplace "Makefile.in", "pkglibdir = $(libdir)", "pkglibdir = $(exec_prefix)"
system "./configure", "--prefix=#{prefix}",
"--disable-core",
"--disable-vsscript",
"--disable-plugins",
"--enable-ocr"
system "make", "install"
rm prefix/"vapoursynth/libocr.la"
end
def post_install
(HOMEBREW_PREFIX/"lib/vapoursynth").mkpath
(HOMEBREW_PREFIX/"lib/vapoursynth").install_symlink prefix/"vapoursynth/libocr.dylib" => "libocr.dylib"
end
test do
xy = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
ENV.prepend_path "PYTHONPATH", lib/"python#{xy}/site-packages"
system Formula["python@3.9"].opt_bin/"python3", "-c", "from vapoursynth import core; core.ocr"
end
end