class Wayland < Formula desc "Protocol for a compositor to talk to its clients" homepage "https://wayland.freedesktop.org" url "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.22.0/downloads/wayland-1.22.0.tar.xz" sha256 "1540af1ea698a471c2d8e9d288332c7e0fd360c8f1d12936ebb7e7cbc2425842" license "MIT" # Versions with a 90+ patch are unstable (e.g., 1.21.91 is an alpha release) # and this regex should only match the stable versions. livecheck do url "https://wayland.freedesktop.org/releases.html" regex(/href=.*?wayland[._-]v?(\d+\.\d+(?:\.(?:\d|[1-8]\d+)(?:\.\d+)*)?)\.t/i) end bottle do sha256 x86_64_linux: "bb61e1add3afef69461363f1283fce7254b2d3562b8c8fc20d62e435b882853b" end depends_on "meson" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on :linux uses_from_macos "expat" uses_from_macos "libffi" uses_from_macos "libxml2" def install mkdir "build" do system "meson", *std_meson_args, "-Dtests=false", "-Ddocumentation=false", ".." system "ninja", "-v" system "ninja", "install", "-v" end end test do (testpath/"test.c").write <<~EOS #include "wayland-server.h" #include "wayland-client.h" int main(int argc, char* argv[]) { const char *socket; struct wl_protocol_logger *logger; return 0; } EOS system ENV.cc, "test.c", "-o", "test", "-I#{include}" system "./test" assert_equal 0, $CHILD_STATUS.exitstatus end end