homebrew-core/Formula/jsonrpc-glib.rb
2018-10-30 17:27:31 +01:00

71 lines
2.1 KiB
Ruby

class JsonrpcGlib < Formula
desc "GNOME library to communicate with JSON-RPC based peers"
homepage "https://gitlab.gnome.org/GNOME/jsonrpc-glib"
url "https://download.gnome.org/sources/jsonrpc-glib/3.30/jsonrpc-glib-3.30.1.tar.xz"
sha256 "b675ce6f414fb8fc9eeed1ad340dc6d08fc329ed67af927bb0fa6a5d7d731dc7"
bottle do
rebuild 1
sha256 "4d2d67165d006e7f07116ee672c8e14e9d5bdb50a315b56221177c32dc298207" => :mojave
sha256 "7f4086decc07f94e58d32b2411277c8910dc74e9875ef45dd609acbad20aa001" => :high_sierra
sha256 "ac1bbbfd5edb3f6e121df91e3d71ec15e116a5fcf760a205d2e5bf7a0d0e81f1" => :sierra
end
depends_on "gobject-introspection" => :build
depends_on "meson-internal" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "python" => :build
depends_on "vala" => :build
depends_on "glib"
depends_on "json-glib"
def install
ENV.refurbish_args
mkdir "build" do
system "meson", "--prefix=#{prefix}", "-Dwith_vapi=true", ".."
system "ninja"
system "ninja", "install"
end
end
test do
(testpath/"test.c").write <<~EOS
#include <jsonrpc-glib.h>
int main(int argc, char *argv[]) {
JsonrpcInputStream *stream = jsonrpc_input_stream_new(NULL);
return 0;
}
EOS
gettext = Formula["gettext"]
glib = Formula["glib"]
json_glib = Formula["json-glib"]
pcre = Formula["pcre"]
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}/jsonrpc-glib-1.0
-I#{json_glib.opt_include}/json-glib-1.0
-I#{pcre.opt_include}
-D_REENTRANT
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{json_glib.opt_lib}
-L#{lib}
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lintl
-ljson-glib-1.0
-ljsonrpc-glib-1.0
-Wl,-framework
-Wl,CoreFoundation
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end