115 lines
3.6 KiB
Ruby
115 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-54.tar.xz"
|
|
sha256 "6d0d952000217b677276a342a4c609776386d0daf2ccf354b6ed8dbc07d22ef7"
|
|
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: "e18f4100558f4a3306fadce757cf74dfbd2c5bdc5377a1cc27605e7e830fd8a8"
|
|
sha256 arm64_monterey: "96709cdf93062b6281910d721237f9ae280732aeb7688163b0ed9b56a9c584e0"
|
|
sha256 arm64_big_sur: "78c7756c3cb3c8cf5cadc9b4f9ce594728011ffdfefa6b008f3d5bd71e7310a3"
|
|
sha256 ventura: "be480a0bf17246905781cb0030666735efe011cef8cf377c5a976cf7b1fac371"
|
|
sha256 monterey: "6565336a8b88383f167676c16da5f26511582e7114ab88d9f9c9243d86c91937"
|
|
sha256 big_sur: "152fdac12f8555e112ccc2dfbb785e4313b7c0069997e40a46fd5005191ab9d0"
|
|
sha256 x86_64_linux: "4c8ade9f5a6320f2808472d494ea28a5c2aced88c88f5e03b4ef4bba66e7dfdb"
|
|
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
|