Implementation of windbus.
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 31 Oct 2008 17:20:38 +0000 (17:20 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 31 Oct 2008 17:20:38 +0000 (17:20 +0000)
dbus/mingw32-dbus-1.2.4-20081031-c++-mingw32.patch [new file with mode: 0644]
dbus/mingw32-dbus-1.2.4-20081031-mingw32.patch [new file with mode: 0644]
dbus/mingw32-dbus.spec [new file with mode: 0644]
dbus/windbus-1.2.4-20081031.tar.gz [new file with mode: 0644]
dbus/windbus-c++-1.2.4-20081031.tar.gz [new file with mode: 0644]

diff --git a/dbus/mingw32-dbus-1.2.4-20081031-c++-mingw32.patch b/dbus/mingw32-dbus-1.2.4-20081031-c++-mingw32.patch
new file mode 100644 (file)
index 0000000..eefeb8b
--- /dev/null
@@ -0,0 +1,340 @@
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/examples/echo/echo-server.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/examples/echo/echo-server.cpp
+--- mingw32-dbus-1.2.4.orig/dbuscxx/examples/echo/echo-server.cpp      2008-10-31 10:01:59.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/examples/echo/echo-server.cpp     2008-10-31 16:43:45.000000000 +0000
+@@ -1,5 +1,10 @@
+ #include "echo-server.h"
++#ifndef _MSC_VER
+ #include <unistd.h>
++#else
++#include <Winsock2.h.>
++#define HOST_NAME_MAX 256
++#endif
+ #include <stdlib.h>
+ #include <signal.h>
+ #include <stdio.h>
+@@ -12,6 +17,7 @@
+ {
+ }
++
+ DBus::Int32 EchoServer::Random()
+ {
+       return rand();
+@@ -60,7 +66,11 @@
+       gethostname(hostname, sizeof(hostname));
+       info["hostname"] = hostname;
++#ifndef _MSC_VER
+       info["username"] = getlogin();
++#else
++      info["username"] = "username not available";
++#endif
+       return info;
+ }
+@@ -78,6 +88,7 @@
+       signal(SIGTERM, niam);
+       signal(SIGINT, niam);
++      DBus::_init_threading();
+       DBus::default_dispatcher = &dispatcher;
+       DBus::Connection conn = DBus::Connection::SessionBus();
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/examples/properties/Makefile.am mingw32-dbus-1.2.4.mingw/dbuscxx/examples/properties/Makefile.am
+--- mingw32-dbus-1.2.4.orig/dbuscxx/examples/properties/Makefile.am    2008-10-31 10:01:58.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/examples/properties/Makefile.am   2008-10-31 16:59:31.000000000 +0000
+@@ -5,7 +5,8 @@
+ noinst_PROGRAMS = props-server
+ props_server_SOURCES = props-glue.h props-server.h props-server.cpp
+-props_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
++props_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la \
++      -L$(top_srcdir)/../trunk/dbus/.libs
+ props-glue.h: props-introspect.xml
+       $(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/include/dbus-c++/interface.h mingw32-dbus-1.2.4.mingw/dbuscxx/include/dbus-c++/interface.h
+--- mingw32-dbus-1.2.4.orig/dbuscxx/include/dbus-c++/interface.h       2008-10-31 10:01:57.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/include/dbus-c++/interface.h      2008-10-31 16:43:45.000000000 +0000
+@@ -49,7 +49,7 @@
+ typedef std::map<std::string, PropertyData>   PropertyTable;
+-class IntrospectedInterface;
++struct IntrospectedInterface;
+ class ObjectAdaptor;
+ class InterfaceAdaptor;
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/eventloop.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/src/eventloop.cpp
+--- mingw32-dbus-1.2.4.orig/dbuscxx/src/eventloop.cpp  2008-10-31 10:01:55.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/eventloop.cpp 2008-10-31 16:53:59.000000000 +0000
+@@ -25,13 +25,112 @@
+ #include <dbus-c++/eventloop.h>
+ #include <dbus-c++/debug.h>
++#ifdef HAVE_POLL
+ #include <sys/poll.h>
++#else
++
++/** There is data to read */
++#define POLLIN      0x0001
++/** There is urgent data to read */
++#define POLLPRI     0x0002
++/** Writing now will not block */
++#define POLLOUT     0x0004
++/** Error condition */
++#define POLLERR     0x0008
++/** Hung up */
++#define POLLHUP     0x0010
++/** Invalid request: fd not open */
++#define POLLNVAL    0x0020
++
++/**
++ * A portable struct pollfd wrapper. 
++ */
++typedef struct
++{
++  int fd;            /**< File descriptor */
++  short events;      /**< Events to poll for */
++  short revents;     /**< Events that occurred */
++} DBusPollFD,pollfd;
++
++extern "C" int _dbus_poll (DBusPollFD *fds,
++                int         n_fds,
++                int         timeout_milliseconds);
++#define poll _dbus_poll
++
++#endif
++
++#ifndef _MSC_VER
+ #include <sys/time.h>
++#endif
+ #include <dbus/dbus.h>
+ using namespace DBus;
++
++#ifdef DBUSCXX_WIN
++#include <windows.h>
++typedef long tv_sec; 
++typedef long tv_usec; 
++#if 0
++#define POLLIN      0x0001    /* There is data to read */
++#define POLLPRI     0x0002    /* There is urgent data to read */
++#define POLLOUT     0x0004    /* Writing now will not block */
++#define POLLERR     0x0008    /* Error condition */
++#define POLLHUP     0x0010    /* Hung up */
++#define POLLNVAL    0x0020    /* Invalid request: fd not open */
++           
++typedef struct {
++      int fd;
++      int events;
++      int revents;
++} pollfd;
++
++// http://man.cx/poll(2)
++int   poll(pollfd *fds, unsigned int nfd, int wait_min)
++{
++              // convert to select parameter structure and call select 
++              
++              /* on return set revent structure 
++                 either of the type requested, or of one of the types POLLERR or POLLHUP
++       or POLLNVAL.  (These three bits are meaningless in  the  events  field,
++    */
++              printf(".");
++              return -1;
++/*
++     On success, a positive number is returned, where the number returned is
++     the number of structures which have non-zero revents fields  (in  other
++     words, those descriptors with events or errors reported).  A value of 0
++     indicates that the call timed out and no  file  descriptors  have  been
++     selected. On error, -1 is returned, and errno is set appropriately.
++*/
++}
++#endif
++
++
++#if 0
++void gettimeofday (struct timeval *t, void *)
++{
++  FILETIME ft;
++  dbus_uint64_t *time64 = (dbus_uint64_t *) &ft;
++
++  GetSystemTimeAsFileTime (&ft);
++
++  /* Convert from 100s of nanoseconds since 1601-01-01
++  * to Unix epoch. Yes, this is Y2038 unsafe.
++  */
++  *time64 -= DBUS_INT64_CONSTANT (116444736000000000);
++  *time64 /= 10;
++
++  if (t)
++    t->tv_sec = *time64 / 1000000;
++              t->tv_usec = *time64 % 1000000;
++}
++#endif
++
++#endif
++
++
+ static double millis( timeval tv )
+ {
+       return (tv.tv_sec*1000.0 + tv.tv_usec/1000.0);
+@@ -93,7 +192,7 @@
+ {
+       int nfd = _watches.size();
+-      pollfd fds[nfd];
++      pollfd *fds = new pollfd[nfd];
+       Watches::iterator wi = _watches.begin();
+@@ -174,6 +273,7 @@
+                       wi = tmp;
+               }
+       }
++      delete [] fds;
+ }
+ /*
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/internalerror.h mingw32-dbus-1.2.4.mingw/dbuscxx/src/internalerror.h
+--- mingw32-dbus-1.2.4.orig/dbuscxx/src/internalerror.h        2008-10-31 10:01:55.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/internalerror.h       2008-10-31 16:43:45.000000000 +0000
+@@ -35,8 +35,9 @@
+ namespace DBus {
+-struct InternalError
++class InternalError
+ {
++public:
+       DBusError       error;
+       InternalError()
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/Makefile.am mingw32-dbus-1.2.4.mingw/dbuscxx/src/Makefile.am
+--- mingw32-dbus-1.2.4.orig/dbuscxx/src/Makefile.am    2008-10-31 10:01:55.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/Makefile.am   2008-10-31 16:50:28.000000000 +0000
+@@ -2,6 +2,7 @@
+       $(dbus_CFLAGS) \
+       $(xml_CFLAGS) \
+       $(glib_CFLAGS) \
++      -DDBUSCXX_WIN \
+       -I$(top_srcdir)/include
+ if ENABLE_GLIB
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/message.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/src/message.cpp
+--- mingw32-dbus-1.2.4.orig/dbuscxx/src/message.cpp    2008-10-31 10:01:55.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/message.cpp   2008-10-31 16:44:31.000000000 +0000
+@@ -22,6 +22,8 @@
+  */
++#include <stdlib.h>
++
+ #include <dbus-c++/message.h>
+ #include <dbus/dbus.h>
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/object.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/src/object.cpp
+--- mingw32-dbus-1.2.4.orig/dbuscxx/src/object.cpp     2008-10-31 10:01:55.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/object.cpp    2008-10-31 16:42:28.000000000 +0000
+@@ -26,6 +26,8 @@
+ #include <dbus-c++/object.h>
+ #include "internalerror.h"
++#include <string.h>
++
+ #include <map>
+ #include <dbus/dbus.h>
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/types.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/src/types.cpp
+--- mingw32-dbus-1.2.4.orig/dbuscxx/src/types.cpp      2008-10-31 10:01:55.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/types.cpp     2008-10-31 16:44:17.000000000 +0000
+@@ -22,6 +22,8 @@
+  */
++#include <stdlib.h>
++
+ #include <dbus-c++/types.h>
+ #include <dbus-c++/object.h>
+ #include <dbus/dbus.h>
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/tools/introspect.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/tools/introspect.cpp
+--- mingw32-dbus-1.2.4.orig/dbuscxx/tools/introspect.cpp       2008-10-31 10:01:56.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/tools/introspect.cpp      2008-10-31 16:50:41.000000000 +0000
+@@ -21,11 +21,16 @@
+  *
+  */
++#include <string.h>
++
+ #include <signal.h>
+-#include <unistd.h>
+ #include <iostream>
+ #include "introspect.h"
++#ifndef _MSC_VER
++#include <unistd.h>
++#endif
++
+ DBus::BusDispatcher dispatcher;
+ static bool systembus;
+ static char* path;
+@@ -44,9 +49,11 @@
+ int main( int argc, char** argv )
+ {
++#ifndef DBUSCXX_WIN
+       signal(SIGTERM, niam);
+       signal(SIGINT, niam);
+       signal(SIGALRM, niam);
++#endif
+       if(argc == 1)
+       {
+@@ -69,7 +76,9 @@
+               DBus::default_dispatcher = &dispatcher;
++#ifndef DBUSCXX_WIN
+               alarm(1);
++#endif
+               dispatcher.enter();
+       }
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/tools/Makefile.am mingw32-dbus-1.2.4.mingw/dbuscxx/tools/Makefile.am
+--- mingw32-dbus-1.2.4.orig/dbuscxx/tools/Makefile.am  2008-10-31 10:01:56.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/tools/Makefile.am 2008-10-31 16:59:53.000000000 +0000
+@@ -4,6 +4,7 @@
+ AM_CPPFLAGS = \
+       $(dbus_CFLAGS) \
++      -DDBUSCXX_WIN \
+       -I$(top_srcdir)/include
+ if CROSS_COMPILING
+@@ -16,9 +17,11 @@
+ dbusxx_xml2cpp_SOURCES = xml2cpp.h xml2cpp.cpp
+ dbusxx_xml2cpp_LDADD = $(libdbus_cxx_la)
++dbusxx_xml2cpp_LDFLAGS = -L../../trunk/dbus/.libs
+ dbusxx_introspect_SOURCES = introspect.h introspect.cpp
+ dbusxx_introspect_LDADD = $(libdbus_cxx_la)
++dbusxx_introspect_LDFLAGS = -L../../trunk/dbus/.libs
+ MAINTAINERCLEANFILES = \
+       Makefile.in
+diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/tools/xml2cpp.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/tools/xml2cpp.cpp
+--- mingw32-dbus-1.2.4.orig/dbuscxx/tools/xml2cpp.cpp  2008-10-31 10:01:56.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/dbuscxx/tools/xml2cpp.cpp 2008-10-31 16:45:02.000000000 +0000
+@@ -24,6 +24,9 @@
+ #include "xml2cpp.h"
++#include <stdlib.h>
++#include <string.h>
++
+ #include <dbus/dbus.h>
+ #include <string>
diff --git a/dbus/mingw32-dbus-1.2.4-20081031-mingw32.patch b/dbus/mingw32-dbus-1.2.4-20081031-mingw32.patch
new file mode 100644 (file)
index 0000000..6a9a063
--- /dev/null
@@ -0,0 +1,226 @@
+diff -ur mingw32-dbus-1.2.4.orig/trunk/bus/main.c mingw32-dbus-1.2.4.mingw/trunk/bus/main.c
+--- mingw32-dbus-1.2.4.orig/trunk/bus/main.c   2008-10-31 10:02:18.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/trunk/bus/main.c  2008-10-31 14:28:45.000000000 +0000
+@@ -52,6 +52,7 @@
+     case SIGIO: 
+       /* explicit fall-through */
+ #endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX  */
++#ifdef SIGUP
+     case SIGHUP:
+       _dbus_string_init_const (&str, "foo");
+       if ((reload_pipe[RELOAD_WRITE_END] > 0) && 
+@@ -61,10 +62,13 @@
+           close_reload_pipe ();
+         }
+       break;
++#endif
++#ifdef SIGTERM
+     case SIGTERM:
+       _dbus_loop_quit (bus_context_get_loop (context));
+       break;
++#endif
+     }
+ }
+@@ -458,8 +462,12 @@
+   
+   setup_reload_pipe (bus_context_get_loop (context));
++#ifdef SIGHUP
+   _dbus_set_signal_handler (SIGHUP, signal_handler);
++#endif
++#ifdef SIGTERM
+   _dbus_set_signal_handler (SIGTERM, signal_handler);
++#endif
+ #ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX 
+   _dbus_set_signal_handler (SIGIO, signal_handler);
+ #endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */
+diff -ur mingw32-dbus-1.2.4.orig/trunk/bus/Makefile.am mingw32-dbus-1.2.4.mingw/trunk/bus/Makefile.am
+--- mingw32-dbus-1.2.4.orig/trunk/bus/Makefile.am      2008-10-31 10:02:18.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/trunk/bus/Makefile.am     2008-10-31 17:09:41.000000000 +0000
+@@ -79,7 +79,7 @@
+ dbus_daemon_LDADD=                                    \
+       $(EFENCE)                                       \
+       $(DBUS_BUS_LIBS)                                \
+-      $(top_builddir)/dbus/libdbus-convenience.la
++      $(top_builddir)/dbus/libdbus-convenience.la -lws2_32
+ dbus_daemon_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ @PIE_LDFLAGS@
+@@ -149,7 +149,8 @@
+ ## we use noinst_PROGRAMS not check_PROGRAMS so that we build 
+ ## even when not doing "make check"
+-noinst_PROGRAMS=$(TESTS) dbus-daemon dbus-daemon-launch-helper-test dbus-daemon-launch-helper
++noinst_PROGRAMS=$(TESTS) dbus-daemon
++# dbus-daemon-launch-helper-test dbus-daemon-launch-helper
+ bus_test_system_SOURCES=                      \
+       $(XML_SOURCES)                          \
+@@ -184,21 +185,21 @@
+               $(mkinstalldirs) $(DESTDIR)$(DBUS_DAEMONDIR); \
+               chmod 755 $(DESTDIR)$(DBUS_DAEMONDIR); \
+       fi
+-      $(INSTALL_PROGRAM) dbus-daemon $(DESTDIR)$(DBUS_DAEMONDIR)
++      $(INSTALL_PROGRAM) dbus-daemon$(EXEEXT) $(DESTDIR)$(DBUS_DAEMONDIR)
+       $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
+       $(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
+       $(mkinstalldirs) $(DESTDIR)$(configdir)/session.d
+       $(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/services
+       $(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/system-services
+       $(mkinstalldirs) $(DESTDIR)$(libexecdir)/dbus-1
+-      $(INSTALL_PROGRAM) dbus-daemon-launch-helper $(DESTDIR)$(libexecdir)
+-      if test `id -u` -eq 0; then \
+-              chown root:$(DBUS_USER) $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper; \
+-              chmod 4750 $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper; \
+-      else \
+-              echo "Not installing $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper binary setuid!"; \
+-              echo "You'll need to manually set permissions to root:$(DBUS_USER) and permissions 4750"; \
+-      fi
++#     $(INSTALL_PROGRAM) dbus-daemon-launch-helper $(DESTDIR)$(libexecdir)
++#     if test `id -u` -eq 0; then \
++#             chown root:$(DBUS_USER) $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper; \
++#             chmod 4750 $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper; \
++#     else \
++#             echo "Not installing $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper binary setuid!"; \
++#             echo "You'll need to manually set permissions to root:$(DBUS_USER) and permissions 4750"; \
++#     fi
+ #### Init scripts fun
+ SCRIPT_IN_FILES=messagebus.in \
+diff -ur mingw32-dbus-1.2.4.orig/trunk/configure.in mingw32-dbus-1.2.4.mingw/trunk/configure.in
+--- mingw32-dbus-1.2.4.orig/trunk/configure.in 2008-10-31 10:02:18.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/trunk/configure.in        2008-10-31 13:02:24.000000000 +0000
+@@ -60,6 +60,8 @@
+ AC_ISC_POSIX
+ AC_HEADER_STDC
+ AC_C_INLINE
++
++AC_LIBTOOL_WIN32_DLL
+ AM_PROG_LIBTOOL
+ AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
+diff -ur mingw32-dbus-1.2.4.orig/trunk/dbus/dbus-sysdeps-win.c mingw32-dbus-1.2.4.mingw/trunk/dbus/dbus-sysdeps-win.c
+--- mingw32-dbus-1.2.4.orig/trunk/dbus/dbus-sysdeps-win.c      2008-10-31 10:02:08.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/trunk/dbus/dbus-sysdeps-win.c     2008-10-31 14:23:29.000000000 +0000
+@@ -31,7 +31,7 @@
+ #define STRSAFE_NO_DEPRECATE
+ #ifndef DBUS_WINCE
+-#define _WIN32_WINNT 0x0500
++#define _WIN32_WINNT 0x0501
+ #endif
+ #include "dbus-internals.h"
+@@ -46,6 +46,8 @@
+ #include "dbus-list.h"
+ #include "dbus-credentials.h"
++#include <stdio.h>
++
+ #include <windows.h>
+ #include <ws2tcpip.h>
+ #include <fcntl.h>
+@@ -55,12 +57,12 @@
+ #include <sys/types.h>
+ // needed for w2k compatibility (getaddrinfo/freeaddrinfo/getnameinfo)
+-#ifdef __GNUC__
+-#define _inline
+-#include "wspiapi.h"
+-#else
+-#include <wspiapi.h>
+-#endif
++//#ifdef __GNUC__
++//#define _inline
++//#include "wspiapi.h"
++//#else
++//#include <wspiapi.h>
++//#endif
+ #ifndef O_BINARY
+ #define O_BINARY 0
+diff -ur mingw32-dbus-1.2.4.orig/trunk/dbus/Makefile.am mingw32-dbus-1.2.4.mingw/trunk/dbus/Makefile.am
+--- mingw32-dbus-1.2.4.orig/trunk/dbus/Makefile.am     2008-10-31 10:02:08.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/trunk/dbus/Makefile.am    2008-10-31 14:25:42.000000000 +0000
+@@ -73,8 +73,8 @@
+       dbus-server-protected.h                 \
+       dbus-server-socket.c                    \
+       dbus-server-socket.h                    \
+-      dbus-server-unix.c                      \
+-      dbus-server-unix.h                      \
++      dbus-server-win.c                       \
++      dbus-server-win.h                       \
+       dbus-sha.c                              \
+       dbus-sha.h                              \
+       dbus-signature.c                        \
+@@ -87,10 +87,8 @@
+       dbus-transport-protected.h              \
+       dbus-transport-socket.c                 \
+       dbus-transport-socket.h                 \
+-      dbus-transport-unix.c                   \
+-      dbus-transport-unix.h                   \
+-      dbus-uuidgen.c                          \
+-      dbus-uuidgen.h                          \
++      dbus-transport-win.c                    \
++      dbus-transport-win.h                    \
+       dbus-watch.c                            \
+       dbus-watch.h
+@@ -120,11 +118,11 @@
+       dbus-string-private.h                   \
+       dbus-sysdeps.c                          \
+       dbus-sysdeps.h                          \
+-      dbus-sysdeps-pthread.c                  \
+-      dbus-sysdeps-unix.c                     \
+-      dbus-sysdeps-unix.h                     \
+-      dbus-userdb.c                           \
+-      dbus-userdb.h
++      dbus-sysdeps-win-thread.c               \
++      dbus-sysdeps-win.c                      \
++      dbus-sysdeps-win.h                      \
++      dbus-sysdeps-util-win.c                 \
++      dbus-string-util.c
+ ### source code that is generic utility functionality used
+ ### by the bus daemon or test apps, but is NOT included
+@@ -144,14 +142,11 @@
+       dbus-message-util.c                     \
+       dbus-shell.c                            \
+       dbus-shell.h                            \
+-      dbus-spawn.c                            \
++      dbus-spawn-win.c                        \
+       dbus-spawn.h                            \
+-      dbus-string-util.c                      \
+       dbus-sysdeps-util.c                     \
+-      dbus-sysdeps-util-unix.c                \
+       dbus-test.c                             \
+-      dbus-test.h                             \
+-      dbus-userdb-util.c
++      dbus-test.h
+ libdbus_1_la_SOURCES=                         \
+       $(DBUS_LIB_SOURCES)                     \
+@@ -170,7 +165,7 @@
+ ## and is only used for static linking within the dbus package.
+ noinst_LTLIBRARIES=libdbus-convenience.la
+-libdbus_1_la_LIBADD= $(DBUS_CLIENT_LIBS)
++libdbus_1_la_LIBADD= $(DBUS_CLIENT_LIBS) -lws2_32
+ ## don't export symbols that start with "_" (we use this 
+ ## convention for internal symbols)
+ libdbus_1_la_LDFLAGS= -export-symbols-regex "^[^_].*" -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -no-undefined @R_DYNAMIC_LDFLAG@ @PIC_LDFLAGS@
+diff -ur mingw32-dbus-1.2.4.orig/trunk/tools/Makefile.am mingw32-dbus-1.2.4.mingw/trunk/tools/Makefile.am
+--- mingw32-dbus-1.2.4.orig/trunk/tools/Makefile.am    2008-10-31 10:02:09.000000000 +0000
++++ mingw32-dbus-1.2.4.mingw/trunk/tools/Makefile.am   2008-10-31 14:35:09.000000000 +0000
+@@ -2,7 +2,8 @@
+ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_X_CFLAGS) -DDBUS_LOCALEDIR=\"@EXPANDED_DATADIR@/locale\" -DDBUS_COMPILATION -DDBUS_DAEMONDIR=\"@DBUS_DAEMONDIR@\" -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\"
+-bin_PROGRAMS=dbus-send dbus-monitor dbus-launch dbus-cleanup-sockets dbus-uuidgen
++bin_PROGRAMS=dbus-send dbus-monitor
++#dbus-launch dbus-cleanup-sockets dbus-uuidgen
+ dbus_send_SOURCES=                            \
+       dbus-print-message.c                    \
diff --git a/dbus/mingw32-dbus.spec b/dbus/mingw32-dbus.spec
new file mode 100644 (file)
index 0000000..26d4e87
--- /dev/null
@@ -0,0 +1,150 @@
+%define __strip %{_mingw32_strip}
+%define __objdump %{_mingw32_objdump}
+%define _use_internal_dependency_generator 0
+%define __find_requires %{_mingw32_findrequires}
+%define __find_provides %{_mingw32_findprovides}
+
+# We are using 'temporarily' the windbus project, which is a port of
+# dbus and dbus-c++ to Windows.  At some point it is expected these
+# will be merged back into the main dbus tree.
+#
+# In Fedora native, dbus and dbus-c++ are separate packages.  Here it
+# is convenient to combine them into a single specfile / separate sub-
+# packages.
+
+%define date 20081031
+
+Name:           mingw32-dbus
+Version:        1.2.4
+Release:        0.1.%{date}svn%{?dist}
+Summary:        MinGW Windows port of DBus
+
+License:        GPLv2+ or AFL
+Group:          Development/Libraries
+URL:            http://sourceforge.net/projects/windbus
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+# svn co https://windbus.svn.sourceforge.net/svnroot/windbus windbus
+# tar zcf windbus-%{version}-%{date}.tar.gz trunk
+# tar zcf windbus-c++-%{version}-%{date}.tar.gz dbuscxx
+Source0:        windbus-%{version}-%{date}.tar.gz
+Source1:        windbus-c++-%{version}-%{date}.tar.gz
+
+# This patch is extremely hacky, and not upstream.
+#
+# windbus seems to prefer to use cmake to build instead of the
+# original dbus autotools.  This patch hacks up the autotools
+# files to work instead.  Really instead of just replacing the
+# *unix*.c files with *win*.c we ought to include both and add
+# proper #ifdef WIN32...#endif around the code.
+Patch0:         mingw32-dbus-1.2.4-20081031-mingw32.patch
+
+# This patch is almost, but not quite working.  For some reason
+# the implementation of _dbus_poll (from the C library above) cannot
+# be accessed by the C++ library.
+Patch1:         mingw32-dbus-1.2.4-20081031-c++-mingw32.patch
+
+BuildArch:      noarch
+
+BuildRequires:  mingw32-filesystem >= 33
+BuildRequires:  mingw32-gcc
+BuildRequires:  mingw32-gcc-c++
+BuildRequires:  mingw32-binutils
+BuildRequires:  mingw32-glib2
+BuildRequires:  mingw32-gtk2
+BuildRequires:  mingw32-gtkmm24
+BuildRequires:  mingw32-expat
+BuildRequires:  libtool, automake, autoconf
+
+
+%description
+D-BUS is a system for sending messages between applications. It is
+used both for the systemwide message bus service, and as a
+per-user-login-session messaging facility.
+
+
+%package c++
+Summary:        MinGW Windows port of DBus
+License:        LGPLv2+
+Group:          Development/Libraries
+
+%description c++
+Native C++ bindings for D-Bus for use in C++ programs.
+
+
+%prep
+%setup -q -b 0 -c
+%setup -q -a 1 -T -D
+
+pushd trunk
+%patch0 -p2
+autoreconf
+chmod +x configure
+popd
+
+pushd dbuscxx
+%patch1 -p2
+autoreconf
+popd
+
+
+%build
+pushd trunk
+# For unknown reasons, the configure script chokes if you
+# pass --build explicitly.  We also need to pass -DDBUS_WIN
+# as an extra flag.
+PKG_CONFIG_PATH="%{_mingw32_libdir}/pkgconfig" \
+CC="%{_mingw32_cc}" \
+CFLAGS="%{_mingw32_cflags} -DDBUS_WIN -DDBUS_BUILD_TESTS" \
+./configure \
+  --host=%{_mingw32_host} \
+  --target=%{_mingw32_target} \
+  --prefix=%{_mingw32_prefix} \
+  --with-xml=expat
+make
+popd
+
+pushd dbuscxx
+%{_mingw32_configure}
+# XXX Does not quite work yet.
+make ||:
+popd
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+pushd trunk
+make DESTDIR=$RPM_BUILD_ROOT install
+popd
+
+# Remove static libraries but DON'T remove *.dll.a files.
+rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libdbus-1.a
+
+# Remove manpages because they duplicate what's in the
+# Fedora native package already.
+rm -r $RPM_BUILD_ROOT%{_mingw32_mandir}/man1
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root)
+%{_mingw32_bindir}/dbus-daemon.exe
+%{_mingw32_bindir}/i686-pc-mingw32-dbus-monitor.exe
+%{_mingw32_bindir}/i686-pc-mingw32-dbus-send.exe
+%{_mingw32_bindir}/libdbus-1-3.dll
+%{_mingw32_libdir}/dbus-1.0/
+%{_mingw32_libdir}/libdbus-1.dll.a
+%{_mingw32_libdir}/libdbus-1.la
+%{_mingw32_libdir}/pkgconfig/dbus-1.pc
+%{_mingw32_sysconfdir}/dbus-1/
+%{_mingw32_sysconfdir}/rc.d/init.d/i686-pc-mingw32-messagebus
+%{_mingw32_includedir}/dbus-1.0/
+
+
+
+%changelog
+* Wed Sep 24 2008 Your Name <you@example.com> - 1.2.3-1
+- Initial RPM release.
diff --git a/dbus/windbus-1.2.4-20081031.tar.gz b/dbus/windbus-1.2.4-20081031.tar.gz
new file mode 100644 (file)
index 0000000..c79eac8
Binary files /dev/null and b/dbus/windbus-1.2.4-20081031.tar.gz differ
diff --git a/dbus/windbus-c++-1.2.4-20081031.tar.gz b/dbus/windbus-c++-1.2.4-20081031.tar.gz
new file mode 100644 (file)
index 0000000..5f01468
Binary files /dev/null and b/dbus/windbus-c++-1.2.4-20081031.tar.gz differ