Submitted By: Alexander E. Patrakov
Date: 2004-02-25
Origin: http://www.eng.uwaterloo.ca/~ejones/software/xdelta-win32.html
(autoconf fixes are by me)
Initial Package Version: 1.1.3
Description: Use glib2 instead of glib1.

After patching, run:
./autogen.sh --prefix=/usr

diff -ur xdelta-1.1.3.old/configure.in xdelta-1.1.3/configure.in
--- xdelta-1.1.3.old/configure.in	2001-09-24 12:59:17.000000000 +0600
+++ xdelta-1.1.3/configure.in	2004-02-25 17:57:09.000000000 +0500
@@ -71,13 +71,13 @@
 top_srcdir_absolute=`cd $srcdir; pwd`
 AC_SUBST(top_srcdir_absolute)
 
-AM_PATH_GLIB(1.2.8,,
-  AC_MSG_ERROR(Test for GLIB failed. Download it from ftp://ftp.gtk.org/pub/gtk/v1.2/))
+PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.0.0)
 
-AC_CHECK_LIB(z, gzsetparams,
-  AC_CHECK_HEADER(zlib.h,,
-    AC_MSG_ERROR(ZLIB headers not found)),
-  AC_MSG_ERROR(ZLIB library not found))
+AC_CHECK_LIB(z, gzsetparams,,
+    AC_MSG_ERROR(ZLIB library not found))
+
+AC_CHECK_HEADER(zlib.h,,
+    AC_MSG_ERROR(ZLIB headers not found))
 
 AC_OUTPUT(Makefile
 	  doc/Makefile
@@ -86,6 +86,5 @@
 	  xdelta-config
 	  libedsio/Makefile
 	  libedsio/edsio-comp,
-
 	  chmod +x libedsio/edsio-comp xdelta-config
 	  )
diff -ur xdelta-1.1.3.old/libedsio/edsio.c xdelta-1.1.3/libedsio/edsio.c
--- xdelta-1.1.3.old/libedsio/edsio.c	2001-09-24 12:48:52.000000000 +0600
+++ xdelta-1.1.3/libedsio/edsio.c	2004-02-25 18:06:42.311810464 +0500
@@ -293,7 +293,6 @@
 
 #else
 
-  struct timeval tv;
   time_t t = time (NULL);
 
   if (t < 0)
@@ -305,7 +304,7 @@
   if (setme)
     {
       setme->nanos = 0;
-      setme->seconds = tv.tv_sec;
+      setme->seconds = t;
     }
 
 #endif
@@ -1485,126 +1484,8 @@
 /* Missing glib stuff
  */
 
-GQueue *
-g_queue_new (void)
-{
-  GQueue *q = g_new (GQueue, 1);
-
-  q->list = q->list_end = NULL;
-  q->list_size = 0;
-
-  return q;
-}
-
-
-void
-g_queue_free (GQueue *q)
-{
-  if (q)
-    {
-      if (q->list)
-        g_list_free (q->list);
-      g_free (q);
-    }
-}
-
-
 guint
 g_queue_get_size (GQueue *q)
 {
-  return (q == NULL) ? 0 : q->list_size;
-}
-
-
-void
-g_queue_push_front (GQueue *q, gpointer data)
-{
-  if (q)
-    {
-      q->list = g_list_prepend (q->list, data);
-
-      if (q->list_end == NULL)
-        q->list_end = q->list;
-
-      q->list_size++;
-    }
-}
-
-
-void
-g_queue_push_back (GQueue *q, gpointer data)
-{
-  if (q)
-    {
-      q->list_end = g_list_append (q->list_end, data);
-
-      if (! q->list)
-        q->list = q->list_end;
-      else
-        q->list_end = q->list_end->next;
-
-      q->list_size++;
-    }
-}
-
-
-gpointer
-g_queue_pop_front (GQueue *q)
-{
-  gpointer data = NULL;
-
-  if ((q) && (q->list))
-    {
-      GList *node;
-
-      node = q->list;
-      data = node->data;
-
-      if (! node->next)
-        {
-          q->list = q->list_end = NULL;
-          q->list_size = 0;
-        }
-      else
-        {
-          q->list = node->next;
-          q->list->prev = NULL;
-          q->list_size--;
-        }
-
-      g_list_free_1 (node);
-    }
-
-  return data;
-}
-
-
-gpointer
-g_queue_pop_back (GQueue *q)
-{
-  gpointer data = NULL;
-
-  if ((q) && (q->list))
-    {
-      GList *node;
-
-      node = q->list_end;
-      data = node->data;
-
-      if (! node->prev)
-	{
-          q->list = q->list_end = NULL;
-          q->list_size = 0;
-        }
-      else
-	{
-          q->list_end = node->prev;
-          q->list_end->next = NULL;
-          q->list_size--;
-        }
-
-      g_list_free_1 (node);
-    }
-
-  return data;
+  return (q == NULL) ? 0 : q->length;
 }
diff -ur xdelta-1.1.3.old/libedsio/edsio.h xdelta-1.1.3/libedsio/edsio.h
--- xdelta-1.1.3.old/libedsio/edsio.h	2001-06-12 09:16:41.000000000 +0600
+++ xdelta-1.1.3/libedsio/edsio.h	2004-02-25 18:06:42.312810312 +0500
@@ -480,48 +480,14 @@
 
 #endif
 
-/* Missing glib stuff
+/* Missing glib stuff:
+ * Queues
  */
 
-typedef struct _GQueue		GQueue;
-
-struct _GQueue
-{
-  GList *list;
-  GList *list_end;
-  guint list_size;
-};
-
-/* Queues
- */
-
-GQueue *	g_queue_new		(void);
-void		g_queue_free		(GQueue *q);
 guint		g_queue_get_size	(GQueue *q);
-void		g_queue_push_front	(GQueue *q, gpointer data);
-void		g_queue_push_back	(GQueue *q, gpointer data);
-gpointer	g_queue_pop_front	(GQueue *q);
-gpointer	g_queue_pop_back	(GQueue *q);
-
-#define g_queue_empty(queue) \
-	((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? FALSE : TRUE)
-
-#define g_queue_peek_front(queue) \
-	((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? \
-		((GQueue *)(queue))->list->data : NULL)
-
-#define g_queue_peek_back(queue) \
-	((((GQueue *)(queue)) && ((GQueue *)(queue))->list_end) ? \
-		((GQueue *)(queue))->list_end->data : NULL)
-
-#define g_queue_index(queue,ptr) \
-	((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? \
-		g_list_index (((GQueue *)(queue))->list, (ptr)) : -1)
-
-#define		g_queue_push		g_queue_push_back
-#define		g_queue_pop		g_queue_pop_front
-#define		g_queue_peek		g_queue_peek_front
 
+#define		g_queue_pop		g_queue_pop_head
+#define		g_queue_push		g_queue_push_tail
 
 #ifdef __cplusplus
 }
diff -ur xdelta-1.1.3.old/libedsio/Makefile.am xdelta-1.1.3/libedsio/Makefile.am
--- xdelta-1.1.3.old/libedsio/Makefile.am	2001-06-24 13:44:27.000000000 +0600
+++ xdelta-1.1.3/libedsio/Makefile.am	2004-02-25 18:02:37.000000000 +0500
@@ -1,5 +1,5 @@
 
-INCLUDES = $(GLIB_CFLAGS)
+INCLUDES = $(GLIB2_CFLAGS)
 
 noinst_SCRIPTS = edsio-comp
 
@@ -9,13 +9,13 @@
 
 edsiotest_SOURCES = edsiotest.c
 
-edsiotest_LDADD = libedsio.la $(GLIB_LIBS)
+edsiotest_LDADD = libedsio.la $(GLIB2_LIBS)
 
 noinst_HEADERS = maketime.h partime.h
 
 include_HEADERS = edsio.h edsio_edsio.h
 
-libedsio_la_LIBADD = $(GLIB_LIBS)
+libedsio_la_LIBADD = $(GLIB2_LIBS)
 
 libedsio_la_SOURCES =				\
 	library.c				\
diff -ur xdelta-1.1.3.old/Makefile.am xdelta-1.1.3/Makefile.am
--- xdelta-1.1.3.old/Makefile.am	2001-06-24 13:30:28.000000000 +0600
+++ xdelta-1.1.3/Makefile.am	2004-02-25 18:02:06.000000000 +0500
@@ -1,5 +1,5 @@
 
-INCLUDES = -I$(top_srcdir)/libedsio $(GLIB_CFLAGS)
+INCLUDES = -I$(top_srcdir)/libedsio $(GLIB2_CFLAGS)
 
 bin_PROGRAMS    = xdelta
 bin_SCRIPTS	= xdelta-config
@@ -8,7 +8,7 @@
 
 xdelta_LDADD    = libxdelta.la				\
 		  $(top_srcdir)/libedsio/libedsio.la	\
-		  $(GLIB_LIBS)				\
+		  $(GLIB2_LIBS)				\
 		  -lz
 
 include_HEADERS = xdelta.h xd_edsio.h
@@ -17,7 +17,7 @@
 lib_LTLIBRARIES = libxdelta.la
 
 libxdelta_la_SOURCES = xdelta.c xdapply.c $(SER_SOURCES)
-libxdelta_la_LIBADD  = $(GLIB_LIBS)
+libxdelta_la_LIBADD  = $(GLIB2_LIBS)
 
 EXTRA_DIST = xd.ser $(SER_OUT) xdelta.magic xdelta.prj xdelta.m4	\
 	autogen.sh xdelta.dsp xdelta.dsw stamp-ser xdrsync.c
diff -ur xdelta-1.1.3.old/test/Makefile.am xdelta-1.1.3/test/Makefile.am
--- xdelta-1.1.3.old/test/Makefile.am	2001-06-24 13:44:10.000000000 +0600
+++ xdelta-1.1.3/test/Makefile.am	2004-02-25 18:02:49.000000000 +0500
@@ -1,7 +1,7 @@
 
 EXTRA_DIST = xdeltatest.c README.test
 
-INCLUDES = -I$(top_srcdir)/libedsio $(GLIB_CFLAGS)
+INCLUDES = -I$(top_srcdir)/libedsio $(GLIB2_CFLAGS)
 
 noinst_PROGRAMS    = xdeltatest
 
@@ -10,4 +10,4 @@
 xdeltatest_LDADD = $(top_srcdir)/libxdelta.la		\
 		  $(top_srcdir)/libedsio/libedsio.la	\
 		  -lz					\
-		  $(GLIB_LIBS)
+		  $(GLIB2_LIBS)
