homebrew-core/Formula/libgee.rb

65 lines
2.2 KiB
Ruby

class Libgee < Formula
desc "Collection library providing GObject-based interfaces"
homepage "https://wiki.gnome.org/Projects/Libgee"
url "https://download.gnome.org/sources/libgee/0.20/libgee-0.20.3.tar.xz"
sha256 "d0b5edefc88cbca5f1709d19fa62aef490922c6577a14ac4e7b085507911a5de"
license "LGPL-2.1"
bottle do
sha256 cellar: :any, arm64_big_sur: "36e8d14974ce46847a85901ef9ce5822ac44f92a2bf0d60fa1ad317657c2d02b"
sha256 cellar: :any, big_sur: "cf79729c731beefa274a0c8dc88569a3e2a748ca28f660dde939768c4fdd03ae"
sha256 cellar: :any, catalina: "f05da401040a1fd6372ebb26550d13b3779309d7e393bb109b9c362e8fcb0a0b"
sha256 cellar: :any, mojave: "ea8b92ad2fc0f9c4191e83d3a4ace603dd99b2d95da665ac699f0805394595e3"
sha256 cellar: :any, high_sierra: "321db1d8698ebe090ee354090920a614d95fb65fa7a38fad01f15fbfc6d2ea53"
end
depends_on "gobject-introspection" => :build
depends_on "pkg-config" => :build
depends_on "vala" => :build
depends_on "glib"
def install
# ensures that the gobject-introspection files remain within the keg
inreplace "gee/Makefile.in" do |s|
s.gsub! "@HAVE_INTROSPECTION_TRUE@girdir = @INTROSPECTION_GIRDIR@",
"@HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0"
s.gsub! "@HAVE_INTROSPECTION_TRUE@typelibdir = @INTROSPECTION_TYPELIBDIR@",
"@HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0"
end
system "./configure", "--prefix=#{prefix}",
"--disable-dependency-tracking"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <gee.h>
int main(int argc, char *argv[]) {
GType type = gee_traversable_stream_get_type();
return 0;
}
EOS
gettext = Formula["gettext"]
glib = Formula["glib"]
flags = %W[
-I#{gettext.opt_include}
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}/gee-0.8
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-lgee-0.8
-lglib-2.0
-lgobject-2.0
]
on_macos do
flags << "-lintl"
end
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end