aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-09-10 12:55:00 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-09-10 16:10:06 +0200
commitf282f333601a250bcf9397a92aab1e3dc6e28100 (patch)
tree5b3e25b798e24a4e2c47dba921a829bb4d3f66b7
parent36115c9d9aa3efa8b98d75632d08510ff368b38c (diff)
Install systemd services with autotools
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac18
-rw-r--r--contrib/Makefile.am1
-rw-r--r--contrib/systemd/Makefile.am5
-rw-r--r--debian/osmo-msc.install1
l---------debian/osmo-msc.service1
-rwxr-xr-xdebian/rules4
7 files changed, 31 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 2f0a78694..9f3644f29 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,12 +12,16 @@ SUBDIRS = \
doc \
include \
src \
+ contrib \
tests \
$(NULL)
BUILT_SOURCES = $(top_srcdir)/.version
EXTRA_DIST = git-version-gen osmoappdesc.py .version
+DISTCHECK_CONFIGURE_FLAGS = \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
@RELMAKE@
$(top_srcdir)/.version:
diff --git a/configure.ac b/configure.ac
index 03acc0ccf..2d8dc425e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -181,6 +181,22 @@ AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
AC_MSG_RESULT([$enable_ext_tests])
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([CFLAGS="$CFLAGS"])
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
@@ -203,4 +219,6 @@ AC_OUTPUT(
tests/msc_vlr/Makefile
doc/Makefile
doc/examples/Makefile
+ contrib/Makefile
+ contrib/systemd/Makefile
Makefile)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 000000000..3439c97be
--- /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 000000000..86481725f
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,5 @@
+if HAVE_SYSTEMD
+EXTRA_DIST = osmo-msc.service
+systemdsystemunit_DATA = \
+ osmo-msc.service
+endif
diff --git a/debian/osmo-msc.install b/debian/osmo-msc.install
index 6b84b8f14..1e7f22f2a 100644
--- a/debian/osmo-msc.install
+++ b/debian/osmo-msc.install
@@ -1,3 +1,4 @@
+lib/systemd/system/osmo-msc.service
usr/bin/osmo-msc
usr/share/doc/osmo-msc/examples/osmo-msc/osmo-msc.cfg usr/share/doc/osmo-msc/examples
usr/share/doc/osmo-msc/examples/osmo-msc/osmo-msc_custom-sccp.cfg usr/share/doc/osmo-msc/examples
diff --git a/debian/osmo-msc.service b/debian/osmo-msc.service
deleted file mode 120000
index 784b8b51d..000000000
--- a/debian/osmo-msc.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-msc.service \ No newline at end of file
diff --git a/debian/rules b/debian/rules
index 15e79dae4..1cf3a355e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -42,11 +42,11 @@
# main packaging script based on dh7 syntax
%:
- dh $@ --with autoreconf
+ dh $@ --with autoreconf
# debmake generated override targets
# Set options for ./configure
-CONFIGURE_FLAGS += --enable-iu --enable-smpp
+CONFIGURE_FLAGS += --enable-iu --enable-smpp --with-systemdsystemunitdir=/lib/systemd/system
override_dh_auto_configure:
dh_auto_configure -- $(CONFIGURE_FLAGS)
#