class Libtiff < Formula desc "TIFF library and utilities" homepage "https://libtiff.gitlab.io/libtiff/" url "https://download.osgeo.org/libtiff/tiff-4.7.0.tar.gz" mirror "https://fossies.org/linux/misc/tiff-4.7.0.tar.gz" sha256 "67160e3457365ab96c5b3286a0903aa6e78bdc44c4bc737d2e486bcecb6ba976" license "libtiff" livecheck do url "https://download.osgeo.org/libtiff/" regex(/href=.*?tiff[._-]v?(\d+(?:\.\d+)+)\.t/i) end depends_on "jpeg-turbo" depends_on "xz" depends_on "zstd" uses_from_macos "zlib" def install args = %W[ --prefix=#{prefix} --disable-dependency-tracking --disable-webp --enable-zstd --enable-lzma --with-jpeg-include-dir=#{Formula["jpeg-turbo"].opt_include} --with-jpeg-lib-dir=#{Formula["jpeg-turbo"].opt_lib} --without-x ] system "./configure", *args system "make", "install" # Avoid rebuilding dependents that hard-code the prefix. inreplace lib/"pkgconfig/libtiff-4.pc", prefix, opt_prefix end test do (testpath/"test.c").write <<~C #include int main(int argc, char* argv[]) { TIFF *out = TIFFOpen(argv[1], "w"); TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) 10); TIFFClose(out); return 0; } C system ENV.cc, "test.c", "-L#{lib}", "-ltiff", "-o", "test" system "./test", "test.tif" assert_match(/ImageWidth.*10/, shell_output("#{bin}/tiffdump test.tif")) end end