smock: use $basearch in smock.mock.extra
[fedora-mingw.git] / dbus / mingw32-dbus-1.2.4-20081031-c++-mingw32.patch
1 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
2 --- mingw32-dbus-1.2.4.orig/dbuscxx/examples/echo/echo-server.cpp       2008-10-31 10:01:59.000000000 +0000
3 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/examples/echo/echo-server.cpp      2008-10-31 16:43:45.000000000 +0000
4 @@ -1,5 +1,10 @@
5  #include "echo-server.h"
6 +#ifndef _MSC_VER
7  #include <unistd.h>
8 +#else
9 +#include <Winsock2.h.>
10 +#define HOST_NAME_MAX 256
11 +#endif
12  #include <stdlib.h>
13  #include <signal.h>
14  #include <stdio.h>
15 @@ -12,6 +17,7 @@
16  {
17  }
18  
19 +
20  DBus::Int32 EchoServer::Random()
21  {
22         return rand();
23 @@ -60,7 +66,11 @@
24  
25         gethostname(hostname, sizeof(hostname));
26         info["hostname"] = hostname;
27 +#ifndef _MSC_VER
28         info["username"] = getlogin();
29 +#else
30 +       info["username"] = "username not available";
31 +#endif
32  
33         return info;
34  }
35 @@ -78,6 +88,7 @@
36         signal(SIGTERM, niam);
37         signal(SIGINT, niam);
38  
39 +       DBus::_init_threading();
40         DBus::default_dispatcher = &dispatcher;
41  
42         DBus::Connection conn = DBus::Connection::SessionBus();
43 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/examples/properties/Makefile.am mingw32-dbus-1.2.4.mingw/dbuscxx/examples/properties/Makefile.am
44 --- mingw32-dbus-1.2.4.orig/dbuscxx/examples/properties/Makefile.am     2008-10-31 10:01:58.000000000 +0000
45 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/examples/properties/Makefile.am    2008-10-31 16:59:31.000000000 +0000
46 @@ -5,7 +5,8 @@
47  noinst_PROGRAMS = props-server
48  
49  props_server_SOURCES = props-glue.h props-server.h props-server.cpp
50 -props_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
51 +props_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la \
52 +       -L$(top_srcdir)/../trunk/dbus/.libs
53  
54  props-glue.h: props-introspect.xml
55         $(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@
56 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
57 --- mingw32-dbus-1.2.4.orig/dbuscxx/include/dbus-c++/interface.h        2008-10-31 10:01:57.000000000 +0000
58 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/include/dbus-c++/interface.h       2008-10-31 16:43:45.000000000 +0000
59 @@ -49,7 +49,7 @@
60  
61  typedef std::map<std::string, PropertyData>    PropertyTable;
62  
63 -class IntrospectedInterface;
64 +struct IntrospectedInterface;
65  
66  class ObjectAdaptor;
67  class InterfaceAdaptor;
68 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/eventloop.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/src/eventloop.cpp
69 --- mingw32-dbus-1.2.4.orig/dbuscxx/src/eventloop.cpp   2008-10-31 10:01:55.000000000 +0000
70 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/eventloop.cpp  2008-10-31 16:53:59.000000000 +0000
71 @@ -25,13 +25,112 @@
72  #include <dbus-c++/eventloop.h>
73  #include <dbus-c++/debug.h>
74  
75 +#ifdef HAVE_POLL
76  #include <sys/poll.h>
77 +#else
78 +
79 +/** There is data to read */
80 +#define POLLIN      0x0001
81 +/** There is urgent data to read */
82 +#define POLLPRI     0x0002
83 +/** Writing now will not block */
84 +#define POLLOUT     0x0004
85 +/** Error condition */
86 +#define POLLERR     0x0008
87 +/** Hung up */
88 +#define POLLHUP     0x0010
89 +/** Invalid request: fd not open */
90 +#define POLLNVAL    0x0020
91 +
92 +/**
93 + * A portable struct pollfd wrapper. 
94 + */
95 +typedef struct
96 +{
97 +  int fd;            /**< File descriptor */
98 +  short events;      /**< Events to poll for */
99 +  short revents;     /**< Events that occurred */
100 +} DBusPollFD,pollfd;
101 +
102 +extern "C" int _dbus_poll (DBusPollFD *fds,
103 +                int         n_fds,
104 +                int         timeout_milliseconds);
105 +#define poll _dbus_poll
106 +
107 +#endif
108 +
109 +#ifndef _MSC_VER
110  #include <sys/time.h>
111 +#endif
112  
113  #include <dbus/dbus.h>
114  
115  using namespace DBus;
116  
117 +
118 +#ifdef DBUSCXX_WIN
119 +#include <windows.h>
120 +typedef long tv_sec; 
121 +typedef long tv_usec; 
122 +#if 0
123 +#define POLLIN      0x0001    /* There is data to read */
124 +#define POLLPRI     0x0002    /* There is urgent data to read */
125 +#define POLLOUT     0x0004    /* Writing now will not block */
126 +#define POLLERR     0x0008    /* Error condition */
127 +#define POLLHUP     0x0010    /* Hung up */
128 +#define POLLNVAL    0x0020    /* Invalid request: fd not open */
129 +           
130 +typedef struct {
131 +       int fd;
132 +       int events;
133 +       int revents;
134 +} pollfd;
135 +
136 +// http://man.cx/poll(2)
137 +int    poll(pollfd *fds, unsigned int nfd, int wait_min)
138 +{
139 +               // convert to select parameter structure and call select 
140 +               
141 +               /* on return set revent structure 
142 +                  either of the type requested, or of one of the types POLLERR or POLLHUP
143 +       or POLLNVAL.  (These three bits are meaningless in  the  events  field,
144 +    */
145 +               printf(".");
146 +               return -1;
147 +/*
148 +     On success, a positive number is returned, where the number returned is
149 +     the number of structures which have non-zero revents fields  (in  other
150 +     words, those descriptors with events or errors reported).  A value of 0
151 +     indicates that the call timed out and no  file  descriptors  have  been
152 +     selected. On error, -1 is returned, and errno is set appropriately.
153 +*/
154 +}
155 +#endif
156 +
157 +
158 +#if 0
159 +void gettimeofday (struct timeval *t, void *)
160 +{
161 +  FILETIME ft;
162 +  dbus_uint64_t *time64 = (dbus_uint64_t *) &ft;
163 +
164 +  GetSystemTimeAsFileTime (&ft);
165 +
166 +  /* Convert from 100s of nanoseconds since 1601-01-01
167 +  * to Unix epoch. Yes, this is Y2038 unsafe.
168 +  */
169 +  *time64 -= DBUS_INT64_CONSTANT (116444736000000000);
170 +  *time64 /= 10;
171 +
172 +  if (t)
173 +    t->tv_sec = *time64 / 1000000;
174 +               t->tv_usec = *time64 % 1000000;
175 +}
176 +#endif
177 +
178 +#endif
179 +
180 +
181  static double millis( timeval tv )
182  {
183         return (tv.tv_sec*1000.0 + tv.tv_usec/1000.0);
184 @@ -93,7 +192,7 @@
185  {
186         int nfd = _watches.size();
187  
188 -       pollfd fds[nfd];
189 +       pollfd *fds = new pollfd[nfd];
190  
191         Watches::iterator wi = _watches.begin();
192  
193 @@ -174,6 +273,7 @@
194                         wi = tmp;
195                 }
196         }
197 +       delete [] fds;
198  }
199  
200  /*
201 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/internalerror.h mingw32-dbus-1.2.4.mingw/dbuscxx/src/internalerror.h
202 --- mingw32-dbus-1.2.4.orig/dbuscxx/src/internalerror.h 2008-10-31 10:01:55.000000000 +0000
203 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/internalerror.h        2008-10-31 16:43:45.000000000 +0000
204 @@ -35,8 +35,9 @@
205  
206  namespace DBus {
207  
208 -struct InternalError
209 +class InternalError
210  {
211 +public:
212         DBusError       error;
213  
214         InternalError()
215 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/Makefile.am mingw32-dbus-1.2.4.mingw/dbuscxx/src/Makefile.am
216 --- mingw32-dbus-1.2.4.orig/dbuscxx/src/Makefile.am     2008-10-31 10:01:55.000000000 +0000
217 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/Makefile.am    2008-10-31 16:50:28.000000000 +0000
218 @@ -2,6 +2,7 @@
219         $(dbus_CFLAGS) \
220         $(xml_CFLAGS) \
221         $(glib_CFLAGS) \
222 +       -DDBUSCXX_WIN \
223         -I$(top_srcdir)/include
224  
225  if ENABLE_GLIB
226 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/message.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/src/message.cpp
227 --- mingw32-dbus-1.2.4.orig/dbuscxx/src/message.cpp     2008-10-31 10:01:55.000000000 +0000
228 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/message.cpp    2008-10-31 16:44:31.000000000 +0000
229 @@ -22,6 +22,8 @@
230   */
231  
232  
233 +#include <stdlib.h>
234 +
235  #include <dbus-c++/message.h>
236  
237  #include <dbus/dbus.h>
238 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/object.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/src/object.cpp
239 --- mingw32-dbus-1.2.4.orig/dbuscxx/src/object.cpp      2008-10-31 10:01:55.000000000 +0000
240 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/object.cpp     2008-10-31 16:42:28.000000000 +0000
241 @@ -26,6 +26,8 @@
242  #include <dbus-c++/object.h>
243  #include "internalerror.h"
244  
245 +#include <string.h>
246 +
247  #include <map>
248  #include <dbus/dbus.h>
249  
250 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/src/types.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/src/types.cpp
251 --- mingw32-dbus-1.2.4.orig/dbuscxx/src/types.cpp       2008-10-31 10:01:55.000000000 +0000
252 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/src/types.cpp      2008-10-31 16:44:17.000000000 +0000
253 @@ -22,6 +22,8 @@
254   */
255  
256  
257 +#include <stdlib.h>
258 +
259  #include <dbus-c++/types.h>
260  #include <dbus-c++/object.h>
261  #include <dbus/dbus.h>
262 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/tools/introspect.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/tools/introspect.cpp
263 --- mingw32-dbus-1.2.4.orig/dbuscxx/tools/introspect.cpp        2008-10-31 10:01:56.000000000 +0000
264 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/tools/introspect.cpp       2008-10-31 16:50:41.000000000 +0000
265 @@ -21,11 +21,16 @@
266   *
267   */
268  
269 +#include <string.h>
270 +
271  #include <signal.h>
272 -#include <unistd.h>
273  #include <iostream>
274  #include "introspect.h"
275  
276 +#ifndef _MSC_VER
277 +#include <unistd.h>
278 +#endif
279 +
280  DBus::BusDispatcher dispatcher;
281  static bool systembus;
282  static char* path;
283 @@ -44,9 +49,11 @@
284  
285  int main( int argc, char** argv )
286  {
287 +#ifndef DBUSCXX_WIN
288         signal(SIGTERM, niam);
289         signal(SIGINT, niam);
290         signal(SIGALRM, niam);
291 +#endif
292  
293         if(argc == 1)
294         {
295 @@ -69,7 +76,9 @@
296  
297                 DBus::default_dispatcher = &dispatcher;
298  
299 +#ifndef DBUSCXX_WIN
300                 alarm(1);
301 +#endif
302  
303                 dispatcher.enter();
304         }
305 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/tools/Makefile.am mingw32-dbus-1.2.4.mingw/dbuscxx/tools/Makefile.am
306 --- mingw32-dbus-1.2.4.orig/dbuscxx/tools/Makefile.am   2008-10-31 10:01:56.000000000 +0000
307 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/tools/Makefile.am  2008-10-31 16:59:53.000000000 +0000
308 @@ -4,6 +4,7 @@
309  
310  AM_CPPFLAGS = \
311         $(dbus_CFLAGS) \
312 +       -DDBUSCXX_WIN \
313         -I$(top_srcdir)/include
314  
315  if CROSS_COMPILING
316 @@ -16,9 +17,11 @@
317  
318  dbusxx_xml2cpp_SOURCES = xml2cpp.h xml2cpp.cpp
319  dbusxx_xml2cpp_LDADD = $(libdbus_cxx_la)
320 +dbusxx_xml2cpp_LDFLAGS = -L../../trunk/dbus/.libs
321  
322  dbusxx_introspect_SOURCES = introspect.h introspect.cpp
323  dbusxx_introspect_LDADD = $(libdbus_cxx_la)
324 +dbusxx_introspect_LDFLAGS = -L../../trunk/dbus/.libs
325  
326  MAINTAINERCLEANFILES = \
327         Makefile.in
328 diff -ur mingw32-dbus-1.2.4.orig/dbuscxx/tools/xml2cpp.cpp mingw32-dbus-1.2.4.mingw/dbuscxx/tools/xml2cpp.cpp
329 --- mingw32-dbus-1.2.4.orig/dbuscxx/tools/xml2cpp.cpp   2008-10-31 10:01:56.000000000 +0000
330 +++ mingw32-dbus-1.2.4.mingw/dbuscxx/tools/xml2cpp.cpp  2008-10-31 16:45:02.000000000 +0000
331 @@ -24,6 +24,9 @@
332  
333  #include "xml2cpp.h"
334  
335 +#include <stdlib.h>
336 +#include <string.h>
337 +
338  #include <dbus/dbus.h>
339  
340  #include <string>