forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgdk-pixbuf.rb
101 lines (88 loc) · 3.67 KB
/
gdk-pixbuf.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
96
97
98
99
100
101
class GdkPixbuf < Formula
desc "Toolkit for image loading and pixel buffer manipulation"
homepage "https://gtk.org"
url "https://download.gnome.org/sources/gdk-pixbuf/2.42/gdk-pixbuf-2.42.12.tar.xz"
sha256 "b9505b3445b9a7e48ced34760c3bcb73e966df3ac94c95a148cb669ab748e3c7"
license "LGPL-2.1-or-later"
revision 1
bottle do
sha256 arm64_sequoia: "64089a3ef04afef0dc8601d22cd534fdc155bef2458bf1a97e6e90f25b7529ad"
sha256 arm64_sonoma: "c703ce18d2e7f538a643fcccca6a42b5fa8e4f1afeaf0fca8588fe1f475f95c9"
sha256 arm64_ventura: "f3b25a91f9e808d5811194ff0e49dcfb67b758e95b341fb95a53066b1e726994"
sha256 sonoma: "4b55a027f7b848eee61127f19da0c29fd2ae32d51d5a936e32ac30d504864fe6"
sha256 ventura: "62202745ffbf466de3dcc1901897f3625cb2e2449944bb76093731342ff4b375"
sha256 x86_64_linux: "0b6776f4eafc2e63c2d718e73bb1714239201929074cbaa0c794a1dd0423d197"
end
depends_on "docutils" => :build # for rst2man
depends_on "gettext" => :build
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkgconf" => [:build, :test]
depends_on "glib"
depends_on "jpeg-turbo"
depends_on "libpng"
depends_on "libtiff"
on_macos do
depends_on "gettext"
end
on_linux do
depends_on "shared-mime-info"
end
# gdk-pixbuf has an internal version number separate from the overall
# version number that specifies the location of its module and cache
# files, this will need to be updated if that internal version number
# is ever changed (as evidenced by the location no longer existing)
def gdk_so_ver
"2.0"
end
def gdk_module_ver
"2.10.0"
end
def install
inreplace "gdk-pixbuf/meson.build",
"-DGDK_PIXBUF_LIBDIR=\"@0@\"'.format(gdk_pixbuf_libdir)",
"-DGDK_PIXBUF_LIBDIR=\"@0@\"'.format('#{HOMEBREW_PREFIX}/lib')"
ENV["DESTDIR"] = "/"
system "meson", "setup", "build", "-Drelocatable=false",
"-Dnative_windows_loaders=false",
"-Dtests=false",
"-Dinstalled_tests=false",
"-Dman=true",
"-Dgtk_doc=false",
"-Dpng=enabled",
"-Dtiff=enabled",
"-Djpeg=enabled",
"-Dothers=enabled",
"-Dintrospection=enabled",
*std_meson_args
system "meson", "compile", "-C", "build", "--verbose"
system "meson", "install", "-C", "build"
# Other packages should use the top-level modules directory
# rather than dumping their files into the gdk-pixbuf keg.
inreplace lib/"pkgconfig/gdk-pixbuf-#{gdk_so_ver}.pc" do |s|
s.change_make_var! "prefix", HOMEBREW_PREFIX
end
end
# The directory that loaders.cache gets linked into, also has the "loaders"
# directory that is scanned by gdk-pixbuf-query-loaders in the first place
def module_dir
"#{HOMEBREW_PREFIX}/lib/gdk-pixbuf-#{gdk_so_ver}/#{gdk_module_ver}"
end
def post_install
ENV["GDK_PIXBUF_MODULEDIR"] = "#{module_dir}/loaders"
system bin/"gdk-pixbuf-query-loaders", "--update-cache"
end
test do
(testpath/"test.c").write <<~C
#include <gdk-pixbuf/gdk-pixbuf.h>
int main(int argc, char *argv[]) {
GType type = gdk_pixbuf_get_type();
return 0;
}
C
flags = shell_output("pkgconf --cflags --libs gdk-pixbuf-#{gdk_so_ver}").chomp.split
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end