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.1.tar.xz"
|
|
sha256 "d85508d21cbbcd63d568a7862af5ecd63b978d7d5799cbe404c91d2389d0ec5f"
|
|
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: "eeeed98a31d94b36b072a8ad119a3c71c822116f2009da11fc3b8964ea860fc1"
|
|
sha256 arm64_big_sur: "ed642b888d5efe2816c3d39a2eb7054b6c5c960c8ec4a15c86fcabba7e78b1fe"
|
|
sha256 monterey: "3f3a5eecd818cab7efd765f9bd18775bfd2dcb10bcccccabd8b1c6cb1979f88e"
|
|
sha256 big_sur: "21b8688d1a0ebf1239208a575b1657170ab09cb29071493daf0f45b35b41ef65"
|
|
sha256 catalina: "10726527c89366be7eac1c32a9c88647d7251d3b070fef813cba9e598782fe06"
|
|
sha256 x86_64_linux: "d8b9074becf9318967d7f3be4a0c44c97d17f4eeac7493a72be74bd62d3f87d3"
|
|
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
|