class Vips < Formula desc "Image processing library" homepage "https://github.com/libvips/libvips" url "https://github.com/libvips/libvips/releases/download/v8.12.1/vips-8.12.1.tar.gz" sha256 "474d8439244cd26c504812fd623259f806c32553b38d2a54798c9766135f5a5c" license "LGPL-2.1-or-later" livecheck do url :stable strategy :github_latest end bottle do sha256 arm64_big_sur: "9c25395fd7c46809cd1fbc887fd53d7e1dadc74182ff48fc361c6f34b4706a68" sha256 monterey: "3671ae76c280fda2dc28bdaf967669e5512f37b3d870e4fe020b07ab7bd119dd" sha256 big_sur: "3ca7cf19414b876ca30e4451b015cff9f9055495dafdad804b38bfb3dfb93043" sha256 catalina: "aaebf8e5098d8a4c9b11fa868176a0c18dd7c139fda45f642bc0de91b9fcc4e1" end depends_on "pkg-config" => :build depends_on "cfitsio" depends_on "cgif" depends_on "fftw" depends_on "fontconfig" depends_on "gettext" depends_on "glib" depends_on "imagemagick" depends_on "jpeg-xl" depends_on "libexif" depends_on "libgsf" depends_on "libheif" depends_on "libimagequant" depends_on "libmatio" depends_on "libpng" depends_on "librsvg" depends_on "libspng" depends_on "libtiff" depends_on "little-cms2" depends_on "mozjpeg" depends_on "openexr" depends_on "openslide" depends_on "orc" depends_on "pango" depends_on "poppler" depends_on "webp" uses_from_macos "zlib" on_linux do depends_on "gobject-introspection" end def install # mozjpeg needs to appear before libjpeg, otherwise it's not used ENV.prepend_path "PKG_CONFIG_PATH", Formula["mozjpeg"].opt_lib/"pkgconfig" args = %W[ --disable-dependency-tracking --prefix=#{prefix} ] system "./configure", *args system "make", "install" end test do system "#{bin}/vips", "-l" cmd = "#{bin}/vipsheader -f width #{test_fixtures("test.png")}" assert_equal "8", shell_output(cmd).chomp # --trellis-quant requires mozjpeg, vips warns if it's not present cmd = "#{bin}/vips jpegsave #{test_fixtures("test.png")} #{testpath}/test.jpg --trellis-quant 2>&1" assert_equal "", shell_output(cmd) # [palette] requires libimagequant, vips warns if it's not present cmd = "#{bin}/vips copy #{test_fixtures("test.png")} #{testpath}/test.png[palette] 2>&1" assert_equal "", shell_output(cmd) end end