homebrew-core/Formula/at-spi2-core.rb

70 lines
2.0 KiB
Ruby

class AtSpi2Core < Formula
desc "Protocol definitions and daemon for D-Bus at-spi"
homepage "https://www.freedesktop.org/wiki/Accessibility/AT-SPI2"
url "https://download.gnome.org/sources/at-spi2-core/2.44/at-spi2-core-2.44.1.tar.xz"
sha256 "4beb23270ba6cf7caf20b597354d75194d89afb69d2efcf15f4271688ba6f746"
license "LGPL-2.1-or-later"
bottle do
rebuild 1
sha256 x86_64_linux: "5886c9ff2107a4f37c76767958c35c3fb1f5547f0a6d0342b533b58bbeb47222"
end
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "python@3.11" => :build
depends_on "dbus"
depends_on "gettext"
depends_on "glib"
depends_on "libx11"
depends_on "libxtst"
depends_on :linux
depends_on "xorgproto"
def install
system "meson", "setup", "build", *std_meson_args
system "meson", "compile", "-C", "build", "--verbose"
system "meson", "install", "-C", "build"
end
test do
(testpath/"test.c").write <<~EOS
/*
* List the applications registered on at-spi.
*/
#include <atspi/atspi.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int main(int argc, gchar **argv)
{
gint i;
AtspiAccessible *desktop = NULL;
AtspiAccessible *app = NULL;
atspi_init ();
desktop = atspi_get_desktop (0);
for (i = 0; i < atspi_accessible_get_child_count (desktop, NULL); i++) {
app = atspi_accessible_get_child_at_index (desktop, i, NULL);
g_print ("(Index, application, application_child_count)=(%d,%s,%d)\\n",
i, atspi_accessible_get_name (app, NULL), atspi_accessible_get_child_count (app, NULL));
g_object_unref (app);
}
return 1;
}
EOS
pkg_config_cflags = shell_output("pkg-config --cflags --libs atspi-2").chomp.split
system ENV.cc, "test.c", *pkg_config_cflags, "-lgobject-2.0", "-o", "test"
assert_match "AT-SPI", shell_output("#{testpath}/test 2>&1", 133)
end
end