class Libnice < Formula desc "GLib ICE implementation" homepage "https://wiki.freedesktop.org/nice/" url "https://nice.freedesktop.org/releases/libnice-0.1.16.tar.gz" sha256 "06b678066f94dde595a4291588ed27acd085ee73775b8c4e8399e28c01eeefdf" revision 1 bottle do cellar :any sha256 "a5ef1e08fe29a17e47670e854e946b15c7c4c62bab5638df797fd315863b5bdb" => :mojave sha256 "2c27b6b47ed04298c57ef98e1e639cd29ba98e634a7be954fc7d4ed06c96f82b" => :high_sierra sha256 "d0c005749a7f6c923e1e704a92229c40cae62d3f20ddc60c999557a3c5e09a5a" => :sierra end depends_on "pkg-config" => :build depends_on "glib" depends_on "gnutls" depends_on "gstreamer" def install system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}" system "make", "install" end test do # Based on https://github.com/libnice/libnice/blob/master/examples/simple-example.c (testpath/"test.c").write <<~EOS #include int main(int argc, char *argv[]) { NiceAgent *agent; GMainLoop *gloop; gloop = g_main_loop_new(NULL, FALSE); // Create the nice agent agent = nice_agent_new(g_main_loop_get_context (gloop), NICE_COMPATIBILITY_RFC5245); if (agent == NULL) g_error("Failed to create agent"); g_main_loop_unref(gloop); g_object_unref(agent); 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}/nice -D_REENTRANT -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{lib} -lgio-2.0 -lglib-2.0 -lgobject-2.0 -lintl -lnice ] system ENV.cc, *flags, "test.c", "-o", "test" system "./test" end end