homebrew-core/Formula/gspell.rb

151 lines
4.4 KiB
Ruby

class Gspell < Formula
desc "Flexible API to implement spellchecking in GTK+ applications"
homepage "https://gitlab.gnome.org/GNOME/gspell"
url "https://download.gnome.org/sources/gspell/1.12/gspell-1.12.0.tar.xz"
sha256 "40d2850f1bb6e8775246fa1e39438b36caafbdbada1d28a19fa1ca07e1ff82ad"
license "LGPL-2.1-or-later"
revision 1
bottle do
sha256 arm64_ventura: "f66ab428e5da9ccce7d0a07b3cdc8f7098faeabd5f9213e32cd82fc40fe5d0b7"
sha256 arm64_monterey: "6b714a13f71269104d97bed81ee41d2de11e076ef40141c3fb8367268548ea8f"
sha256 arm64_big_sur: "27df3558377dd19da7d51f6c908f7723b096b7393d3574cd3006a061b81ae84d"
sha256 ventura: "912da8ef4a4f013086a170560d003ec1964fec5b440122fe669d79acc14f6235"
sha256 monterey: "cfd8fda21d898f78d594fccabc8164689e2a3f1a40345a92e34f31360ba2bb95"
sha256 big_sur: "f4126e8aeea56725448696a83aaab1923b8a130c903660d3a87a4f9b6e7e6bda"
sha256 catalina: "a27f1af9269be53f6eab63fd30941ca01b64bc16caf111f7ad328606a21897fa"
sha256 x86_64_linux: "3aa83e251a519603ddc71d06d6c001e281cdc1e27167a8f6114ab7741fd98a93"
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "gobject-introspection" => :build
depends_on "gtk-doc" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "enchant"
depends_on "gtk+3"
depends_on "iso-codes"
depends_on "vala"
uses_from_macos "libffi"
on_macos do
depends_on "gtk-mac-integration"
end
patch :DATA
def install
system "autoreconf", "--force", "--install", "--verbose"
system "./configure", *std_configure_args, "--disable-silent-rules", "--enable-vala=yes"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <gspell/gspell.h>
int main(int argc, char *argv[]) {
const GList *list = gspell_language_get_available();
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
enchant = Formula["enchant"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
gtkx3 = Formula["gtk+3"]
harfbuzz = Formula["harfbuzz"]
libepoxy = Formula["libepoxy"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{enchant.opt_include}/enchant-2
-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
]
if OS.mac?
gtk_mac_integration = Formula["gtk-mac-integration"]
flags << "-I#{gtk_mac_integration.opt_include}/gtkmacintegration"
end
flags += %W[
-I#{gtkx3.opt_include}/gtk-3.0
-I#{harfbuzz.opt_include}/harfbuzz
-I#{include}/gspell-1
-I#{libepoxy.opt_include}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-DMAC_INTEGRATION
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{gtkx3.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lcairo-gobject
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgspell-1
-lgtk-3
-lpango-1.0
-lpangocairo-1.0
]
flags << "-lintl" if OS.mac?
system ENV.cc, "test.c", "-o", "test", *flags
ENV["G_DEBUG"] = "fatal-warnings"
# This test will fail intentionally when iso-codes gets updated.
# Resolve by increasing the `revision` on this formula.
system "./test"
end
end
__END__
diff --git a/gspell/Makefile.am b/gspell/Makefile.am
index 076a9fd..6c67184 100644
--- a/gspell/Makefile.am
+++ b/gspell/Makefile.am
@@ -91,6 +91,7 @@ nodist_libgspell_core_la_SOURCES = \
$(BUILT_SOURCES)
libgspell_core_la_LIBADD = \
+ $(GTK_MAC_LIBS) \
$(CODE_COVERAGE_LIBS)
libgspell_core_la_CFLAGS = \
@@ -155,6 +156,12 @@ gspell_private_headers += \
gspell_private_c_files += \
gspell-osx.c
+libgspell_core_la_CFLAGS += \
+ -xobjective-c
+
+libgspell_core_la_LDFLAGS += \
+ -framework Cocoa
+
endif # OS_OSX
if HAVE_INTROSPECTION