summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <qulogic@pidgin.im>2018-11-29 23:06:14 -0500
committerElliott Sales de Andrade <qulogic@pidgin.im>2018-11-29 23:06:14 -0500
commitaf1888dc3a81cb8c30fb55ad1797399497e7e791 (patch)
treef12f894825db4681fb8ac29a35ff40423892b4b0
parentcc65a59249b4086a04dad3680b0cab06e6b8ab37 (diff)
downloadpidgin-af1888dc3a81cb8c30fb55ad1797399497e7e791.tar.gz
Add explicit ncurses dependency to finch.
This should hopefully be temporary until libgnt wraps the functionality.
-rw-r--r--finch/gntblist.c2
-rw-r--r--finch/gntconv.c2
-rw-r--r--finch/gntpounce.c2
-rw-r--r--finch/gntsound.c2
-rw-r--r--finch/meson.build73
-rw-r--r--finch/plugins/gntgf.c2
-rw-r--r--finch/plugins/meson.build5
7 files changed, 83 insertions, 5 deletions
diff --git a/finch/gntblist.c b/finch/gntblist.c
index f8c6904767..4eb9e14e57 100644
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -21,6 +21,8 @@
#include <internal.h>
#include "finch.h"
+#include NCURSES_HEADER
+
#include <account.h>
#include <buddylist.h>
#include <log.h>
diff --git a/finch/gntconv.c b/finch/gntconv.c
index ebbc982cf6..cbb999e659 100644
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -22,6 +22,8 @@
#include <internal.h>
#include "finch.h"
+#include NCURSES_HEADER
+
#include <cmds.h>
#include <core.h>
#include <idle.h>
diff --git a/finch/gntpounce.c b/finch/gntpounce.c
index 637f9cffa1..a680a829ea 100644
--- a/finch/gntpounce.c
+++ b/finch/gntpounce.c
@@ -21,6 +21,8 @@
*/
#include <internal.h>
+#include NCURSES_HEADER
+
#include <gnt.h>
#include <gntbox.h>
#include <gntbutton.h>
diff --git a/finch/gntsound.c b/finch/gntsound.c
index 6c35677cb0..6063435ce2 100644
--- a/finch/gntsound.c
+++ b/finch/gntsound.c
@@ -21,6 +21,8 @@
#include "finch.h"
#include <internal.h>
+#include NCURSES_HEADER
+
#ifdef _WIN32
#include <windows.h>
#include <mmsystem.h>
diff --git a/finch/meson.build b/finch/meson.build
index a257262085..a6cfec2ee1 100644
--- a/finch/meson.build
+++ b/finch/meson.build
@@ -9,7 +9,74 @@ if get_option('consoleui')
libgnt_gir = libgnt_proj.get_variable('libgnt_gir')
endif
- if libgnt_dep.found()
+ #######################################################################
+ # Check for ncurses and other things used by it
+ # FIXME: This should be temporary until libgnt wraps the functionality.
+ #######################################################################
+ ncurses_available = true
+ ncurses_header = 'ncurses.h'
+ # Some distros put the headers in ncursesw/, some don't. These are ordered to
+ # pick the last available as most-specific version.
+ ncursesw_header_paths = ['', 'ncursesw/']
+
+ ncurses = dependency('ncursesw', required : false)
+ if ncurses.found()
+ foreach location : ncursesw_header_paths
+ f = location + 'ncurses.h'
+ if compiler.has_header_symbol(f, 'get_wch',
+ prefix : '#define _XOPEN_SOURCE_EXTENDED')
+ ncurses_header = f
+ endif
+ endforeach
+ else
+ ncurses_available = false
+ ncurses_inc = []
+ ncurses_libs = compiler.find_library('ncursesw', required : false)
+ if ncurses_libs.found()
+ foreach location : ncursesw_header_paths
+ f = location + 'ncurses.h'
+ if compiler.has_header_symbol(f, 'get_wch',
+ prefix : '#define _XOPEN_SOURCE_EXTENDED')
+ ncurses_available = true
+ ncurses_header = f
+ endif
+ endforeach
+
+ if ncurses_available
+ ncurses = declare_dependency(
+ include_directories : ncurses_inc,
+ dependencies : ncurses_libs
+ )
+ endif
+ endif
+ endif
+
+ if not ncurses_available
+ # ncursesw was not found. Look for plain old ncurses
+ ncurses = dependency('ncurses', required : false)
+ if ncurses.found()
+ ncurses_available = true
+ else
+ ncurses_libs = compiler.find_library('ncurses', required : false)
+ ncurses_available = ncurses_libs.found()
+ ncurses = declare_dependency(dependencies : ncurses_libs)
+ endif
+ endif
+
+ if not ncurses_available and host_machine.system() == 'windows'
+ # Try pdcurses too.
+ ncurses_header = 'curses.h'
+ ncurses_libs = compiler.find_library('pdcurses', required : false)
+ ncurses_available = compiler.has_header(ncurses_header) and ncurses_libs.found()
+ ncurses = declare_dependency(dependencies : ncurses_libs)
+ endif
+
+ if not ncurses_available
+ error('ncurses could not be found!')
+ endif
+
+ if libgnt_dep.found() and ncurses_available
+ ncurses_header = '-DNCURSES_HEADER="@0@"'.format(ncurses_header)
enable_consoleui = true
else
error('''
@@ -96,10 +163,10 @@ if enable_consoleui
libfinch_inc = include_directories('.')
libfinch = shared_library('finch',
libfinch_SOURCES,
- c_args : '-DSTANDALONE',
+ c_args : ['-DSTANDALONE', ncurses_header],
include_directories : [toplevel_inc],
version : PURPLE_LIB_VERSION,
- dependencies : [libpurple_dep, libgnt_dep, glib],
+ dependencies : [libpurple_dep, libgnt_dep, ncurses, glib],
install : true)
libfinch_dep = declare_dependency(
include_directories : [toplevel_inc, libfinch_inc],
diff --git a/finch/plugins/gntgf.c b/finch/plugins/gntgf.c
index aaee0f32af..da18914e91 100644
--- a/finch/plugins/gntgf.c
+++ b/finch/plugins/gntgf.c
@@ -21,6 +21,8 @@
#include "internal.h"
+#include NCURSES_HEADER
+
#define PLUGIN_STATIC_NAME GntGf
#define PREFS_PREFIX "/plugins/gnt/gntgf"
diff --git a/finch/plugins/meson.build b/finch/plugins/meson.build
index 9cdb523f7f..73e6bcc990 100644
--- a/finch/plugins/meson.build
+++ b/finch/plugins/meson.build
@@ -6,7 +6,8 @@ if PLUGINS
install : true, install_dir : FINCH_PLUGINDIR)
gntgf = library('gntgf', 'gntgf.c',
- dependencies : [x11, libpurple_dep, libfinch_dep, glib],
+ c_args : ncurses_header,
+ dependencies : [x11, libpurple_dep, libfinch_dep, ncurses, glib],
name_prefix : '',
install : true, install_dir : FINCH_PLUGINDIR)
endif
@@ -17,7 +18,7 @@ if PLUGINS
install : true, install_dir : FINCH_PLUGINDIR)
gntlastlog = library('gntlastlog', 'lastlog.c',
- dependencies : [libpurple_dep, libfinch_dep, glib],
+ dependencies : [libpurple_dep, libfinch_dep, ncurses, glib],
name_prefix : '',
install : true, install_dir : FINCH_PLUGINDIR)