Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/10843
Change subject: Install systemd services with autotools ...................................................................... Install systemd services with autotools Change-Id: Ie77ee4b32a75e2d207030ddc78d39fb664103d33 --- M Makefile.am M configure.ac A contrib/Makefile.am A contrib/systemd/Makefile.am M debian/osmo-stp.install D debian/osmo-stp.service M debian/rules 7 files changed, 28 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/43/10843/1 diff --git a/Makefile.am b/Makefile.am index 3f4de13..7d09259 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,13 +1,16 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -SUBDIRS = include src tests examples stp doc +SUBDIRS = include src tests examples stp doc contrib pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-sccp.pc libosmo-mtp.pc libosmo-sigtran.pc libosmo-xua.pc EXTRA_DIST = .version git-version-gen osmoappdesc.py doc/examples/osmo-stp.cfg +DISTCHECK_CONFIGURE_FLAGS = \ + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) + @RELMAKE@ BUILT_SOURCES = $(top_srcdir)/.version diff --git a/configure.ac b/configure.ac index c0cc488..af64bc0 100644 --- a/configure.ac +++ b/configure.ac @@ -98,6 +98,21 @@ AC_PATH_PROG(DOXYGEN,doxygen,false) AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false && test "x$doxygen" = "xyes") +# https://www.freedesktop.org/software/systemd/man/daemon.html +AC_ARG_WITH([systemdsystemunitdir], + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, + [with_systemdsystemunitdir=auto]) +AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ + def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) + AS_IF([test "x$def_systemdsystemunitdir" = "x"], + [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], + [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) + with_systemdsystemunitdir=no], + [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) +AS_IF([test "x$with_systemdsystemunitdir" != "xno"], + [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) +AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) + AC_MSG_RESULT([CFLAGS="$CFLAGS"]) AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) @@ -122,5 +137,7 @@ stp/Makefile doc/Makefile doc/examples/Makefile + contrib/Makefile + contrib/systemd/Makefile Doxyfile Makefile) diff --git a/contrib/Makefile.am b/contrib/Makefile.am new file mode 100644 index 0000000..3439c97 --- /dev/null +++ b/contrib/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = systemd diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am new file mode 100644 index 0000000..d6a94e7 --- /dev/null +++ b/contrib/systemd/Makefile.am @@ -0,0 +1,4 @@ +if HAVE_SYSTEMD +systemdsystemunit_DATA = \ + osmo-stp.service +endif diff --git a/debian/osmo-stp.install b/debian/osmo-stp.install index b2f8077..2c250b0 100644 --- a/debian/osmo-stp.install +++ b/debian/osmo-stp.install @@ -1,2 +1,3 @@ +/lib/sytemd/system/osmo-stp.service /usr/bin/osmo-stp /usr/share/doc/libosmo-sccp/examples/osmo-stp/osmo-stp.cfg diff --git a/debian/osmo-stp.service b/debian/osmo-stp.service deleted file mode 120000 index 55f37c2..0000000 --- a/debian/osmo-stp.service +++ /dev/null @@ -1 +0,0 @@ -../contrib/systemd/osmo-stp.service \ No newline at end of file diff --git a/debian/rules b/debian/rules index bea0a76..c0c9f0c 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,7 @@ dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) override_dh_auto_configure: - dh_auto_configure -- --enable-static + dh_auto_configure -- --enable-static --with-systemdsystemunitdir=/lib/sytemd/system # Print test results in case of a failure override_dh_auto_test: -- To view, visit https://gerrit.osmocom.org/10843 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ie77ee4b32a75e2d207030ddc78d39fb664103d33 Gerrit-Change-Number: 10843 Gerrit-PatchSet: 1 Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>