diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-09-21 00:48:24 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-09-21 00:48:24 +0200 |
commit | 8a679892b9e6e96b10dfeb16d1caacb096bc116f (patch) | |
tree | dd76a6cc2ccf9558d13b9c3242df7235a2ec34aa /src | |
parent | fixed path to examples dir (diff) |
improved install routines (added systemd service unit and initscript
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 27 | ||||
-rwxr-xr-x | src/configure | 29 |
2 files changed, 46 insertions, 10 deletions
diff --git a/src/Makefile b/src/Makefile index 77619cf..886872e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -79,6 +79,11 @@ manpage: INSTALL_TARGETS := install-bin install-etc REMOVE_TARGETS := remove-bin remove-etc +ifdef SYSTEMDDIR +INSTALL_TARGETS += install-systemd +REMOVE_TARGETS += remove-systemd +endif + ifdef MANDIR INSTALL_TARGETS += install-man REMOVE_TARGETS += remove-man @@ -95,7 +100,15 @@ install-bin: $(EXECUTABLE) $(INSTALL) -d $(DESTDIR)$(BINDIR) $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(BINDIR) +install-systemd: + $(INSTALL) -d $(DESTDIR)$(SYSTEMDDIR) + $(INSTALL) -m 644 ../contrib/systemd.service $(DESTDIR)$(SYSTEMDDIR)/$(EXECUTABLE).service + $(INSTALL) -d $(DESTDIR)$(BINDIR) + $(INSTALL) -m 755 ../contrib/$(EXECUTABLE)-launcher $(DESTDIR)$(BINDIR) + install-etc: + $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d/ + $(INSTALL) -m 755 ../contrib/initscript $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE) $(INSTALL) -d $(DESTDIR)$(ETCDIR)/$(EXECUTABLE) @ echo "example configurations can be found at $(EXAMPLESDIR)/$(EXECUTABLE)" > $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/README @@ -105,8 +118,8 @@ install-man: manpage install-examples: $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE) - $(INSTALL) -m 644 etc/dropnroll/autostart $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/autostart - @( cd 'etc/dropnroll/' ; \ + $(INSTALL) -m 644 ../contrib/etc/dropnroll/autostart $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/autostart + @( cd '../contrib/etc/dropnroll/' ; \ for dir in `ls`; do \ if [ -d $$dir ]; then \ echo "install $$dir configuration" ; \ @@ -128,13 +141,17 @@ remove: $(REMOVE_TARGETS) remove-bin: rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE) -remove-etc: +remove-systemd: + rm -f $(DESTDIR)$(SYSTEMDDIR)/$(EXECUTABLE).service -remove-examples: - rm -rf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/ +remove-etc: + rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE) remove-man: rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8 +remove-examples: + rm -rf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/ + purge: remove rm -rf $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/ diff --git a/src/configure b/src/configure index 50e3239..f092fef 100755 --- a/src/configure +++ b/src/configure @@ -26,15 +26,14 @@ EBUILD_COMPAT=0 USE_CLANG=0 -CFLAGS='-g -O2' -LDFLAGS='-g -Wall -O2' - PREFIX='/usr/local' BINDIR='' ETCDIR='' +SYSTEMDDIR='' +INSTALLSYSTEMD=1 MANDIR='' INSTALLMANPAGE=1 -EXAMPLESDIR='../' +EXAMPLESDIR='' INSTALLEXAMPLES=1 print_usage() { @@ -43,10 +42,13 @@ print_usage() { echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)" echo " --bindir=<DIR> the path to the bin directory (default: $PREFIX/bin)" echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc" + echo " --systemddir=<DIR> the path to the systemd service unit directory (default: /usr/lib/systemd/system)" + echo " --no-systemd dont't install systemd service unit" echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)" echo " --no-manpage dont't install manpage" echo " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)" echo " --no-examples dont't install example files" + echo " --use-clang use clang/llvm as compiler/linker" } for arg @@ -67,6 +69,12 @@ do --sysconfdir=*) ETCDIR=${arg#--sysconfdir=} ;; + --systemddir=*) + SYSTEMDDIR=${arg#--systemddir=} + ;; + --no-systemd) + INSTALLSYSTEMD=0 + ;; --mandir=*) MANDIR=${arg#--mandir=} ;; @@ -123,7 +131,7 @@ case $TARGET in LDFLAGS=$LDFLAGS' -L/usr/local/lib' ;; *) - echo "Plattform not supported" + echo "platform not supported" exit 1; ;; esac @@ -132,6 +140,10 @@ if [ -z "$BINDIR" ]; then BINDIR=$PREFIX/bin fi +if [ -z "$SYSTEMDDIR" ]; then + SYSTEMDDIR=/usr/lib/systemd/system +fi + if [ -z "$ETCDIR" ]; then ETCDIR=$PREFIX/etc fi @@ -160,6 +172,13 @@ BINDIR := $BINDIR ETCDIR := $ETCDIR EOF +if [ $INSTALLSYSTEMD -eq 1 ]; then + echo "SYSTEMDDIR := $SYSTEMDDIR" >> include.mk + echo "installing systemd service unit" +else + echo "not installing system service unit" +fi + if [ $INSTALLMANPAGE -eq 1 ]; then echo "MANDIR := $MANDIR" >> include.mk echo "installing manpage" |