class Leptonica < Formula desc "Image processing and image analysis library" homepage "http://www.leptonica.org/" url "http://www.leptonica.org/source/leptonica-1.78.0.tar.gz" sha256 "e2ed2e81e7a22ddf45d2c05f0bc8b9ae7450545d995bfe28517ba408d14a5a88" bottle do cellar :any sha256 "534b5e4c96c34aed7f2e3dd9ffc046fd49a9a015a1ed0c2f1859d2cc182ed66e" => :mojave sha256 "ca7ccc979d58c3586d74169c5dbd537976f2ec9a41bd16effaec418fb03ecfc0" => :high_sierra sha256 "9f14866468766e9b7344b18c6d530f6cbb88919e2b3d25dad248f2e049f7bd3a" => :sierra end depends_on "pkg-config" => :build depends_on "giflib" depends_on "jpeg" depends_on "libpng" depends_on "libtiff" depends_on "openjpeg" depends_on "webp" def install args = %W[ --disable-dependency-tracking --prefix=#{prefix} --with-libwebp --with-libopenjpeg ] system "./configure", *args system "make", "install" end test do (testpath/"test.cpp").write <<~EOS #include #include 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