homebrew-core/Formula/json-glib.rb
2016-06-23 22:00:10 +01:00

55 lines
1.7 KiB
Ruby

class JsonGlib < Formula
desc "Library for JSON, based on GLib"
homepage "https://live.gnome.org/JsonGlib"
url "https://download.gnome.org/sources/json-glib/1.2/json-glib-1.2.0.tar.xz"
sha256 "99d6dfbe49c08fd7529f1fe8dcb1893b810a1bb222f1e7b65f41507658b8a7d3"
bottle do
sha256 "552b84c3d28960bbd36105d0325c6a5ac9b7c1abb722e7cb3b8a4785f1acffc5" => :el_capitan
sha256 "d9e25aeb683db66120566da0d01079bc05866e7e42465db2abd468e3a36d3597" => :yosemite
sha256 "3f0b31f25463eed33c0cc15d9593a121412b23216d2ac2956a64627d87526548" => :mavericks
end
depends_on "pkg-config" => :build
depends_on "glib"
depends_on "gobject-introspection"
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--enable-introspection=yes"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <json-glib/json-glib.h>
int main(int argc, char *argv[]) {
JsonParser *parser = json_parser_new();
return 0;
}
EOS
gettext = Formula["gettext"]
glib = Formula["glib"]
flags = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split
flags += %W[
-I#{gettext.opt_include}
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}/json-glib-1.0
-D_REENTRANT
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lintl
-ljson-glib-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end