homebrew-core/Formula/gupnp.rb
2020-01-18 11:51:55 +01:00

67 lines
2.2 KiB
Ruby

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.2/gupnp-1.2.2.tar.xz"
sha256 "9a80bd953e5c8772ad26b72f8da01cbe7241a113edd6084903f413ce751c9989"
bottle do
cellar :any
sha256 "8af437527ff0740e1746f470e197231927e0f6c9873ac61c5e3edf6be4758952" => :catalina
sha256 "5d949c4b677089f4aff00e47b25b89edb623aeb9e54f79968573c29eddbd92fb" => :mojave
sha256 "90bedfbb94cade43ff9a0ed9a26ded2070d19f4dabb83bc4d635a6236480626f" => :high_sierra
end
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "gettext"
depends_on "glib"
depends_on "gssdp"
depends_on "libsoup"
def install
mkdir "build" do
system "meson", "--prefix=#{prefix}", ".."
system "ninja"
system "ninja", "install"
end
end
test do
system bin/"gupnp-binding-tool-1.2", "--help"
(testpath/"test.c").write <<~EOS
#include <libgupnp/gupnp-control-point.h>
static GMainLoop *main_loop;
int main (int argc, char **argv)
{
GUPnPContext *context;
GUPnPControlPoint *cp;
context = gupnp_context_new (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.2", "-L#{lib}", "-lgupnp-1.2",
"-I#{Formula["gssdp"].opt_include}/gssdp-1.2",
"-L#{Formula["gssdp"].opt_lib}", "-lgssdp-1.2",
"-I#{Formula["glib"].opt_include}/glib-2.0",
"-I#{Formula["glib"].opt_lib}/glib-2.0/include",
"-L#{Formula["glib"].opt_lib}",
"-lglib-2.0", "-lgobject-2.0",
"-I#{Formula["libsoup"].opt_include}/libsoup-2.4",
"-I#{MacOS.sdk_path}/usr/include/libxml2",
testpath/"test.c", "-o", testpath/"test"
system "./test"
end
end