/pidgin/main: 6c3ab2fd4412: cross-win32: fix finch build

Tomasz Wasilczyk twasilczyk at pidgin.im
Sun Apr 20 12:13:44 EDT 2014


Changeset: 6c3ab2fd441240f63f97dd3af1f64ce93a2566f5
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-20 18:13 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/6c3ab2fd4412

Description:

cross-win32: fix finch build

diffstat:

 configure.ac                 |  10 +++++++++-
 finch/Makefile.am            |   5 +++++
 finch/finch.c                |   2 ++
 finch/gntblist.h             |   1 +
 finch/gntdebug.c             |   2 +-
 finch/gntidle.c              |   1 +
 finch/gntpounce.c            |   4 ++++
 finch/gntsound.c             |   4 ++--
 finch/libfinch.c             |   2 +-
 finch/libgnt/gnt.h           |  14 ++++++++++++++
 finch/libgnt/gntbindable.h   |   1 -
 finch/libgnt/gntcolors.c     |   4 ----
 finch/libgnt/gntinternal.h   |   4 +++-
 finch/libgnt/gntkeys.h       |   1 -
 finch/libgnt/gntmain.c       |  12 +++++++++++-
 finch/libgnt/gntwidget.c     |   1 -
 finch/libgnt/gntwidget.h     |   1 -
 finch/plugins/gntclipboard.c |   1 +
 18 files changed, 55 insertions(+), 15 deletions(-)

diffs (truncated from 311 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -816,10 +816,18 @@ if test "x$enable_consoleui" = "xyes"; t
 	AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"],
 	    [enable_consoleui=no], [$GNT_LIBS])
 
+	if test "x$is_win32" = "xyes" ; then
+		ncurses_sys_prefix="/usr/$host/sys-root/$host"
+	else
+		ncurses_sys_prefix="/usr"
+	fi
+
+	ncurses_sys_dirs="$ncurses_sys_prefix/include/ncursesw $ncurses_sys_prefix/include"
+
 	if test "x$enable_consoleui" = "xyes"; then
 		dnl # Some distros put the headers in ncursesw/, some don't
 		found_ncurses_h=no
-		for location in $ac_ncurses_includes $NCURSES_HEADERS /usr/include/ncursesw /usr/include
+		for location in $ac_ncurses_includes $NCURSES_HEADERS $ncurses_sys_dirs
 		do
 			f="$location/ncurses.h"
 			orig_CFLAGS="$CFLAGS"
diff --git a/finch/Makefile.am b/finch/Makefile.am
--- a/finch/Makefile.am
+++ b/finch/Makefile.am
@@ -83,6 +83,11 @@ libfinch_la_LIBADD = \
 	./libgnt/libgnt.la \
 	$(top_builddir)/libpurple/libpurple.la
 
+if IS_WIN32
+libfinch_la_LIBADD += \
+	-lwinmm
+endif
+
 finch_DEPENDENCIES = $(builddir)/libfinch.la
 finch_LDFLAGS = -export-dynamic
 finch_LDADD = $(builddir)/libfinch.la $(libfinch_la_LIBADD)
diff --git a/finch/finch.c b/finch/finch.c
--- a/finch/finch.c
+++ b/finch/finch.c
@@ -28,7 +28,9 @@
 
 int main(int argc, char *argv[])
 {
+#ifndef _WIN32
 	signal(SIGPIPE, SIG_IGN);
+#endif
 
 #if !GLIB_CHECK_VERSION(2, 32, 0)
 	/* GLib threading system is automaticaly initialized since 2.32.
diff --git a/finch/gntblist.h b/finch/gntblist.h
--- a/finch/gntblist.h
+++ b/finch/gntblist.h
@@ -29,6 +29,7 @@
  */
 
 #include "buddylist.h"
+#include "gnt.h"
 #include "gnttree.h"
 
 #define FINCH_TYPE_BLIST_MANAGER (finch_blist_manager_get_type())
diff --git a/finch/gntdebug.c b/finch/gntdebug.c
--- a/finch/gntdebug.c
+++ b/finch/gntdebug.c
@@ -72,7 +72,7 @@ handle_fprintf_stderr(gboolean stop)
 		}
 		return;
 	}
-	if (pipe(pipes)) {
+	if (purple_input_pipe(pipes)) {
 		readhandle = -1;
 		return;
 	};
diff --git a/finch/gntidle.c b/finch/gntidle.c
--- a/finch/gntidle.c
+++ b/finch/gntidle.c
@@ -25,6 +25,7 @@
 
 #include "finch.h"
 #include "gntidle.h"
+#include "gnt.h"
 #include "gntwm.h"
 
 #include "idle.h"
diff --git a/finch/gntpounce.c b/finch/gntpounce.c
--- a/finch/gntpounce.c
+++ b/finch/gntpounce.c
@@ -882,6 +882,9 @@ pounce_cb(PurplePounce *pounce, PurplePo
 
 	if (purple_pounce_action_is_enabled(pounce, "execute-command"))
 	{
+#ifdef _WIN32
+		purple_debug_error("gntpounce", "execute-command is not supported on this OS");
+#else
 		const char *command;
 
 		command = purple_pounce_action_get_attribute(pounce,
@@ -911,6 +914,7 @@ pounce_cb(PurplePounce *pounce, PurplePo
 				g_free(localecmd);
 			}
 		}
+#endif
 	}
 
 	if (purple_pounce_action_is_enabled(pounce, "play-beep"))
diff --git a/finch/gntsound.c b/finch/gntsound.c
--- a/finch/gntsound.c
+++ b/finch/gntsound.c
@@ -423,7 +423,7 @@ finch_sound_uninit(void)
 	purple_signals_disconnect_by_handle(finch_sound_get_handle());
 }
 
-#ifdef USE_GSTREAMER
+#if defined(USE_GSTREAMER) && !defined(_WIN32)
 static gboolean
 bus_call (GstBus *bus, GstMessage *msg, gpointer data)
 {
@@ -456,7 +456,7 @@ static void
 finch_sound_play_file(const char *filename)
 {
 	const char *method;
-#ifdef USE_GSTREAMER
+#if defined(USE_GSTREAMER) && !defined(_WIN32)
 	float volume;
 	char *uri;
 	GstElement *sink = NULL;
diff --git a/finch/libfinch.c b/finch/libfinch.c
--- a/finch/libfinch.c
+++ b/finch/libfinch.c
@@ -174,7 +174,7 @@ static gboolean purple_gnt_io_invoke(GIO
 
 #ifdef _WIN32
 	if(! purple_cond) {
-#if DEBUG
+#if 0
 		purple_debug_misc("gnt_eventloop",
 			   "CLOSURE received GIOCondition of 0x%x, which does not"
 			   " match 0x%x (READ) or 0x%x (WRITE)\n",
diff --git a/finch/libgnt/gnt.h b/finch/libgnt/gnt.h
--- a/finch/libgnt/gnt.h
+++ b/finch/libgnt/gnt.h
@@ -30,6 +30,20 @@
  */
 
 #include <glib.h>
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+#ifdef _WIN32
+#  undef KEY_EVENT
+#endif
+#ifdef NO_WIDECHAR
+#  define NCURSES_WIDECHAR 0
+#else
+#  define NCURSES_WIDECHAR 1
+#endif
+#include <ncurses.h>
+
 #include "gntwidget.h"
 #include "gntclipboard.h"
 #include "gntcolors.h"
diff --git a/finch/libgnt/gntbindable.h b/finch/libgnt/gntbindable.h
--- a/finch/libgnt/gntbindable.h
+++ b/finch/libgnt/gntbindable.h
@@ -32,7 +32,6 @@
 #include <stdio.h>
 #include <glib.h>
 #include <glib-object.h>
-#include <ncurses.h>
 
 #define GNT_TYPE_BINDABLE				(gnt_bindable_get_type())
 #define GNT_BINDABLE(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BINDABLE, GntBindable))
diff --git a/finch/libgnt/gntcolors.c b/finch/libgnt/gntcolors.c
--- a/finch/libgnt/gntcolors.c
+++ b/finch/libgnt/gntcolors.c
@@ -20,10 +20,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 
-#include "config.h"
-
-#include <ncurses.h>
-
 #include "gntinternal.h"
 #undef GNT_LOG_DOMAIN
 #define GNT_LOG_DOMAIN "Colors"
diff --git a/finch/libgnt/gntinternal.h b/finch/libgnt/gntinternal.h
--- a/finch/libgnt/gntinternal.h
+++ b/finch/libgnt/gntinternal.h
@@ -19,7 +19,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
-#include <glib.h>
+
+#include "gnt.h"
+
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "Gnt"
 
diff --git a/finch/libgnt/gntkeys.h b/finch/libgnt/gntkeys.h
--- a/finch/libgnt/gntkeys.h
+++ b/finch/libgnt/gntkeys.h
@@ -29,7 +29,6 @@
  * @title: Keys API
  */
 
-#include <curses.h>
 #include <term.h>
 
 /*
diff --git a/finch/libgnt/gntmain.c b/finch/libgnt/gntmain.c
--- a/finch/libgnt/gntmain.c
+++ b/finch/libgnt/gntmain.c
@@ -30,7 +30,9 @@
 #include <gmodule.h>
 
 #include <sys/types.h>
+#ifndef _WIN32
 #include <sys/wait.h>
+#endif
 
 #include "gntinternal.h"
 #undef GNT_LOG_DOMAIN
@@ -339,6 +341,7 @@ refresh_screen(void)
 	return FALSE;
 }
 
+#ifndef _WIN32
 /* Xerox */
 static void
 clean_pid(void)
@@ -356,6 +359,7 @@ clean_pid(void)
 		perror(errmsg);
 	}
 }
+#endif
 
 static void
 exit_confirmed(gpointer null)
@@ -425,10 +429,12 @@ sighandler(int sig)
 		signal(SIGWINCH, sighandler);
 		break;
 #endif
+#ifndef _WIN32
 	case SIGCHLD:
 		clean_pid();
 		signal(SIGCHLD, sighandler);
 		break;
+#endif
 	case SIGINT:
 		ask_before_exit();
 		signal(SIGINT, sighandler);
@@ -508,9 +514,11 @@ void gnt_init()
 #ifdef SIGWINCH
 	org_winch_handler = signal(SIGWINCH, sighandler);
 #endif
+#ifndef _WIN32
 	signal(SIGCHLD, sighandler);
+	signal(SIGPIPE, SIG_IGN);
+#endif
 	signal(SIGINT, sighandler);
-	signal(SIGPIPE, SIG_IGN);
 
 #if !GLIB_CHECK_VERSION(2, 36, 0)
 	/* GLib type system is automaticaly initialized since 2.36. */
@@ -696,7 +704,9 @@ reap_child(GPid pid, gint status, gpoint
 		cp->callback(status, cp->data);
 	}
 	g_free(cp);
+#ifndef _WIN32
 	clean_pid();
+#endif
 	wm->mode = GNT_KP_MODE_NORMAL;
 	endwin();
 	setup_io();
diff --git a/finch/libgnt/gntwidget.c b/finch/libgnt/gntwidget.c
--- a/finch/libgnt/gntwidget.c
+++ b/finch/libgnt/gntwidget.c
@@ -27,7 +27,6 @@
 #include "gntstyle.h"
 #include "gntmarshal.h"
 #include "gntutils.h"
-#include "gnt.h"
 
 enum
 {
diff --git a/finch/libgnt/gntwidget.h b/finch/libgnt/gntwidget.h
--- a/finch/libgnt/gntwidget.h
+++ b/finch/libgnt/gntwidget.h
@@ -31,7 +31,6 @@
 
 #include <stdio.h>
 #include <glib.h>
-#include <ncurses.h>
 
 #include "gntbindable.h"
 



More information about the Commits mailing list