homebrew-core/Formula/gupnp.rb

76 lines
2.4 KiB
Ruby

class Gupnp < Formula
include Language::Python::Shebang
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.3.tar.xz"
sha256 "d447e54d88e4a8fab84ad1766070e9208e21166fc7e2ce95df6e33e49e8d29b1"
revision 1
bottle do
cellar :any
sha256 "da351b27a2193be5d836bd5fbd31aab7706f1426b1b6ba9da8c90d2022f4d01c" => :catalina
sha256 "3b1e7a276f6f54f95bcfc0931fe44b33ffbf2d5b9b7c3209262c52e9dede0c4d" => :mojave
sha256 "f5bb73541890d0571feb5ebef958bfb9dff3fc0ff800dce0ac7caa3f1b6a7714" => :high_sierra
end
depends_on "docbook-xsl" => :build
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"
depends_on "python@3.8"
def install
mkdir "build" do
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
system "meson", *std_meson_args, ".."
system "ninja"
system "ninja", "install"
bin.find { |f| rewrite_shebang detected_python_shebang, f }
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