forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgdk-pixbuf.rb
88 lines (75 loc) · 3.12 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
class GdkPixbuf < Formula
desc "Toolkit for image loading and pixel buffer manipulation"
homepage "http://gtk.org"
url "https://download.gnome.org/sources/gdk-pixbuf/2.34/gdk-pixbuf-2.34.0.tar.xz"
sha256 "d55e5b383ee219bd0e23bf6ed4427d56a7db5379729a6e3e0a0e0eba9a8d8879"
bottle do
sha256 "2457c164f46d315b58ed69358973c78139af3422205f7376a777d16e43ceb7da" => :el_capitan
sha256 "15096f218ea453b77ae40d88752610742d78d199b2b90fa1c5323eeb547dd394" => :yosemite
sha256 "57cc04ff998e51dc3004656c2f44cf2820d5002cfdc18f7a7dc6e04e674315ab" => :mavericks
end
option :universal
option "with-relocations", "Build with relocation support for bundles"
depends_on "pkg-config" => :build
depends_on "glib"
depends_on "jpeg"
depends_on "libtiff"
depends_on "libpng"
depends_on "gobject-introspection"
# 'loaders.cache' must be writable by other packages
skip_clean "lib/gdk-pixbuf-2.0"
# Patch that fixes an occasional segfault in Freeciv
# See:
# - https://bugzilla.gnome.org/show_bug.cgi?id=766842
# - https://gna.org/bugs/?func=detailitem&item_id=24298
patch do
url "https://github.com/GNOME/gdk-pixbuf/commit/ad43d54b11d0b337e8032d9d25b09eb8f8650ace.patch"
sha256 "c38cbf14bee68a15a12edb55a5fa39e36a8dc3d82b4160e9cefea921eda6a13d"
end
def install
ENV.universal_binary if build.universal?
ENV.append_to_cflags "-DGDK_PIXBUF_LIBDIR=\\\"#{HOMEBREW_PREFIX}/lib\\\""
args = %W[
--disable-dependency-tracking
--disable-maintainer-mode
--enable-debug=no
--prefix=#{prefix}
--enable-introspection=yes
--disable-Bsymbolic
--enable-static
--without-gdiplus
]
args << "--enable-relocations" if build.with?("relocations")
system "./configure", *args
system "make"
system "make", "install"
# Other packages should use the top-level modules directory
# rather than dumping their files into the gdk-pixbuf keg.
inreplace lib/"pkgconfig/gdk-pixbuf-2.0.pc" do |s|
libv = s.get_make_var "gdk_pixbuf_binary_version"
s.change_make_var! "gdk_pixbuf_binarydir",
HOMEBREW_PREFIX/"lib/gdk-pixbuf-2.0"/libv
end
# Remove the cache. We will regenerate it in post_install
(lib/"gdk-pixbuf-2.0/2.10.0/loaders.cache").unlink
end
def post_install
# Change the version directory below with any future update
if build.with?("relocations")
ENV["GDK_PIXBUF_MODULE_FILE"]="#{lib}/gdk-pixbuf-2.0/2.10.0/loaders.cache"
ENV["GDK_PIXBUF_MODULEDIR"]="#{HOMEBREW_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders"
end
system "#{bin}/gdk-pixbuf-query-loaders", "--update-cache"
end
def caveats; <<-EOS.undent
Programs that require this module need to set the environment variable
export GDK_PIXBUF_MODULE_FILE="#{lib}/gdk-pixbuf-2.0/2.10.0/loaders.cache"
export GDK_PIXBUF_MODULEDIR="#{HOMEBREW_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders"
If you need to manually update the query loader cache, set these variables then run
#{bin}/gdk-pixbuf-query-loaders --update-cache
EOS
end if build.with?("relocations")
test do
system bin/"gdk-pixbuf-csource", test_fixtures("test.png")
end
end