From f696796b60235b1668d4166e6936d480b796c15c Mon Sep 17 00:00:00 2001 From: "Wulf C. Krueger" Date: Thu, 24 May 2012 23:41:47 +0200 Subject: [PATCH 1/4] znc.service: Improve description, don't fork on your own The description gets displayed when the service is started and would output something like "Starting An advanced IRC bouncer". There's potentially more than one, though, and, thus, the name should at least be included. Type=forking should be used as a last resort only. systemd does the forking itself and, thus, ZNC should be started with the -f switch. --- znc.service | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/znc.service b/znc.service index 6d8ed8b9..2f862bf3 100644 --- a/znc.service +++ b/znc.service @@ -1,11 +1,10 @@ [Unit] -Description=An advanced IRC bouncer +Description=ZNC, an advanced IRC bouncer After=network.target [Service] -ExecStart=/usr/bin/znc +ExecStart=/usr/bin/znc -f User=znc -Type=forking [Install] WantedBy=multi-user.target From 40641b40a46b33d294980642e50e54b293c14994 Mon Sep 17 00:00:00 2001 From: "Wulf C. Krueger" Date: Sat, 2 Jun 2012 19:57:42 +0200 Subject: [PATCH 2/4] Add support for --with-systemdsystemunitdir. --with-systemdsystemunitdir is the usual way to configure the directory to which any systemd service file gets installed. --- Makefile.in | 4 ++++ configure.ac | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Makefile.in b/Makefile.in index 646c73d5..b8758482 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,6 +14,7 @@ libdir := @libdir@ includedir := @includedir@ sbindir := @sbindir@ localstatedir := @localstatedir@ +systemdsystemunitdir := @systemdsystemunitdir@ CXX := @CXX@ CXXFLAGS := -I$(srcdir)/include -Iinclude @CPPFLAGS@ @CXXFLAGS@ LDFLAGS := @LDFLAGS@ @@ -125,6 +126,9 @@ install: znc $(LIBZNC) fi @$(MAKE) -C man install DESTDIR=$(DESTDIR) + @HAVE_SYSTEMD_TRUE@test -d $(DESTDIR)$(systemdsystemunitdir) || $(INSTALL) -d $(DESTDIR)$(systemdsystemunitdir) + @HAVE_SYSTEMD_TRUE@$(INSTALL_DATA) znc.service $(DESTDIR)$(systemdsystemunitdir) + uninstall: rm $(DESTDIR)$(bindir)/znc rm $(DESTDIR)$(bindir)/znc-config diff --git a/configure.ac b/configure.ac index 8373756a..19786d1e 100644 --- a/configure.ac +++ b/configure.ac @@ -149,6 +149,14 @@ AC_ARG_ENABLE([add-networks], AS_HELP_STRING([--enable-add-networks], [allow non-admins to add networks]), [ if test x"$enableval" = "xyes" ; then appendCXX "-DENABLE_ADD_NETWORK" ; fi ]) +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) +if test "x$with_systemdsystemunitdir" != xno; then + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) +fi +AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) + if test "$DEBUG" != "no"; then appendCXX -ggdb3 AC_DEFINE([_DEBUG], [1], [Define for debugging]) From 4f3094e6c76863316a52bf1a7e5ec11f819e5d9f Mon Sep 17 00:00:00 2001 From: "Wulf C. Krueger" Date: Sat, 2 Jun 2012 19:28:55 +0200 Subject: [PATCH 3/4] Fix the tests. Due to the restructure directory layout, header files weren't found anymore. CConfigEntry was moved out of CConfig which had to be reflected in ConfigTest. --- test/ConfigTest.cpp | 8 ++++---- test/EscapeTest.cpp | 4 ++-- test/Makefile.in | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/ConfigTest.cpp b/test/ConfigTest.cpp index 13673fca..f3b12974 100644 --- a/test/ConfigTest.cpp +++ b/test/ConfigTest.cpp @@ -6,9 +6,9 @@ * by the Free Software Foundation. */ -#include "ZNCDebug.h" -#include "FileUtils.h" -#include "Config.h" +#include "znc/ZNCDebug.h" +#include "znc/FileUtils.h" +#include "znc/Config.h" #include class CConfigTest { @@ -113,7 +113,7 @@ public: CConfig::SubConfigMapIterator it2 = conf.BeginSubConfigs(); while (it2 != conf.EndSubConfigs()) { - map::const_iterator it3 = it2->second.begin(); + map::const_iterator it3 = it2->second.begin(); while (it3 != it2->second.end()) { sRes += "->" + it2->first + "/" + it3->first + "\n"; diff --git a/test/EscapeTest.cpp b/test/EscapeTest.cpp index ac46ac57..0ada6c9f 100644 --- a/test/EscapeTest.cpp +++ b/test/EscapeTest.cpp @@ -6,8 +6,8 @@ * by the Free Software Foundation. */ -#include "ZNCString.h" -#include "ZNCDebug.h" +#include "znc/ZNCString.h" +#include "znc/ZNCDebug.h" static int testEqual(const CString& a, const CString& b, const CString& what) { diff --git a/test/Makefile.in b/test/Makefile.in index 6e377c60..357f3c83 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -5,14 +5,14 @@ srcdir := @srcdir@ VPATH := @srcdir@ CXX := @CXX@ -CXXFLAGS := @CPPFLAGS@ @CXXFLAGS@ -I.. +CXXFLAGS := @CPPFLAGS@ @CXXFLAGS@ -I../include LDFLAGS := @LDFLAGS@ LIBS := @LIBS@ TARGETS := ConfigTest EscapeTest OBJS := $(addsuffix .o, $(TARGETS)) ZNC_OBJS := Config.o ZNCDebug.o FileUtils.o Utils.o ZNCString.o MD5.o SHA256.o -ZNC_OBJS := $(addprefix ../, $(ZNC_OBJS)) +ZNC_OBJS := $(addprefix ../src/, $(ZNC_OBJS)) ifneq "$(V)" "" VERBOSE=1 From 524ec572249311e8ce44b7832fe33445c3a0534b Mon Sep 17 00:00:00 2001 From: "Wulf C. Krueger" Date: Mon, 3 Sep 2012 20:40:42 +0200 Subject: [PATCH 4/4] configure.ac: Move the pkg_config check upwards to allow using it earlier. --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 19786d1e..5fe94c21 100644 --- a/configure.ac +++ b/configure.ac @@ -89,6 +89,8 @@ case "${host_os}" in ;; esac +PKG_PROG_PKG_CONFIG() + AC_ARG_WITH( [openssl], AS_HELP_STRING([--with-openssl=DIR], [openssl installation prefix]), [OPENSSL=$withval],) @@ -201,7 +203,6 @@ fi AC_CHECK_LIB( gnugetopt, getopt_long,) AC_CHECK_FUNCS([lstat getopt_long getphassphrase]) -PKG_PROG_PKG_CONFIG() # ----- Check for dlopen