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

Allow compile without python plugin support

This commit is contained in:
James Booth 2013-09-14 01:28:35 +01:00
parent 5762d951d6
commit 0f011439fa
3 changed files with 55 additions and 55 deletions

View File

@ -1,49 +1,4 @@
bin_PROGRAMS = profanity
profanity_SOURCES = \
src/contact.c src/contact.h src/log.c src/common.c \
src/log.h src/profanity.c src/common.h \
src/main.c src/profanity.h src/chat_session.c \
src/chat_session.h src/muc.c src/muc.h src/jid.h src/jid.c \
src/resource.c src/resource.h \
src/xmpp/xmpp.h src/xmpp/capabilities.c src/xmpp/connection.c \
src/xmpp/iq.c src/xmpp/message.c src/xmpp/presence.c src/xmpp/stanza.c \
src/xmpp/stanza.h src/xmpp/message.h src/xmpp/iq.h src/xmpp/presence.h \
src/xmpp/capabilities.h src/xmpp/connection.h \
src/xmpp/roster.c src/xmpp/roster.h \
src/xmpp/bookmark.c src/xmpp/bookmark.h \
src/ui/ui.h src/ui/window.c src/ui/window.h src/ui/core.c \
src/ui/titlebar.c src/ui/statusbar.c src/ui/inputwin.c \
src/ui/console.c src/ui/notifier.c src/ui/notifier.h \
src/ui/windows.c src/ui/windows.h \
src/command/command.h src/command/command.c src/command/history.c \
src/command/history.h src/tools/parser.c \
src/tools/parser.h \
src/tools/autocomplete.c src/tools/autocomplete.h \
src/tools/history.c src/tools/history.h \
src/tools/tinyurl.c src/tools/tinyurl.h \
src/config/accounts.c src/config/accounts.h \
src/config/preferences.c src/config/preferences.h \
src/config/theme.c src/config/theme.h \
src/plugins/plugins.h src/plugins/plugins.c \
src/plugins/api.h src/plugins/api.c \
src/plugins/callbacks.h src/plugins/callbacks.c \
src/plugins/python_plugins.h src/plugins/python_plugins.c \
src/plugins/python_api.h src/plugins/python_api.c \
src/plugins/c_plugins.h src/plugins/c_plugins.c \
src/plugins/ruby_plugins.h src/plugins/ruby_plugins.c \
src/plugins/ruby_api.h src/plugins/ruby_api.c \
src/plugins/c_api.h src/plugins/c_api.c
lib_LTLIBRARIES = libprofanity.la
libprofanity_la_LDFLAGS=-module -avoid-version -shared
libprofanity_la_SOURCES = src/plugins/profapi.c
library_includedir=$(includedir)
library_include_HEADERS = src/plugins/profapi.h
TESTS = tests/testsuite
check_PROGRAMS = tests/testsuite
tests_testsuite_SOURCES = \
core_sources = \
src/contact.c src/contact.h src/log.c src/common.c \
src/log.h src/profanity.c src/common.h \
src/profanity.h src/chat_session.c \
@ -71,15 +26,41 @@ tests_testsuite_SOURCES = \
src/plugins/plugins.h src/plugins/plugins.c \
src/plugins/api.h src/plugins/api.c \
src/plugins/callbacks.h src/plugins/callbacks.c \
src/plugins/python_plugins.h src/plugins/python_plugins.c \
src/plugins/c_plugins.h src/plugins/c_plugins.c \
src/plugins/c_api.h src/plugins/c_api.c \
src/plugins/python_api.h src/plugins/python_api.c \
src/plugins/ruby_plugins.h src/plugins/ruby_plugins.c \
src/plugins/ruby_api.h src/plugins/ruby_api.c \
src/plugins/c_api.h src/plugins/c_api.c
main_source = src/main.c
python_sources = \
src/plugins/python_plugins.h src/plugins/python_plugins.c \
src/plugins/python_api.h src/plugins/python_api.c
test_sources = \
tests/test_roster.c tests/test_common.c tests/test_history.c \
tests/test_autocomplete.c tests/testsuite.c tests/test_parser.c \
tests/test_jid.c
if BUILD_PYTHON_API
all_sources = $(core_sources) $(python_sources)
else
all_sources = $(core_sources)
endif
bin_PROGRAMS = profanity
profanity_SOURCES = $(main_source) $(all_sources)
lib_LTLIBRARIES = libprofanity.la
libprofanity_la_LDFLAGS=-module -avoid-version -shared
libprofanity_la_SOURCES = src/plugins/profapi.c
library_includedir=$(includedir)
library_include_HEADERS = src/plugins/profapi.h
TESTS = tests/testsuite
check_PROGRAMS = tests/testsuite
tests_testsuite_SOURCES = $(all_sources) $(test_sources)
tests_testsuite_LDADD = -lheadunit -lstdc++
man_MANS = docs/profanity.1

View File

@ -73,6 +73,8 @@ AC_CHECK_LIB([curl], [main], [],
[AC_MSG_ERROR([libcurl is required for profanity])])
AC_CHECK_LIB([headunit], [main], [],
[AC_MSG_NOTICE([headunit not found, will not be able to run tests])])
AC_CHECK_LIB([dl], [main], [],
[AC_MSG_ERROR([dl library needed to run C plugins])])
# check for python development, for python plugin support
AC_CHECK_PROG(PYTHON_CONFIG, python-config, yes, no)
@ -85,8 +87,10 @@ if test $PYTHON_CONFIG = yes; then
AC_MSG_NOTICE([Python LIBS=$PYTHON_LIBS])
PYTHON_LDFLAGS=`python-config --ldflags`
AC_MSG_NOTICE([Python LDFLAGS=$PYTHON_LDFLAGS])
AM_CONDITIONAL([BUILD_PYTHON_API], [true])
else
AC_MSG_NOTICE([Python not supported])
AM_CONDITIONAL([BUILD_PYTHON_API], [false])
fi
# Checks for header files.
@ -105,7 +109,7 @@ if test "x$enable_notifications" != xno; then
fi
# Default parameters
AM_CFLAGS="-Wall"
AM_CFLAGS="-Wall -export-dynamic"
# TODO use another method to get flags for system
RUBY_CFLAGS="-I/usr/lib/ruby/1.8/x86_64-linux -L/usr/lib/ruby/1.8/x86_64-linux"

View File

@ -29,8 +29,12 @@
#include "plugins/callbacks.h"
#include "plugins/api.h"
#include "plugins/plugins.h"
#ifdef PROF_HAVE_PYTHON
#include "plugins/python_plugins.h"
#include "plugins/python_api.h"
#endif
#include "plugins/c_plugins.h"
#include "plugins/c_api.h"
#include "plugins/ruby_plugins.h"
@ -44,7 +48,9 @@ plugins_init(void)
{
plugins = NULL;
#ifdef PROF_HAVE_PYTHON
python_env_init();
#endif
ruby_env_init();
c_env_init();
@ -56,19 +62,23 @@ plugins_init(void)
{
gboolean loaded = FALSE;
gchar *filename = plugins_load[i];
#ifdef PROF_HAVE_PYTHON
if (g_str_has_suffix(filename, ".py")) {
ProfPlugin *plugin = python_plugin_create(filename);
if (plugin != NULL) {
plugins = g_slist_append(plugins, plugin);
loaded = TRUE;
}
} else if (g_str_has_suffix(filename, ".so")) {
}
#endif
if (g_str_has_suffix(filename, ".so")) {
ProfPlugin *plugin = c_plugin_create(filename);
if (plugin != NULL) {
plugins = g_slist_append(plugins, plugin);
loaded = TRUE;
}
} else if (g_str_has_suffix(filename, ".rb")) {
}
if (g_str_has_suffix(filename, ".rb")) {
ProfPlugin *plugin = ruby_plugin_create(filename);
if (plugin != NULL) {
plugins = g_slist_append(plugins, plugin);
@ -302,16 +312,21 @@ plugins_shutdown(void)
ProfPlugin *plugin = curr->data;
if (plugin->lang == LANG_C) {
c_plugin_destroy(plugin);
} else if (plugin->lang == LANG_PYTHON) {
}
#ifdef PROF_HAVE_PYTHON
if (plugin->lang == LANG_PYTHON) {
python_plugin_destroy(plugin);
} else if (plugin->lang == LANG_RUBY) {
}
#endif
if (plugin->lang == LANG_RUBY) {
ruby_plugin_destroy(plugin);
}
curr = g_slist_next(curr);
}
#ifdef PROF_HAVE_PYTHON
python_shutdown();
#endif
ruby_shutdown();
c_shutdown();
}