-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
Copy pathvips.rb
95 lines (84 loc) · 3.38 KB
/
vips.rb
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
class Vips < Formula
desc "Image processing library"
homepage "https://github.com/libvips/libvips"
url "https://github.com/libvips/libvips/releases/download/v8.16.1/vips-8.16.1.tar.xz"
sha256 "d114d7c132ec5b45f116d654e17bb4af84561e3041183cd4bfd79abfb85cf724"
license "LGPL-2.1-or-later"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 arm64_sequoia: "a5c9ff3d50640de8bca6d78cb928d139c51999d484ea342cf864db3d86e27c97"
sha256 arm64_sonoma: "013d0aab231b653fa3e2ee4251bda92c1e0eea1ed1a4baafbf444b3273a60375"
sha256 arm64_ventura: "47dc847d95d38abea41706e81d7009d57d176fa02b0c231513a032dcd3a23e16"
sha256 sonoma: "362496337c54b8cce1b87f2835436ecbf328334ff7953417cf95b348123ac26f"
sha256 ventura: "bbb669b3daf640b0e18306f6df0cdc3d27beb7fd7c20821d35cf2f09ac8579da"
sha256 arm64_linux: "be574b0fe541e799244a7e34b1e5070c43d18f19ebc87f435eb4ca04ea772736"
sha256 x86_64_linux: "5baeeb91cc40682eec26c3f06ba91a09e7c529e03ea2ff2314450791beb9f9fe"
end
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkgconf" => [:build, :test]
depends_on "cairo"
depends_on "cfitsio"
depends_on "cgif"
depends_on "fftw"
depends_on "fontconfig"
depends_on "gettext"
depends_on "glib"
depends_on "highway"
depends_on "imagemagick"
depends_on "jpeg-xl"
depends_on "libarchive"
depends_on "libexif"
depends_on "libheif"
depends_on "libimagequant"
depends_on "libmatio"
depends_on "librsvg"
depends_on "libspng"
depends_on "libtiff"
depends_on "little-cms2"
depends_on "mozjpeg"
depends_on "openexr"
depends_on "openjpeg"
depends_on "openslide"
depends_on "pango"
depends_on "poppler"
depends_on "webp"
uses_from_macos "python" => :build
uses_from_macos "expat"
uses_from_macos "zlib"
def install
# mozjpeg needs to appear before libjpeg, otherwise it's not used
ENV.prepend_path "PKG_CONFIG_PATH", Formula["mozjpeg"].opt_lib/"pkgconfig"
system "meson", "setup", "build", *std_meson_args
system "meson", "compile", "-C", "build", "--verbose"
system "meson", "install", "-C", "build"
if OS.mac?
# `pkg-config --libs vips` includes libarchive, but that package is
# keg-only so it needs to look for the pkgconfig file in libarchive's opt
# path.
libarchive = Formula["libarchive"].opt_prefix
inreplace [lib/"pkgconfig/vips.pc", lib/"pkgconfig/vips-cpp.pc"] do |s|
s.gsub!(/^Requires\.private:(.*)\blibarchive\b(.*?)(,.*)?$/,
"Requires.private:\\1#{libarchive}/lib/pkgconfig/libarchive.pc\\3")
end
end
end
test do
system bin/"vips", "-l"
cmd = "#{bin}/vipsheader -f width #{test_fixtures("test.png")}"
assert_equal "8", shell_output(cmd).chomp
# --trellis-quant requires mozjpeg, vips warns if it's not present
cmd = "#{bin}/vips jpegsave #{test_fixtures("test.png")} #{testpath}/test.jpg --trellis-quant 2>&1"
assert_empty shell_output(cmd)
# [palette] requires libimagequant, vips warns if it's not present
cmd = "#{bin}/vips copy #{test_fixtures("test.png")} #{testpath}/test.png[palette] 2>&1"
assert_empty shell_output(cmd)
# Make sure `pkg-config` can parse `vips.pc` and `vips-cpp.pc` after the `inreplace`.
system "pkgconf", "--print-errors", "vips"
system "pkgconf", "--print-errors", "vips-cpp"
end
end