diff options
author | Siraj Razick <siraj.razick@collabora.co.uk> | 2012-01-03 20:59:36 -0500 |
---|---|---|
committer | Rob Staudinger <robsta@linux.intel.com> | 2012-02-02 22:31:57 +0100 |
commit | 2916018392df240d98fe00dc9e1c08b2547aeb5f (patch) | |
tree | aa5f2c0288d21be8f296a651948d6c3a31c52d0f | |
parent | 505a80825f60aa9ac0dfd6170716c3bf758f3339 (diff) |
Build fixes for Mingw32
These changes enables us to cross-compile ytstenut-glib for windows
with mingw32.
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | ytstenut/Makefile.am | 11 | ||||
-rw-r--r-- | ytstenut/empathy-tp-file.c | 40 |
3 files changed, 61 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index 488bce4..0402691 100644 --- a/configure.ac +++ b/configure.ac @@ -57,7 +57,27 @@ AC_SUBST(GLIB_PREFIX) TELEPATHY_VERSION=">= 0.11.7" AC_SUBST(TELEPATHY_VERSION) -YTS_PC_MODULES="$YTS_PC_MODULES telepathy-glib $TELEPATHY_VERSION telepathy-ytstenut-glib >= 0.2.0 gio-unix-2.0 rest-0.7 >= 0.7 glib-2.0 gobject-2.0" +AC_MSG_CHECKING([for operating system]) +case "$host" in + *-*-*mingw*|*-*-*cygwin*) + platform=win32 + ;; + *) + platform=generic + ;; +esac + +AC_MSG_RESULT($platform) + +AM_CONDITIONAL([OS_WINDOWS], [test "$platform" = "win32"]) + +YTS_PC_MODULES="$YTS_PC_MODULES telepathy-glib $TELEPATHY_VERSION telepathy-ytstenut-glib >= 0.2.0 rest-0.7 >= 0.7 glib-2.0 gobject-2.0" + +if test "$platform" = "win32"; then +YTS_PC_MODULES="$YTS_PC_MODULES gio-windows-2.0" +else +YTS_PC_MODULES="$YTS_PC_MODULES gio-unix-2.0" +fi AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug], @@ -172,6 +192,7 @@ echo " Debug : ${enable_debug} API Reference : ${enable_gtk_doc} Introspection : ${have_introspection} + Platform : ${platform} CFLAGS: ${CFLAGS} diff --git a/ytstenut/Makefile.am b/ytstenut/Makefile.am index de892cd..baa658c 100644 --- a/ytstenut/Makefile.am +++ b/ytstenut/Makefile.am @@ -295,11 +295,20 @@ endif # WITH_INTROSPECTION # PONDERING should only run on platforms we know it works. # Use "nm" to get the public symbols from libytstenut, and then # check that every symbol from ytstenut.sym actually shows up in the library. + +if OS_WINDOWS + SOEXT=".dll" + OUT_VERSION=@YTS_API_VERSION@-@YTS_MINOR_VERSION@ +else + SOEXT=".so" + OUT_VERSION=@YTS_API_VERSION@ +endif + all-local: $(AM_V_GEN) b=`tput bold` && \ n=`tput sgr0` && \ NM_CMD="$(NM) --defined-only --extern-only" && \ - exported_syms=`$${NM_CMD} ".libs/libytstenut-$(YTS_API_VERSION).so" | cut -d' ' -f3` && \ + exported_syms=`$${NM_CMD} ".libs/libytstenut-$(OUT_VERSION)$(SOEXT)" | cut -d' ' -f3` && \ for sym in `cat $(srcdir)/ytstenut.sym`; do \ if [ "`echo $${exported_syms} | grep $${sym}`" = "" ]; then \ echo "$${b}Error: $${sym} exported in ytstenut.sym but not found in libytstenut.$${n}" && \ diff --git a/ytstenut/empathy-tp-file.c b/ytstenut/empathy-tp-file.c index 2a87f6d..ac11e4b 100644 --- a/ytstenut/empathy-tp-file.c +++ b/ytstenut/empathy-tp-file.c @@ -32,11 +32,25 @@ #include <string.h> #include <unistd.h> #include <errno.h> +#include <glib.h> +#include <gio/gio.h> +#include <telepathy-glib/gtypes.h> +#include <telepathy-glib/proxy-subclass.h> + +#ifdef G_OS_WIN32 +#include <windows.h> +#include <ws2tcpip.h> +#include <gio/gwin32inputstream.h> +#include <gio/gwin32outputstream.h> +#else #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> +#include <gio/gunixinputstream.h> +#include <gio/gunixoutputstream.h> +#endif #if 0 #include <glib/gi18n-lib.h> @@ -44,12 +58,6 @@ #define _(x) (x) #endif -#include <gio/gio.h> -#include <gio/gunixinputstream.h> -#include <gio/gunixoutputstream.h> - -#include <telepathy-glib/gtypes.h> -#include <telepathy-glib/proxy-subclass.h> #include <telepathy-glib/util.h> #include <telepathy-glib/interfaces.h> @@ -317,7 +325,7 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) return; } - +#ifdef G_OS_UNIX if (priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_UNIX) { struct sockaddr_un addr; @@ -330,13 +338,18 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) my_addr = (struct sockaddr *) &addr; my_size = sizeof (addr); } - else if (priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_IPV4) +#endif + if (priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_IPV4) { struct sockaddr_in addr; memset (&addr, 0, sizeof (addr)); addr.sin_family = domain; +#ifdef G_OS_WIN32 + addr.sin_addr.s_addr = inet_addr ((const char * ) priv->socket_address->data); +#else inet_pton (AF_INET, priv->socket_address->data, &addr.sin_addr); +#endif addr.sin_port = htons (priv->port); my_addr = (struct sockaddr *) &addr; @@ -374,9 +387,11 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) if (priv->incoming) { GInputStream *socket_stream; - +#ifdef G_OS_WIN32 + socket_stream = g_win32_input_stream_new (fd, TRUE); +#else socket_stream = g_unix_input_stream_new (fd, TRUE); - +#endif g_output_stream_splice_async (priv->out_stream, socket_stream, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, @@ -388,8 +403,11 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) else { GOutputStream *socket_stream; - +#ifdef G_OS_WIN32 + socket_stream = g_win32_output_stream_new (fd, TRUE); +#else socket_stream = g_unix_output_stream_new (fd, TRUE); +#endif g_output_stream_splice_async (socket_stream, priv->in_stream, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | |