From 2b88e2f1bffca2800b521214df6009da673a0835 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 21 Sep 2015 21:40:04 +0100 Subject: [PATCH 1/2] Check for libmesode, fall back to libstrophe --- .travis.yml | 6 ++--- configure.ac | 57 +++++------------------------------------ install-all.sh | 30 +++++++++++----------- src/main.c | 7 +++++ src/xmpp/bookmark.c | 10 +++++++- src/xmpp/capabilities.c | 8 +++++- src/xmpp/capabilities.h | 7 +++++ src/xmpp/connection.c | 7 +++++ src/xmpp/connection.h | 7 +++++ src/xmpp/form.c | 10 +++++++- src/xmpp/iq.c | 6 +++++ src/xmpp/message.c | 7 +++++ src/xmpp/presence.c | 9 +++++++ src/xmpp/roster.c | 8 ++++++ src/xmpp/stanza.c | 8 ++++++ src/xmpp/stanza.h | 8 ++++++ src/xmpp/xmpp.h | 7 +++++ 17 files changed, 130 insertions(+), 72 deletions(-) diff --git a/.travis.yml b/.travis.yml index ccc67e6b..64355414 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,15 +4,15 @@ install: - uname -a - sudo apt-get update - sudo apt-get -y install libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr2-dev libgpgme11-dev uuid-dev expect-dev tcl-dev - - git clone git://github.com/strophe/libstrophe.git - - cd libstrophe + - git clone git@github.com:boothj5/libmesode.git + - cd libmesode - mkdir m4 - ./bootstrap.sh - ./configure --prefix=/usr - make - sudo make install - cd .. - - rm -rf libstrophe + - rm -rf libmesode - wget https://cmocka.org/files/1.0/cmocka-1.0.0.tar.xz - tar -xvf cmocka-1.0.0.tar.xz - cd cmocka-1.0.0 diff --git a/configure.ac b/configure.ac index 4a76d3f9..bc0afaae 100644 --- a/configure.ac +++ b/configure.ac @@ -47,62 +47,17 @@ AC_ARG_ENABLE([otr], [AS_HELP_STRING([--enable-otr], [enable otr encryption])]) AC_ARG_ENABLE([pgp], [AS_HELP_STRING([--enable-pgp], [enable pgp])]) -AC_ARG_WITH([libxml2], - [AS_HELP_STRING([--with-libxml2], [link with libxml2 instead of expat])]) AC_ARG_WITH([xscreensaver], [AS_HELP_STRING([--with-xscreensaver], [use libXScrnSaver to determine idle time])]) AC_ARG_WITH([themes], [AS_HELP_STRING([--with-themes[[=PATH]]], [install themes (default yes)])]) -# Use the CFLAGS and libs provided by libstrophe.pc if libstrophe has pkg-config support. -PKG_CHECK_MODULES([libstrophe], [libstrophe], [LIBS="$libstrophe_LIBS $LIBS"], - [ - if test "x$PLATFORM" != xfreebsd; then - AC_CHECK_LIB([resolv], [res_query], [], - [AC_CHECK_LIB([resolv], [__res_query], [], - [AC_MSG_ERROR([libresolv not found; libresolv required for profanity])])]) - else - AC_MSG_NOTICE([skipping libresolv checks for freebsd]) - fi - - ### Check for libstrophe dependencies - ### Select first existing xml library among expat and libxml2 - PARSER="" - PARSER_LIBS="" - PARSER_CFLAGS="" - AS_IF([test "x$with_libxml2" != xyes], - [PKG_CHECK_MODULES([expat], [expat], - [PARSER_CFLAGS="$expat_CFLAGS"; PARSER_LIBS="$expat_LIBS"; PARSER="expat"], - [AC_CHECK_LIB([expat], [XML_ParserCreate], - [PARSER_LIBS="-lexpat"; PARSER="expat"], - AS_IF([test "x$with_libxml2" = xno], - [AC_MSG_ERROR([expat is required but does not exist])]))]) - ]) - - AS_IF([test "x$PARSER" = x -a "x$with_libxml2" != xno], - [PKG_CHECK_MODULES([libxml2], [libxml-2.0], - [PARSER_CFLAGS="$libxml2_CFLAGS"; PARSER_LIBS="$libxml2_LIBS"; PARSER="libxml2"], - AS_IF([test "x$with_libxml2" = xyes], - [AC_MSG_ERROR([libxml2 is required but does not exist])])) - ]) - - AS_IF([test "x$PARSER" = x], - [AC_MSG_ERROR([either expat or libxml2 is required for profanity])]) - AM_CPPFLAGS="$AM_CPPFLAGS $PARSER_CFLAGS" - LIBS="$PARSER_LIBS $LIBS" - - PKG_CHECK_MODULES([openssl], [openssl], [], - [AC_CHECK_HEADER(openssl/ssl.h, [openssl_LIBS="-lssl -lcrypto"], [AC_MSG_ERROR([openssl not found; openssl required for profanity])])]) - AM_CPPFLAGS="$AM_CPPFLAGS $openssl_CFLAGS" - LIBS="$openssl_LIBS $LIBS" - - CFLAGS_RESTORE="$CFLAGS" - CFLAGS="$CFLAGS $AM_CPPFLAGS" - AC_CHECK_LIB([strophe], [xmpp_ctx_new], [LIBS="-lstrophe $LIBS"; listrophe_CFLAGS=""], - [AC_MSG_ERROR([libstrophe linked with $PARSER is required for profanity])]) - CFLAGS="$CFLAGS_RESTORE" - ]) -CFLAGS="$CFLAGS $libstrophe_CFLAGS" +### Check for libmesode, fall back to libstrophe +PKG_CHECK_MODULES([libmesode], [libmesode], + [LIBS="$libmesode_LIBS $LIBS" CFLAGS="$CFLAGS $libmesode_CFLAGS" AC_DEFINE([HAVE_LIBMESODE], [1], [libmesode])], + [PKG_CHECK_MODULES([libstrophe], [libstrophe], + [LIBS="$libstrophe_LIBS $LIBS" CFLAGS="$CFLAGS $libstrophe_CFLAGS" AC_DEFINE([HAVE_LIBSTROPHE], [1], [libstrophe])], + [AC_MSG_ERROR([Neither libmesode or libstrophe found, either is required for profanity])])]) ### Check for ncurses library PKG_CHECK_MODULES([ncursesw], [ncursesw], diff --git a/install-all.sh b/install-all.sh index 9d42696f..bd5093dd 100755 --- a/install-all.sh +++ b/install-all.sh @@ -77,13 +77,13 @@ cygwin_prepare() fi } -install_lib_strophe() +install_lib_mesode() { echo - echo Profanity installer... installing libstrophe + echo Profanity installer... installing libmesode echo - git clone git://github.com/strophe/libstrophe.git - cd libstrophe + git clone git@github.com:boothj5/libmesode.git + cd libmesode ./bootstrap.sh ./configure --prefix=$1 make @@ -105,13 +105,13 @@ install_profanity() sudo make install } -cyg_install_lib_strophe() +cyg_install_lib_mesode() { echo - echo Profanity installer... installing libstrophe + echo Profanity installer... installing libmesode echo - git clone git://github.com/strophe/libstrophe.git - cd libstrophe + git clone git@github.com:boothj5/libmesode.git + cd libmesode ./bootstrap.sh ./bootstrap.sh # second call seems to fix problem on cygwin ./configure --prefix=/usr @@ -140,8 +140,8 @@ cleanup() echo Profanity installer... cleaning up echo - echo Removing libstrophe repository... - rm -rf libstrophe + echo Removing libmesode repository... + rm -rf libmesode echo echo Profanity installer... complete! @@ -183,25 +183,25 @@ unknown) echo The install script will not work on this OS. exit ;; fedora) fedora_prepare - install_lib_strophe /usr + install_lib_mesode /usr install_profanity ;; debian) debian_prepare - install_lib_strophe /usr + install_lib_mesode /usr install_profanity ;; opensuse) opensuse_prepare - install_lib_strophe /usr/local + install_lib_mesode /usr/local sudo /sbin/ldconfig install_profanity ;; centos) centos_prepare - install_lib_strophe /usr + install_lib_mesode /usr sudo ldconfig install_profanity ;; cygwin) cygwin_prepare - cyg_install_lib_strophe + cyg_install_lib_mesode cyg_install_profanity ;; esac diff --git a/src/main.c b/src/main.c index ea8f0cea..49e1defc 100644 --- a/src/main.c +++ b/src/main.c @@ -98,6 +98,13 @@ main(int argc, char **argv) g_print("Build information:\n"); +#ifdef HAVE_LIBMESODE + g_print("XMPP library: libmesode\n"); +#endif +#ifdef HAVE_LIBSTROPHE + g_print("XMPP library: libstrophe\n"); +#endif + gboolean notify_enabled = FALSE; #ifdef HAVE_OSXNOTIFY diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c index 68e66569..3705d699 100644 --- a/src/xmpp/bookmark.c +++ b/src/xmpp/bookmark.c @@ -32,12 +32,20 @@ * */ +#include "config.h" + #include #include #include #include #include + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "common.h" #include "log.h" @@ -468,4 +476,4 @@ _send_bookmarks(void) xmpp_send(conn, iq); xmpp_stanza_release(iq); -} \ No newline at end of file +} diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c index 15d64e8a..adaea383 100644 --- a/src/xmpp/capabilities.c +++ b/src/xmpp/capabilities.c @@ -43,7 +43,13 @@ #include #include + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "common.h" #include "log.h" @@ -683,4 +689,4 @@ _save_cache(void) g_file_set_contents(cache_loc, g_cache_data, g_data_size, NULL); g_chmod(cache_loc, S_IRUSR | S_IWUSR); g_free(g_cache_data); -} \ No newline at end of file +} diff --git a/src/xmpp/capabilities.h b/src/xmpp/capabilities.h index 85f1d989..3e281d1c 100644 --- a/src/xmpp/capabilities.h +++ b/src/xmpp/capabilities.h @@ -35,7 +35,14 @@ #ifndef XMPP_CAPABILITIES_H #define XMPP_CAPABILITIES_H +#include "config.h" + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "xmpp/xmpp.h" diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 3c9ba214..6f9de18d 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -32,11 +32,18 @@ * */ +#include "config.h" + #include #include #include +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "chat_session.h" #include "common.h" diff --git a/src/xmpp/connection.h b/src/xmpp/connection.h index 63f7cde0..705dd129 100644 --- a/src/xmpp/connection.h +++ b/src/xmpp/connection.h @@ -35,7 +35,14 @@ #ifndef XMPP_CONNECTION_H #define XMPP_CONNECTION_H +#include "config.h" + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "resource.h" diff --git a/src/xmpp/form.c b/src/xmpp/form.c index e6213b64..fdec2a49 100644 --- a/src/xmpp/form.c +++ b/src/xmpp/form.c @@ -32,10 +32,18 @@ * */ +#include "config.h" + #include #include +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif + #include #include "log.h" @@ -714,4 +722,4 @@ form_reset_autocompleters(DataForm *form) autocomplete_reset(field->value_ac); curr_field = g_slist_next(curr_field); } -} \ No newline at end of file +} diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 496e9caa..7b57c1af 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -42,7 +42,13 @@ #include #include + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "log.h" #include "muc.h" diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 5581521c..ad75735b 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -32,10 +32,17 @@ * */ +#include "config.h" + #include #include +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "chat_session.h" #include "config/preferences.h" diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index 42215322..ff34cc50 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -32,6 +32,8 @@ * */ +#include "config.h" + #include #include #include @@ -39,6 +41,13 @@ #include #include +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE +#include +#endif + #include "common.h" #include "config/preferences.h" #include "log.h" diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c index 84a88d62..55695d75 100644 --- a/src/xmpp/roster.c +++ b/src/xmpp/roster.c @@ -32,12 +32,20 @@ * */ +#include "config.h" + #include #include #include #include + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "log.h" #include "profanity.h" diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index acee97fb..68ace83c 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -32,11 +32,19 @@ * */ +#include "config.h" + #include #include #include + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "common.h" #include "log.h" diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index 8cae0dc3..dbb09ab3 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -35,7 +35,15 @@ #ifndef XMPP_STANZA_H #define XMPP_STANZA_H +#include "config.h" + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif + #include #define STANZA_NAME_ACTIVE "active" diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 575f9ae1..5c5fa3ef 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -35,7 +35,14 @@ #ifndef XMPP_XMPP_H #define XMPP_XMPP_H +#include "config.h" + +#ifdef HAVE_LIBMESODE +#include +#endif +#ifdef HAVE_LIBSTROPHE #include +#endif #include "config/accounts.h" #include "contact.h" From b24529171f4cef137cf864fde3d8b94e24bffef9 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 21 Sep 2015 21:48:14 +0100 Subject: [PATCH 2/2] Fix travis build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 64355414..ade6084b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ install: - uname -a - sudo apt-get update - sudo apt-get -y install libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr2-dev libgpgme11-dev uuid-dev expect-dev tcl-dev - - git clone git@github.com:boothj5/libmesode.git + - git clone git://github.com/boothj5/libmesode.git - cd libmesode - mkdir m4 - ./bootstrap.sh