[avv] Update avv dependencies default tip
authorMyhailo Danylenko <isbear@ukrpost.net>
Thu, 13 Nov 2014 23:29:42 +0200
changeset 34 1820e2dc90ef
parent 33 c7259f0fac72
[avv] Update avv dependencies
CMakeLists.txt
config.h.in
marking.avv.in
marking.c
--- a/CMakeLists.txt	Thu Nov 13 22:39:40 2014 +0200
+++ b/CMakeLists.txt	Thu Nov 13 23:29:42 2014 +0200
@@ -24,6 +24,18 @@
 find_package(PkgConfig REQUIRED) 
 pkg_check_modules(GLIB REQUIRED glib-2.0) 
 pkg_check_modules(MCABBER REQUIRED mcabber)
+include(CheckSymbolExists)
+set(CMAKE_REQUIRED_INCLUDES ${MCABBER_INCLUDE_DIRS})
+set(CMAKE_REQUIRED_LIBRARIES ${MCABBER_LIBRARIES})
+set(CMAKE_REQUIRED_FLAGS ${MCABBER_LDFLAGS} ${MCABBER_CFLAGS})
+check_symbol_exists(MCABBER_API_HAVE_CMD_ID mcabber/api.h HAVE_MCABBER_CMD_ID)
+include(CheckCSourceCompiles)
+check_c_source_compiles("
+    #include <mcabber/commands.h>
+	int process_command(const char *line, guint iscmd);
+    int main (void) { }
+	" HAVE_MCABBER_PROCESS_COMMAND_RETVAL)
+
 link_directories(${GLIB_LIBRARY_DIRS}
 				 ${MCABBER_LIBRARY_DIRS})
 
@@ -60,6 +72,14 @@
 set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so")
 include(CPack)
 
+## AVV build-time dependent requirements
+if(NOT HAVE_MCABBER_CMD_ID)
+    set(AVV_COMMANDS_VERSION "commands:2 | commands:1")
+elseif(HAVE_MCABBER_PROCESS_COMMAND_RETVAL)
+	set(AVV_COMMANDS_VERSION "commands:4 | commands:3")
+else()
+	set(AVV_COMMANDS_VERSION "commands:5")
+endif()
 configure_file(marking.avv.in marking.avv)
 
 ## Installation
@@ -68,4 +88,4 @@
 install(DIRECTORY help DESTINATION share/mcabber)
 install(FILES ${PROJECT_BINARY_DIR}/marking.avv DESTINATION share/mcabber/avv/modules RENAME marking)
 
-## The End ## vim: se ts=4: ##
+## The End ## vim: se ts=4 sw=4: ##
--- a/config.h.in	Thu Nov 13 22:39:40 2014 +0200
+++ b/config.h.in	Thu Nov 13 23:29:42 2014 +0200
@@ -2,6 +2,8 @@
 #ifndef LOCAL_CONFIG_H
 #define LOCAL_CONFIG_H
 
+#cmakedefine HAVE_MCABBER_CMD_ID @HAVE_MCABBER_CMD_ID@
+
 #define PROJECT_VERSION ( "${PROJECT_VERSION}" )
 
 #endif
--- a/marking.avv.in	Thu Nov 13 22:39:40 2014 +0200
+++ b/marking.avv.in	Thu Nov 13 23:29:42 2014 +0200
@@ -4,9 +4,11 @@
 Version:     ${PROJECT_VERSION}
 Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
 # commands depend on building environment: 4+3, 2+1
-Requires:    ( roster:4 | roster:3 | roster:2 | roster:1 ) + ( commands:4 | commands:3 ) +
-             utils:2 + logprint:3 + ( hbuf:3 | hbuf:2 | hbuf:1 ) +
-             ( screen:10 | screen:9 | screen:8 | screen:7 | screen:6 | screen:5 | screen:4 )
+Requires:    ( ${AVV_COMMANDS_VERSION} ) +
+	     ( hbuf:4 | hbuf:3 | hbuf:2 | hbuf:1 ) + logprint:3 +
+             ( roster:7 | roster:6 | roster:5 | roster:4 | roster:3 | roster:2 ) +
+             ( screen:13 | screen:12 | screen:11 | screen:10 | screen:9 | screen:8 | screen:7 | screen:6 | screen:5 | screen:4 ) +
+             ( utils:3 | utils:2 )
 Init:        marking_init
 Uninit:      marking_uninit
 
--- a/marking.c	Thu Nov 13 22:39:40 2014 +0200
+++ b/marking.c	Thu Nov 13 23:29:42 2014 +0200
@@ -23,13 +23,14 @@
 #include <glib.h>
 #include <string.h>
 
-#include <mcabber/hbuf.h>
-#include <mcabber/screen.h>
-#include <mcabber/commands.h>
-#include <mcabber/compl.h>
-#include <mcabber/utils.h>
-#include <mcabber/logprint.h>
-#include <mcabber/modules.h>
+#include <mcabber/commands.h>  // cmd_add (), cmd_del (), process_command ()
+#include <mcabber/compl.h>     // COMPL_JID, COMPL_CMD
+#include <mcabber/hbuf.h>      // HBB_PREFIX_INFO, HBB_PREFIX_NOFLAG
+#include <mcabber/logprint.h>  // scr_log_print ()
+#include <mcabber/modules.h>   // module_info_t
+#include <mcabber/roster.h>    // ROSTER_UI_PRIO_STATUS_WIN_MESSAGE, SPECIAL_BUFFER_STATUS_ID, current_buddy
+#include <mcabber/screen.h>    // scr_write_incoming_message (), scr_getlogwinheight (), scr_setmsgflag_if_needed (), scr_setattentionflag_if_needed ()
+#include <mcabber/utils.h>     // free_arg_lst (), split_arg ()
 
 #include "config.h"
 
@@ -50,7 +51,7 @@
 	.next        = NULL,
 };
 
-#ifdef MCABBER_API_HAVE_CMD_ID
+#ifdef HAVE_MCABBER_CMD_ID
 static gpointer mark_cmid   = NULL;
 static gpointer marked_cmid = NULL;
 #endif
@@ -253,7 +254,7 @@
 
 void marking_init (void)
 {
-#ifndef MCABBER_API_HAVE_CMD_ID
+#ifndef HAVE_MCABBER_CMD_ID
 	cmd_add ("mark",   "", 0, COMPL_JID, do_mark,   NULL);
 	cmd_add ("marked", "", 0, COMPL_CMD, do_marked, NULL);
 #else
@@ -264,7 +265,7 @@
 
 void marking_uninit (void)
 {
-#ifndef MCABBER_API_HAVE_CMD_ID
+#ifndef HAVE_MCABBER_CMD_ID
 	cmd_del ("mark");
 	cmd_del ("marked");
 #else