Hi,
Friedrich: C_O_N_G_R_A_T_U_L_A_T_I_O_N_S !!!!!!!!!
I have attached a patch to make libsyncml compile under Windows/MinGW.
As suggested by Daniel, the "cable" part has been #ifdef'ed out.
Please review and check-in if you find it appropriate.
Following this patch, libsyncml compiles under Windows/MinGW.
However, there are still some linking problems:
Creating library file: libsyncml.dll.a
CMakeFiles/syncml.dir/sml_support.obj:sml_support.c:(.text+0x2d7):
undefined reference to `_imp__pthread_self'
CMakeFiles/syncml.dir/data_sync_api/data_sync.obj:data_sync.c:(.text+0x1d5f):
undefined reference to `index'
CMakeFiles/syncml.dir/data_sync_api/data_sync.obj:data_sync.c:(.text+0x1dae):
undefined reference to `index'
CMakeFiles/syncml.dir/data_sync_api/data_sync_callbacks.obj:data_sync_callbacks.c:(.text+0x1356):
undefined reference to `index'
CMakeFiles/syncml.dir/objects/sml_devinf_obj.obj:sml_devinf_obj.c:(.text+0xef9):
undefined reference to `GetVersion'
CMakeFiles/syncml.dir/transports/obex_client.obj:obex_client.c:(.text+0x1823):
undefined reference to `htons@4'
CMakeFiles/syncml.dir/transports/obex_client.obj:obex_client.c:(.text+0x1838):
undefined reference to `gethostbyname@4'
CMakeFiles/syncml.dir/transports/obex_client.obj:obex_client.c:(.text+0x1897):
undefined reference to `socket@12'
CMakeFiles/syncml.dir/transports/obex_client.obj:obex_client.c:(.text+0x1904):
undefined reference to `inet_ntoa@4'
CMakeFiles/syncml.dir/transports/obex_client.obj:obex_client.c:(.text+0x1970):
undefined reference to `connect@12'
CMakeFiles/syncml.dir/transports/obex_server.obj:obex_server.c:(.text+0x1482):
undefined reference to `select@20'
I will continue to try to iron those out, but if anyone has experience /
help / hints to offer, they would be most welcome!
/Henrik
Friedrich Beckmann wrote:
> Hi,
>
> sorry for the mess but the wiki that I changed
> for the windows port is here:
>
>
http://www.opensync.org/wiki/trunk/windows>
> Sorry also for being so late but I am quite busy
> changing clothes of my new daughter...
>
> Regards
>
> Friedrich
>
> Daniel Gollub schrieb:
>
>> On Friday 03 April 2009 05:29:55 pm Henrik /KaarPoSoft wrote:
>>
>>> Hi,
>>>
>>> I am trying to port OpenSync in general - and SyncML and mozilla-sync in
>>> particular - to Windows under MinGW/MSYS.
>>>
>>> I have looked at
http://opensync.org/wiki/devel/compilingForWindows>>> which does not contain too many details ))-:
>>> My approach, in case you care, is documented here:
>>>
http://kaarposoft.dk/bluezync/building.html#building_windows>>>
>>> Although the basic OpenSync now compiles (except for a few issues for
>>> which I have created ticket with patches), I do have one problem with
>>> libsyncml:
>>> Compiling libsyncml complains that "termios.h" is not found.
>>> I have looked extensively for a package containing this (probably
>>> termcap), but found nothing so far.
>>>
>> In GNU/Linux this is shipped by glibc.
>>
>>
>>> So:
>>> 1) Does anyone know where to find a library/package including
>>> "termios.h" for Windows/MinGW/MSYS ?
>>>
>>
http://www.gnu.org/software/hello/manual/gnulib/termios_002eh.html>>
>>
>>> 2) Does anyone have experiences with Windows/MinGW/MSYS porting they
>>> want to share?
>>>
>> Yes - but not with regards to termios.
>> Looking at the code where this is used in libsyncml - i would say quick an
>> easy fix would by check for the termios.h and if not declared disable the
>> ClientCableConnect transport. This ObexCableConnect is used by (old?) Samsungs
>> and LG(?) mobiles and some other - which require some AT-command-chatting to
>> enable the OBEX-Server on the mobile.
>>
>> Actually we would just need to #ifdef __WIN32__ this code and write it on the
>> Windows provided Serial API.
>>
>> I checked other projects which could face the same problem - e.g. openobex has
>> a test application, which has a TODO for mingw builds ;)
>>
>> Just #ifdef the libsyncml code until it builds for you - and send a patch for
>> review ;)
>>
>>
>> Best Regards,
>> Daniel
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Opensync-devel mailing list
>>
Opensync-devel@...
>>
https://lists.sourceforge.net/lists/listinfo/opensync-devel>>
>>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
>
http://p.sf.net/sfu/www-ibm-com> _______________________________________________
> Opensync-devel mailing list
>
Opensync-devel@...
>
https://lists.sourceforge.net/lists/listinfo/opensync-devel>
>
Index: libsyncml/transports/obex_client_internals.h
===================================================================
--- libsyncml/transports/obex_client_internals.h (revision 1038)
+++ libsyncml/transports/obex_client_internals.h (working copy)
@@ -25,8 +25,10 @@
#include "obex_bluetooth.h"
#include <openobex/obex.h>
+#ifndef WIN32
#include <termios.h>
#include <sys/ioctl.h>
+#endif
#define STREAM_CHUNK 4096
@@ -61,8 +63,9 @@
char *databuf;
int *databuflen;
int connected;
+#ifndef WIN32
struct termios oldtio;
-
+#endif
SmlBool busy;
SmlBool error;
SmlMimeType mimetype;
Index: libsyncml/transports/obex_server.c
===================================================================
--- libsyncml/transports/obex_server.c (revision 1038)
+++ libsyncml/transports/obex_server.c (working copy)
@@ -28,6 +28,7 @@
#include "obex_internals.h"
#include "obex_server_internals.h"
+#ifndef WIN32
#include <fcntl.h>
#include <sys/poll.h>
#include <sys/stat.h>
@@ -36,6 +37,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#endif
static gboolean _dispatch_obex(gpointer data)
{
Index: libsyncml/transports/obex_client.c
===================================================================
--- libsyncml/transports/obex_client.c (revision 1038)
+++ libsyncml/transports/obex_client.c (working copy)
@@ -37,23 +37,27 @@
#endif
#include <fcntl.h>
+#ifndef WIN32
#include <sys/poll.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <termios.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#endif
+#include <sys/types.h>
#include <stdio.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <netinet/in.h>
#include <strings.h>
+#ifndef WIN32
+
static SmlBool obex_cable_at(
SmlTransportObexClientEnv *userdata,
const char *cmd,
@@ -408,6 +412,8 @@
}
+#endif
+
static void smlTransportObexClientEvent(obex_t *handle, obex_object_t *object, int mode, int event, int obex_cmd, int obex_rsp)
{
smlTrace(TRACE_ENTRY, "%s(%p, %p, %i, %i, %i, %i)", __func__, handle, object, mode, event, obex_cmd, obex_rsp);
@@ -725,6 +731,7 @@
return FALSE;
}
+#ifndef WIN32
if (env->type == SML_TRANSPORT_CONNECTION_TYPE_SERIAL) {
obex_ctrans_t cabletrans = {
smlTransportObexClientCableConnect,
@@ -733,9 +740,9 @@
smlTransportObexClientCableWrite,
obex_cable_handleinput,
env};
-
OBEX_RegisterCTransport(env->obexhandle, &cabletrans);
}
+#endif
smlTrace(TRACE_EXIT, "%s", __func__);
return TRUE;
@@ -976,6 +983,7 @@
smlTrace(TRACE_INTERNAL, "%s: IrDA connect done", __func__);
} else {
+#ifndef WIN32
struct termios tio;
memset(&tio, 0, sizeof(tio));
@@ -1018,6 +1026,7 @@
goto error_unlock;
}
tcflush(fd, TCIFLUSH);
+#endif
}
if (env->type != SML_TRANSPORT_CONNECTION_TYPE_USB
@@ -1081,8 +1090,10 @@
error_transport_close:
OBEX_Cleanup(env->obexhandle);
error_unlock:
+#ifndef WIN32
if (!lockf(fd, F_ULOCK, 0))
smlTrace(TRACE_ERROR, "%s: error_unlock failed.", __func__);
+#endif
error_close:
close(fd);
error:
Index: libsyncml/objects/sml_devinf_obj.c
===================================================================
--- libsyncml/objects/sml_devinf_obj.c (revision 1038)
+++ libsyncml/objects/sml_devinf_obj.c (working copy)
@@ -29,7 +29,11 @@
#include <libsyncml/sml_command_internals.h>
#include "libsyncml/sml_error_internals.h"
+#ifdef WIN32
+#include <windef.h>
+#else
#include<sys/utsname.h>
+#endif
/* Design notice
*
@@ -371,6 +375,18 @@
smlDevInfSetModel(devinf, "libsyncml");
if (!smlDevInfGetOEM(devinf))
{
+#ifdef WIN32
+ smlDevInfSetOEM(devinf, "Windows");
+ DWORD dwVersion = GetVersion();
+ DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
+ DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
+ DWORD dwBuild = 0;
+ if (dwVersion < 0x80000000) dwBuild = (DWORD)(HIWORD(dwVersion));
+
+ char szVersion[1024];
+ sprintf(szVersion, "%d.%d (%d)", dwMajorVersion, dwMinorVersion, dwBuild);
+ smlDevInfSetFirmwareVersion(devinf, szVersion);
+#else
struct utsname *buf = malloc(sizeof(struct utsname));
if (uname(buf) == 0)
{
@@ -378,6 +394,7 @@
smlDevInfSetFirmwareVersion(devinf, buf->release);
}
smlSafeFree((gpointer *)&buf);
+#endif
}
if (!smlDevInfGetSoftwareVersion(devinf))
smlDevInfSetSoftwareVersion(devinf, VERSION);
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com_______________________________________________
Opensync-devel mailing list
Opensync-devel@...
https://lists.sourceforge.net/lists/listinfo/opensync-devel