[gtk-vnc-devel] [patch] versions



Hi, gang!

Due to vinagre get into GNOME 2.22 Desktop, I need to be more careful
when using gtk-vnc trunk.

For example, I'm using the new function
vnc_display_set_lossy_encoding(), available only in trunk. This has
caused some issues on people trying to build vinagre from trunk.

In order to fix this, I created a file vncversion.h.in, similar to
gtkversion.h.in, which we can test if we're compiling against a specific
version of gtk-vnc.

In this case, I could just put in vinagre:
#if VNC_CHECK_VERSION(0, 3, 3)
  vnc_display_set_lossy_encoding (VNC_DISPLAY(tab->priv->vnc), TRUE);
#endif

What do you think about this approach? OK to commit? comments?

Regards,
-- 
Jonh Wendell
www.bani.com.br

diff -r 3a0afe359edf .hgignore
--- a/.hgignore	Wed Jan 16 16:51:46 2008 -0300
+++ b/.hgignore	Sun Jan 20 14:00:13 2008 -0300
@@ -1,6 +1,7 @@
 ^src/\.deps/
 ^src/\.libs/
 ^src/libgtk_vnc_1_0_la-.*
+^src/vncversion.h
 ^.*~
 Makefile$
 Makefile\.in$
diff -r 3a0afe359edf Makefile.am
--- a/Makefile.am	Wed Jan 16 16:51:46 2008 -0300
+++ b/Makefile.am	Sun Jan 20 14:00:13 2008 -0300
@@ -1,7 +1,7 @@
 
 SUBDIRS = src examples plugin
 
-pkgconfig_DATA = @PACKAGE -1 0 pc
+pkgconfig_DATA = @PACKAGE -@VNC_API_VERSION  pc
 pkgconfigdir = $(libdir)/pkgconfig
 
-EXTRA_DIST = $(PACKAGE)-1.0.pc.in $(PACKAGE).spec.in $(PACKAGE).spec
+EXTRA_DIST = $(PACKAGE)- VNC_API_VERSION@.pc.in $(PACKAGE).spec.in $(PACKAGE).spec
diff -r 3a0afe359edf configure.ac
--- a/configure.ac	Wed Jan 16 16:51:46 2008 -0300
+++ b/configure.ac	Sun Jan 20 14:00:13 2008 -0300
@@ -1,6 +1,14 @@ dnl Process this file with autoconf to p
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT([gtk-vnc], [0.3.2], [anthony codemonkey ws])
+m4_define([vnc_major_version], [0])
+m4_define([vnc_minor_version], [3])
+m4_define([vnc_micro_version], [3])
+m4_define([vnc_version],
+          [vnc_major_version.vnc_minor_version.vnc_micro_version])
+# This is the X.Y used in -lgtk-vnc-FOO-X.Y
+m4_define([vnc_api_version], [1.0])
+
+AC_INIT([gtk-vnc], [vnc_version], [http://gtk-vnc.sf.net])
 AC_CONFIG_SRCDIR([src/gvnc.c])
 
 GTK_REQUIRED=2.0.0
@@ -14,14 +22,24 @@ PYTHON_REQUIRED=2.4
 
 AC_CONFIG_HEADERS([config.h:config.hin])
 
-
 AC_CANONICAL_TARGET
 
-AM_INIT_AUTOMAKE(gtk-vnc, 0.3.2)
+AM_INIT_AUTOMAKE(gtk-vnc, vnc_version)
 
 AC_PROG_CC_STDC
 AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
+
+VNC_MAJOR_VERSION=vnc_major_version
+VNC_MINOR_VERSION=vnc_minor_version
+VNC_MICRO_VERSION=vnc_micro_version
+VNC_VERSION=vnc_version
+VNC_API_VERSION=vnc_api_version
+AC_SUBST(VNC_MAJOR_VERSION)
+AC_SUBST(VNC_MINOR_VERSION)
+AC_SUBST(VNC_MICRO_VERSION)
+AC_SUBST(VNC_VERSION)
+AC_SUBST(VNC_API_VERSION)
 
 AC_ARG_WITH(python,
 [  --with-python           build python bindings],
@@ -183,16 +201,19 @@ AM_CONDITIONAL(ENABLE_PLUGIN, [test "$en
 
 AC_CONFIG_FILES(
   Makefile
+  src/vncversion.h
   src/Makefile
   examples/Makefile
   plugin/Makefile
-  gtk-vnc-1.0.pc
+  gtk-vnc-${VNC_API_VERSION}.pc
   gtk-vnc.spec
   )
 
 AC_OUTPUT
 
 echo "
+This is gtk-vnc version ${VNC_VERSION}
+
 Configure summary:
 
 	Compiler ...................:  ${CC} 
diff -r 3a0afe359edf gtk-vnc-1.0.pc.in
--- a/gtk-vnc-1.0.pc.in	Wed Jan 16 16:51:46 2008 -0300
+++ b/gtk-vnc-1.0.pc.in	Sun Jan 20 14:00:13 2008 -0300
@@ -7,5 +7,5 @@ Description: GTK widget for a VNC client
 Description: GTK widget for a VNC client
 Requires: gtk+-2.0 >= @GTK_REQUIRED@, gnutls >= @GNUTLS_REQUIRED@
 Version: @VERSION@
-Libs: -L${libdir} -lgtk-vnc-1.0
-Cflags: -I${includedir}/gtk-vnc-1.0
+Libs: -L${libdir} -lgtk-vnc- VNC_API_VERSION@
+Cflags: -I${includedir}/gtk-vnc- VNC_API_VERSION@
diff -r 3a0afe359edf gtk-vnc.spec.in
--- a/gtk-vnc.spec.in	Wed Jan 16 16:51:46 2008 -0300
+++ b/gtk-vnc.spec.in	Sun Jan 20 14:00:13 2008 -0300
@@ -73,9 +73,9 @@ rm -fr %{buildroot}
 %doc AUTHORS ChangeLog NEWS README COPYING.LIB
 %doc examples/gvncviewer.c
 %{_libdir}/lib*.so
-%dir %{_includedir}/%{name}-1.0/
-%{_includedir}/%{name}-1.0/*.h
-%{_libdir}/pkgconfig/%{name}-1.0.pc
+%dir %{_includedir}/%{name}- VNC_API_VERSION@/
+%{_includedir}/%{name}- VNC_API_VERSION@/*.h
+%{_libdir}/pkgconfig/%{name}- VNC_API_VERSION@.pc
 
 %files python
 %defattr(-, root, root)
diff -r 3a0afe359edf src/Makefile.am
--- a/src/Makefile.am	Wed Jan 16 16:51:46 2008 -0300
+++ b/src/Makefile.am	Sun Jan 20 14:00:13 2008 -0300
@@ -11,8 +11,8 @@ libgtk_vnc_1_0_la_LDFLAGS = -Wl,--versio
 libgtk_vnc_1_0_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libgtk-vnc_sym.version \
                             -version-info 0:1:0
 
-gtk_vnc_includedir = $(includedir)/gtk-vnc-1.0/
-gtk_vnc_include_HEADERS = vncdisplay.h gvnc.h
+gtk_vnc_includedir = $(includedir)/gtk-vnc- VNC_API_VERSION@/
+gtk_vnc_include_HEADERS = vncdisplay.h gvnc.h vncversion.h
 
 libgtk_vnc_1_0_la_SOURCES = blt.h blt1.h \
 	coroutine.h \
@@ -20,7 +20,7 @@ libgtk_vnc_1_0_la_SOURCES = blt.h blt1.h
 	gvnc.h gvnc.c \
 	vncdisplay.h vncdisplay.c \
         vncmarshal.h vncmarshal.c \
-	utils.h
+	utils.h vncversion.h
 
 if WITH_UCONTEXT
 libgtk_vnc_1_0_la_SOURCES += continuation.h continuation.c coroutine_ucontext.c
@@ -43,7 +43,7 @@ if WITH_PYTHON
 if WITH_PYTHON
 pyexec_LTLIBRARIES = gtkvnc.la
 
-gtkvnc_la_LIBADD = libgtk-vnc-1.0.la @PYGTK_LIBS@
+gtkvnc_la_LIBADD = libgtk-vnc- VNC_API_VERSION@.la @PYGTK_LIBS@
 # Auto-generated C code for Python binding is full of compiler warnings :-(
 #gtkvnc_la_CFLAGS = @GTK_CFLAGS@ @WARNING_CFLAGS@ @PYTHON_INCLUDES@ @PYGTK_CFLAGS@
 gtkvnc_la_CFLAGS = @GTK_CFLAGS@ @PYTHON_INCLUDES@ @PYGTK_CFLAGS@ @DEBUG_CFLAGS@
diff -r 3a0afe359edf src/vncdisplay.h
--- a/src/vncdisplay.h	Wed Jan 16 16:51:46 2008 -0300
+++ b/src/vncdisplay.h	Sun Jan 20 14:00:13 2008 -0300
@@ -17,6 +17,7 @@ typedef struct _VncDisplayPrivate VncDis
 
 #include <gtk/gtkdrawingarea.h>
 #include <glib.h>
+#include <vncversion.h>
 
 #define VNC_TYPE_DISPLAY (vnc_display_get_type())
 #define VNC_TYPE_DISPLAY_CREDENTIAL (vnc_display_credential_get_type())
diff -r 3a0afe359edf src/vncversion.h.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/vncversion.h.in	Sun Jan 20 14:00:13 2008 -0300
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006  Anthony Liguori <anthony codemonkey ws>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *  GTK VNC Widget
+ */
+
+#ifndef __VNC_VERSION_H__
+#define __VNC_VERSION_H__
+
+/* compile time version
+ */
+#define VNC_MAJOR_VERSION				(@VNC_MAJOR_VERSION@)
+#define VNC_MINOR_VERSION				(@VNC_MINOR_VERSION@)
+#define VNC_MICRO_VERSION				(@VNC_MICRO_VERSION@)
+
+/* check whether a VncDisplay version equal to or greater than
+ * major.minor.micro is present.
+ */
+#define	VNC_CHECK_VERSION(major,minor,micro)	\
+    (VNC_MAJOR_VERSION > (major) || \
+     (VNC_MAJOR_VERSION == (major) && VNC_MINOR_VERSION > (minor)) || \
+     (VNC_MAJOR_VERSION == (major) && VNC_MINOR_VERSION == (minor) && \
+      VNC_MICRO_VERSION >= (micro)))
+
+#endif /* __VNC_VERSION_H__ */
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]