class Libxcb < Formula desc "X.Org: Interface to the X Window System protocol" homepage "https://www.x.org/" url "https://xorg.freedesktop.org/archive/individual/lib/libxcb-1.17.0.tar.xz" sha256 "599ebf9996710fea71622e6e184f3a8ad5b43d0e5fa8c4e407123c88a59a6d55" license "MIT" depends_on "pkgconf" => :build depends_on "python@3.13" => :build # match version in `xcb-proto` depends_on "xcb-proto" => :build depends_on "libxau" depends_on "libxdmcp" def install python3 = "python3.13" args = %W[ --sysconfdir=#{etc} --localstatedir=#{var} --enable-dri3 --enable-ge --enable-xevie --enable-xprint --enable-selinux --disable-silent-rules --enable-devel-docs=no --with-doxygen=no PYTHON=#{python3} ] system "./configure", *args, *std_configure_args system "make" system "make", "install" end test do (testpath/"test.c").write <<~C #include #include #include #include "xcb/xcb.h" int main() { xcb_connection_t *connection; xcb_atom_t *atoms; xcb_intern_atom_cookie_t *cookies; int count, i; char **names; char buf[100]; count = 200; connection = xcb_connect(NULL, NULL); atoms = (xcb_atom_t *) malloc(count * sizeof(atoms)); names = (char **) malloc(count * sizeof(char *)); for (i = 0; i < count; ++i) { sprintf(buf, "NAME%d", i); names[i] = strdup(buf); memset(buf, 0, sizeof(buf)); } cookies = (xcb_intern_atom_cookie_t *) malloc(count * sizeof(xcb_intern_atom_cookie_t)); for(i = 0; i < count; ++i) { cookies[i] = xcb_intern_atom(connection, 0, strlen(names[i]), names[i]); } for(i = 0; i < count; ++i) { xcb_intern_atom_reply_t *r; r = xcb_intern_atom_reply(connection, cookies[i], 0); if(r) atoms[i] = r->atom; free(r); } free(atoms); free(cookies); xcb_disconnect(connection); return 0; } C system ENV.cc, "test.c", "-o", "test", "-I#{include}", "-L#{lib}", "-lxcb" system "./test" assert_equal 0, $CHILD_STATUS.exitstatus end end