[Pkg-privacy-commits] [irssi-plugin-otr] 16/267: mostly build related changes.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:26:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.
commit 4c1b73ce746ad402c7ae2853ae07727e9c7f7b7b
Author: Uli Meis <a.sporto+bee at gmail.com>
Date: Tue Jun 10 11:58:11 2008 +0200
mostly build related changes.
* First try at packaging with CPack and TGZ/RPM/DEB
* new command /otr version
* now using irssi MSGLEVEL_MSGS
---
CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++--------------
HOWTO_PACKAGE | 16 ++++++++++++++++
INSTALL | 20 +++++++++++++-------
Packaging-DEB.cmake | 4 ++++
Packaging-RPM.cmake | 19 +++++++++++++++++++
Packaging.cmake | 33 +++++++++++++++++++++++++++++++++
README | 2 ++
formats.txt | 1 +
io-config.h.in | 3 +++
otr.c | 10 ++++++++++
otr.h | 7 ++++---
ui.c | 2 +-
12 files changed, 139 insertions(+), 25 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3af3e22..5d0ec5f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,16 +17,31 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
#
-PROJECT(IRSSIOTR)
+PROJECT(irssi-otr)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
SET(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake-extensions/
${PROJECT_BINARY_DIR})
INCLUDE(cmake-extensions/cscope.cmake)
+INCLUDE(cmake-extensions/Git.cmake)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckIncludeFile)
+# get version from git
+
+IF(NOT IRSSIOTR_VERSION)
+ FIND_GIT_TAGORCOMMIT(${PROJECT_SOURCE_DIR} IRSSIOTR_VERSION)
+ IF(NOT IRSSIOTR_VERSION)
+ MESSAGE(FATAL_ERROR
+ "Couldn't determine version. Please run cmake -DIRSSIOTR_VERSION=...")
+ ENDIF(NOT IRSSIOTR_VERSION)
+ENDIF(NOT IRSSIOTR_VERSION)
+
+MESSAGE(STATUS "Building irssi-otr version ${IRSSIOTR_VERSION}")
+
# wget
FIND_PACKAGE(Wget REQUIRED)
@@ -114,24 +129,21 @@ SET(CMAKE_REQUIRED_INCLUDES ${IRSSIOTR_INCLUDE_DIRS})
# optional for html stripping and nick ignoring
CHECK_INCLUDE_FILE(glib/gregex.h HAVE_GREGEX_H)
-IF(HAVE_GREGEX_H)
- ADD_DEFINITIONS(-DHAVE_GREGEX_H)
-ENDIF(HAVE_GREGEX_H)
# check for strsignal
CHECK_FUNCTION_EXISTS(strsignal HAVE_STRSIGNAL)
-IF(HAVE_STRSIGNAL)
- SET_SOURCE_FILES_PROPERTIES(otr_key.c PROPERTIES COMPILE_FLAGS
- "-DHAVE_STRSIGNAL")
-ENDIF(HAVE_STRSIGNAL)
+
+# generate io-config.h
+
+CONFIGURE_FILE(io-config.h.in io-config.h)
# defs
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE debug)
- SET(CMAKE_C_FLAGS_DEBUG -g)
ENDIF(NOT CMAKE_BUILD_TYPE)
+SET(CMAKE_C_FLAGS_DEBUG -g)
MESSAGE(STATUS "This is a ${CMAKE_BUILD_TYPE} build")
@@ -154,12 +166,19 @@ ADD_LIBRARY(otr SHARED otr.c otrutil.c otr_ops.c otr_key.c ui.c ${PROJECT_BINARY
TARGET_LINK_LIBRARIES(otr ${GLIB_LIBRARIES} ${LIBOTR_LIBRARIES})
-# Install
-
-INSTALL(SCRIPT cmake-extensions/InstallAsUser.cmake)
-INSTALL(TARGETS otr DESTINATION modules/)
-
# cscope
FILE(GLOB CSANDHS *.c *.h)
ADD_CSCOPE_TARGET("${CSANDHS}" "${IRSSIOTR_INCLUDE_DIRS}")
+
+# Install / CPack
+
+IF(CMAKE_BUILD_TYPE MATCHES "package-.*")
+ SET(CMAKE_INSTALL_PREFIX "/usr/irssi/lib/")
+ INCLUDE(Packaging.cmake)
+ INSTALL(TARGETS otr DESTINATION irssi/lib/modules)
+ INSTALL(FILES README DESTINATION share/doc/${CMAKE_PROJECT_NAME}-${IRSSIOTR_VERSION})
+ELSE(CMAKE_BUILD_TYPE MATCHES "package-.*")
+ INSTALL(SCRIPT cmake-extensions/InstallAsUser.cmake)
+ INSTALL(TARGETS otr DESTINATION modules/)
+ENDIF(CMAKE_BUILD_TYPE MATCHES "package-.*")
diff --git a/HOWTO_PACKAGE b/HOWTO_PACKAGE
new file mode 100644
index 0000000..441efb2
--- /dev/null
+++ b/HOWTO_PACKAGE
@@ -0,0 +1,16 @@
+Thanks for helping me with packaging.
+
+You'll need cmake >= 2.6. In theory, all you should have to do is:
+
+ $ cmake -DCMAKE_BUILD_TYPE=packaging-DEB /path/to/src
+ $ sudo make package
+
+For an RPM it should be packaging-RPM and for TGZ...you can imagine.
+
+I'm not sure yet if the RPMs/DEBs generated by cmake/CPack are 100% OK. You can
+tweak the settings in Packaging-{RPM,DEB}.cmake. If you wanna see how CPack does
+it and what variables affect it, check out:
+
+ /usr/share/cmake/Modules/CPackDeb.cmake
+ /usr/share/cmake/Modules/CPackRPM.cmake
+
diff --git a/INSTALL b/INSTALL
index 4e33902..0e451c5 100644
--- a/INSTALL
+++ b/INSTALL
@@ -11,15 +11,21 @@ Usually the following will do:
1. into the system wide irssi modules folder if you're root or
2. into ~/.irssi/modules if you're not root
----------- MAJOR DEPENDENCIES ----------
-
-* cmake. Sry for that, but I'm not an autofoo fan. If you're running
- < cmake-2.4.7 then configure will try to download a missing module
- (pkgconfig) from the cmake-2.4.7 sources. Should work.
+---------- RUNTIME DEPENDENCIES ----------
* libotr >= 3.1.0. Fragmentation has been introduced in that version so
nothing smaller will work.
----------- OTHER DEPENDENCIES ----------
+* glib. Will work with < 2.13 but since there are no regexes available
+ HTML stripping (OTR spits out HTML sometimes) and nick ignoring won't
+ work.
+
+* irssi. Obviously ;)
+
+---------- BUILD-TIME ONLY DEPENDENCIES ----------
+
+* cmake. Sry for that, but I'm not an autofoo fan. If you're running
+ < cmake-2.4.7 then configure will try to download a missing module
+ (pkgconfig) from the cmake-2.4.7 sources. Should work.
-irssi,wget,pkg-config,glib,python
+* pkg-config, python and wget.
diff --git a/Packaging-DEB.cmake b/Packaging-DEB.cmake
new file mode 100644
index 0000000..c79cb87
--- /dev/null
+++ b/Packaging-DEB.cmake
@@ -0,0 +1,4 @@
+SET(CPACK_GENERATOR DEB)
+#SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
+SET(CPACK_DEBIAN_PACKAGE_SECTION "net")
+SET(CPACK_DEBIAN_PACKAGE_DEPENDS "irssi")
diff --git a/Packaging-RPM.cmake b/Packaging-RPM.cmake
new file mode 100644
index 0000000..d3928f6
--- /dev/null
+++ b/Packaging-RPM.cmake
@@ -0,0 +1,19 @@
+SET(CPACK_GENERATOR RPM)
+SET(CPACK_RPM_PACKAGE_DEBUG)
+SET(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
+SET(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+
+EXECUTE_PROCESS(COMMAND bash -c
+ "ARCH=`which arch` && $ARCH | tr -d '\n'"
+ OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE)
+
+#IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+# SET(CPACK_RPM_PACKAGE_ARCHITECTURE i386)
+#ELSE
+# SET(CPACK_RPM_PACKAGE_ARCHITECTURE i386)
+#ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+
+SET(CPACK_RPM_PACKAGE_RELEASE 1)
+SET(CPACK_RPM_PACKAGE_GROUP "unknown")
+SET(CPACK_RPM_FILE_NAME
+ ${CPACK_PACKAGE_FILE_NAME}-${CPACK_RPM_PACKAGE_RELEASE}.${CPACK_RPM_PACKAGE_ARCHITECTURE})
diff --git a/Packaging.cmake b/Packaging.cmake
new file mode 100644
index 0000000..af72bec
--- /dev/null
+++ b/Packaging.cmake
@@ -0,0 +1,33 @@
+SET(CPACK_PACKAGE_CONTACT "Ulim <a.sporto+bee at gmail.com>")
+SET(CPACK_PACKAGE_VENDOR ${CPACK_PACKAGE_CONTACT})
+
+SET(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)
+SET(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README)
+
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
+ "Off-The-Record Messaging (OTR) for irssi")
+
+SET(CPACK_PACKAGE_FILE_NAME
+ ${CMAKE_PROJECT_NAME}-${IRSSIOTR_VERSION})
+
+SET(CPACK_GENERATOR TGZ)
+
+SET(CPACK_PACKAGE_VERSION ${IRSSIOTR_VERSION})
+
+IF(CMAKE_BUILD_TYPE STREQUAL "package-rpm")
+ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+ INCLUDE(Packaging-RPM.cmake)
+ENDIF(CMAKE_BUILD_TYPE STREQUAL "package-rpm")
+IF(CMAKE_BUILD_TYPE STREQUAL "package-deb")
+ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+ INCLUDE(Packaging-DEB.cmake)
+ENDIF(CMAKE_BUILD_TYPE STREQUAL "package-deb")
+
+#SET(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/README)
+#SET(CPACK_PACKAGE_VERSION_MAJOR "0")
+#SET(CPACK_PACKAGE_VERSION_MINOR "1")
+#SET(CPACK_PACKAGE_VERSION_PATCH "0")
+#SET(CPACK_PACKAGE_FILE_NAME
+# ${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
+
+INCLUDE(CPack)
diff --git a/README b/README
index 6664cf2..5bb7665 100644
--- a/README
+++ b/README
@@ -38,3 +38,5 @@ Commands:
List all OTR contexts along with their fingerprints and status
/otr finish
Finish an OTR conversation
+/otr version
+ Display irssi-otr version. Might be a git commit
diff --git a/formats.txt b/formats.txt
index d53ae19..b1d65ba 100644
--- a/formats.txt
+++ b/formats.txt
@@ -69,6 +69,7 @@ cmd_auth Please agree on a secret with your peer and then initiate the authentic
cmd_debug_on Debug mode is on
cmd_debug_off Debug mode is off
cmd_finish Finished conversation with %s
+cmd_version This is irssi-otr version %s
peer_finished %s has finished the OTR conversation
Nickignore
nickignore xmlconsole[0-9]*
diff --git a/io-config.h.in b/io-config.h.in
new file mode 100644
index 0000000..02dd318
--- /dev/null
+++ b/io-config.h.in
@@ -0,0 +1,3 @@
+#cmakedefine HAVE_STRSIGNAL
+#cmakedefine HAVE_GREGEX_H
+#define IRSSIOTR_VERSION "${IRSSIOTR_VERSION}"
diff --git a/otr.c b/otr.c
index a3a1e50..19cb28a 100644
--- a/otr.c
+++ b/otr.c
@@ -174,6 +174,14 @@ static void cmd_help(const char *data, void *server, WI_ITEM_REC *item)
}
/*
+ * /otr version
+ */
+static void cmd_version(const char *data, void *server, WI_ITEM_REC *item)
+{
+ otr_noticest(TXT_CMD_VERSION,IRSSIOTR_VERSION);
+}
+
+/*
* /otr contexts
*/
static void cmd_contexts(const char *data, void *server, WI_ITEM_REC *item)
@@ -229,6 +237,7 @@ void otr_init(void)
command_bind("otr authabort", NULL, (SIGNAL_FUNC) cmd_authabort);
command_bind("otr help", NULL, (SIGNAL_FUNC) cmd_help);
command_bind("otr contexts", NULL, (SIGNAL_FUNC) cmd_contexts);
+ command_bind("otr version", NULL, (SIGNAL_FUNC) cmd_version);
statusbar_item_register("otr", NULL, otr_statusbar);
@@ -257,6 +266,7 @@ void otr_deinit(void)
command_unbind("otr authabort", (SIGNAL_FUNC) cmd_authabort);
command_unbind("otr help", (SIGNAL_FUNC) cmd_help);
command_unbind("otr contexts", (SIGNAL_FUNC) cmd_contexts);
+ command_unbind("otr version", (SIGNAL_FUNC) cmd_version);
statusbar_item_unregister("otr");
diff --git a/otr.h b/otr.h
index 4bc3ffb..685d67f 100644
--- a/otr.h
+++ b/otr.h
@@ -51,6 +51,7 @@
/* own */
+#include "io-config.h"
#include "otr-formats.h"
/* irssi module name */
@@ -123,15 +124,15 @@ void otr_writefps();
otr_log(NULL,NULL,level,format, ## __VA_ARGS__)
#define otr_noticest(formatnum,...) \
- printformat(NULL,NULL,MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
+ printformat(NULL,NULL,MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__)
#define otr_notice(server,nick,formatnum,...) \
- printformat(server,nick,MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
+ printformat(server,nick,MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__)
#define otr_debug(server,nick,formatnum,...) { \
if (debug) \
printformat(server,nick, \
- MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__); \
+ MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__); \
}
void otr_log(SERVER_REC *server, const char *to,
diff --git a/ui.c b/ui.c
index 7a3e78f..ceb971c 100644
--- a/ui.c
+++ b/ui.c
@@ -45,5 +45,5 @@ void otr_log(SERVER_REC *server, const char *nick,
sprintf( s, "internal error parsing error string (BUG)" );
va_end( params );
- printtext(server, nick, MSGLEVEL_CRAP, msg);
+ printtext(server, nick, MSGLEVEL_MSGS, msg);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/irssi-plugin-otr.git
More information about the Pkg-privacy-commits
mailing list