Install systemd services with autotools

Change-Id: I672f49f1034554ce62347ff9493eca18340deb3a
This commit is contained in:
Pau Espin 2018-09-10 13:54:05 +02:00
parent 3233e0d9df
commit b47fc45642
7 changed files with 32 additions and 2 deletions

View File

@ -1,10 +1,13 @@
AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6
SUBDIRS = src tests SUBDIRS = src tests contrib
BUILT_SOURCES = $(top_srcdir)/.version BUILT_SOURCES = $(top_srcdir)/.version
EXTRA_DIST = git-version-gen osmoappdesc.py .version EXTRA_DIST = git-version-gen osmoappdesc.py .version
DISTCHECK_CONFIGURE_FLAGS = \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
@RELMAKE@ @RELMAKE@
$(top_srcdir)/.version: $(top_srcdir)/.version:

View File

@ -65,6 +65,22 @@ AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
AC_MSG_RESULT([$enable_ext_tests]) AC_MSG_RESULT([$enable_ext_tests])
AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "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([CPPFLAGS="$CPPFLAGS"]) AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
AC_MSG_RESULT([CFLAGS="$CFLAGS"]) AC_MSG_RESULT([CFLAGS="$CFLAGS"])
AC_MSG_RESULT([CXXFLAGS="$CXXFLAGS"]) AC_MSG_RESULT([CXXFLAGS="$CXXFLAGS"])
@ -73,4 +89,6 @@ AC_MSG_RESULT([LDFLAGS="$LDFLAGS"])
AC_OUTPUT( AC_OUTPUT(
src/Makefile src/Makefile
tests/Makefile tests/Makefile
contrib/Makefile
contrib/systemd/Makefile
Makefile) Makefile)

1
contrib/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = systemd

View File

@ -0,0 +1,5 @@
if HAVE_SYSTEMD
EXTRA_DIST = osmo-sip-connector.service
systemdsystemunit_DATA = \
osmo-sip-connector.service
endif

View File

@ -1 +1,2 @@
lib/systemd/system/osmo-sip-connector.service
usr/bin/osmo-sip-connector usr/bin/osmo-sip-connector

View File

@ -1 +0,0 @@
../contrib/systemd/osmo-sip-connector.service

3
debian/rules vendored
View File

@ -13,3 +13,6 @@ export DEB_BUILD_HARDENING=1
override_dh_strip: override_dh_strip:
dh_strip --dbg-package=osmo-sip-connector-dbg dh_strip --dbg-package=osmo-sip-connector-dbg
override_dh_auto_configure:
dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system