Am Sonntag 17 Dezember 2006 20:00 schrieb Marcel Holtmann:
> > > please post the patch to the mailing list. I need to review it and I am
> > > sure that we have to break it into pieces.
> >
> > I attached them. Order is:
> > win32.patch
> > old-compiler.patch
> > ws2bth.patch
> > glib-win32.patch
> > apps-win32.patch
>
> first I need to know what is old-compiler.patch for. I don't see the
> reason behind it.
The reason is simple: it will not compile without it. "interface" is a
keyword in the Windows C world and mingw32 stumbles about that:
In file included from obex_main.h:58,
from obex.c:50:
../include/openobex/obex_const.h:68: error: syntax error before "struct"
../include/openobex/obex_const.h:68: warning: no semicolon at end of struct or
union
[...]
The patch fixes this.
Actually, mingw32 is broken but since there is no alternative...
> The second is that the Bluetooth part is too hackish for me at the
> moment, I would need more time to look at it.
Ok. If you want the patch that adapts to the patches in this mail, just
tell me.
> So can you send a win32
> patch that adapts this with leaving Bluetooth out of it. This would be
> much more simpler to apply and get this started.
Sure, minimal set(only for lib/ subdir):
win32.patch
old-compiler.patch
LIBLINK_LIBS now moved as -lws2_32 is always needed when using winsock2.
HS
Index: openobex-cvs/include/obex_const.h
===================================================================
--- openobex-cvs.orig/include/obex_const.h 2006-12-17 18:12:08.747116756 +0100
+++ openobex-cvs/include/obex_const.h 2006-12-17 19:17:44.313074256 +0100
@@ -65,7 +65,7 @@
/* Active data interface description, typically empty */
char *data_interface_active;
/* Internal information for the transport layer in the library */
- struct obex_usb_intf_transport_t *interface;
+ struct obex_usb_intf_transport_t *intf;
} obex_usb_intf_t;
/* Generic OBEX interface information */
Index: openobex-cvs/lib/obex.c
===================================================================
--- openobex-cvs.orig/lib/obex.c 2006-12-17 19:17:42.664971256 +0100
+++ openobex-cvs/lib/obex.c 2006-12-17 19:17:44.345076256 +0100
@@ -1122,7 +1122,7 @@
* An easier connect function to connect to a discovered interface (currently
* USB OBEX only).
*/
-int OBEX_InterfaceConnect(obex_t *self, obex_interface_t *interface)
+int OBEX_InterfaceConnect(obex_t *self, obex_interface_t *intf)
{
DEBUG(4, "\n");
@@ -1133,12 +1133,12 @@
return -EBUSY;
}
- obex_return_val_if_fail(interface != NULL, -1);
+ obex_return_val_if_fail(intf != NULL, -1);
switch (self->trans.type) {
case OBEX_TRANS_USB:
- obex_return_val_if_fail(interface->usb.interface != NULL, -1);
+ obex_return_val_if_fail(intf->usb.intf != NULL, -1);
#ifdef HAVE_USB
- usbobex_prepare_connect(self, interface->usb.interface);
+ usbobex_prepare_connect(self, intf->usb.intf);
return obex_transport_connect_request(self);
#else
return -ESOCKTNOSUPPORT;
Index: openobex-cvs/include/obex.h
===================================================================
--- openobex-cvs.orig/include/obex.h 2006-12-17 19:17:42.520962256 +0100
+++ openobex-cvs/include/obex.h 2006-12-17 19:17:44.413080506 +0100
@@ -141,8 +141,8 @@
/*
* OBEX interface discovery API
*/
- int OBEX_FindInterfaces(obex_t *self, obex_interface_t **interfaces);
- int OBEX_InterfaceConnect(obex_t *self, obex_interface_t *interface);
+ int OBEX_FindInterfaces(obex_t *self, obex_interface_t **intf);
+ int OBEX_InterfaceConnect(obex_t *self, obex_interface_t *intf);
void OBEX_FreeInterfaces(obex_t *self);
#ifdef __cplusplus
Index: openobex-cvs/lib/usbobex.c
===================================================================
--- openobex-cvs.orig/lib/usbobex.c 2006-12-17 19:19:27.283509506 +0100
+++ openobex-cvs/lib/usbobex.c 2006-12-17 19:19:34.891985006 +0100
@@ -264,7 +264,7 @@
memset(intf_array, 0, sizeof(obex_interface_t) * num);
num = 0;
while (current) {
- intf_array[num].usb.interface = current;
+ intf_array[num].usb.intf = current;
usb_handle = usb_open(current->device);
get_intf_string(usb_handle, &intf_array[num].usb.manufacturer,
current->device->descriptor.iManufacturer);
@@ -313,7 +313,7 @@
free(intf[i].usb.control_interface);
free(intf[i].usb.data_interface_idle);
free(intf[i].usb.data_interface_active);
- free(intf[i].usb.interface);
+ free(intf[i].usb.intf);
}
free(intf);
}
Index: openobex-cvs/acinclude.m4
===================================================================
--- openobex-cvs.orig/acinclude.m4 2006-12-17 19:29:43.798039256 +0100
+++ openobex-cvs/acinclude.m4 2006-12-17 19:30:31.136997756 +0100
@@ -96,7 +96,15 @@
])
AC_DEFUN([AC_PATH_USB], [
- PKG_CHECK_MODULES(USB, libusb, usb_found=yes, AC_MSG_RESULT(no))
+ case $host in
+ *-*-mingw32*)
+ USB_CFLAGS=""
+ USB_LIBS="-lusb"
+ ;;
+ *)
+ PKG_CHECK_MODULES(USB, libusb, usb_found=yes, AC_MSG_RESULT(no))
+ ;;
+ esac
AC_SUBST(USB_CFLAGS)
AC_SUBST(USB_LIBS)
AC_CHECK_LIB(usb, usb_get_busses, dummy=yes, AC_DEFINE(NEED_USB_GET_BUSSES, 1, [Define to 1 if you need the usb_get_busses() function.]))
Index: openobex-cvs/apps/obex_tcp.c
===================================================================
--- openobex-cvs.orig/apps/obex_tcp.c 2006-12-17 19:29:43.850042506 +0100
+++ openobex-cvs/apps/obex_tcp.c 2006-12-17 19:30:31.148998506 +0100
@@ -38,7 +38,7 @@
#include <string.h>
#if _WIN32
-#include <winsock.h>
+#include <winsock2.h>
#else
#include <sys/stat.h>
Index: openobex-cvs/apps/obex_test.c
===================================================================
--- openobex-cvs.orig/apps/obex_test.c 2006-12-17 19:29:43.906046006 +0100
+++ openobex-cvs/apps/obex_test.c 2006-12-17 19:30:31.193001256 +0100
@@ -35,7 +35,7 @@
#include <string.h>
#if _WIN32
-#include <winsock.h>
+#include <winsock2.h>
#else
#include <sys/socket.h>
#include <arpa/inet.h>
Index: openobex-cvs/include/obex.h
===================================================================
--- openobex-cvs.orig/include/obex.h 2006-12-17 19:29:43.970050006 +0100
+++ openobex-cvs/include/obex.h 2006-12-17 19:45:53.630650006 +0100
@@ -34,7 +34,7 @@
#include <inttypes.h>
#ifdef _WIN32
-#include <winsock.h>
+#include <winsock2.h>
#else
#include <sys/socket.h>
#endif
Index: openobex-cvs/lib/btobex.c
===================================================================
--- openobex-cvs.orig/lib/btobex.c 2006-12-17 19:29:44.022053256 +0100
+++ openobex-cvs/lib/btobex.c 2006-12-17 19:30:31.305008256 +0100
@@ -34,7 +34,7 @@
#ifdef HAVE_BLUETOOTH
#ifdef _WIN32
-#include <winsock.h>
+#include <winsock2.h>
#else /* _WIN32 */
/* Linux/FreeBSD/NetBSD case */
Index: openobex-cvs/lib/inobex.c
===================================================================
--- openobex-cvs.orig/lib/inobex.c 2006-12-17 19:29:44.074056506 +0100
+++ openobex-cvs/lib/inobex.c 2006-12-17 19:30:31.353011256 +0100
@@ -35,7 +35,8 @@
#include <string.h>
#ifdef _WIN32
-#include <winsock.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
#else
#include <sys/types.h>
Index: openobex-cvs/lib/irobex.c
===================================================================
--- openobex-cvs.orig/lib/irobex.c 2006-12-17 19:29:44.126059756 +0100
+++ openobex-cvs/lib/irobex.c 2006-12-17 19:30:31.389013506 +0100
@@ -35,7 +35,7 @@
#ifdef HAVE_IRDA
#ifdef _WIN32
-#include <winsock.h>
+#include <winsock2.h>
#include <irda_wrap.h>
Index: openobex-cvs/lib/obex.c
===================================================================
--- openobex-cvs.orig/lib/obex.c 2006-12-17 19:29:44.174062756 +0100
+++ openobex-cvs/lib/obex.c 2006-12-17 19:45:53.682653256 +0100
@@ -38,7 +38,7 @@
#include <errno.h>
#ifdef _WIN32
-#include <winsock.h>
+#include <winsock2.h>
#define ESOCKTNOSUPPORT 1
#else /* _WIN32 */
Index: openobex-cvs/lib/obex_main.c
===================================================================
--- openobex-cvs.orig/lib/obex_main.c 2006-12-17 19:29:44.222065756 +0100
+++ openobex-cvs/lib/obex_main.c 2006-12-17 19:30:31.473018756 +0100
@@ -33,7 +33,7 @@
#endif
#ifdef _WIN32
-#include <winsock.h>
+#include <winsock2.h>
#else /* _WIN32 */
#include <unistd.h>
Index: openobex-cvs/lib/obex_transport.h
===================================================================
--- openobex-cvs.orig/lib/obex_transport.h 2006-12-17 19:29:44.274069006 +0100
+++ openobex-cvs/lib/obex_transport.h 2006-12-17 19:30:31.513021256 +0100
@@ -31,7 +31,7 @@
#define OBEX_TRANSPORT_H
#ifdef _WIN32
-#include <winsock.h>
+#include <winsock2.h>
#else
#include <netinet/in.h>
#endif
Index: openobex-cvs/lib/Makefile.am
===================================================================
--- openobex-cvs.orig/lib/Makefile.am 2006-12-17 19:29:44.318071756 +0100
+++ openobex-cvs/lib/Makefile.am 2006-12-17 19:30:31.545023256 +0100
@@ -18,10 +18,11 @@
usbobex.c usbobex.h
libopenobex_la_LDFLAGS = \
+ -no-undefined
-version-info 4:0:3 \
-export-symbols $(top_srcdir)/lib/obex.sym
-libopenobex_la_LIBADD = @USB_LIBS@
+libopenobex_la_LIBADD = @USB_LIBS@ @LIBLINK_LIBS@
INCLUDES = -I$(top_builddir)/include
Index: openobex-cvs/lib/obex_main.h
===================================================================
--- openobex-cvs.orig/lib/obex_main.h 2006-12-17 19:29:44.370075006 +0100
+++ openobex-cvs/lib/obex_main.h 2006-12-17 19:30:31.573025006 +0100
@@ -96,9 +96,8 @@
# endif /* OBEX_DUMP != 0 */
#else /* _WIN32 */
-
-void DEBUG(unsigned int n, ...);
-void DUMPBUFFERS(n, label, msg);
+#define DEBUG(n, format, args...)
+#define DUMPBUFFER(n, label, msg)
#endif /* _WIN32 */
Index: openobex-cvs/configure.in
===================================================================
--- openobex-cvs.orig/configure.in 2006-12-17 19:29:44.422078256 +0100
+++ openobex-cvs/configure.in 2006-12-17 19:42:46.930982006 +0100
@@ -17,10 +17,21 @@
m4_define([_LT_AC_TAGCONFIG], [])
m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
+AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_CANONICAL_HOST
+dnl some special libs for the target platform
+LIBLINK_LIBS=
+case $host in
+ *-*-mingw32*)
+ dnl needed for all winsock2 operations
+ LIBLINK_LIBS="-lws2_32"
+ ;;
+esac
+AC_SUBST(LIBLINK_LIBS)
+
AC_PATH_GLIB
AC_PATH_IRDA
AC_PATH_BLUETOOTH
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Openobex-users mailing list
[email protected]
http://lists.sourceforge.net/lists/listinfo/openobex-users