Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3e4f92

Browse files
cameronwhiteBrewTestBot
authored andcommitted
webp-pixbuf-loader 0.0.4 (new formula)
* webp-pixbuf-loader 0.0.4 (new formula)* Avoid relying on dependencies being linked in.* Use the gdk_so_ver / gdk_module_ver constants from the gdk-pixbuf formula, instead of maintaining separate copiesClosesHomebrew#94463.Signed-off-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
1 parent8f684fe commitf3e4f92

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

‎Formula/webp-pixbuf-loader.rb‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
classWebpPixbufLoader <Formula
2+
desc"WebP Image format GdkPixbuf loader"
3+
homepage"https://github.com/aruiz/webp-pixbuf-loader"
4+
url"https://github.com/aruiz/webp-pixbuf-loader/archive/0.0.4.tar.gz"
5+
sha256"cd6e4ec44755e8df3e298688c0aeb72b9467bbdd03009989c0d94b219b30fb51"
6+
license"LGPL-2.0-or-later"
7+
8+
depends_on"meson"=>:build
9+
depends_on"ninja"=>:build
10+
depends_on"pkg-config"=>[:build,:test]
11+
depends_on"gdk-pixbuf"
12+
depends_on"webp"
13+
14+
# Constants for gdk-pixbuf's multiple version numbers, which are the same as
15+
# the constants in the gdk-pixbuf formula.
16+
defgdk_so_ver
17+
Formula["gdk-pixbuf"].gdk_so_ver
18+
end
19+
20+
defgdk_module_ver
21+
Formula["gdk-pixbuf"].gdk_module_ver
22+
end
23+
24+
# Subfolder that pixbuf loaders are installed into.
25+
defmodule_subdir
26+
"lib/gdk-pixbuf-#{gdk_so_ver}/#{gdk_module_ver}/loaders"
27+
end
28+
29+
definstall
30+
mkdir"build"do
31+
system"meson", *std_meson_args,"-Dgdk_pixbuf_moduledir=#{prefix}/#{module_subdir}",".."
32+
system"ninja","-v"
33+
system"ninja","install","-v"
34+
end
35+
end
36+
37+
# After the loader is linked in, update the global cache of pixbuf loaders
38+
defpost_install
39+
ENV["GDK_PIXBUF_MODULEDIR"]="#{HOMEBREW_PREFIX}/#{module_subdir}"
40+
system"#{Formula["gdk-pixbuf"].opt_bin}/gdk-pixbuf-query-loaders","--update-cache"
41+
end
42+
43+
testdo
44+
# Generate a .webp file to test with.
45+
system"#{Formula["webp"].opt_bin}/cwebp",test_fixtures("test.png"),"-o","test.webp"
46+
47+
# Sample program to load a .webp file via gdk-pixbuf.
48+
(testpath/"test.c").write<<~EOS
49+
#include <gdk-pixbuf/gdk-pixbuf.h>
50+
51+
gint main (gint argc, gchar **argv) {
52+
GError *error = NULL;
53+
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (argv[1], &error);
54+
if (error) {
55+
g_error("%s", error->message);
56+
return 1;
57+
};
58+
59+
g_assert(gdk_pixbuf_get_width(pixbuf) == 8);
60+
g_assert(gdk_pixbuf_get_height(pixbuf) == 8);
61+
g_object_unref(pixbuf);
62+
return 0;
63+
}
64+
EOS
65+
66+
flags=shell_output("pkg-config --cflags --libs gdk-pixbuf-#{gdk_so_ver}").chomp.split
67+
systemENV.cc,"test.c","-o","test_loader", *flags
68+
system"./test_loader","test.webp"
69+
end
70+
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp