aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2011-03-18 00:57:14 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2011-03-18 00:57:14 +0000
commit417002e1714b97cc3073e3968ee0cee3181dc96c (patch)
treecb48a2257695cab1f90bfbe40b340823d98e49ce
parentf68fd5f0a37883438a13b8043489543f01b78c35 (diff)
systemd stuff (bug #738)
-rw-r--r--Makefile24
-rwxr-xr-xconfigure19
2 files changed, 40 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 24ef2168..43deb3f8 100644
--- a/Makefile
+++ b/Makefile
@@ -26,18 +26,18 @@ endif
# Expansion of variables
subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
-all: $(OUTFILE) $(OTR_PI)
+all: $(OUTFILE) $(OTR_PI) systemd
$(MAKE) -C doc
uninstall: uninstall-bin uninstall-doc
@echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n'
-install: install-bin install-doc install-plugins
+install: install-bin install-doc install-plugins install-systemd
@if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi
@if ! [ -e $(DESTDIR)$(ETCDIR)/bitlbee.conf ]; then echo -e '\nNo files are installed in '$(DESTDIR)$(ETCDIR)' by make install. Run make install-etc to do that.'; fi
@echo
-.PHONY: install install-bin install-etc install-doc install-plugins \
+.PHONY: install install-bin install-etc install-doc install-plugins install-systemd \
uninstall uninstall-bin uninstall-etc uninstall-doc \
all clean distclean tar $(subdirs)
@@ -109,6 +109,24 @@ ifdef OTR_PI
install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR)
endif
+systemd:
+ifdef SYSTEMDSYSTEMUNITDIR
+ sed 's|@sbindir@|$(BINDIR)|' init/bitlbee.service.in > init/bitlbee.service
+ sed 's|@sbindir@|$(BINDIR)|' init/bitlbee@.service.in > init/bitlbee@.service
+endif
+
+install-systemd:
+ifdef SYSTEMDSYSTEMUNITDIR
+ifeq ($(USER),root)
+ mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
+ install -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
+ install -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
+ install -m 0644 init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
+else
+ @echo Not root, so not installing systemd files.
+endif
+endif
+
tar:
fakeroot debian/rules clean || make distclean
x=$$(basename $$(pwd)); \
diff --git a/configure b/configure
index 0728146a..77dc560a 100755
--- a/configure
+++ b/configure
@@ -15,6 +15,7 @@ datadir='$prefix/share/bitlbee/'
config='/var/lib/bitlbee/'
plugindir='$prefix/lib/bitlbee/'
includedir='$prefix/include/bitlbee/'
+systemdsystemunitdir=''
libevent='/usr/'
pidfile='/var/run/bitlbee.pid'
ipcsocket='/var/run/bitlbee.sock'
@@ -61,6 +62,7 @@ Option Description Default
--mandir=... $mandir
--datadir=... $datadir
--plugindir=... $plugindir
+--systemdsystemunitdir=... $systemdsystemunitdir
--pidfile=... $pidfile
--config=... $config
--ipcsocket=... $ipcsocket
@@ -486,6 +488,17 @@ else
fi;
fi
+if [ -z "$systemdsystemunitdir" ]; then
+ if $PKG_CONFIG --exists systemd; then
+ systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
+ fi
+fi
+if [ -n "$systemdsystemunitdir" ]; then
+ if [ "$systemdsystemunitdir" != "no" ]; then
+ echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
+ fi
+fi
+
if [ "$gcov" = "1" ]; then
echo "CFLAGS+=--coverage" >> Makefile.settings
echo "EFLAGS+=--coverage" >> Makefile.settings
@@ -726,6 +739,12 @@ else
echo ' Off-the-Record (OTR) Messaging disabled.'
fi
+if [ -n "$systemdsystemunitdir" ]; then
+ echo ' systemd enabled.'
+else
+ echo ' systemd disabled.'
+fi
+
echo ' Using event handler: '$events
echo ' Using SSL library: '$ssl
#echo ' Building with these storage backends: '$STORAGES