1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge pull request #1424 from niacat/netbsd

NetBSD support
This commit is contained in:
Michael Vetter 2020-09-07 10:31:33 +02:00 committed by GitHub
commit 3d082bfb66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 60 additions and 18 deletions

View File

@ -22,6 +22,7 @@ AC_CANONICAL_HOST
PLATFORM="unknown"
AS_CASE([$host_os],
[freebsd*], [PLATFORM="freebsd"],
[netbsd*], [PLATFORM="netbsd"],
[openbsd*], [PLATFORM="openbsd"],
[darwin*], [PLATFORM="osx"],
[cygwin], [PLATFORM="cygwin"],
@ -81,7 +82,7 @@ elif test "x$enable_python_plugins" != xno; then
rm -f Python.framework
ln -s $PYTHON_FRAMEWORK Python.framework ])
AC_CHECK_PROG(PYTHON_CONFIG_EXISTS, python-config, yes, no)
if test "$PYTHON_CONFIG_EXISTS" == "yes"; then
if test "$PYTHON_CONFIG_EXISTS" = "yes"; then
AX_PYTHON_DEVEL
AM_CONDITIONAL([BUILD_PYTHON_API], [true])
AC_DEFINE([HAVE_PYTHON], [1], [Python support])
@ -106,9 +107,9 @@ else
if test "x$enable_plugins" = xno; then
AM_CONDITIONAL([BUILD_C_API], [false])
elif test "x$enable_c_plugins" != xno; then
# libdl doesn't exist as a separate library in OpenBSD/FreeBSD and is
# libdl doesn't exist as a separate library in the BSDs and is
# provided in the standard libraries.
AS_IF([test "x$PLATFORM" = xopenbsd -o "x$PLATFORM" = xfreebsd],
AS_IF([test "x$PLATFORM" = xopenbsd -o "x$PLATFORM" = xfreebsd -o "x$PLATFORM" = xnetbsd],
[AM_CONDITIONAL([BUILD_C_API], [true]) AC_DEFINE([HAVE_C], [1], [C support])],
[AC_CHECK_LIB([dl], [main],
[AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])],
@ -160,21 +161,23 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([[
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([${XMPP_LIB} is broken, check config.log for details])])
### Check for ncurses library
### Check for curses library
PKG_CHECK_MODULES([ncursesw], [ncursesw],
[NCURSES_CFLAGS="$ncursesw_CFLAGS"; NCURSES_LIBS="$ncursesw_LIBS"; NCURSES="ncursesw"],
[NCURSES_CFLAGS="$ncursesw_CFLAGS"; NCURSES_LIBS="$ncursesw_LIBS"; CURSES="ncursesw"],
[PKG_CHECK_MODULES([ncurses], [ncurses],
[NCURSES_CFLAGS="$ncurses_CFLAGS"; NCURSES_LIBS="$ncurses_LIBS"; NCURSES="ncurses"],
[NCURSES_CFLAGS="$ncurses_CFLAGS"; NCURSES_LIBS="$ncurses_LIBS"; CURSES="ncurses"],
[AC_CHECK_LIB([ncursesw], [main], [],
[AC_CHECK_LIB([ncurses], [main], [],
[AC_MSG_ERROR([ncurses is required for profanity])])])])])
[AC_CHECK_LIB([curses], [main],
[LIBS="$LIBS -lcurses"; CURSES="curses"],
[AC_MSG_ERROR([ncurses or curses is required for profanity])])])])])])
AM_CPPFLAGS="$AM_CPPFLAGS $NCURSES_CFLAGS"
LIBS="$NCURSES_LIBS $LIBS"
### Check wide characters support in ncurses library
### Check wide characters support in curses library
CFLAGS_RESTORE="$CFLAGS"
CFLAGS="$CFLAGS $NCURSES_CFLAGS"
AC_CACHE_CHECK([for wget_wch support in $NCURSES], ncurses_cv_wget_wch,
AC_CACHE_CHECK([for wget_wch support in $CURSES], ncurses_cv_wget_wch,
[AC_LINK_IFELSE([AC_LANG_SOURCE([
void wget_wch(void);
int main() {
@ -354,6 +357,7 @@ AC_CHECK_LIB([expect], [exp_expectl], [AM_CONDITIONAL([HAVE_EXPECT], [true])],
### Check for ncursesw/ncurses.h first, Arch linux uses ncurses.h for ncursesw
AC_CHECK_HEADERS([ncursesw/ncurses.h], [], [])
AC_CHECK_HEADERS([ncurses.h], [], [])
AC_CHECK_HEADERS([curses.h], [], [])
### Default parameters
AM_CFLAGS="-Wall -Wno-deprecated-declarations -std=gnu99"

View File

@ -54,6 +54,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "log.h"

View File

@ -46,6 +46,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "config/color.h"

View File

@ -45,6 +45,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "common.h"

View File

@ -46,6 +46,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "ui/window.h"

View File

@ -42,6 +42,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "common.h"

View File

@ -55,6 +55,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "log.h"

View File

@ -52,6 +52,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "profanity.h"
@ -306,7 +308,9 @@ _inp_win_update_virtual(void)
{
int wcols = getmaxx(stdscr);
int row = screen_inputwin_row();
pnoutrefresh(inp_win, 0, pad_start, row, 0, row, wcols - 2);
if (inp_win != NULL) {
pnoutrefresh(inp_win, 0, pad_start, row, 0, row, wcols - 2);
}
}
static void

View File

@ -95,7 +95,10 @@ rosterwin_roster(void)
ProfLayoutSplit* layout = (ProfLayoutSplit*)console->layout;
assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
werase(layout->subwin);
if (layout->subwin != NULL) {
werase(layout->subwin);
}
char* roomspos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "first") == 0)) {
@ -1106,9 +1109,11 @@ _rosterwin_contacts_header(ProfLayoutSplit* layout, const char* const title, GSL
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
win_sub_print(layout->subwin, header->str, FALSE, wrap, 1);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
if (layout->subwin != NULL) {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
win_sub_print(layout->subwin, header->str, FALSE, wrap, 1);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
}
g_string_free(header, TRUE);
}
@ -1166,9 +1171,11 @@ _rosterwin_rooms_header(ProfLayoutSplit* layout, GList* rooms, char* title)
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
win_sub_print(layout->subwin, header->str, FALSE, wrap, 1);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
if (layout->subwin != NULL) {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
win_sub_print(layout->subwin, header->str, FALSE, wrap, 1);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
}
g_string_free(header, TRUE);
}

View File

@ -39,6 +39,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "config/preferences.h"

View File

@ -44,6 +44,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "config/theme.h"

View File

@ -45,6 +45,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "tools/autocomplete.h"

View File

@ -48,6 +48,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "log.h"
@ -1861,7 +1863,12 @@ win_sub_print(WINDOW* win, char* msg, gboolean newline, gboolean wrap, int inden
void
win_sub_newline_lazy(WINDOW* win)
{
int curx = getcurx(win);
int curx;
if (win == NULL) {
return;
}
curx = getcurx(win);
if (curx > 0) {
int cury = getcury(win);
wmove(win, cury + 1, 0);

View File

@ -45,6 +45,8 @@
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
#include <curses.h>
#endif
#include "ui/ui.h"