class Gupnp < Formula desc "Framework for creating UPnP devices and control points" homepage "https://wiki.gnome.org/Projects/GUPnP" url "https://download.gnome.org/sources/gupnp/1.0/gupnp-1.0.3.tar.xz" sha256 "794b162ee566d85eded8c3f3e8c9c99f6b718a6b812d8b56f0c2ed72ac37cbbb" bottle do cellar :any sha256 "a89d7df0d7f7b89bb3b2218445c908497a9ab9e0d61a4c5d6b56d4fcbf265f65" => :high_sierra sha256 "5bd40488125dc5c85ea820941128948bbd0cfcf040d26e0871128a62efbc1c52" => :sierra sha256 "1af28d4893393c049714b924eb012c6c2554d8ddf3acf95d9b765ef74fe6f6d3" => :el_capitan end depends_on "pkg-config" => :build depends_on "intltool" => :build depends_on "gettext" depends_on "glib" depends_on "libsoup" depends_on "gssdp" def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}" system "make", "install" end test do system bin/"gupnp-binding-tool", "--help" (testpath/"test.c").write <<~EOS #include static GMainLoop *main_loop; int main (int argc, char **argv) { GUPnPContext *context; GUPnPControlPoint *cp; context = gupnp_context_new (NULL, NULL, 0, NULL); cp = gupnp_control_point_new (context, "urn:schemas-upnp-org:service:WANIPConnection:1"); main_loop = g_main_loop_new (NULL, FALSE); g_main_loop_unref (main_loop); g_object_unref (cp); g_object_unref (context); return 0; } EOS system ENV.cc, "-I#{include}/gupnp-1.0", "-L#{lib}", "-lgupnp-1.0", "-I#{Formula["gssdp"].opt_include}/gssdp-1.0", "-L#{Formula["gssdp"].opt_lib}", "-lgssdp-1.0", "-I#{Formula["glib"].opt_include}/glib-2.0", "-I#{Formula["glib"].opt_lib}/glib-2.0/include", "-lglib-2.0", "-lgobject-2.0", "-I#{Formula["libsoup"].opt_include}/libsoup-2.4", "-I/usr/include/libxml2", testpath/"test.c", "-o", testpath/"test" system "./test" end end