| 1 | Patch-Source: https://lore.kernel.org/linux-bluetooth/[email protected]/
|
| 2 | ---
|
| 3 | From: Achill Gilgenast <[email protected]>
|
| 4 | To: [email protected]
|
| 5 | Cc: Achill Gilgenast <[email protected]>
|
| 6 | Subject: [PATCH BlueZ] build: Allow systemd unit build without libsystemd
|
| 7 | Date: Mon, 8 Dec 2025 02:24:18 +0100
|
| 8 | Message-ID: <[email protected]>
|
| 9 |
|
| 10 | Decouples libsystemd and systemd units from the same option and allows
|
| 11 | installation of services without systemd.pc by manually specifying the
|
| 12 | directories.
|
| 13 |
|
| 14 | This is useful in Alpine Linux where we don't ship systemd, but allow
|
| 15 | systemd services to be subpackaged for downstream distributions like
|
| 16 | postmarketOS.
|
| 17 | ---
|
| 18 | I'm by far no expert in autotools or bluez and how specific components
|
| 19 | are best categorized, so please let me know your feedback.
|
| 20 | ---
|
| 21 | Makefile.am | 6 +++++-
|
| 22 | Makefile.mesh | 4 +++-
|
| 23 | Makefile.obexd | 2 +-
|
| 24 | Makefile.tools | 4 ++--
|
| 25 | configure.ac | 21 +++++++++++++++------
|
| 26 | 5 files changed, 26 insertions(+), 11 deletions(-)
|
| 27 |
|
| 28 | diff --git a/Makefile.am b/Makefile.am
|
| 29 | index e152ae64853c..d3cdb2890d32 100644
|
| 30 | |
| 31 | |
| 32 | @@ -49,13 +49,17 @@ conf_DATA += profiles/network/network.conf
|
| 33 | state_DATA =
|
| 34 | endif
|
| 35 |
|
| 36 | -if SYSTEMD
|
| 37 | +if SYSTEMD_SYSTEMUNITS
|
| 38 | systemdsystemunitdir = $(SYSTEMD_SYSTEMUNITDIR)
|
| 39 | systemdsystemunit_DATA = src/bluetooth.service
|
| 40 | +endif
|
| 41 |
|
| 42 | +if SYSTEMD_USERUNITS
|
| 43 | systemduserunitdir = $(SYSTEMD_USERUNITDIR)
|
| 44 | systemduserunit_DATA =
|
| 45 | +endif
|
| 46 |
|
| 47 | +if SYSTEMD_UNITS
|
| 48 | dbussystembusdir = $(DBUS_SYSTEMBUSDIR)
|
| 49 | dbussystembus_DATA = src/org.bluez.service
|
| 50 | endif
|
| 51 | diff --git a/Makefile.mesh b/Makefile.mesh
|
| 52 | index e4c9fa6a32e6..e9998a9cdd75 100644
|
| 53 | |
| 54 | |
| 55 | @@ -6,8 +6,10 @@ dbus_DATA += mesh/bluetooth-mesh.conf
|
| 56 | conf_DATA += mesh/mesh-main.conf
|
| 57 | endif
|
| 58 |
|
| 59 | -if SYSTEMD
|
| 60 | +if SYSTEMD_SYSTEMUNITS
|
| 61 | systemdsystemunit_DATA += mesh/bluetooth-mesh.service
|
| 62 | +endif
|
| 63 | +if SYSTEMD_UNITS
|
| 64 | dbussystembus_DATA += mesh/org.bluez.mesh.service
|
| 65 | endif
|
| 66 |
|
| 67 | diff --git a/Makefile.obexd b/Makefile.obexd
|
| 68 | index 7ad74e1286b6..25aa8feb73d1 100644
|
| 69 | |
| 70 | |
| 71 | @@ -1,7 +1,7 @@
|
| 72 | # SPDX-License-Identifier: GPL-2.0
|
| 73 | if OBEX
|
| 74 |
|
| 75 | -if SYSTEMD
|
| 76 | +if SYSTEMD_USERUNITS
|
| 77 | systemduserunit_DATA += obexd/src/obex.service
|
| 78 |
|
| 79 | obexd-add-service-symlink:
|
| 80 | diff --git a/Makefile.tools b/Makefile.tools
|
| 81 | index 561b03d0b95b..72dffe7cd005 100644
|
| 82 | |
| 83 | |
| 84 | @@ -74,7 +74,7 @@ pkglibexec_PROGRAMS += tools/btmon-logger
|
| 85 | tools_btmon_logger_SOURCES = tools/btmon-logger.c
|
| 86 | tools_btmon_logger_LDADD = src/libshared-mainloop.la
|
| 87 |
|
| 88 | -if SYSTEMD
|
| 89 | +if SYSTEMD_SYSTEMUNITS
|
| 90 | systemdsystemunit_DATA += tools/bluetooth-logger.service
|
| 91 | endif
|
| 92 | endif
|
| 93 | @@ -340,7 +340,7 @@ tools_hex2hcd_SOURCES = tools/hex2hcd.c tools/missing.h
|
| 94 |
|
| 95 | tools_mpris_proxy_SOURCES = tools/mpris-proxy.c
|
| 96 | tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
|
| 97 | -if SYSTEMD
|
| 98 | +if SYSTEMD_USERUNITS
|
| 99 | systemduserunit_DATA += tools/mpris-proxy.service
|
| 100 | endif
|
| 101 |
|
| 102 | diff --git a/configure.ac b/configure.ac
|
| 103 | index 16b81aca37e6..2d9352b59557 100644
|
| 104 | |
| 105 | |
| 106 | @@ -352,29 +352,38 @@ AC_ARG_WITH([systemdsystemunitdir],
|
| 107 | AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
|
| 108 | [path to systemd system unit directory]),
|
| 109 | [path_systemunitdir=${withval}])
|
| 110 | -if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
|
| 111 | +if (test "${enable_systemd}" != "no" -o -z "${path_systemunitdir}"); then
|
| 112 | AC_MSG_CHECKING([systemd system unit dir])
|
| 113 | - path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
|
| 114 | if (test -z "${path_systemunitdir}"); then
|
| 115 | - AC_MSG_ERROR([systemd system unit directory is required])
|
| 116 | + path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
|
| 117 | + if (test -z "${path_systemunitdir}"); then
|
| 118 | + AC_MSG_ERROR([systemd system unit directory is required])
|
| 119 | + fi
|
| 120 | fi
|
| 121 | AC_MSG_RESULT([${path_systemunitdir}])
|
| 122 | fi
|
| 123 | AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
|
| 124 | +AM_CONDITIONAL(SYSTEMD_SYSTEMUNITS, test "${path_systemunitdir}" != "")
|
| 125 |
|
| 126 | AC_ARG_WITH([systemduserunitdir],
|
| 127 | AS_HELP_STRING([--with-systemduserunitdir=DIR],
|
| 128 | [path to systemd user unit directory]),
|
| 129 | [path_userunitdir=${withval}])
|
| 130 | -if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
|
| 131 | +if (test "${enable_systemd}" != "no" -o -z "${path_userunitdir}"); then
|
| 132 | AC_MSG_CHECKING([systemd user unit dir])
|
| 133 | - path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
|
| 134 | if (test -z "${path_userunitdir}"); then
|
| 135 | - AC_MSG_ERROR([systemd user unit directory is required])
|
| 136 | + path_userunitdir="`$PKG_CONFIG --variable=systemduserunitdir systemd`"
|
| 137 | + if (test -z "${path_userunitdir}"); then
|
| 138 | + AC_MSG_ERROR([systemd user unit directory is required])
|
| 139 | + fi
|
| 140 | fi
|
| 141 | AC_MSG_RESULT([${path_userunitdir}])
|
| 142 | fi
|
| 143 | AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
|
| 144 | +AM_CONDITIONAL(SYSTEMD_USERUNITS, test "${path_userunitdir}" != "")
|
| 145 | +
|
| 146 | +AM_CONDITIONAL(SYSTEMD_UNITS, (test "${path_systemunitdir}" != "" || test "${path_userunitdir}" != ""))
|
| 147 | +
|
| 148 |
|
| 149 | AC_ARG_ENABLE(datafiles, AS_HELP_STRING([--disable-datafiles],
|
| 150 | [do not install configuration and data files]),
|
| 151 | --
|
| 152 | 2.52.0
|