[Spice-devel] [PATCH spice-gtk] Make phodav an optionnal external dependency

Christophe Fergeau cfergeau at redhat.com
Wed Apr 2 02:38:06 PDT 2014


'optional' in the subject

On Tue, Apr 01, 2014 at 05:03:43PM +0200, Marc-André Lureau wrote:
> Now that upstream provides a stable/versionnized API, it will be

versioned

> easier to deal with than with submodules.
> ---
>  .gitmodules              |  3 ---
>  autogen.sh               |  1 -
>  configure.ac             | 16 ++++++++++++----
>  gtk/Makefile.am          |  6 +++---
>  gtk/channel-webdav.c     | 10 +++++++++-
>  gtk/phodav               |  1 -
>  gtk/spice-channel.c      |  4 ++++
>  gtk/spice-session-priv.h | 10 +++++++++-
>  8 files changed, 37 insertions(+), 14 deletions(-)
>  delete mode 160000 gtk/phodav
> 
> diff --git a/.gitmodules b/.gitmodules
> index cfce54a..0c618ee 100644
> --- a/.gitmodules
> +++ b/.gitmodules
> @@ -1,6 +1,3 @@
>  [submodule "spice-common"]
>  	path = spice-common
>  	url = ../spice-common
> -[submodule "gtk/phodav"]
> -	path = gtk/phodav
> -	url = git://git.gnome.org/phodav
> diff --git a/autogen.sh b/autogen.sh
> index d71be70..7b4415f 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -6,7 +6,6 @@ srcdir=`dirname $0`
>  test -z "$srcdir" && srcdir=.
>  
>  git submodule update --init --recursive
> -(cd "$srcdir/gtk/phodav/" && intltoolize -f)
>  
>  gtkdocize
>  autoreconf -v --force --install
> diff --git a/configure.ac b/configure.ac
> index dc6a4ad..19f767d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -75,8 +75,6 @@ AC_CONFIG_SUBDIRS([spice-common])
>  COMMON_CFLAGS='-I ${top_srcdir}/spice-common/ -I ${top_srcdir}/spice-common/spice-protocol/'
>  AC_SUBST(COMMON_CFLAGS)
>  
> -AC_CONFIG_SUBDIRS([gtk/phodav])
> -
>  SPICE_GTK_MAJOR_VERSION=`echo $PACKAGE_VERSION | cut -d. -f1`
>  SPICE_GTK_MINOR_VERSION=`echo $PACKAGE_VERSION | cut -d. -f2`
>  SPICE_GTK_MICRO_VERSION=`echo $PACKAGE_VERSION | cut -d. -f3 | cut -d- -f1`
> @@ -270,6 +268,15 @@ AC_SUBST(GTHREAD_CFLAGS)
>  AC_SUBST(GTHREAD_LIBS)
>  
>  PKG_CHECK_MODULES(SOUP, libsoup-2.4)
> +AC_SUBST(SOUP_CFLAGS)
> +AC_SUBST(SOUP_LIBS)
> +

This bit could go in a separate commit

> +PKG_CHECK_MODULES(PHODAV, [libphodav-1.0], [have_phodav=yes], [have_phodav=no])

I assume phodav shipping a .pc file is a recent thing, and that any version
with the libphodav-1.0.pc will be new enough for spice-gtk to be able to
use it? Or do we need to check for libphodav-1.0 > $someversion here?


> +AC_SUBST(PHODAV_CFLAGS)
> +AC_SUBST(PHODAV_LIBS)
> +AM_CONDITIONAL([WITH_PHODAV], [test "x$have_phodav" = "xyes"])

The conditional does not seem to be used ?

> +AS_IF([test "x$have_phodav" = "xyes"],
> +       AC_DEFINE(USE_PHODAV, [1], [Define if supporting phodav]))
>  
>  AC_ARG_WITH([audio],
>    AS_HELP_STRING([--with-audio=@<:@gstreamer/pulse/auto/no@:>@], [Select audio backend @<:@default=auto@:>@]),
> @@ -738,15 +745,16 @@ AC_MSG_NOTICE([
>  
>          prefix:                   ${prefix}
>          c compiler:               ${CC}
> +        Target:                   ${red_target}
> +        Gtk:                      $GTK_API_VERSION

NACK to doing this bit here.

>  
>          Coroutine:                ${with_coroutine}
>          Audio:                    ${with_audio}
> -        Target:                   ${red_target}
>          SASL support:             ${enable_sasl}
>          Smartcard support:        ${have_smartcard}
>          USB redirection support:  ${have_usbredir} ${with_usbredir_hotplug}
> -        Gtk:                      $GTK_API_VERSION
>          DBus:                     ${have_dbus}
> +        PhoDAV:                   ${have_phodav}
>  
>          Now type 'make' to build $PACKAGE
>  
> diff --git a/gtk/Makefile.am b/gtk/Makefile.am
> index 2e38cce..e28220c 100644
> --- a/gtk/Makefile.am
> +++ b/gtk/Makefile.am
> @@ -1,6 +1,5 @@
>  NULL =
> -
> -SUBDIRS = phodav
> +SUBDIRS =
>  
>  if WITH_CONTROLLER
>  SUBDIRS += controller
> @@ -97,6 +96,7 @@ SPICE_COMMON_CPPFLAGS =						\
>  	$(USBREDIR_CFLAGS)					\
>  	$(GUDEV_CFLAGS)						\
>  	$(SOUP_CFLAGS)						\
> +	$(PHODAV_CFLAGS)					\
>  	$(NULL)
>  
>  AM_CPPFLAGS =					\
> @@ -186,7 +186,6 @@ libspice_client_glib_2_0_la_LDFLAGS =	\
>  libspice_client_glib_2_0_la_LIBADD =					\
>  	$(top_builddir)/spice-common/common/libspice-common.la		\
>  	$(top_builddir)/spice-common/common/libspice-common-client.la	\
> -	phodav/libphodav.la						\
>  	$(GLIB2_LIBS)							\
>  	$(SOUP_LIBS)							\
>  	$(GOBJECT2_LIBS)						\
> @@ -202,6 +201,7 @@ libspice_client_glib_2_0_la_LIBADD =					\
>  	$(SMARTCARD_LIBS)						\
>  	$(USBREDIR_LIBS)						\
>  	$(GUDEV_LIBS)							\
> +	$(PHODAV_LIBS)							\
>  	$(NULL)
>  
>  if WITH_POLKIT
> diff --git a/gtk/channel-webdav.c b/gtk/channel-webdav.c
> index 2bee513..c619e48 100644
> --- a/gtk/channel-webdav.c
> +++ b/gtk/channel-webdav.c
> @@ -15,6 +15,8 @@
>     You should have received a copy of the GNU Lesser General Public
>     License along with this library; if not, see <http://www.gnu.org/licenses/>.
>  */
> +#include "config.h"
> +
>  #include "spice-client.h"
>  #include "spice-common.h"
>  #include "spice-channel-priv.h"
> @@ -642,6 +644,7 @@ static void spice_webdav_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg)
>  
>  
>  
> +#ifdef USE_PHODAV
>  static void new_connection(SoupSocket *sock,
>                             SoupSocket *new,
>                             gpointer    user_data)
> @@ -715,12 +718,14 @@ static PhodavServer* webdav_server_new(SpiceSession *session)
>  
>      return dav;
>  }
> +#endif /* USE_PHODAV */
>  
>  static PhodavServer* phodav_server_get(SpiceSession *session, gint *port)
>  {
>      g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
>  
> -    PhodavServer *self;
> +#ifdef USE_PHODAV
> +    PhodavServer *self = NULL;
>      static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
>  
>      g_static_mutex_lock(&mutex);
> @@ -735,4 +740,7 @@ static PhodavServer* phodav_server_get(SpiceSession *session, gint *port)
>          *port = phodav_server_get_port(self);
>  
>      return self;
> +#else
> +    g_return_val_if_reached(NULL);
> +#endif
>  }
> diff --git a/gtk/phodav b/gtk/phodav
> deleted file mode 160000
> index 2f53900..0000000
> --- a/gtk/phodav
> +++ /dev/null
> @@ -1 +0,0 @@
> -Subproject commit 2f53900e88eab21b5bd023145e0a6cce3b9cfe0c
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index 6f3f689..e460590 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -1945,7 +1945,9 @@ gchar *spice_channel_supported_string(void)
>  #ifdef USE_USBREDIR
>                       spice_channel_type_to_string(SPICE_CHANNEL_USBREDIR),
>  #endif
> +#ifdef USE_PHODAV
>                       spice_channel_type_to_string(SPICE_CHANNEL_WEBDAV),
> +#endif
>                       NULL);
>  }
>  
> @@ -2010,10 +2012,12 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
>          break;
>      }
>  #endif
> +#ifdef USE_PHODAV
>      case SPICE_CHANNEL_WEBDAV: {
>          gtype = SPICE_TYPE_WEBDAV_CHANNEL;
>          break;
>      }
> +#endif
>      case SPICE_CHANNEL_PORT:
>          gtype = SPICE_TYPE_PORT_CHANNEL;
>          break;
> diff --git a/gtk/spice-session-priv.h b/gtk/spice-session-priv.h
> index 94535a8..4b2c151 100644
> --- a/gtk/spice-session-priv.h
> +++ b/gtk/spice-session-priv.h
> @@ -18,12 +18,20 @@
>  #ifndef __SPICE_CLIENT_SESSION_PRIV_H__
>  #define __SPICE_CLIENT_SESSION_PRIV_H__
>  
> +#include "config.h"
> +
>  #include <glib.h>
>  #include <gio/gio.h>
> +
> +#ifdef USE_PHODAV
> +#include <libphodav/phodav.h>
> +#else
> +typedef struct _PhodavServer PhodavServer;
> +#endif
> +
>  #include "desktop-integration.h"
>  #include "spice-session.h"
>  #include "spice-gtk-session.h"
> -#include "phodav/libphodav/phodav.h"
>  #include "spice-channel-cache.h"
>  #include "decode.h"
>  

I've tested compilation without phodav installed on my machine, and things
were fine, so ACK with these various small things addressed.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140402/c08aa32e/attachment.sig>


More information about the Spice-devel mailing list