class Imagemagick < Formula desc "Tools and libraries to manipulate images in many formats" homepage "https://imagemagick.org/index.php" url "https://imagemagick.org/archive/releases/ImageMagick-7.1.0-50.tar.xz" sha256 "cc8cf9e302a5afe5668ab17003769d9d8753104d2cf82883b72b175e152dc67a" license "ImageMagick" head "https://github.com/ImageMagick/ImageMagick.git", branch: "main" livecheck do url "https://imagemagick.org/archive/" regex(/href=.*?ImageMagick[._-]v?(\d+(?:\.\d+)+-\d+)\.t/i) end bottle do sha256 arm64_monterey: "7bea7ae9f6ebf435d7a4a74ee55c0aea4e1cd7575d3c94844f4b2af4eb8c2639" sha256 arm64_big_sur: "e571dfd64333636cb0d733297cd0131a3b4f4c6e1fde848f7f5137434fc3f57e" sha256 monterey: "9a0394980388cad8787e8abef69a77a6611e0e41b6ab78a6e6e4c055aa59d9f9" sha256 big_sur: "fac64ed58c1182434f8db2d73e4e584297407871ff902372450279d9b11f0d4a" sha256 catalina: "ba022bb831e67232be685c1f12c27c1fc10c183a3c49bbcf7904dabb1997b013" sha256 x86_64_linux: "fb0347f0cc148fe67297ca4c875019f319cea0b07ba427358046246d7fd47c5e" end depends_on "pkg-config" => :build depends_on "freetype" depends_on "ghostscript" depends_on "jpeg-turbo" depends_on "libheif" depends_on "liblqr" depends_on "libpng" depends_on "libraw" depends_on "libtiff" depends_on "libtool" depends_on "little-cms2" depends_on "openexr" depends_on "openjpeg" depends_on "webp" depends_on "xz" uses_from_macos "bzip2" uses_from_macos "libxml2" uses_from_macos "zlib" on_macos do depends_on "libomp" end on_linux do depends_on "libx11" end skip_clean :la def install # Avoid references to shim inreplace Dir["**/*-config.in"], "@PKG_CONFIG@", Formula["pkg-config"].opt_bin/"pkg-config" args = [ "--enable-osx-universal-binary=no", "--prefix=#{prefix}", "--disable-dependency-tracking", "--disable-silent-rules", "--disable-opencl", "--enable-shared", "--enable-static", "--with-freetype=yes", "--with-gvc=no", "--with-modules", "--with-openjp2", "--with-openexr", "--with-webp=yes", "--with-heic=yes", "--with-raw=yes", "--with-gslib", "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts", "--with-lqr", "--without-fftw", "--without-pango", "--without-wmf", "--enable-openmp", ] if OS.mac? args += [ "--without-x", # Work around "checking for clang option to support OpenMP... unsupported" "ac_cv_prog_c_openmp=-Xpreprocessor -fopenmp", "ac_cv_prog_cxx_openmp=-Xpreprocessor -fopenmp", "LDFLAGS=-lomp -lz", ] end # versioned stuff in main tree is pointless for us inreplace "configure", "${PACKAGE_NAME}-${PACKAGE_BASE_VERSION}", "${PACKAGE_NAME}" system "./configure", *args system "make", "install" end test do assert_match "PNG", shell_output("#{bin}/identify #{test_fixtures("test.png")}") # Check support for recommended features and delegates. features = shell_output("#{bin}/magick -version") %w[Modules freetype heic jpeg png raw tiff].each do |feature| assert_match feature, features end # Check support for a few specific image formats, mostly to ensure LibRaw linked correctly. formats = shell_output("#{bin}/magick -list format") ["AVIF HEIC rw+", "ARW DNG r--", "DNG DNG r--"].each do |format| assert_match format, formats end assert_match "Helvetica", shell_output("#{bin}/magick -list font") end end