Index: portage/win32libs-sources/dbus-cpp-src/dbus-cpp-src-0.5.0.py
===================================================================
--- portage/win32libs-sources/dbus-cpp-src/dbus-cpp-src-0.5.0.py	(revision 0)
+++ portage/win32libs-sources/dbus-cpp-src/dbus-cpp-src-0.5.0.py	(revision 0)
@@ -0,0 +1,47 @@
+import info
+import os
+
+class subinfo(info.infoclass):
+    def setTargets( self ):
+        self.targets['0.5.0']       = 'http://people.debian.org.tw/~mat/kde-windows/libdbus-c++-0.5.0.tar.gz' 
+        self.targetInstSrc['0.5.0'] = 'libdbus-c++-0.5.0' 
+        self.targetDigests['0.5.0'] = ['4e4bed909044220c7ad568d7ce2c55cf30e99ee4']
+        self.patchToApply['0.5.0'] = ( 'works_for_win32.patch', 1 )
+
+
+        self.svnTargets['gitHEAD'] = 'git://gitorious.org/dbus-cplusplus/mainline.git'
+        self.patchToApply['gitHEAD'] = ( 'works_for_win32.patch', 1 )
+
+        #self.defaultTarget = 'gitHEAD'
+        self.defaultTarget = '0.5.0'
+
+    def setDependencies( self ):
+        self.hardDependencies['virtual/base'] = 'default'
+        self.hardDependencies['dev-util/msys'] = 'default'
+        self.hardDependencies['testing/pkg-config'] = 'default'
+        self.hardDependencies['testing/pthreads-win32'] = 'default'
+        self.hardDependencies['win32libs-bin/dbus'] = 'default'
+        self.hardDependencies['win32libs-bin/expat'] = 'default'
+
+from Package.AutoToolsPackageBase import *
+
+class Package(AutoToolsPackageBase):
+    def __init__( self, **args ):
+        self.subinfo = subinfo()
+        cppflags= "-I%s" % os.path.join( os.environ.get("KDEROOT"), "include" )
+        ldflags= "-L%s -lws2_32 -lpthread" % os.path.join( os.environ.get("KDEROOT"), "lib" )
+        self.subinfo.options.configure.defines=" CPPFLAGS='%s' LDFLAGS='%s' " % ( cppflags, ldflags )
+        AutoToolsPackageBase.__init__(self)
+
+
+    def configure( self, cflags="", ldflags=""):
+        # Check whether compiler is mingw or not...
+        if self.compiler() != "mingw" and self.compiler() != "mingw4":
+            utils.die("This package is currently only compiled with mingw.")
+
+	#self.shell.execute( self.sourceDir(), "bootstrap", "" )
+        return AutoToolsPackageBase.configure( self, cflags, ldflags )
+       
+
+if __name__ == '__main__':
+    Package().execute()
Index: portage/win32libs-sources/dbus-cpp-src/works_for_win32.patch
===================================================================
--- portage/win32libs-sources/dbus-cpp-src/works_for_win32.patch	(revision 0)
+++ portage/win32libs-sources/dbus-cpp-src/works_for_win32.patch	(revision 0)
@@ -0,0 +1,481 @@
+diff --git a/examples/echo/Makefile.am b/examples/echo/Makefile.am
+index 63fe2eb..d208bc0 100644
+--- a/examples/echo/Makefile.am
++++ b/examples/echo/Makefile.am
+@@ -10,11 +10,11 @@ echo_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
+ echo-server-glue.h: echo-introspect.xml
+ 	$(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@
+
+-noinst_PROGRAMS += echo-client-mt
+-
+-echo_client_mt_SOURCES = echo-client-glue.h echo-client.h echo-client.cpp
+-echo_client_mt_LDADD = $(top_builddir)/src/libdbus-c++-1.la @PTHREAD_LIBS@
+-echo_client_mt_CXXFLAGS = @PTHREAD_CFLAGS@
++#noinst_PROGRAMS += echo-client-mt
++#
++#echo_client_mt_SOURCES = echo-client-glue.h echo-client.h echo-client.cpp
++#echo_client_mt_LDADD = $(top_builddir)/src/libdbus-c++-1.la @PTHREAD_LIBS@
++#echo_client_mt_CXXFLAGS = @PTHREAD_CFLAGS@
+
+ echo-client-glue.h: echo-introspect.xml
+ 	$(top_builddir)/tools/dbusxx-xml2cpp $^ --proxy=$@
+diff --git a/examples/echo/echo-server.cpp b/examples/echo/echo-server.cpp
+index cbcd517..40dcdac 100644
+--- a/examples/echo/echo-server.cpp
++++ b/examples/echo/echo-server.cpp
+@@ -9,6 +9,17 @@
+ #include <stdio.h>
+ #include <limits.h>
+
++#ifdef _WIN32
++
++#include <winsock2.h>
++#define HOST_NAME_MAX 1024
++
++char *getlogin(){
++	return getenv("USERNAME");
++}
++
++#endif
++
+ static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
+ static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
+
+diff --git a/include/dbus-c++/connection.h b/include/dbus-c++/connection.h
+index 3f8aaf6..b766ac4 100644
+--- a/include/dbus-c++/connection.h
++++ b/include/dbus-c++/connection.h
+@@ -26,6 +26,14 @@
+ #define __DBUSXX_CONNECTION_H
+
+ #include <list>
++/*
++ * 'interface' is defined somewhere in the Windows header files.
++ * Possible includes: <list>
++ * This macro is deleted here to avoid conflicts and compile errors.
++ */
++#ifdef _WIN32
++#undef interface
++#endif
+
+ #include "api.h"
+ #include "types.h"
+diff --git a/include/dbus-c++/eventloop-integration.h b/include/dbus-c++/eventloop-integration.h
+index b8e02c7..20eae42 100644
+--- a/include/dbus-c++/eventloop-integration.h
++++ b/include/dbus-c++/eventloop-integration.h
+@@ -31,6 +31,16 @@
+ #include "util.h"
+ #include "eventloop.h"
+
++#ifdef _WIN32
++#include <direct.h>
++static inline int pipe(int pipefd[2]){
++  const unsigned int buffer_size = 4096;
++  const int flags = 0;
++  return _pipe(pipefd, buffer_size, flags);
++}
++#endif
++
++
+ namespace DBus {
+
+ /*
+diff --git a/include/dbus-c++/eventloop.h b/include/dbus-c++/eventloop.h
+index 5b1b808..3bf4997 100644
+--- a/include/dbus-c++/eventloop.h
++++ b/include/dbus-c++/eventloop.h
+@@ -27,10 +27,79 @@
+
+ #include <pthread.h>
+ #include <list>
++/*
++ * 'interface' is defined somewhere in the Windows header files.
++ * Possible includes: <list>
++ * This macro is deleted here to avoid conflicts and compile errors.
++ */
++#ifdef _WIN32
++#undef interface
++#endif
+
+ #include "api.h"
+ #include "util.h"
+
++
++extern "C" {
++
++  /* AIX uses different values for poll */
++  #ifdef _AIX
++    /** There is data to read */
++    #define _DBUS_POLLIN      0x0001
++    /** There is urgent data to read */
++    #define _DBUS_POLLPRI     0x0004
++    /** Writing now will not block */
++    #define _DBUS_POLLOUT     0x0002
++    /** Error condition */
++    #define _DBUS_POLLERR     0x4000
++    /** Hung up */
++    #define _DBUS_POLLHUP     0x2000
++    /** Invalid request: fd not open */
++    #define _DBUS_POLLNVAL    0x8000
++
++  #elif defined(__HAIKU__)
++    /** There is data to read */
++    #define _DBUS_POLLIN      0x0001
++    /** Writing now will not block */
++    #define _DBUS_POLLOUT     0x0002
++    /** Error condition */
++    #define _DBUS_POLLERR     0x0004
++    /** There is urgent data to read */
++    #define _DBUS_POLLPRI     0x0020
++    /** Hung up */
++    #define _DBUS_POLLHUP     0x0080
++    /** Invalid request: fd not open */
++    #define _DBUS_POLLNVAL    0x1000
++
++  #else
++    /** There is data to read */
++    #define _DBUS_POLLIN      0x0001
++    /** There is urgent data to read */
++    #define _DBUS_POLLPRI     0x0002
++    /** Writing now will not block */
++    #define _DBUS_POLLOUT     0x0004
++    /** Error condition */
++    #define _DBUS_POLLERR     0x0008
++    /** Hung up */
++    #define _DBUS_POLLHUP     0x0010
++    /** Invalid request: fd not open */
++    #define _DBUS_POLLNVAL    0x0020
++  #endif
++
++  /**
++   * A portable struct pollfd wrapper.
++   */
++  typedef struct
++  {
++    int fd;
++    short events;
++    short revents;
++  } DBusPollFD;
++
++  int _dbus_poll( DBusPollFD *fds, int n_fds, int timeout_milliseconds );
++
++}
++
+ namespace DBus {
+
+ /*
+diff --git a/include/dbus-c++/object.h b/include/dbus-c++/object.h
+index 962bf77..a5ea0f2 100644
+--- a/include/dbus-c++/object.h
++++ b/include/dbus-c++/object.h
+@@ -27,6 +27,14 @@
+
+ #include <string>
+ #include <list>
++/*
++ * 'interface' is defined somewhere in the Windows header files.
++ * Possible includes: <list>
++ * This macro is deleted here to avoid conflicts and compile errors.
++ */
++#ifdef _WIN32
++#undef interface
++#endif
+
+ #include "api.h"
+ #include "interface.h"
+diff --git a/include/dbus-c++/server.h b/include/dbus-c++/server.h
+index 30879bf..c0a95c9 100644
+--- a/include/dbus-c++/server.h
++++ b/include/dbus-c++/server.h
+@@ -26,6 +26,14 @@
+ #define __DBUSXX_SERVER_H
+
+ #include <list>
++/*
++ * 'interface' is defined somewhere in the Windows header files.
++ * Possible includes: <list>
++ * This macro is deleted here to avoid conflicts and compile errors.
++ */
++#ifdef _WIN32
++#undef interface
++#endif
+
+ #include "api.h"
+ #include "error.h"
+diff --git a/src/dispatcher.cpp b/src/dispatcher.cpp
+index 2da4e86..818f222 100644
+--- a/src/dispatcher.cpp
++++ b/src/dispatcher.cpp
+@@ -69,7 +69,7 @@ Watch::Watch(Watch::Internal *i)
+
+ int Watch::descriptor() const
+ {
+-#if HAVE_WIN32
++#if _WIN32
+ 	return dbus_watch_get_socket((DBusWatch*)_int);
+ #else
+ 	return dbus_watch_get_unix_fd((DBusWatch*)_int);
+diff --git a/src/eventloop-integration.cpp b/src/eventloop-integration.cpp
+index d801574..cb3f052 100644
+--- a/src/eventloop-integration.cpp
++++ b/src/eventloop-integration.cpp
+@@ -25,13 +25,17 @@
+ #include <config.h>
+ #endif
+
++#ifdef _WIN32
++#include <io.h>
++#include <process.h>
++#endif
++
++
+ #include <string.h>
+
+ #include <dbus-c++/eventloop-integration.h>
+ #include <dbus-c++/debug.h>
+
+-#include <sys/poll.h>
+-
+ #include <dbus/dbus.h>
+ #include <errno.h>
+
+@@ -53,12 +57,12 @@ void BusTimeout::toggle()
+ BusWatch::BusWatch(Watch::Internal *wi, BusDispatcher *bd)
+ : Watch(wi), DefaultWatch(Watch::descriptor(), 0, bd)
+ {
+-	int flags = POLLHUP | POLLERR;
++	int flags = _DBUS_POLLHUP | _DBUS_POLLERR;
+
+ 	if (Watch::flags() & DBUS_WATCH_READABLE)
+-		flags |= POLLIN;
++		flags |= _DBUS_POLLIN;
+ 	if (Watch::flags() & DBUS_WATCH_WRITABLE)
+-		flags |= POLLOUT;
++		flags |= _DBUS_POLLOUT;
+
+ 	DefaultWatch::flags(flags);
+ 	DefaultWatch::enabled(Watch::enabled());
+@@ -161,13 +165,13 @@ void BusDispatcher::watch_ready(DefaultWatch &ew)
+
+ 	int flags = 0;
+
+-	if (watch->state() & POLLIN)
++	if (watch->state() & _DBUS_POLLIN)
+ 		flags |= DBUS_WATCH_READABLE;
+-	if (watch->state() & POLLOUT)
++	if (watch->state() & _DBUS_POLLOUT)
+ 		flags |= DBUS_WATCH_WRITABLE;
+-	if (watch->state() & POLLHUP)
++	if (watch->state() & _DBUS_POLLHUP)
+ 		flags |= DBUS_WATCH_HANGUP;
+-	if (watch->state() & POLLERR)
++	if (watch->state() & _DBUS_POLLERR)
+ 		flags |= DBUS_WATCH_ERROR;
+
+ 	watch->handle(flags);
+diff --git a/src/eventloop.cpp b/src/eventloop.cpp
+index 76b94f8..4fdaa7a 100644
+--- a/src/eventloop.cpp
++++ b/src/eventloop.cpp
+@@ -28,7 +28,6 @@
+ #include <dbus-c++/eventloop.h>
+ #include <dbus-c++/debug.h>
+
+-#include <sys/poll.h>
+ #include <sys/time.h>
+
+ #include <dbus/dbus.h>
+@@ -149,12 +148,14 @@ void DefaultMainLoop::dispatch()
+
+ 	int nfd = _watches.size();
+
++#ifndef _WIN32
+ 	if(_fdunlock)
+ 	{
+ 		nfd=nfd+2;
+ 	}
++#endif
+
+-	pollfd fds[nfd];
++	DBusPollFD fds[nfd];
+
+ 	DefaultWatches::iterator wi = _watches.begin();
+
+@@ -170,16 +171,18 @@ void DefaultMainLoop::dispatch()
+ 		}
+ 	}
+
++#ifndef _WIN32
+ 	if(_fdunlock){
+ 		fds[nfd].fd = _fdunlock[0];
+-		fds[nfd].events = POLLIN | POLLOUT | POLLPRI ;
++		fds[nfd].events = _DBUS_POLLIN | _DBUS_POLLOUT | _DBUS_POLLPRI ;
+ 		fds[nfd].revents = 0;
+ 		
+ 		nfd++;
+ 		fds[nfd].fd = _fdunlock[1];
+-		fds[nfd].events = POLLIN | POLLOUT | POLLPRI ;
++		fds[nfd].events = _DBUS_POLLIN | _DBUS_POLLOUT | _DBUS_POLLPRI ;
+ 		fds[nfd].revents = 0;
+ 	}
++#endif
+
+ 	_mutex_w.unlock();
+
+@@ -197,7 +200,7 @@ void DefaultMainLoop::dispatch()
+
+ 	_mutex_t.unlock();
+
+-	poll(fds, nfd, wait_min);
++	_dbus_poll(fds, nfd, wait_min);
+
+ 	timeval now;
+ 	gettimeofday(&now, NULL);
+@@ -240,10 +243,13 @@ void DefaultMainLoop::dispatch()
+ 			DefaultWatches::iterator tmp = wi;
+ 			++tmp;
+
++			debug_log("mainlooping...");
+ 			if ((*wi)->enabled() && (*wi)->_fd == fds[j].fd)
+ 			{
++				debug_log("filtering...%d", (*wi)->_fd );
+ 				if (fds[j].revents)
+ 				{
++					debug_log("triggering...");
+ 					(*wi)->_state = fds[j].revents;
+
+ 					(*wi)->ready(*(*wi));
+@@ -258,3 +264,90 @@ void DefaultMainLoop::dispatch()
+ 	_mutex_w.unlock();
+ }
+
++
++#ifdef _WIN32
++#include <winsock2.h>
++#endif
++
++int _dbus_poll (DBusPollFD *fds, int n_fds, int timeout_milliseconds)
++{
++
++	fd_set read_set, write_set, err_set;
++	int max_fd = 0;
++	int i;
++	struct timeval tv;
++	int ready;
++
++	FD_ZERO (&read_set);
++	FD_ZERO (&write_set);
++	FD_ZERO (&err_set);
++
++	for (i = 0; i < n_fds; i++)
++	{
++		DBusPollFD *fdp = &fds[i];
++
++#ifdef _WIN32
++		if ( fdp->fd < 1024 ){
++			continue;
++		}
++#endif
++
++		debug_log("adding (fd: %d) for selecting set...\n", fdp->fd  );
++
++		if (fdp->events & _DBUS_POLLIN){
++			FD_SET (fdp->fd, &read_set);
++		}
++
++		if (fdp->events & _DBUS_POLLOUT){
++			FD_SET (fdp->fd, &write_set);
++		}
++
++		FD_SET (fdp->fd, &err_set);
++
++		max_fd = ( max_fd > fdp->fd ) ? max_fd : fdp->fd;
++	}
++
++	tv.tv_sec = timeout_milliseconds / 1000;
++	tv.tv_usec = (timeout_milliseconds % 1000) * 1000;
++
++	debug_log("before selecting...(max_fd: %d, tv_sec:%d, tv_usec: %d) \n", max_fd, tv.tv_sec, tv.tv_usec );
++	ready = select (max_fd + 1, &read_set, &write_set, &err_set, timeout_milliseconds < 0 ? NULL : &tv);
++	debug_log("after selecting (return: %d)... \n", ready );
++
++	if (ready > 0)
++	{
++		debug_log("select: ready for triggering \n");
++		for (i = 0; i < n_fds; i++)
++		{
++			DBusPollFD *fdp = &fds[i];
++
++			fdp->revents = 0;
++
++			if (FD_ISSET (fdp->fd, &read_set)){
++				fdp->revents |= _DBUS_POLLIN;
++			}
++
++			if (FD_ISSET (fdp->fd, &write_set)){
++				fdp->revents |= _DBUS_POLLOUT;
++			}
++
++			if (FD_ISSET (fdp->fd, &err_set)){
++				fdp->revents |= _DBUS_POLLERR;
++			}
++		}
++	}
++	else if (ready == 0)
++	{
++		debug_log("select timeout \n");
++	}
++	else
++	{
++		debug_log( "select failed!\n" );
++#ifdef _WIN32
++		int error_number = WSAGetLastError();
++		debug_log("select: error number is ( %d )\n", error_number );
++#endif
++	}
++
++	return ready;
++}
+diff --git a/tools/generate_proxy.cpp b/tools/generate_proxy.cpp
+index a46fc32..6079ab2 100644
+--- a/tools/generate_proxy.cpp
++++ b/tools/generate_proxy.cpp
+@@ -29,6 +29,10 @@
+ #include "generator_utils.h"
+ #include "generate_proxy.h"
+
++#ifdef _WIN32
++typedef unsigned int uint;
++#endif
++
+ using namespace std;
+ using namespace DBus;
+
+diff --git a/tools/introspect.cpp b/tools/introspect.cpp
+index 8ce9f3a..17563cf 100644
+--- a/tools/introspect.cpp
++++ b/tools/introspect.cpp
+@@ -27,6 +27,22 @@
+ #include <iostream>
+ #include "introspect.h"
+
++#ifdef _WIN32
++ #include <windows.h>
++
++ #ifndef SIGALRM
++  #define SIGALRM 14
++ #endif
++
++VOID CALLBACK raiseSigAlarm(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
++{
++    raise(SIGALRM);
++}
++  #define alarm(delay) SetTimer(NULL, NULL, delay, (TIMERPROC) raiseSigAlarm)
++
++
++#endif
++
+ DBus::BusDispatcher dispatcher;
+ static bool systembus;
+ static char *path;

Property changes on: portage/win32libs-sources/dbus-cpp-src/works_for_win32.patch
___________________________________________________________________
Added: svn:executable
   + *

