114 lines
3.6 KiB
Ruby
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-58.tar.xz"
|
|
sha256 "ec4d6f0ae3bdcf3f2015f8082048f0d2cf973bf82841abb6785c4a808cf61ae3"
|
|
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: "4a3df97a913228ff72be79a4955d1e2da6b2cc00017dac843950d15a7bd4dbef"
|
|
sha256 arm64_monterey: "d2cf7cf5415cbdb107a84963def54b3da6b5823dc410e2e5b6901f61774b42b6"
|
|
sha256 arm64_big_sur: "2fab2a277b026a44a28179e5ed0c9744beb3eb938d60dfb9a006b98e6ea5d0db"
|
|
sha256 ventura: "a181d4a2b4f37efe4df24c9b9a7d0e5899b51cbe32e2bdbee2bca2b128674327"
|
|
sha256 monterey: "7e25d208941acb9e32138fa052eca87baa3021e34493f1f03a05e55c38bda178"
|
|
sha256 big_sur: "e3587a3147d700e9bf4bde3e42b4ef5166d742cfc94a545d23c3caa6fedc5b30"
|
|
sha256 x86_64_linux: "f8d5614638ca60c8af98b0b28c656962d9d1da11e8bb28ffeb3297edad1fb979"
|
|
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
|