From 879667599e3c18291d0315250c2670b3e145f156 Mon Sep 17 00:00:00 2001 From: Jeffrey Wildman Date: Sun, 6 Jan 2019 15:51:51 -0500 Subject: [PATCH] spice-gtk: update deps, add test, remove patch in favor of CFLAGS with -ObjC --- spice-gtk.rb | 129 +++++++++++++++++++++------------------------------ 1 file changed, 52 insertions(+), 77 deletions(-) diff --git a/spice-gtk.rb b/spice-gtk.rb index 010fadd..92cc142 100644 --- a/spice-gtk.rb +++ b/spice-gtk.rb @@ -3,6 +3,7 @@ class SpiceGtk < Formula homepage "https://www.spice-space.org" url "https://www.spice-space.org/download/gtk/spice-gtk-0.35.tar.bz2" sha256 "b4e6073de5125e2bdecdf1fbe7c9e8c4cabe9c85518889b42f72bf63c8ab9e86" + revision 1 depends_on "autoconf" => :build depends_on "autogen" => :build @@ -13,12 +14,20 @@ class SpiceGtk < Formula depends_on "pkg-config" => :build depends_on "vala" => :build + depends_on "atk" depends_on "cairo" depends_on "gdk-pixbuf" depends_on "gettext" depends_on "glib" + depends_on "gst-libav" + depends_on "gst-plugins-bad" + depends_on "gst-plugins-base" + depends_on "gst-plugins-good" + depends_on "gst-plugins-ugly" + depends_on "gstreamer" depends_on "gtk+3" depends_on "jpeg" + depends_on "libusb" depends_on "lz4" depends_on "openssl" depends_on "opus" @@ -27,85 +36,51 @@ class SpiceGtk < Formula depends_on "spice-protocol" depends_on "usbredir" - # for --enable-gst(audio|video) - depends_on "gstreamer" - depends_on "gst-libav" - depends_on "gst-plugins-base" - depends_on "gst-plugins-good" - depends_on "gst-plugins-bad" - depends_on "gst-plugins-ugly" - - # compile vncdisplaykeymap.c as objc to fix include issue - patch :DATA - def install - ENV["CFLAGS"] = "-Wno-cast-align -Wno-error" - ENV["XML_CATALOG_FILES"] = "/usr/local/etc/xml/catalog" + # Some files (vncdisplaykeymap.c) require building as Objective-C + # https://www.mail-archive.com/spice-devel@lists.freedesktop.org/msg40085.html + ENV["CFLAGS"] = "-ObjC -g -O2" - mv "src/vncdisplaykeymap.c", "src/vncdisplaykeymap.m" - - system "autoreconf", "-v", "--force", "--install" - system "./configure", "--disable-dependency-tracking", - "--disable-silent-rules", - "--with-gtk=3.0", - "--enable-introspection", - "--enable-vala", - "--enable-gstvideo", - "--enable-gstaudio", - "--enable-gstreamer=1.0", - "--with-lz4", - "--with-coroutine=gthread", - "--prefix=#{prefix}" + args = %W[ + --disable-dependency-tracking + --disable-silent-rules + --enable-introspection + --enable-gstvideo + --enable-gstaudio + --enable-gstreamer=1.0 + --enable-vala + --with-coroutine=gthread + --with-gtk=3.0 + --with-lz4 + --prefix=#{prefix} + ] + system "./configure", *args system "make", "install" end + + test do + (testpath/"test.cpp").write <<~EOS + #include + #include + int main() { + return spice_session_new() ? 0 : 1; + } + EOS + system ENV.cc, "test.cpp", + "-I#{Formula["spice-protocol"].include}/spice-1", + "-I#{Formula["glib"].include}/glib-2.0", + "-I#{Formula["glib"].lib}/glib-2.0/include", + "-I#{Formula["atk"].include}/atk-1.0", + "-I#{Formula["gdk-pixbuf"].include}/gdk-pixbuf-2.0", + "-I#{Formula["cairo"].include}/cairo", + "-I#{Formula["pango"].include}/pango-1.0", + "-I#{Formula["gtk+3"].include}/gtk-3.0", + "-I#{include}/spice-client-glib-2.0", + "-I#{include}/spice-client-gtk-3.0", + "-L#{lib}", + "-lspice-client-glib-2.0", + "-lspice-client-gtk-3.0", + "-o", "test" + system "./test" + end end -__END__ -diff --git a/configure.ac b/configure.ac -index f915d81..10ef73d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -25,6 +25,7 @@ AC_SUBST(SPICE_GTK_LOCALEDIR) - - GTK_DOC_CHECK([1.14],[--flavour no-tmpl]) - -+AC_PROG_OBJC - AC_PROG_CC - AC_PROG_CC_C99 - if test "x$ac_cv_prog_cc_c99" = xno; then -diff --git a/src/Makefile.am b/src/Makefile.am -index 5430d84..dad3fa5 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -125,7 +125,7 @@ SPICE_GTK_SOURCES_COMMON = \ - spice-widget.c \ - spice-widget-priv.h \ - spice-file-transfer-task.h \ -- vncdisplaykeymap.c \ -+ vncdisplaykeymap.m \ - vncdisplaykeymap.h \ - spice-grabsequence.c \ - spice-grabsequence.h \ -@@ -481,7 +481,7 @@ spice-widget-enums.h: spice-widget.h - $< > $@ - - --vncdisplaykeymap.c: $(KEYMAPS) -+vncdisplaykeymap.m: $(KEYMAPS) - $(KEYMAPS): $(srcdir)/$(KEYMAP_GEN) $(srcdir)/$(KEYMAP_CSV) - - vncdisplaykeymap_xorgevdev2xtkbd.c: -diff --git a/spice-common/m4/spice-deps.m4 b/spice-common/m4/spice-deps.m4 -index 68e3091..2e4c305 100644 ---- a/spice-common/m4/spice-deps.m4 -+++ b/spice-common/m4/spice-deps.m4 -@@ -1,10 +1,3 @@ --# For autoconf < 2.63 --m4_ifndef([AS_VAR_APPEND], -- AC_DEFUN([AS_VAR_APPEND], $1=$$1$2)) --m4_ifndef([AS_VAR_COPY], -- [m4_define([AS_VAR_COPY], -- [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])]) -- - - # SPICE_WARNING(warning) - # SPICE_PRINT_MESSAGES