summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBernhard Tittelbach <service-anytun@tittelbach.org>2015-01-16 00:13:27 +0000
committerBernhard Tittelbach <service-anytun@tittelbach.org>2015-01-16 00:13:27 +0000
commit3de5d986dc5cebf31287d1c41388a1004976df7d (patch)
treed3acbf5aaf350354fd11ca833c85ae2b315f671b /src
parentversion output now includes compiler version (diff)
systemd support (--with-systemd) (config/install script untested)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile34
-rwxr-xr-xsrc/configure4
2 files changed, 30 insertions, 8 deletions
diff --git a/src/Makefile b/src/Makefile
index b2f1646..b04d76b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -171,7 +171,7 @@ ANYCTRSRCS := $(ANYCTROBJS:%.o=%.cpp)
ANYCONFSRCS := $(ANYCONFOBJS:%.o=%.cpp)
EXESRCS := $(EXEOBJS:%.o=%.cpp)
-.PHONY: distclean cleanall clean manpage install install-bin install-etc install-man uninstall remove purge
+.PHONY: distclean cleanall clean manpage install install-bin install-etc install-man uninstall remove purge remove-systemd install-systemd remove-bin remove-man remove-examples
all: $(EXECUTABLES) #libAnysync.a
@@ -211,13 +211,13 @@ anytun-controld$(EXE): $(ANYCTROBJS) anytun-controld.o
$(LD) $(ANYCTROBJS) anytun-controld.o -o $@ $(LDFLAGS)
-options.o: options.cpp
+options.o: options.cpp
$(CXX) $(CXXFLAGS) -DANYTUN_OPTIONS $< -c -o $@
-anyCtrOptions.o: options.cpp
+anyCtrOptions.o: options.cpp
$(CXX) $(CXXFLAGS) -DANYCTR_OPTIONS $< -c -o $@
-anyConfOptions.o: options.cpp
+anyConfOptions.o: options.cpp
$(CXX) $(CXXFLAGS) -DANYCONF_OPTIONS $< -c -o $@
nullOptions.o: options.cpp
@@ -234,7 +234,6 @@ libAnysync.a: $(OBJS)
anyrtpproxy: anytun
$(MAKE) --directory=$(CURDIR)/anyrtpproxy
-
distclean: cleanall
find . -name *.o -exec rm -f {} \;
rm -f config.sub config.guess
@@ -281,6 +280,11 @@ INSTALL_TARGETS += install-examples
REMOVE_TARGETS += remove-examples
endif
+ifdef SYSTEMD
+INSTALL_TARGETS += install-systemd
+REMOVE_TARGETS := remove-systemd
+endif
+
install: all $(INSTALL_TARGETS)
install-bin: $(EXECUTABLES)
@@ -290,18 +294,28 @@ install-bin: $(EXECUTABLES)
$(INSTALL) -m 755 anytun-config $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 anytun-controld $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 anytun-showtables $(DESTDIR)$(BINDIR)
+ @ sed -e 's#DAEMON=/usr/sbin/anytun#DAEMON=$(SBINDIR)/anytun#' \
+ -e 's#ANYTUNCONFIG=/usr/bin/anytun-config#ANYTUNCONFIG=$(BINDIR)/anytun-config#' \
+ -e 's#CONTROLDAEMON=/usr/bin/anytun-controld#CONTROLDAEMON=$(BINDIR)/anytun-controld#' \
+ -e 's#CONFIG_DIR=/etc/anytun#CONFIG_DIR=$(ETCDIR)/anytun#' ../usr/bin/anytun-launcher.sh > ../usr/bin/anytun-launcher.sh.bak
+ $(INSTALL) -m 755 ../usr/bin/anytun-launcher.sh.bak $(DESTDIR)$(BINDIR)/anytun-launcher.sh
install-etc:
$(INSTALL) -d $(DESTDIR)$(ETCDIR)/anytun
@ echo "example configurations can be found at $(EXAMPLESDIR)/anytun" > $(DESTDIR)$(ETCDIR)/anytun/README
$(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d
- @ sed -e 's#DAEMON=/usr/sbin/anytun#DAEMON=$(SBINDIR)/anytun#' \
- -e 's#ANYTUNCONFIG=/usr/bin/anytun-config#ANYTUNCONFIG=$(BINDIR)/anytun-config#' \
- -e 's#CONTROLDAEMON=/usr/bin/anytun-controld#CONTROLDAEMON=$(BINDIR)/anytun-controld#' \
+ @ sed -e 's#ANYTUNLAUNCHER=/usr/bin/anytun-launcher.sh#ANYTUNLAUNCHER=$(BINDIR)/anytun-launcher.sh#' \
-e 's#CONFIG_DIR=/etc/anytun#CONFIG_DIR=$(ETCDIR)/anytun#' ../etc/init.d/anytun > ../etc/init.d/anytun.bak
$(INSTALL) -m 755 ../etc/init.d/anytun.bak $(DESTDIR)$(ETCDIR)/init.d/anytun
rm -f ../etc/init.d/anytun.bak
+install-systemd:
+ $(INSTALL) -d $(DESTDIR)/lib/systemd/system/
+ @ sed -e 's#/usr/bin/#$(DESTDIR)$(BINDIR)/#' ../usr/lib/systemd/system/anytun@.service > ../usr/lib/systemd/system/anytun@.service.bak
+ @ sed -e 's#/usr/bin/#$(DESTDIR)$(BINDIR)/#' ../usr/lib/systemd/system/anytun-control@.service > ../usr/lib/systemd/system/anytun-control@.service.bak
+ $(INSTALL) ../usr/lib/systemd/system/anytun@.service.bak $(DESTDIR)/lib/systemd/system/anytun@.service
+ $(INSTALL) ../usr/lib/systemd/system/anytun-control@.service.bak $(DESTDIR)/anytun-control@.service
+
install-examples:
$(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun
$(INSTALL) -m 644 ../etc/anytun/autostart $(DESTDIR)$(EXAMPLESDIR)/anytun/autostart
@@ -351,6 +365,10 @@ remove-bin:
remove-etc:
rm -f $(DESTDIR)$(ETCDIR)/init.d/anytun
+remove-systemd:
+ rm -f $(DESTDIR)/lib/systemd/system/anytun@.service
+ rm -f $(DESTDIR)/anytun-control@.service
+
remove-examples:
rm -rf $(DESTDIR)$(EXAMPLESDIR)/anytun/
diff --git a/src/configure b/src/configure
index f070150..c318121 100755
--- a/src/configure
+++ b/src/configure
@@ -94,6 +94,7 @@ print_usage() {
echo " --with-gcrypt=<PREFIX> don't use systemwide gcrypt"
echo " --with-nettle=<PREFIX> don't use systemwide nettle"
echo " --with-openssl=<PREFIX> don't use systemwide openssl"
+ echo " --with-systemd install systemd unit descriptions"
echo " --use-clang use clang/llvm as compiler/linker"
}
@@ -172,6 +173,9 @@ do
--with-openssl=*)
OPENSSL_PREFIX=${arg#--with-openssl=}
;;
+ --with-systemd=*)
+ SYSTEMD=1
+ ;;
--help)
print_usage
exit 0