Skip to content

Commit

Permalink
build: manage .service.in files via configure.ac
Browse files Browse the repository at this point in the history
Considering we do basic substitution, we don't need to manually sed,
track dependencies, dist nor clean. Just add the files to
AC_CONFIG_FILES() call it a day - it does everything for us.
  • Loading branch information
evelikov-work authored and Vudentz committed Jan 25, 2024
1 parent 808d008 commit 116524c
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 26 deletions.
14 changes: 2 additions & 12 deletions Makefile.am
Expand Up @@ -47,7 +47,7 @@ dbussystembusdir = $(DBUS_SYSTEMBUSDIR)
dbussystembus_DATA = src/org.bluez.service
endif

EXTRA_DIST += src/bluetooth.service.in src/org.bluez.service
EXTRA_DIST += src/org.bluez.service

plugindir = $(libdir)/bluetooth/plugins

Expand Down Expand Up @@ -345,7 +345,7 @@ builtin_files = src/builtin.h

nodist_src_bluetoothd_SOURCES = $(builtin_files)

CLEANFILES += $(builtin_files) src/bluetooth.service
CLEANFILES += $(builtin_files)

if MANPAGES
man_MANS += src/bluetoothd.8
Expand Down Expand Up @@ -736,13 +736,6 @@ MAINTAINERCLEANFILES = Makefile.in \
aclocal.m4 configure config.h.in config.sub config.guess \
ltmain.sh depcomp compile missing install-sh mkinstalldirs test-driver

SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
$(SED) -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
-e 's,@libexecdir\@,$(libexecdir),g' \
-e 's,@statedir\@,$(statedir),g' \
-e 's,@confdir\@,$(confdir),g' \
< $< > $@

if RUN_RST2MAN
RST2MAN_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
$(RST2MAN) --strict --no-raw \
Expand All @@ -752,9 +745,6 @@ RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
{ echo "Generated manual page $@ does not exist"; false; }
endif

%.service: %.service.in Makefile
$(SED_PROCESS)

%.1: %.rst Makefile
$(RST2MAN_PROCESS)

Expand Down
5 changes: 1 addition & 4 deletions Makefile.mesh
Expand Up @@ -51,9 +51,6 @@ man_MANS += mesh/bluetooth-meshd.8
endif
manual_pages += mesh/bluetooth-meshd.8

CLEANFILES += mesh/bluetooth-mesh.service

endif

EXTRA_DIST += mesh/bluetooth-mesh.conf mesh/bluetooth-mesh.service.in \
mesh/org.bluez.mesh.service mesh/mesh-main.conf
EXTRA_DIST += mesh/bluetooth-mesh.conf mesh/org.bluez.mesh.service mesh/mesh-main.conf
4 changes: 2 additions & 2 deletions Makefile.obexd
Expand Up @@ -7,7 +7,7 @@ dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
dbussessionbus_DATA = obexd/src/org.bluez.obex.service
endif

EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
EXTRA_DIST += obexd/src/org.bluez.obex.service

if OBEX

Expand Down Expand Up @@ -112,6 +112,6 @@ obexd/src/builtin.h: obexd/src/genbuiltin $(obexd_builtin_sources)
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(srcdir)/obexd/src/genbuiltin $(obexd_builtin_modules) > $@

CLEANFILES += obexd/src/builtin.h $(builtin_files) obexd/src/obex.service
CLEANFILES += obexd/src/builtin.h

EXTRA_DIST += obexd/src/genbuiltin
3 changes: 0 additions & 3 deletions Makefile.tools
Expand Up @@ -77,9 +77,6 @@ systemdsystemunit_DATA += tools/bluetooth-logger.service
endif
endif

CLEANFILES += tools/bluetooth-logger.service
EXTRA_DIST += tools/bluetooth-logger.service.in

if TESTING
noinst_PROGRAMS += emulator/btvirt emulator/b1ee emulator/hfp \
peripheral/btsensor tools/3dsp \
Expand Down
11 changes: 10 additions & 1 deletion configure.ac
Expand Up @@ -441,5 +441,14 @@ if (test "${plugin_phonebook}" = "ebook"); then
fi
AC_SUBST(PLUGIN_PHONEBOOK, [${plugin_phonebook}])

AC_CONFIG_FILES(Makefile src/bluetoothd.rst lib/bluez.pc mesh/bluetooth-meshd.rst)
AC_CONFIG_FILES(
lib/bluez.pc
Makefile
mesh/bluetooth-meshd.rst
mesh/bluetooth-mesh.service
obexd/src/obex.service
src/bluetoothd.rst
src/bluetooth.service
tools/bluetooth-logger.service
)
AC_OUTPUT
2 changes: 1 addition & 1 deletion mesh/bluetooth-mesh.service.in
Expand Up @@ -5,7 +5,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth
[Service]
Type=dbus
BusName=org.bluez.mesh
ExecStart=@pkglibexecdir@/bluetooth-meshd
ExecStart=@exec_prefix@/bluetooth/bluetooth-meshd
NotifyAccess=main
LimitNPROC=1
ProtectHome=true
Expand Down
2 changes: 1 addition & 1 deletion obexd/src/obex.service.in
Expand Up @@ -4,7 +4,7 @@ Description=Bluetooth OBEX service
[Service]
Type=dbus
BusName=org.bluez.obex
ExecStart=@pkglibexecdir@/obexd
ExecStart=@exec_prefix@/bluetooth/obexd

[Install]
Alias=dbus-org.bluez.obex.service
2 changes: 1 addition & 1 deletion src/bluetooth.service.in
Expand Up @@ -6,7 +6,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth
[Service]
Type=dbus
BusName=org.bluez
ExecStart=@pkglibexecdir@/bluetoothd
ExecStart=@exec_prefix@/bluetooth/bluetoothd
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
Expand Down
2 changes: 1 addition & 1 deletion tools/bluetooth-logger.service.in
Expand Up @@ -4,7 +4,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth

[Service]
Type=simple
ExecStart=@pkglibexecdir@/btmon-logger -p -b /var/log/bluetooth/hci.log
ExecStart=@exec_prefix@/bluetooth/btmon-logger -p -b /var/log/bluetooth/hci.log
NotifyAccess=main
CapabilityBoundingSet=CAP_NET_RAW
LimitNPROC=1
Expand Down

0 comments on commit 116524c

Please sign in to comment.