-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gtk4@4.14 4.14.5 (new formula) (#1959)
- Loading branch information
1 parent
6c3f9d4
commit b42cc4a
Showing
1 changed file
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
class Gtk4AT414 < Formula | ||
desc "Toolkit for creating graphical user interfaces" | ||
homepage "https://gtk.org/" | ||
url "https://download.gnome.org/sources/gtk/4.14/gtk-4.14.5.tar.xz" | ||
sha256 "5547f2b9f006b133993e070b87c17804e051efda3913feaca1108fa2be41e24d" | ||
license "LGPL-2.1-or-later" | ||
|
||
livecheck do | ||
url :stable | ||
regex(/gtk[._-](4\.([0-8]\d*?)?[02468](?:\.\d+)*?)\.t/i) | ||
end | ||
|
||
depends_on "docbook" => :build | ||
depends_on "docbook-xsl" => :build | ||
depends_on "docutils" => :build | ||
depends_on "gettext" => :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 "cairo" | ||
depends_on "fontconfig" | ||
depends_on "fribidi" | ||
depends_on "gdk-pixbuf" | ||
depends_on "glib" | ||
depends_on "graphene" | ||
depends_on "harfbuzz" | ||
depends_on "hicolor-icon-theme" | ||
depends_on "jpeg-turbo" | ||
depends_on "libepoxy" | ||
depends_on "libpng" | ||
depends_on "libtiff" | ||
depends_on "pango" | ||
|
||
uses_from_macos "libxslt" => :build # for xsltproc | ||
uses_from_macos "cups" | ||
|
||
on_macos do | ||
depends_on "gettext" | ||
end | ||
|
||
on_linux do | ||
depends_on "libx11" | ||
depends_on "libxcursor" | ||
depends_on "libxdamage" | ||
depends_on "libxext" | ||
depends_on "libxfixes" | ||
depends_on "libxi" | ||
depends_on "libxinerama" | ||
depends_on "libxkbcommon" | ||
depends_on "libxrandr" | ||
depends_on "wayland" | ||
end | ||
|
||
def install | ||
args = %w[ | ||
-Dgtk_doc=false | ||
-Dman-pages=true | ||
-Dintrospection=enabled | ||
-Dbuild-examples=false | ||
-Dbuild-tests=false | ||
-Dmedia-gstreamer=disabled | ||
-Dvulkan=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" | ||
|
||
system "meson", "setup", "build", *args, *std_meson_args | ||
system "meson", "compile", "-C", "build", "--verbose" | ||
system "meson", "install", "-C", "build" | ||
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 |