99 lines
3.1 KiB
Ruby
99 lines
3.1 KiB
Ruby
class Gtk4 < Formula
|
|
desc "Toolkit for creating graphical user interfaces"
|
|
homepage "https://gtk.org/"
|
|
url "https://download.gnome.org/sources/gtk/4.6/gtk-4.6.6.tar.xz"
|
|
sha256 "7bbfe4d13569f7c297ed49834ac7263e318b7bf102d3271cb466d5971f59ae70"
|
|
license "LGPL-2.1-or-later"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/gtk[._-](4\.([0-8]\d*?)?[02468](?:\.\d+)*?)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "9fb1dfbaf68211e3afb9e407781a6627b4cc9c7ee0077a4794f811101a7d3fa7"
|
|
sha256 arm64_big_sur: "4400fdceb0e38370d8d82197dd1324d6889d66347d89fd1db58f7d5d81e8d202"
|
|
sha256 monterey: "08d61fb9146b92e4c96879cab866e0583199397425a8d0cb1783422a64bfed79"
|
|
sha256 big_sur: "7323e811e12505fff6593de1e1194b69ef4ddde9f995dcff7406bc7b064c2b35"
|
|
sha256 catalina: "c18015cdcadd1895370794444d6b959551fb99e52a81013057931c4ce4c89473"
|
|
sha256 x86_64_linux: "c9f3e862e0a432f6df5482260ee38c4bb4ba12a17308c6c447b27c356e1ba387"
|
|
end
|
|
|
|
depends_on "docbook" => :build
|
|
depends_on "docbook-xsl" => :build
|
|
depends_on "docutils" => :build
|
|
depends_on "gobject-introspection" => :build
|
|
depends_on "meson" => :build
|
|
depends_on "ninja" => :build
|
|
depends_on "pkg-config" => [:build, :test]
|
|
depends_on "sassc" => :build
|
|
depends_on "gdk-pixbuf"
|
|
depends_on "glib"
|
|
depends_on "graphene"
|
|
depends_on "hicolor-icon-theme"
|
|
depends_on "libepoxy"
|
|
depends_on "pango"
|
|
|
|
uses_from_macos "libxslt" => :build # for xsltproc
|
|
uses_from_macos "cups"
|
|
|
|
on_linux do
|
|
depends_on "libxkbcommon"
|
|
depends_on "libxcursor"
|
|
end
|
|
|
|
def install
|
|
args = std_meson_args + %w[
|
|
-Dgtk_doc=false
|
|
-Dman-pages=true
|
|
-Dintrospection=enabled
|
|
-Dbuild-examples=false
|
|
-Dbuild-tests=false
|
|
-Dmedia-gstreamer=disabled
|
|
]
|
|
|
|
if OS.mac?
|
|
args << "-Dx11-backend=false"
|
|
args << "-Dmacos-backend=true"
|
|
args << "-Dprint-cups=disabled" if MacOS.version <= :mojave
|
|
end
|
|
|
|
# ensure that we don't run the meson post install script
|
|
ENV["DESTDIR"] = "/"
|
|
|
|
# Find our docbook catalog
|
|
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
|
|
|
|
# Disable asserts and cast checks explicitly
|
|
ENV.append "CPPFLAGS", "-DG_DISABLE_ASSERT -DG_DISABLE_CAST_CHECKS"
|
|
|
|
mkdir "build" do
|
|
system "meson", *args, ".."
|
|
system "ninja", "-v"
|
|
system "ninja", "install", "-v"
|
|
end
|
|
end
|
|
|
|
def post_install
|
|
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
|
|
system bin/"gtk4-update-icon-cache", "-f", "-t", "#{HOMEBREW_PREFIX}/share/icons/hicolor"
|
|
system "#{Formula["glib"].opt_bin}/gio-querymodules", "#{HOMEBREW_PREFIX}/lib/gtk-4.0/4.0.0/printbackends"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <gtk/gtk.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
gtk_disable_setlocale();
|
|
return 0;
|
|
}
|
|
EOS
|
|
flags = shell_output("#{Formula["pkg-config"].opt_bin}/pkg-config --cflags --libs gtk4").strip.split
|
|
system ENV.cc, "test.c", "-o", "test", *flags
|
|
system "./test"
|
|
# include a version check for the pkg-config files
|
|
assert_match version.to_s, shell_output("cat #{lib}/pkgconfig/gtk4.pc").strip
|
|
end
|
|
end
|