class Leptonica < Formula desc "Image processing and image analysis library" homepage "http://www.leptonica.org/" url "https://github.com/DanBloomberg/leptonica/releases/download/1.85.0/leptonica-1.85.0.tar.gz" sha256 "3745ae3bf271a6801a2292eead83ac926e3a9bc1bf622e9cd4dd0f3786e17205" license "BSD-2-Clause" depends_on "pkg-config" => :build depends_on "giflib" depends_on "jpeg-turbo" depends_on "libpng" depends_on "libtiff" depends_on "openjpeg" depends_on "webp" uses_from_macos "zlib" def install system "./configure", "--with-libwebp", "--with-libopenjpeg", *std_configure_args system "make", "install" end test do (testpath/"test.cpp").write <<~EOS #include #include int main(int argc, char **argv) { 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