Skip to contentSkip to conversation

package/sway: make systemd optional

PATCH Superseded Stefan Ott via buildroot 2 participants 8 messages Jan 18, 2024 – Jan 21, 2024

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/sway: make systemd optional

Sway works perfectly fine without it.

---
 package/sway/Config.in | 22 ++++++++++++++++++----
 package/sway/sway.mk   | 10 +++++++---
 2 files changed, 25 insertions(+), 7 deletions(-)
package/sway/Config.in +18 -4
index 4f6d9fb215..8d79d3ca6a 100644
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_SWAY
 	bool "sway"
-	depends on BR2_PACKAGE_SYSTEMD # is required by the sd-bus provider
 	depends on !BR2_STATIC_LIBS # wlroots
 	depends on BR2_TOOLCHAIN_HAS_THREADS # pango, wlroots
 	depends on BR2_PACKAGE_HAS_LIBEGL # wlroots
@@ -30,6 +29,22 @@ config BR2_PACKAGE_SWAY
 
 if BR2_PACKAGE_SWAY
 
+choice BR2_PACKAGE_SWAY_SD_BUS_PROVIDER
+	prompt "Provider of the sd-bus library"
+	default BR2_PACKAGE_SWAY_SD_BUS_PROVIDER_AUTO
+
+config BR2_PACKAGE_SWAY_SD_BUS_PROVIDER_AUTO
+	bool "auto"
+
+config BR2_PACKAGE_SWAY_SD_BUS_PROVIDER_LIBSYSTEMD
+	bool "libsystemd"
+	depends on BR2_PACKAGE_SYSTEMD
+
+comment "The systemd backend needs systemd"
+	depends on !BR2_PACKAGE_SYSTEMD
+endchoice
+
+
 config BR2_PACKAGE_SWAY_SWAYBAR
 	bool "swaybar"
 	select BR2_PACKAGE_DEJAVU
@@ -54,9 +69,8 @@ config BR2_PACKAGE_SWAY_SWAYNAG
 
 endif # BR2_PACKAGE_SWAY
 
-comment "sway needs systemd, udev, EGL w/ Wayland backend and OpenGL ES support"
-	depends on !BR2_PACKAGE_SYSTEMD || \
-		!BR2_PACKAGE_HAS_UDEV || \
+comment "sway needs udev, EGL w/ Wayland backend and OpenGL ES support"
+	depends on !BR2_PACKAGE_HAS_UDEV || \
 		!BR2_PACKAGE_HAS_LIBEGL || \
 		!BR2_PACKAGE_HAS_LIBEGL_WAYLAND || \
 		!BR2_PACKAGE_HAS_LIBGLES
package/sway/sway.mk +7 -3
index 0aad9de712..cce3b72d14 100644
@@ -8,13 +8,17 @@ SWAY_VERSION = 1.8.1
 SWAY_SITE = https://github.com/swaywm/sway/releases/download/$(SWAY_VERSION)
 SWAY_LICENSE = MIT
 SWAY_LICENSE_FILES = LICENSE
-SWAY_DEPENDENCIES = systemd host-pkgconf wlroots json-c pcre cairo pango
+SWAY_DEPENDENCIES = host-pkgconf wlroots json-c pcre cairo pango
 SWAY_CONF_OPTS = \
 	-Dwerror=false \
 	-Dzsh-completions=false \
 	-Dfish-completions=false \
-	-Dman-pages=disabled \
-	-Dsd-bus-provider=libsystemd
+	-Dman-pages=disabled
+
+ifeq ($(BR2_PACKAGE_SWAY_SD_BUS_PROVIDER_LIBSYSTEMD),y)
+SWAY_CONF_OPTS += -Dsd-bus-provider=libsystemd
+SWAY_DEPENDENCIES += systemd
+endif
 
 ifeq ($(BR2_PACKAGE_WLROOTS_X11),y)
 SWAY_CONF_OPTS += -Dxwayland=enabled
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello,

Quoted 6 lines · On Thu, 18 Jan 2024 01:28:34 +0100 Stefan Ott via buildroot…

if BR2_PACKAGE_SWAY

package/sway/Config.in +4 -0
+choice BR2_PACKAGE_SWAY_SD_BUS_PROVIDER
+	prompt "Provider of the sd-bus library"
+	default BR2_PACKAGE_SWAY_SD_BUS_PROVIDER_AUTO
+

package/sway/Config.in config BR2_PACKAGE_SWAY · line 45

Quoted 10 lines
package/sway/Config.in +10 -0
+config BR2_PACKAGE_SWAY_SD_BUS_PROVIDER_AUTO
+	bool "auto"
+
+config BR2_PACKAGE_SWAY_SD_BUS_PROVIDER_LIBSYSTEMD
+	bool "libsystemd"
+	depends on BR2_PACKAGE_SYSTEMD
+
+comment "The systemd backend needs systemd"
+	depends on !BR2_PACKAGE_SYSTEMD
+endchoice

Thanks for your patch! I am wondering if adding an option for this is needed. Can't we just enable systemd support when BR2_PACKAGE_SYSTEMD=y?

I think the fact that your comments is worded as "The systemd backend needs systemd" is a good hint that this dependency is obvious, and there's no need to have an explicit option for it.

package/sway/sway.mk SWAY_VERSION = 1.8.1 · line 19

Quoted 5 lines
package/sway/sway.mk +4 -1
-	-Dsd-bus-provider=libsystemd
+	-Dman-pages=disabled
+
+ifeq ($(BR2_PACKAGE_SWAY_SD_BUS_PROVIDER_LIBSYSTEMD),y)
+SWAY_CONF_OPTS += -Dsd-bus-provider=libsystemd

Is there another sd-bus-provider option value that should be set when systemd is not available?

package/sway/sway.mk SWAY_VERSION = 1.8.1 · line 21

Quoted 2 lines
package/sway/sway.mk +2 -0
+SWAY_DEPENDENCIES += systemd
+endif

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hi!

Quoted 3 lines · Thomas Petazzoni

Thanks for your patch! I am wondering if adding an option for this is needed. Can't we just enable systemd support when BR2_PACKAGE_SYSTEMD=y?

That would indeed seem to be a more reasonable approach. The reason I chose to turn it into an option was to make the user aware of the fact that there is such an option at all and that they might get additional features when using systemd.

Whether this is relevant or not, I cannot say. But if you think it would be acceptable to do it automatically, I'll update the patch accordingly.

Quoted 2 lines

Is there another sd-bus-provider option value that should be set when systemd is not available?

To be quite honest, I can't tell you what benefits you get from this in combination with systemd or any of the other options. All I know is that in my case sway does work with the default value (which is 'auto').

cheers

Signature · 2 lines
Stefan Ott
https://www.ott.net/

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hello Stefan,

Quoted 8 lines · On Thu, 18 Jan 2024 14:43:01 +0100 Stefan Ott <[email protected]> wrote:

That would indeed seem to be a more reasonable approach. The reason I chose to turn it into an option was to make the user aware of the fact that there is such an option at all and that they might get additional features when using systemd.

Whether this is relevant or not, I cannot say. But if you think it would be acceptable to do it automatically, I'll update the patch accordingly.

There's rarely a super clear-cut way of deciding whether an option should be added, or the dependency be handled implicitly/automatically. But in this particular case, it seems relatively obvious to me. In addition, the systemd integration is mostly relevant if you use systemd as your init system, in which case systemd will anyway already be enabled, and therefore the systemd support in sway will be automagically enabled.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

PATCH v2 1/1 package/sway: make systemd optional

Sway works perfectly fine without it.

---
Changes v1 -> v2:
- Automatically enable systemd integration for builds with systemd support (suggested by Thomas Petazzoni)

---
 package/sway/Config.in |  6 ++----
 package/sway/sway.mk   | 10 +++++++---
 2 files changed, 9 insertions(+), 7 deletions(-)
package/sway/Config.in +2 -4
index 4f6d9fb215..084ba830d7 100644
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_SWAY
 	bool "sway"
-	depends on BR2_PACKAGE_SYSTEMD # is required by the sd-bus provider
 	depends on !BR2_STATIC_LIBS # wlroots
 	depends on BR2_TOOLCHAIN_HAS_THREADS # pango, wlroots
 	depends on BR2_PACKAGE_HAS_LIBEGL # wlroots
@@ -54,9 +53,8 @@ config BR2_PACKAGE_SWAY_SWAYNAG
 
 endif # BR2_PACKAGE_SWAY
 
-comment "sway needs systemd, udev, EGL w/ Wayland backend and OpenGL ES support"
-	depends on !BR2_PACKAGE_SYSTEMD || \
-		!BR2_PACKAGE_HAS_UDEV || \
+comment "sway needs udev, EGL w/ Wayland backend and OpenGL ES support"
+	depends on !BR2_PACKAGE_HAS_UDEV || \
 		!BR2_PACKAGE_HAS_LIBEGL || \
 		!BR2_PACKAGE_HAS_LIBEGL_WAYLAND || \
 		!BR2_PACKAGE_HAS_LIBGLES
package/sway/sway.mk +7 -3
index 0aad9de712..60492ae720 100644
@@ -8,13 +8,17 @@ SWAY_VERSION = 1.8.1
 SWAY_SITE = https://github.com/swaywm/sway/releases/download/$(SWAY_VERSION)
 SWAY_LICENSE = MIT
 SWAY_LICENSE_FILES = LICENSE
-SWAY_DEPENDENCIES = systemd host-pkgconf wlroots json-c pcre cairo pango
+SWAY_DEPENDENCIES = host-pkgconf wlroots json-c pcre cairo pango
 SWAY_CONF_OPTS = \
 	-Dwerror=false \
 	-Dzsh-completions=false \
 	-Dfish-completions=false \
-	-Dman-pages=disabled \
-	-Dsd-bus-provider=libsystemd
+	-Dman-pages=disabled
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+SWAY_CONF_OPTS += -Dsd-bus-provider=libsystemd
+SWAY_DEPENDENCIES += systemd
+endif
 
 ifeq ($(BR2_PACKAGE_WLROOTS_X11),y)
 SWAY_CONF_OPTS += -Dxwayland=enabled
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Hello,

Thanks for the new iteration!

package/sway/sway.mk SWAY_VERSION = 1.8.1 · line 19

Quoted 2 lines · On Fri, 19 Jan 2024 03:11:23 +0100 Stefan Ott via buildroot…
package/sway/sway.mk +2 -0
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+SWAY_CONF_OPTS += -Dsd-bus-provider=libsystemd

Which other values of -Dsd-bus-provider are available? Would one be suitable for an "else" clause to this "if" condition?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Hi

Quoted 3 lines · Thomas Petazzoni

Which other values of -Dsd-bus-provider are available? Would one be suitable for an "else" clause to this "if" condition?

The other values are "auto", "libelogind" and "basu", with "auto" being the default.

Signature · 6 lines
Stefan Ott
https://www.ott.net/
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Hi Stefan,

On 1/20/24 16:08, Stefan Ott wrote:

[SNIP]

Quoted 4 lines

The other values are "auto", "libelogind" and "basu", with "auto" being the default.

I just checked the code. "auto" means that it will check if "libelogind" is present and then check for "basu". [1] According to the code, a "sd-bus-provider" has to be present if "tray" is enabled [2], else it is not used anywhere. So, we can check if "BR2_PACKAGE_SYSTEMD" is enabled and enable also "tray", or disable it.

[1]: https://github.com/swaywm/sway/blob/master/meson.build#L89
[2]: https://github.com/swaywm/sway/blob/master/meson.build#L105

Thanks,
Raphael Pavlidis
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot