Skip to contentSkip to conversation

package/sdbus-cpp: add support to build the host stub generator

PATCH In review Charles Hardin 3 participants 3 messages Jun 20, 2023 – Sep 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/sdbus-cpp: add support to build the host stub generator

Add a host option to build the xml2cpp-codegen part of the sdbus-cpp package for use in creating adaptor and proxy implementations from the D-Bus IDL.

---
 package/Config.in.host           |  1 +
 package/sdbus-cpp/Config.in.host | 14 ++++++++++++++
 package/sdbus-cpp/sdbus-cpp.mk   |  9 +++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 package/sdbus-cpp/Config.in.host
package/Config.in.host +1 -0
index dcadbfdfc1..13eec7f7f5 100644
@@ -94,6 +94,7 @@ menu "Host utilities"
 	source "package/rustc/Config.in.host"
 	source "package/s6-rc/Config.in.host"
 	source "package/sam-ba/Config.in.host"
+	source "package/sdbus-cpp/Config.in.host"
 	source "package/sdbusplus/Config.in.host"
 	source "package/sentry-cli/Config.in.host"
 	source "package/sloci-image/Config.in.host"
package/sdbus-cpp/Config.in.host new file +14 -0
new file mode 100644
index 0000000000..79402af441
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_HOST_SDBUS_CPP
+	bool "host-sdbus-c++-xml2cpp"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_PACKAGE_HOST_SYSTEMD
+	select BR2_PACKAGE_HOST_PKGCONF
+	depends on BR2_HOST_GCC_AT_LEAST_7
+	help
+	  sdbus-c++ is a high-level C++ D-Bus library for Linux
+	  designed to provide expressive, easy-to-use API in modern C++.
+
+	  This will build the stub code generator for the adaptor and
+	  proxy interfaces from D-Bus IDL.
+
+	  https://github.com/Kistler-Group/sdbus-cpp
package/sdbus-cpp/sdbus-cpp.mk +9 -0
index 0e8d74cfcd..ece18126ba 100644
@@ -12,4 +12,13 @@ SDBUS_CPP_DEPENDENCIES = host-pkgconf systemd
 SDBUS_CPP_LICENSE = LGPL-2.1+ with exception (headers)
 SDBUS_CPP_LICENSE_FILES = COPYING COPYING-LGPL-Exception
 
+# Host build for sdbus-c++-xml2cpp
+HOST_SDBUS_CPP_DEPENDENCIES = host-pkgconf host-systemd
+HOST_SDBUS_CPP_CONF_OPTS += \
+	-DBUILD_CODE_GEN=ON \
+	-DBUILD_DOC=OFF \
+	-DBUILD_TESTS=OFF \
+	-DBUILD_LIBSYSTEMD=OFF
+
 $(eval $(cmake-package))
+$(eval $(host-cmake-package))
Signature · 6 lines
2.39.2 (Apple Git-143)

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

Hi Charles,

I also think that it would be useful to have an option to build the 'sdbus-c++-xml2cpp' host tool. I even tried to add a host variant of the package initially [1]. But I wasn't sure of the right way to implement it.
'sdbus-c++-xml2cpp' is more like a stand-alone tool: it doesn't depend on sdbus-c++ or its dependencies, it has its own build files, it requires a different C++ standard (14 vs 17). It just lives in the same repository.
So I think, maybe it would be better to make 'sdbus-c++-xml2cpp' a separate host package? For example, the same approach is used in the 'Yocto meta-oe' repository: one package for sdbus-c++ itself, and another package for sdbus-c++-tools [2].

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/CAA9bybPbYubZDBnACQAa+44K4Jkza9Eb9wpgAo_r0WB7e6MjaA@mail.gmail.com/

Quoted 50 lines · Charles Hardin

Add a host option to build the xml2cpp-codegen part of the sdbus-cpp package for use in creating adaptor and proxy implementations from the D-Bus IDL.

---
 package/Config.in.host           |  1 +
 package/sdbus-cpp/Config.in.host | 14 ++++++++++++++
 package/sdbus-cpp/sdbus-cpp.mk   |  9 +++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 package/sdbus-cpp/Config.in.host
package/Config.in.host +1 -0
index dcadbfdfc1..13eec7f7f5 100644
@@ -94,6 +94,7 @@ menu "Host utilities"
 	source "package/rustc/Config.in.host"
 	source "package/s6-rc/Config.in.host"
 	source "package/sam-ba/Config.in.host"
+	source "package/sdbus-cpp/Config.in.host"
 	source "package/sdbusplus/Config.in.host"
 	source "package/sentry-cli/Config.in.host"
 	source "package/sloci-image/Config.in.host"
package/sdbus-cpp/Config.in.host new file +9 -0
new file mode 100644
index 0000000000..79402af441
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_HOST_SDBUS_CPP
+	bool "host-sdbus-c++-xml2cpp"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_PACKAGE_HOST_SYSTEMD
+	select BR2_PACKAGE_HOST_PKGCONF
+	depends on BR2_HOST_GCC_AT_LEAST_7
+	help
+	  sdbus-c++ is a high-level C++ D-Bus library for Linux
+	  designed to provide expressive, easy-to-use API in modern 

C++.

package/sdbus-cpp/Config.in.host new file +5 -0
+
+	  This will build the stub code generator for the adaptor and
+	  proxy interfaces from D-Bus IDL.
+
+	  https://github.com/Kistler-Group/sdbus-cpp
package/sdbus-cpp/sdbus-cpp.mk +0 -0
index 0e8d74cfcd..ece18126ba 100644

package/sdbus-cpp/sdbus-cpp.mk SDBUS_CPP_DEPENDENCIES = host-pkgconf systemd · line 16

Quoted 5 lines
package/sdbus-cpp/sdbus-cpp.mk +2 -0
@@ -12,4 +12,13 @@ SDBUS_CPP_DEPENDENCIES = host-pkgconf systemd
 SDBUS_CPP_LICENSE = LGPL-2.1+ with exception (headers)
 SDBUS_CPP_LICENSE_FILES = COPYING COPYING-LGPL-Exception
 
+# Host build for sdbus-c++-xml2cpp
+HOST_SDBUS_CPP_DEPENDENCIES = host-pkgconf host-systemd

'sdbus-c++-xml2cpp' depends on the 'expat' library, so 'host-expat' is required as well.

Quoted 8 lines
package/sdbus-cpp/sdbus-cpp.mk +7 -0
+HOST_SDBUS_CPP_CONF_OPTS += \
+	-DBUILD_CODE_GEN=ON \
+	-DBUILD_DOC=OFF \
+	-DBUILD_TESTS=OFF \
+	-DBUILD_LIBSYSTEMD=OFF
+
 $(eval $(cmake-package))
+$(eval $(host-cmake-package))
Signature · 6 lines
Sergey Bobrenok
System software developer
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Charles Hardin

Hello Charles,

Quoted 5 lines · On Tue, 20 Jun 2023 10:43:21 -0700 Charles Hardin <[email protected]> wrote:

Add a host option to build the xml2cpp-codegen part of the sdbus-cpp package for use in creating adaptor and proxy implementations from the D-Bus IDL.

I've applied, with some small changes, see below.

package/sdbus-cpp/Config.in.host line 2

Quoted 8 lines
package/sdbus-cpp/Config.in.host new file +2 -0
new file mode 100644
index 0000000000..79402af441
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_HOST_SDBUS_CPP
+	bool "host-sdbus-c++-xml2cpp"

Changed to:

bool "host sdbus-c++"

package/sdbus-cpp/Config.in.host line 3

Quoted 1 line
package/sdbus-cpp/Config.in.host new file +1 -0
+	depends on BR2_INSTALL_LIBSTDCPP

Not relevant, as we are a host package, while BR2_INSTALL_LIBSTDCPP indicates availability of C++ support in the cross-compiler.

package/sdbus-cpp/Config.in.host line 4

Quoted 1 line
package/sdbus-cpp/Config.in.host new file +1 -0
+	depends on BR2_PACKAGE_HOST_SYSTEMD

Not needed for host packages.

package/sdbus-cpp/Config.in.host line 5

Quoted 1 line
package/sdbus-cpp/Config.in.host new file +1 -0
+	select BR2_PACKAGE_HOST_PKGCONF

Same.

package/sdbus-cpp/sdbus-cpp.mk SDBUS_CPP_DEPENDENCIES = host-pkgconf systemd · line 16

Quoted 10 lines
package/sdbus-cpp/sdbus-cpp.mk +2 -0
index 0e8d74cfcd..ece18126ba 100644
@@ -12,4 +12,13 @@ SDBUS_CPP_DEPENDENCIES = host-pkgconf systemd
 SDBUS_CPP_LICENSE = LGPL-2.1+ with exception (headers)
 SDBUS_CPP_LICENSE_FILES = COPYING COPYING-LGPL-Exception
 
+# Host build for sdbus-c++-xml2cpp
+HOST_SDBUS_CPP_DEPENDENCIES = host-pkgconf host-systemd

It's pretty silly that host-systemd is needed, because in fact the host sdbus-c++-xml2cpp is not linked against the sdbus-c++ library, and only the sdbus-c++ library needs libsystemd. But oh well, since anyway systemd+host-systemd are built for target sdbus-c++, there's in practice no overhead.

package/sdbus-cpp/sdbus-cpp.mk SDBUS_CPP_DEPENDENCIES = host-pkgconf systemd · line 17

Quoted 1 line
package/sdbus-cpp/sdbus-cpp.mk +1 -0
+HOST_SDBUS_CPP_CONF_OPTS += \

^^ Changed to just =

Applied with those changes, thanks a lot!

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