[msitools] wixl: remove gio-unix dependency



commit d16ee17c08a383b77070f3ba40d91882c0cb56e8
Author: Paolo Bonzini <pbonzini redhat com>
Date:   Fri Jan 18 09:01:43 2013 +0100

    wixl: remove gio-unix dependency
    
    It is not available under Windows, but it can be easily implemented
    using Posix.read.

 Makefile.am               |    7 ++++---
 configure.ac              |    7 +------
 tools/wixl/util.vala      |   16 ++++++++++++++++
 tools/wixl/wixl-heat.vala |    2 +-
 4 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index beae662..0ef1e3b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -104,7 +104,8 @@ wixl_LDADD =					\
 
 wixl_DEPENDENCIES = libmsi/libmsi.la
 
-if !WIN32
+# Wixl-heat
+
 bin_PROGRAMS += wixl-heat
 
 wixl_heat_CFLAGS = -w
@@ -112,8 +113,9 @@ wixl_heat_CFLAGS = -w
 wixl_heat_VALAFLAGS =				\
 	--vapidir=.				\
 	--pkg config				\
+	--pkg gio-2.0				\
+	--pkg posix				\
 	--enable-experimental			\
-	--pkg gio-unix-2.0			\
 	$(NULL)
 
 wixl_heat_SOURCES =				\
@@ -123,7 +125,6 @@ wixl_heat_SOURCES =				\
 
 wixl_heat_CPPFLAGS = $(wixl_CPPFLAGS)
 wixl_heat_LDADD = $(wixl_LDADD)
-endif
 
 # Autotest support
 
diff --git a/configure.ac b/configure.ac
index f4c8f76..a384fbd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,15 +31,10 @@ AC_PATH_PROG(VAPIGEN, vapigen, no)
 AC_SUBST(VAPIGEN)
 AM_CONDITIONAL([VAPI], [test "x$VAPIGEN" != xno])
 
-# used by wixl-heat
-AS_IF([test $win32 = no],
-      [WIXL_UNIX="gio-unix-2.0"])
-
 PKG_CHECK_MODULES([WIXL], [gio-2.0 >= 0.23.0
                            libgcab-1.0 >= 0.1.10
                            uuid >= 1.41.3
-                           libxml-2.0 >= 2.7
-                           $WIXL_UNIX])
+                           libxml-2.0 >= 2.7])
 
 GETTEXT_PACKAGE=wixl
 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package])
diff --git a/tools/wixl/util.vala b/tools/wixl/util.vala
index e7fadcc..13269c7 100644
--- a/tools/wixl/util.vala
+++ b/tools/wixl/util.vala
@@ -143,4 +143,20 @@ namespace Wixl {
 
         return -1;
     }
+
+    public class UnixInputStream : GLib.InputStream {
+        public int fd { get; set construct; }
+
+        public UnixInputStream(int fd_) {
+            fd = fd_;
+        }
+
+        public override ssize_t read ([CCode (array_length_type = "gsize")] uint8[] buffer, GLib.Cancellable? cancellable = null) throws GLib.IOError {
+            return Posix.read(fd, buffer, buffer.length);
+        }
+
+        public override bool close(GLib.Cancellable? cancellable = null) throws GLib.IOError {
+            return true;
+        }
+    }
 } // Wixl
diff --git a/tools/wixl/wixl-heat.vala b/tools/wixl/wixl-heat.vala
index 560367d..44989c2 100644
--- a/tools/wixl/wixl-heat.vala
+++ b/tools/wixl/wixl-heat.vala
@@ -61,7 +61,7 @@ public int main (string[] args) {
     var indent = "      ";
 
     try {
-        var dis = new DataInputStream (new UnixInputStream (0, false));
+        var dis = new DataInputStream (new UnixInputStream (0));
         string line;
 
         while ((line = dis.read_line (null)) != null) {



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