homebrew-core/Formula/gitg.rb

151 lines
4.9 KiB
Ruby

class Gitg < Formula
desc "GNOME GUI client to view git repositories"
homepage "https://wiki.gnome.org/Apps/Gitg"
url "https://download.gnome.org/sources/gitg/41/gitg-41.tar.xz"
sha256 "7fb61b9fb10fbaa548d23d7065babd72ad63e621de55840c065ce6e3986c4629"
license "GPL-2.0-or-later"
livecheck do
url :stable
regex(/gitg[._-]v?(\d+(?:\.\d+)*)\.t/i)
end
bottle do
sha256 arm64_ventura: "f2ddb91d679e3cce264f52960a7e30e2a5267dbcd85e64b02c8706cfd3a5479c"
sha256 arm64_monterey: "f68e86061156ba405410156aa3e4066015cdb9227162d68f2581664a6a7b4ba9"
sha256 arm64_big_sur: "a2bf23c4cb3fdfdcdb05f250b5bf62d33bc60d01072f182f1209a40b604674df"
sha256 ventura: "5309cb3218437eb04e8f635a281f2e027cce2132fc172625da6647e2b95ab76d"
sha256 monterey: "70d587c967403aafdff322736896ad013be0b1bc0a4a9fbe60329913a4f07fad"
sha256 big_sur: "45de0fdc63fdd84c90e4ccfcbd99e7f2338b5d5510f7b8364fc32b49d6335528"
sha256 catalina: "6243ae261e1994f5b72c79bb469c23270c67e25a1e0f1a4a1fa39f1f248fd3f4"
sha256 x86_64_linux: "e25650fea8b7537a43e868afc3f0e1ac7aa1ed8153b655556bafe6fbdf883132"
end
depends_on "intltool" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "vala" => :build
depends_on "adwaita-icon-theme"
depends_on "gobject-introspection"
depends_on "gspell"
depends_on "gtk+3"
depends_on "gtksourceview4"
depends_on "hicolor-icon-theme"
depends_on "json-glib"
depends_on "libdazzle"
depends_on "libgee"
depends_on "libgit2"
depends_on "libgit2-glib"
depends_on "libpeas"
depends_on "libsecret"
# Apply upstream commit to fix build. Remove with next release.
patch do
url "https://gitlab.gnome.org/GNOME/gitg/-/commit/1978973b12848741b08695ec2020bac98584d636.diff"
sha256 "1787335100ab78bc044cda29613a40f3f85c3ef287646914e56b2ce578e05fdf"
end
def install
ENV["DESTDIR"] = "/"
system "meson", *std_meson_args, "build", "-Dpython=false"
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 "#{Formula["gtk+3"].opt_bin}/gtk3-update-icon-cache", "-f", "-t", "#{HOMEBREW_PREFIX}/share/icons/hicolor"
end
test do
# test executable
# Disable this part of test on Linux because display is not available.
assert_match version.to_s, shell_output("#{bin}/gitg --version") if OS.mac?
# test API
(testpath/"test.c").write <<~EOS
#include <libgitg/libgitg.h>
int main(int argc, char *argv[]) {
GType gtype = gitg_stage_status_file_get_type();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
gobject_introspection = Formula["gobject-introspection"]
gtkx3 = Formula["gtk+3"]
harfbuzz = Formula["harfbuzz"]
libepoxy = Formula["libepoxy"]
libffi = Formula["libffi"]
libgee = Formula["libgee"]
libgit2 = Formula["libgit2"]
libgit2_glib = Formula["libgit2-glib"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/gio-unix-2.0/
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{gobject_introspection.opt_include}/gobject-introspection-1.0
-I#{gtkx3.opt_include}/gtk-3.0
-I#{harfbuzz.opt_include}/harfbuzz
-I#{include}/libgitg-1.0
-I#{libepoxy.opt_include}
-I#{libgee.opt_include}/gee-0.8
-I#{libffi.opt_lib}/libffi-3.0.13/include
-I#{libgit2}/include
-I#{libgit2_glib.opt_include}/libgit2-glib-1.0
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-DGIT_SSH=1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{gobject_introspection.opt_lib}
-L#{gtkx3.opt_lib}
-L#{libgee.opt_lib}
-L#{libgit2.opt_lib}
-L#{libgit2_glib.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lgirepository-1.0
-lgit2
-lgit2-glib-1.0
-lgitg-1.0
-lglib-2.0
-lgmodule-2.0
-lgobject-2.0
-lgthread-2.0
-lgtk-3
-lpango-1.0
-lpangocairo-1.0
]
flags << "-lintl" if OS.mac?
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end