homebrew-core/Formula/json-glib.rb

62 lines
1.6 KiB
Ruby

class JsonGlib < Formula
desc "Library for JSON, based on GLib"
homepage "https://wiki.gnome.org/Projects/JsonGlib"
url "https://download.gnome.org/sources/json-glib/1.6/json-glib-1.6.0.tar.xz"
sha256 "0d7c67602c4161ea7070fab6c5823afd9bd7f7bc955f652a50d3753b08494e73"
license "LGPL-2.1-or-later"
livecheck do
url :stable
end
bottle do
sha256 "7a4f86a42a66360951fcbeac7ddcda95288fa3cd7fc5aee8d297fe31540e048f" => :catalina
sha256 "8f0e9b27a61d547cb185eb2952fb81e2bcf2ad502e459a7ec2037e505281e060" => :mojave
sha256 "6b72cc181e7ee816a8444adc59373b51033712dc8fc58b73531cc9fefbd0bd5e" => :high_sierra
end
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "glib"
def install
mkdir "build" do
system "meson", *std_meson_args, "-Dintrospection=enabled", ".."
system "ninja"
system "ninja", "install"
end
end
test do
(testpath/"test.c").write <<~EOS
#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 = %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