/pidgin/main: 3e60f9385431: cross-win32: libpurple builds now

Tomasz Wasilczyk twasilczyk at pidgin.im
Tue Apr 15 19:30:07 EDT 2014


Changeset: 3e60f9385431048472a4e0d555b246d910b20044
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-16 01:30 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/3e60f9385431

Description:

cross-win32: libpurple builds now

diffstat:

 configure.ac                     |   3 +++
 libpurple/Makefile.am            |   5 ++++-
 libpurple/example/nullclient.c   |  38 +++++++++++++++++++++++++++++++++++---
 libpurple/win32/libc_interface.c |   2 +-
 4 files changed, 43 insertions(+), 5 deletions(-)

diffs (110 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,9 @@ dnl Check for Win32
 case "$host" in
 	*-*-mingw* | *-*-cygwin*)
 		is_win32="yes"
+		LIBS="$LIBS -lws2_32"
+		DNSAPI_LIBS="-ldnsapi"
+		AC_SUBST(DNSAPI_LIBS)
 		;;
 	*)
 		is_win32="no"
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -401,6 +401,7 @@ libpurple_la_LDFLAGS = -export-dynamic -
 libpurple_la_LIBADD = \
 	$(STATIC_LINK_LIBS) \
 	$(DBUS_LIBS) \
+	$(DNSAPI_LIBS) \
 	$(GLIB_LIBS) \
 	$(LIBXML_LIBS) \
 	$(NETWORKMANAGER_LIBS) \
@@ -413,6 +414,7 @@ libpurple_la_LIBADD = \
 	$(JSON_LIBS) \
 	$(GNUTLS_LIBS) \
 	$(NSS_LIBS) \
+	$(ZLIB_LIBS) \
 	-lm
 
 AM_CPPFLAGS = \
@@ -428,4 +430,5 @@ AM_CPPFLAGS = \
 	$(NETWORKMANAGER_CFLAGS) \
 	$(JSON_CFLAGS) \
 	$(GNUTLS_CFLAGS) \
-	$(NSS_CFLAGS)
+	$(NSS_CFLAGS) \
+	$(ZLIB_CFLAGS)
diff --git a/libpurple/example/nullclient.c b/libpurple/example/nullclient.c
--- a/libpurple/example/nullclient.c
+++ b/libpurple/example/nullclient.c
@@ -24,13 +24,15 @@
 #include "purple.h"
 
 #include <glib.h>
+#include <glib/gprintf.h>
 
 #include <signal.h>
 #include <string.h>
-#ifndef _WIN32
-#include <unistd.h>
+#ifdef _WIN32
+#  include <conio.h>
+#  include "win32/win32dep.h"
 #else
-#include "win32/win32dep.h"
+#  include <unistd.h>
 #endif
 
 #include "defines.h"
@@ -236,6 +238,36 @@ connect_to_signals_for_demonstration_pur
 				PURPLE_CALLBACK(signed_on), NULL);
 }
 
+#if defined(_WIN32) || defined(__BIONIC__)
+#ifndef PASS_MAX
+#  define PASS_MAX 1024
+#endif
+static gchar *
+getpass(const gchar *prompt)
+{
+	static gchar buff[PASS_MAX + 1];
+	guint i = 0;
+
+	g_fprintf(stderr, "%s", prompt);
+	fflush(stderr);
+
+	while (i < sizeof(buff) - 1) {
+#ifdef __BIONIC__
+		buff[i] = getc(stdin);
+#else
+		buff[i] = _getch();
+#endif
+		if (buff[i] == '\r' || buff[i] == '\n')
+			break;
+		i++;
+	}
+	buff[i] = '\0';
+	g_fprintf(stderr, "\n");
+
+	return buff;
+}
+#endif /* _WIN32 || __BIONIC__ */
+
 int main(int argc, char *argv[])
 {
 	GList *iter;
diff --git a/libpurple/win32/libc_interface.c b/libpurple/win32/libc_interface.c
--- a/libpurple/win32/libc_interface.c
+++ b/libpurple/win32/libc_interface.c
@@ -82,7 +82,7 @@ int wpurple_socket (int namespace, int s
 
 	ret = socket( namespace, style, protocol );
 
-	if( ret == INVALID_SOCKET ) {
+	if (ret == (int)INVALID_SOCKET) {
 		errno = WSAGetLastError();
 		return -1;
 	}



More information about the Commits mailing list