-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimagemagick.rb
More file actions
116 lines (103 loc) · 3.27 KB
/
imagemagick.rb
File metadata and controls
116 lines (103 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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.1-47.tar.xz"
sha256 "2396cd3c4237cfbc09a89d31d1cee157ee11fbc8ec1e540530e10175cb707160"
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
depends_on "pkgconf" => :build
depends_on "fontconfig"
depends_on "freetype"
depends_on "jpeg-turbo"
depends_on "jpeg-xl"
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 "gettext"
depends_on "glib"
depends_on "imath"
depends_on "libomp"
end
on_linux do
depends_on "libx11"
depends_on "libxext"
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-hdri=no",
"--with-quantum-depth=8",
"--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",
"--without-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", *args, *std_configure_args
system "make", "install"
end
def caveats
<<~EOS
Ghostscript is not installed by default as a dependency.
If you need PS or PDF support, ImageMagick will still use the ghostscript formula if installed directly.
EOS
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
end
end