Change in osmo-trx[master]: Install systemd services with autotools

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Sep 13 13:56:55 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/10900 )

Change subject: Install systemd services with autotools
......................................................................

Install systemd services with autotools

Change-Id: Ia1a4fb62dee35737ece1f3501f352501eba2449e
---
M Makefile.am
M configure.ac
A contrib/Makefile.am
A contrib/systemd/Makefile.am
M debian/osmo-trx-lms.install
D debian/osmo-trx-lms.service
M debian/osmo-trx-uhd.install
D debian/osmo-trx-uhd.service
M debian/osmo-trx-usrp1.install
D debian/osmo-trx-usrp1.service
M debian/patches/build-for-debian8.patch
M debian/rules
12 files changed, 47 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Pau Espin Pedrol: Verified



diff --git a/Makefile.am b/Makefile.am
index 8ab73a6..38cd88d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,6 +32,7 @@
 	CommonLibs \
 	GSM \
 	Transceiver52M \
+	contrib \
 	tests
 
 EXTRA_DIST = \
@@ -41,6 +42,9 @@
 	COPYING \
 	README
 
+DISTCHECK_CONFIGURE_FLAGS = \
+	--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
 .PHONY: release
 
 @RELMAKE@
diff --git a/configure.ac b/configure.ac
index daa8677..64e3b35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,6 +223,22 @@
 AC_CHECK_HEADER([boost/config.hpp],[],
     [AC_MSG_ERROR([boost/config.hpp not found, install e.g. libboost-dev])])
 
+    # 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([CFLAGS="$CFLAGS"])
 AC_MSG_RESULT([CXXFLAGS="$CXXFLAGS"])
@@ -247,6 +263,8 @@
     tests/Transceiver52M/Makefile \
     doc/Makefile \
     doc/examples/Makefile \
+    contrib/Makefile \
+    contrib/systemd/Makefile \
 ])
 
 AC_OUTPUT
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..21fbb53
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,18 @@
+if HAVE_SYSTEMD
+SYSTEMD_SERVICES =
+
+if DEVICE_UHD
+SYSTEMD_SERVICES += osmo-trx-uhd.service
+endif
+
+if DEVICE_USRP1
+SYSTEMD_SERVICES += osmo-trx-usrp1.service
+endif
+
+if DEVICE_LMS
+SYSTEMD_SERVICES += osmo-trx-lms.service
+endif
+
+EXTRA_DIST = $(SYSTEMD_SERVICES)
+systemdsystemunit_DATA = $(SYSTEMD_SERVICES)
+endif # HAVE_SYSTEMD
diff --git a/debian/osmo-trx-lms.install b/debian/osmo-trx-lms.install
index dd9d407..b58c862 100644
--- a/debian/osmo-trx-lms.install
+++ b/debian/osmo-trx-lms.install
@@ -1,2 +1,3 @@
+lib/systemd/system/osmo-trx-lms.service
 /usr/bin/osmo-trx-lms
 /usr/share/doc/osmo-trx/examples/osmo-trx-lms/osmo-trx-limesdr.cfg /usr/share/doc/osmo-trx/examples/osmo-trx-lms/
diff --git a/debian/osmo-trx-lms.service b/debian/osmo-trx-lms.service
deleted file mode 120000
index d2d697a..0000000
--- a/debian/osmo-trx-lms.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-trx-lms.service
\ No newline at end of file
diff --git a/debian/osmo-trx-uhd.install b/debian/osmo-trx-uhd.install
index 8944b13..b7ec5ca 100644
--- a/debian/osmo-trx-uhd.install
+++ b/debian/osmo-trx-uhd.install
@@ -1,3 +1,4 @@
+lib/systemd/system/osmo-trx-uhd.service
 /usr/bin/osmo-trx-uhd
 /usr/share/doc/osmo-trx/examples/osmo-trx-uhd/osmo-trx-usrp_b200.cfg /usr/share/doc/osmo-trx/examples/osmo-trx-uhd/
 /usr/share/doc/osmo-trx/examples/osmo-trx-uhd/osmo-trx-limesdr.cfg /usr/share/doc/osmo-trx/examples/osmo-trx-uhd/
diff --git a/debian/osmo-trx-uhd.service b/debian/osmo-trx-uhd.service
deleted file mode 120000
index c67648f..0000000
--- a/debian/osmo-trx-uhd.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-trx-uhd.service
\ No newline at end of file
diff --git a/debian/osmo-trx-usrp1.install b/debian/osmo-trx-usrp1.install
index c7e54b1..112a149 100644
--- a/debian/osmo-trx-usrp1.install
+++ b/debian/osmo-trx-usrp1.install
@@ -1,3 +1,4 @@
+lib/systemd/system/osmo-trx-usrp1.service
 /usr/bin/osmo-trx-usrp1
 /usr/share/usrp/rev2/std_inband.rbf
 /usr/share/usrp/rev4/std_inband.rbf
diff --git a/debian/osmo-trx-usrp1.service b/debian/osmo-trx-usrp1.service
deleted file mode 120000
index a7b33ad..0000000
--- a/debian/osmo-trx-usrp1.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-trx-usrp1.service
\ No newline at end of file
diff --git a/debian/patches/build-for-debian8.patch b/debian/patches/build-for-debian8.patch
index d44eb2f..cd1f356 100644
--- a/debian/patches/build-for-debian8.patch
+++ b/debian/patches/build-for-debian8.patch
@@ -50,8 +50,8 @@
  	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
  
  override_dh_auto_configure:
--	dh_auto_configure -- --with-uhd --with-usrp1 --with-lms
-+	dh_auto_configure -- --with-uhd --with-usrp1
+-	dh_auto_configure -- --with-uhd --with-usrp1 --with-lms --with-systemdsystemunitdir=/lib/systemd/system
++	dh_auto_configure -- --with-uhd --with-usrp1 --with-systemdsystemunitdir=/lib/systemd/system
  
  override_dh_strip:
  	dh_strip --dbg-package=osmo-trx-dbg
diff --git a/debian/rules b/debian/rules
index 8081162..68de706 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,7 +9,7 @@
 	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
 
 override_dh_auto_configure:
-	dh_auto_configure -- --with-uhd --with-usrp1 --with-lms
+	dh_auto_configure -- --with-uhd --with-usrp1 --with-lms --with-systemdsystemunitdir=/lib/systemd/system
 
 override_dh_strip:
 	dh_strip --dbg-package=osmo-trx-dbg

-- 
To view, visit https://gerrit.osmocom.org/10900
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia1a4fb62dee35737ece1f3501f352501eba2449e
Gerrit-Change-Number: 10900
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180913/e5de2f74/attachment.htm>


More information about the gerrit-log mailing list