homebrew-core/Formula/gedit.rb

145 lines
4.2 KiB
Ruby

class Gedit < Formula
desc "GNOME text editor"
homepage "https://wiki.gnome.org/Apps/Gedit"
url "https://download.gnome.org/sources/gedit/40/gedit-40.1.tar.xz"
sha256 "55e394a82cb65678b1ab49526cf5bd43f00d8fba21476a4849051a8e137d3691"
license "GPL-2.0-or-later"
bottle do
sha256 arm64_big_sur: "944db5b9131011efb9ac1ca370342b21895bc8c2220138c90fd137cc883ccc1e"
sha256 big_sur: "7cee9c8a408d1f8bfc28f05475babd0e9d0236cfb2411042c56112c97d6ccbd7"
sha256 catalina: "f36d6723b16e6271e0c5327b6d7723ed501c51bd1ab07a4c3c125ed877ff4e99"
sha256 mojave: "5a842c19e3ff549f23d6854265423064666686548356d0c188df63b741d49d77"
sha256 x86_64_linux: "43fd433db4952cba82e79d384f06abc89d5dbd46d8ed6b37fca84a002ebadff4"
end
depends_on "itstool" => :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 "atk"
depends_on "cairo"
depends_on "gdk-pixbuf"
depends_on "gettext"
depends_on "glib"
depends_on "gobject-introspection"
depends_on "gsettings-desktop-schemas"
depends_on "gspell"
depends_on "gtk+3"
depends_on "gtksourceview4"
depends_on "libpeas"
depends_on "libsoup"
depends_on "libxml2"
depends_on "pango"
depends_on "tepl"
def install
ENV["DESTDIR"] = "/"
ENV.append "LDFLAGS", "-Wl,-rpath,#{lib}/gedit" if OS.linux?
mkdir "build" do
system "meson", *std_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 Formula["gtk+3"].opt_bin/"gtk3-update-icon-cache", "-qtf", HOMEBREW_PREFIX/"share/icons/hicolor"
end
test do
# main executable test
system bin/"gedit", "--version"
# API test
(testpath/"test.c").write <<~EOS
#include <gedit/gedit-debug.h>
int main(int argc, char *argv[]) {
gedit_debug_init();
return 0;
}
EOS
ENV.libxml2
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"]
gtksourceview4 = Formula["gtksourceview4"]
harfbuzz = Formula["harfbuzz"]
libepoxy = Formula["libepoxy"]
libffi = Formula["libffi"]
libpeas = Formula["libpeas"]
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#{gtksourceview4.opt_include}/gtksourceview-4
-I#{gtkx3.opt_include}/gtk-3.0
-I#{harfbuzz.opt_include}/harfbuzz
-I#{include}/gedit-40.0
-I#{libepoxy.opt_include}
-I#{libffi.opt_lib}/libffi-3.0.13/include
-I#{libpeas.opt_include}/libpeas-1.0
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{lib}/gedit
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{gobject_introspection.opt_lib}
-L#{gtksourceview4.opt_lib}
-L#{gtkx3.opt_lib}
-L#{libpeas.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgedit-40.0
-lgio-2.0
-lgirepository-1.0
-lglib-2.0
-lgmodule-2.0
-lgobject-2.0
-lgtk-3
-lgtksourceview-4
-lpango-1.0
-lpangocairo-1.0
-lpeas-1.0
-lpeas-gtk-1.0
]
flags << if OS.mac?
"-lintl"
else
"-Wl,-rpath,#{lib}/gedit"
end
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end