homebrew-core/Formula/jsonrpc-glib.rb
2018-08-26 10:07:21 +02:00

70 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.28/jsonrpc-glib-3.28.1.tar.xz"
sha256 "cf2ac25944c3990904d63999deea3add38d99ea2fad16f335a996fd9a8706e2b"
bottle do
sha256 "d4abbc2258745ab94a07e6a05d3db29910daa631a8d81465bbe4020a7f0ac4c7" => :mojave
sha256 "5bc3503c765ac68aefbbf6b4d13ce5f7f16abfe19b4e47434631e397f597344c" => :high_sierra
sha256 "19e6c73cc0974615cb6ad8f2a321dc12dd8d6b62564d1959b91a65603c98fcd8" => :sierra
sha256 "c8d9b3ff3b6a69eb3cc6f52c551284578ce7edaadf38409e88974e0ac5deeace" => :el_capitan
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 "glib"
depends_on "json-glib"
def install
ENV.refurbish_args
mkdir "build" do
system "meson", "--prefix=#{prefix}", "-Dwith_vapi=false", ".."
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