homebrew-core/Formula/imagemagick.rb

114 lines
3.6 KiB
Ruby

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-62.tar.xz"
sha256 "8b89c1a023d4b03cca3e63a0f3cb944427d46d1363a20440282d9f6e0e343518"
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_ventura: "9077aa03701635fdd66026855db9c87e1c50c52c39c1b1fa831a08aad95b9d5d"
sha256 arm64_monterey: "3b44f6a2ced6b2fa0ae54efc5efa62a86ed43c139880000572cf54ae2ac0d774"
sha256 arm64_big_sur: "e3c8cec7cbf4ff2fc4a60922f1d534d469d83a9baea0b9a79fb28d2b6635bbd0"
sha256 ventura: "d67bd9ccec5d7cc0c458a4476ef7040f77613a36b958c1b337a001453168194a"
sha256 monterey: "2cd2228062583d181c9569f6626c482dd8a0e52fd44279a5421e85260b047f7f"
sha256 big_sur: "c57d7c4ca905ee4b2946ada8d6ddacd3498cb084bab836203df78dc06cf32a52"
sha256 x86_64_linux: "1d61379bbefe817bcfe2872c389a95090c15409384c2d3360f04738d16a7766f"
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"
# versioned stuff in main tree is pointless for us
inreplace "configure", "${PACKAGE_NAME}-${PACKAGE_BASE_VERSION}", "${PACKAGE_NAME}"
args = [
"--enable-osx-universal-binary=no",
"--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-djvu",
"--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
system "./configure", *std_configure_args, *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