diff mbox series

package/dbus-cxx: new package

Message ID VI1P190MB0493DF9BFD49D3072CFE03A19F229@VI1P190MB0493.EURP190.PROD.OUTLOOK.COM
State Accepted
Headers show
Series package/dbus-cxx: new package | expand

Commit Message

Lang Daniel Jan. 28, 2022, 11:12 a.m. UTC
DBus-cxx provides an object-oriented interface to DBus

Signed-off-by: Lang Daniel <d.lang@abatec.at>
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 .../0001-gcc11-include-typeinfo.patch         | 29 ++++++
 .../0002-cmake-improve-include-paths.patch    | 91 +++++++++++++++++++
 package/dbus-cxx/0003-sasl-use-uid_t.patch    | 41 +++++++++
 package/dbus-cxx/Config.in                    | 40 ++++++++
 package/dbus-cxx/dbus-cxx.hash                |  5 +
 package/dbus-cxx/dbus-cxx.mk                  | 28 ++++++
 8 files changed, 236 insertions(+)
 create mode 100644 package/dbus-cxx/0001-gcc11-include-typeinfo.patch
 create mode 100644 package/dbus-cxx/0002-cmake-improve-include-paths.patch
 create mode 100644 package/dbus-cxx/0003-sasl-use-uid_t.patch
 create mode 100644 package/dbus-cxx/Config.in
 create mode 100644 package/dbus-cxx/dbus-cxx.hash
 create mode 100644 package/dbus-cxx/dbus-cxx.mk

Comments

Arnout Vandecappelle Feb. 12, 2022, 2:44 p.m. UTC | #1
On 28/01/2022 12:12, Lang Daniel via buildroot wrote:
> DBus-cxx provides an object-oriented interface to DBus
> 
> Signed-off-by: Lang Daniel <d.lang@abatec.at>

  Applied to master, thanks. I made some changes though.

> ---
>   DEVELOPERS                                    |  1 +
>   package/Config.in                             |  1 +
>   .../0001-gcc11-include-typeinfo.patch         | 29 ++++++
>   .../0002-cmake-improve-include-paths.patch    | 91 +++++++++++++++++++
>   package/dbus-cxx/0003-sasl-use-uid_t.patch    | 41 +++++++++
>   package/dbus-cxx/Config.in                    | 40 ++++++++
>   package/dbus-cxx/dbus-cxx.hash                |  5 +
>   package/dbus-cxx/dbus-cxx.mk                  | 28 ++++++
>   8 files changed, 236 insertions(+)
>   create mode 100644 package/dbus-cxx/0001-gcc11-include-typeinfo.patch
>   create mode 100644 package/dbus-cxx/0002-cmake-improve-include-paths.patch
>   create mode 100644 package/dbus-cxx/0003-sasl-use-uid_t.patch
>   create mode 100644 package/dbus-cxx/Config.in
>   create mode 100644 package/dbus-cxx/dbus-cxx.hash
>   create mode 100644 package/dbus-cxx/dbus-cxx.mk
> 
[snip]
> diff --git a/package/dbus-cxx/Config.in b/package/dbus-cxx/Config.in
> new file mode 100644
> index 0000000000..49f0f2237e
> --- /dev/null
> +++ b/package/dbus-cxx/Config.in
> @@ -0,0 +1,40 @@
> +config BR2_PACKAGE_DBUS_CXX
> +	bool "dbus-cxx"
> +	depends on BR2_INSTALL_LIBSTDCPP
> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # libsigc
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	depends on !BR2_STATIC_LIBS
> +	depends on BR2_PACKAGE_DBUS # runtime dependency

  I converted this into a "select". Normally you'd say that obviously this 
package is only relevant if you have dbus, but it's very well possible that some 
other package has a non-optional dependency on dbus-cxx and you want to use that 
in a context where you don't actually need dbus for anything else. So select is 
more appropriate.

> +	select BR2_PACKAGE_LIBSIGC
> +	help
> +	  DBus-cxx is a C++ implementation for DBus. DBus is a
> +	  Linux-specific RPC (remote procedure call) and
> +	  IPC (inter-process communications) mechanism.
> +	  DBus-cxx provides an object-oriented view of all programs
> +	  on the DBus, and allows an object-oriented way of
> +	  exporting methods onto the DBus.
> +
> +	  https://dbus-cxx.github.io/
> +
> +if BR2_PACKAGE_DBUS_CXX
> +
> +config BR2_PACKAGE_DBUS_CXX_QT
> +	bool "Qt support"
> +	depends on BR2_PACKAGE_QT5

  I've made these automatic dependencies instead of explicit options. I assume 
that the overhead of them is fairly small.

> +
> +comment "Qt support needs Qt5"
> +	depends on !BR2_PACKAGE_QT5
> +
> +config BR2_PACKAGE_DBUS_CXX_GLIB
> +	bool "Glib support"
> +	depends on BR2_PACKAGE_LIBGLIB2
> +
> +comment "Glib support needs libglib2"
> +	depends on !BR2_PACKAGE_LIBGLIB2
> +
> +endif
> +
> +comment "dbus-cxx needs a toolchain w/ C++, threads, gcc >= 7 and dynamic library support"
> +	depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || \
> +		!BR2_TOOLCHAIN_HAS_THREADS || \
> +		!BR2_TOOLCHAIN_GCC_AT_LEAST_7
> diff --git a/package/dbus-cxx/dbus-cxx.hash b/package/dbus-cxx/dbus-cxx.hash
> new file mode 100644
> index 0000000000..907de1866f
> --- /dev/null
> +++ b/package/dbus-cxx/dbus-cxx.hash
> @@ -0,0 +1,5 @@
> +# Locally computed:
> +sha256  05c4f4750261f09819564bb8ee93b5d7f56fd05bbcd755858860fa6697d09c2a  dbus-cxx-2.1.0.tar.gz
> +sha256  e85e018c8ee7d4f439b097289bf4371f6fcfec24e89f3e77c422944501bc383d  COPYING
> +sha256  c9bff75738922193e67fa726fa225535870d2aa1059f91452c411736284ad566  cmake-modules/LICENSE_1_0.txt
> +sha256  c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08  tools/libcppgenerate/LICENSE
> diff --git a/package/dbus-cxx/dbus-cxx.mk b/package/dbus-cxx/dbus-cxx.mk
> new file mode 100644
> index 0000000000..e184ef48ef
> --- /dev/null
> +++ b/package/dbus-cxx/dbus-cxx.mk
> @@ -0,0 +1,28 @@
> +################################################################################
> +#
> +# dbus-cxx
> +#
> +################################################################################
> +
> +DBUS_CXX_VERSION = 2.1.0
> +DBUS_CXX_SITE = $(call github,dbus-cxx,dbus-cxx,$(DBUS_CXX_VERSION))
> +DBUS_CXX_LICENSE = Boost license (cmake-modules), Apache 2.0 (libcppgenerate), GPL-3.0

  I put GPL-3.0 at the beginning. It's not a very strict convention, but it 
seems obvious that the "main" license should be first.

  Regards,
  Arnout

> +DBUS_CXX_LICENSE_FILES = cmake-modules/LICENSE_1_0.txt tools/libcppgenerate/LICENSE COPYING
> +DBUS_CXX_INSTALL_STAGING = YES
> +DBUS_CXX_DEPENDENCIES = libsigc
> +
> +ifeq ($(BR2_PACKAGE_DBUS_CXX_QT),y)
> +DBUS_CXX_CONF_OPTS += -DENABLE_QT_SUPPORT=ON
> +DBUS_CXX_DEPENDENCIES += qt5base
> +else
> +DBUS_CXX_CONF_OPTS += -DENABLE_QT_SUPPORT=OFF
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DBUS_CXX_GLIB),y)
> +DBUS_CXX_CONF_OPTS += -DENABLE_GLIB_SUPPORT=ON
> +DBUS_CXX_DEPENDENCIES += libglib2
> +else
> +DBUS_CXX_CONF_OPTS += -DENABLE_GLIB_SUPPORT=OFF
> +endif
> +
> +$(eval $(cmake-package))
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index fe8de1916e..c319c53e00 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -626,6 +626,7 @@  N:	Daniel J. Leach <dleach@belcan.com>
 F:	package/dacapo/
 
 N:	Daniel Lang <d.lang@abatec.at>
+F:	package/dbus-cxx/
 F:	package/paho-mqtt-cpp/
 
 N:	Damien Lanson <damien@kal-host.com>
diff --git a/package/Config.in b/package/Config.in
index e4ca195beb..4e3d261cc1 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -460,6 +460,7 @@  endmenu
 	source "package/davinci-bootcount/Config.in"
 	source "package/dbus/Config.in"
 	source "package/dbus-cpp/Config.in"
+	source "package/dbus-cxx/Config.in"
 	source "package/dbus-glib/Config.in"
 	source "package/dbus-python/Config.in"
 	source "package/dbus-triggerd/Config.in"
diff --git a/package/dbus-cxx/0001-gcc11-include-typeinfo.patch b/package/dbus-cxx/0001-gcc11-include-typeinfo.patch
new file mode 100644
index 0000000000..b4b7d83de2
--- /dev/null
+++ b/package/dbus-cxx/0001-gcc11-include-typeinfo.patch
@@ -0,0 +1,29 @@ 
+From 0a4c5db225d8d213916655593471e303ba71e0ea Mon Sep 17 00:00:00 2001
+From: Oleksandr Kravchuk <sashko@users.noreply.github.com>
+Date: Mon, 13 Dec 2021 03:42:44 +0100
+Subject: [PATCH] Include typeinfo for typeid() (#83)
+
+Otherwise fails with:
+    error: must '#include <typeinfo>' before using 'typeid'
+
+Fetch from: https://github.com/dbus-cxx/dbus-cxx/pull/83
+Upstream-Status: Accepted
+Signed-off-by: Daniel Lang <d.lang@abatec.at>
+
+---
+ dbus-cxx/demangle.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/dbus-cxx/demangle.h b/dbus-cxx/demangle.h
+index b71bcb9..9a4e99b 100644
+--- a/dbus-cxx/demangle.h
++++ b/dbus-cxx/demangle.h
+@@ -21,6 +21,7 @@
+ #define DBUSCXX_DEMANGLE_H
+ 
+ #include <string>
++#include <typeinfo>
+ #include <dbus-cxx/dbus-cxx-config.h>
+ 
+ #if DBUS_CXX_HAS_CXXABI_H
+
diff --git a/package/dbus-cxx/0002-cmake-improve-include-paths.patch b/package/dbus-cxx/0002-cmake-improve-include-paths.patch
new file mode 100644
index 0000000000..1f6a36a2c0
--- /dev/null
+++ b/package/dbus-cxx/0002-cmake-improve-include-paths.patch
@@ -0,0 +1,91 @@ 
+From 5a0ebbf55515a928acf9926d3fcd789115e347d3 Mon Sep 17 00:00:00 2001
+From: Lang Daniel <d.lang@abatec.at>
+Date: Mon, 17 Jan 2022 13:57:55 +0100
+Subject: [PATCH] cmake: improve include paths
+
+Adding the dbus-cxx subfolders as an include path might override system
+headers (signal.h for gcc 10).
+By removing the subfolders, includes can happen via #include "..." or
+via #include <dbus-cxx/...>.
+
+Fetch from: https://github.com/dbus-cxx/dbus-cxx/pull/86
+Upstream-Status: Accepted
+Signed-off-by: Daniel Lang <d.lang@abatec.at>
+
+---
+ CMakeLists.txt                | 4 +---
+ dbus-cxx/matchrule.h          | 2 +-
+ dbus-cxx/sasl.h               | 2 +-
+ dbus-cxx/sendmsgtransport.cpp | 2 +-
+ dbus-cxx/simpletransport.cpp  | 2 +-
+ 5 files changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5b6d28c..e76cd61 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -207,9 +207,7 @@ set( DBUS_CXX_HEADERS
+ 
+ set( DBUS_CXX_INCLUDE_DIRECTORIES 
+     ${PROJECT_SOURCE_DIR} 
+-    ${PROJECT_SOURCE_DIR}/dbus-cxx
+-    ${PROJECT_BINARY_DIR}
+-    ${PROJECT_BINARY_DIR}/dbus-cxx )
++    ${PROJECT_BINARY_DIR} )
+ include_directories( ${DBUS_CXX_INCLUDE_DIRECTORIES} 
+     ${dbus_INCLUDE_DIRS} 
+     ${sigc_INCLUDE_DIRS} )
+diff --git a/dbus-cxx/matchrule.h b/dbus-cxx/matchrule.h
+index 69fdab7..18c9e81 100644
+--- a/dbus-cxx/matchrule.h
++++ b/dbus-cxx/matchrule.h
+@@ -20,7 +20,7 @@
+ #define DBUSCXX_MATCH_RULE_H
+ 
+ #include <memory>
+-#include "dbus-cxx-config.h"
++#include <dbus-cxx/dbus-cxx-config.h>
+ 
+ namespace DBus {
+ 
+diff --git a/dbus-cxx/sasl.h b/dbus-cxx/sasl.h
+index d7429a3..44edd6e 100644
+--- a/dbus-cxx/sasl.h
++++ b/dbus-cxx/sasl.h
+@@ -19,7 +19,7 @@
+ #ifndef DBUSCXX_SASL_H
+ #define DBUSCXX_SASL_H
+ 
+-#include <dbus-cxx-config.h>
++#include <dbus-cxx/dbus-cxx-config.h>
+ 
+ #include <memory>
+ #include <stdint.h>
+diff --git a/dbus-cxx/sendmsgtransport.cpp b/dbus-cxx/sendmsgtransport.cpp
+index ae053ff..a10ae66 100644
+--- a/dbus-cxx/sendmsgtransport.cpp
++++ b/dbus-cxx/sendmsgtransport.cpp
+@@ -21,8 +21,8 @@
+ #include "dbus-cxx-private.h"
+ #include "utility.h"
+ #include "validator.h"
++#include "message.h"
+ 
+-#include <message.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+diff --git a/dbus-cxx/simpletransport.cpp b/dbus-cxx/simpletransport.cpp
+index f291d9f..fed4364 100644
+--- a/dbus-cxx/simpletransport.cpp
++++ b/dbus-cxx/simpletransport.cpp
+@@ -18,7 +18,7 @@
+  ***************************************************************************/
+ #include "simpletransport.h"
+ 
+-#include <dbus-cxx-private.h>
++#include "dbus-cxx-private.h"
+ #include "demarshaling.h"
+ #include "message.h"
+ #include "utility.h"
+
diff --git a/package/dbus-cxx/0003-sasl-use-uid_t.patch b/package/dbus-cxx/0003-sasl-use-uid_t.patch
new file mode 100644
index 0000000000..e517068891
--- /dev/null
+++ b/package/dbus-cxx/0003-sasl-use-uid_t.patch
@@ -0,0 +1,41 @@ 
+From 9db9673c0c2407e18e215844adadbd4a397e6f78 Mon Sep 17 00:00:00 2001
+From: Lang Daniel <d.lang@abatec.at>
+Date: Fri, 28 Jan 2022 07:53:13 +0100
+Subject: [PATCH] use uid_t instead of __uid_t
+
+uclibc and glibc define getuid() as
+extern __uid_t getuid (void) __THROW;
+https://elixir.bootlin.com/glibc/glibc-2.34/source/posix/unistd.h#L698
+which is a typedef for unsigned int.
+
+musl uses uid_t as return type
+uid_t getuid(void);
+https://elixir.bootlin.com/musl/v1.2.2/source/include/unistd.h#L108
+which is a typedef to unsigned.
+
+glibc and uclibc include typedefs from __uid_t to uid_t,
+which means one should be able to use uid_t as a replacement
+for __uid_t and make compiling with all three c standard libraries
+possible.
+
+Fetch from: https://github.com/dbus-cxx/dbus-cxx/pull/87
+Signed-off-by: Daniel Lang <d.lang@abatec.at>
+
+---
+ dbus-cxx/sasl.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dbus-cxx/sasl.cpp b/dbus-cxx/sasl.cpp
+index e8a6060..7a76af6 100644
+--- a/dbus-cxx/sasl.cpp
++++ b/dbus-cxx/sasl.cpp
+@@ -70,7 +70,7 @@ std::tuple<bool, bool, std::vector<uint8_t>> SASL::authenticate() {
+     bool success = false;
+     bool negotiatedFD = false;
+     std::vector<uint8_t> serverGUID;
+-    __uid_t uid = getuid();
++    uid_t uid = getuid();
+     std::string line;
+     std::smatch regex_match;
+ 
+
diff --git a/package/dbus-cxx/Config.in b/package/dbus-cxx/Config.in
new file mode 100644
index 0000000000..49f0f2237e
--- /dev/null
+++ b/package/dbus-cxx/Config.in
@@ -0,0 +1,40 @@ 
+config BR2_PACKAGE_DBUS_CXX
+	bool "dbus-cxx"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # libsigc
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_PACKAGE_DBUS # runtime dependency
+	select BR2_PACKAGE_LIBSIGC
+	help
+	  DBus-cxx is a C++ implementation for DBus. DBus is a
+	  Linux-specific RPC (remote procedure call) and
+	  IPC (inter-process communications) mechanism.
+	  DBus-cxx provides an object-oriented view of all programs
+	  on the DBus, and allows an object-oriented way of
+	  exporting methods onto the DBus.
+
+	  https://dbus-cxx.github.io/
+
+if BR2_PACKAGE_DBUS_CXX
+
+config BR2_PACKAGE_DBUS_CXX_QT
+	bool "Qt support"
+	depends on BR2_PACKAGE_QT5
+
+comment "Qt support needs Qt5"
+	depends on !BR2_PACKAGE_QT5
+
+config BR2_PACKAGE_DBUS_CXX_GLIB
+	bool "Glib support"
+	depends on BR2_PACKAGE_LIBGLIB2
+
+comment "Glib support needs libglib2"
+	depends on !BR2_PACKAGE_LIBGLIB2
+
+endif
+
+comment "dbus-cxx needs a toolchain w/ C++, threads, gcc >= 7 and dynamic library support"
+	depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || \
+		!BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_7
diff --git a/package/dbus-cxx/dbus-cxx.hash b/package/dbus-cxx/dbus-cxx.hash
new file mode 100644
index 0000000000..907de1866f
--- /dev/null
+++ b/package/dbus-cxx/dbus-cxx.hash
@@ -0,0 +1,5 @@ 
+# Locally computed:
+sha256  05c4f4750261f09819564bb8ee93b5d7f56fd05bbcd755858860fa6697d09c2a  dbus-cxx-2.1.0.tar.gz
+sha256  e85e018c8ee7d4f439b097289bf4371f6fcfec24e89f3e77c422944501bc383d  COPYING
+sha256  c9bff75738922193e67fa726fa225535870d2aa1059f91452c411736284ad566  cmake-modules/LICENSE_1_0.txt
+sha256  c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08  tools/libcppgenerate/LICENSE
diff --git a/package/dbus-cxx/dbus-cxx.mk b/package/dbus-cxx/dbus-cxx.mk
new file mode 100644
index 0000000000..e184ef48ef
--- /dev/null
+++ b/package/dbus-cxx/dbus-cxx.mk
@@ -0,0 +1,28 @@ 
+################################################################################
+#
+# dbus-cxx
+#
+################################################################################
+
+DBUS_CXX_VERSION = 2.1.0
+DBUS_CXX_SITE = $(call github,dbus-cxx,dbus-cxx,$(DBUS_CXX_VERSION))
+DBUS_CXX_LICENSE = Boost license (cmake-modules), Apache 2.0 (libcppgenerate), GPL-3.0
+DBUS_CXX_LICENSE_FILES = cmake-modules/LICENSE_1_0.txt tools/libcppgenerate/LICENSE COPYING
+DBUS_CXX_INSTALL_STAGING = YES
+DBUS_CXX_DEPENDENCIES = libsigc
+
+ifeq ($(BR2_PACKAGE_DBUS_CXX_QT),y)
+DBUS_CXX_CONF_OPTS += -DENABLE_QT_SUPPORT=ON
+DBUS_CXX_DEPENDENCIES += qt5base
+else
+DBUS_CXX_CONF_OPTS += -DENABLE_QT_SUPPORT=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_DBUS_CXX_GLIB),y)
+DBUS_CXX_CONF_OPTS += -DENABLE_GLIB_SUPPORT=ON
+DBUS_CXX_DEPENDENCIES += libglib2
+else
+DBUS_CXX_CONF_OPTS += -DENABLE_GLIB_SUPPORT=OFF
+endif
+
+$(eval $(cmake-package))