diff mbox

[6/7] libsigrok: enable building C++ bindings

Message ID 1424435342-2188-7-git-send-email-bgolaszewski@baylibre.com
State Changes Requested
Headers show

Commit Message

Bartosz Golaszewski Feb. 20, 2015, 12:29 p.m. UTC
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 package/libsigrok/Config.in    | 15 +++++++++++++++
 package/libsigrok/libsigrok.mk |  9 ++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni Feb. 20, 2015, 6:30 p.m. UTC | #1
Dear Bartosz Golaszewski,

On Fri, 20 Feb 2015 13:29:01 +0100, Bartosz Golaszewski wrote:

> +config BR2_PACKAGE_LIBSIGROKCXX
> +	bool "build C++ bindings"
> +	select BR2_PACKAGE_GLIBMM
> +	depends on BR2_PACKAGE_LIBSIGROK
> +	depends on BR2_TOOLCHAIN_BUILDROOT_CXX
> +	# C++11 support
> +	depends on BR2_TOOLCHAIN_BUILDROOT_GLIBC || BR2_TOOLCHAIN_BUILDROOT_EGLIBC

I am not really happy with this, because there are potentially plenty
of external toolchains that support C++11. So I believe we really need
to go ahead and add a:

	BR2_TOOLCHAIN_HAS_CXX11

And make sure it gets properly selected depending on whether the
toolchain has C++11 support or not. You can look at how
BR2_TOOLCHAIN_HAS_SSP or BR2_TOOLCHAIN_HAS_THREADS are implemented for
example.

Moreover, you make this apparently depend on the selected C library.
But isn't C++11 support purely a gcc problem ?

Thanks,

Thomas
Nicolas Cavallari Feb. 23, 2015, 11:23 a.m. UTC | #2
On 20/02/2015 19:30, Thomas Petazzoni wrote:
> Moreover, you make this apparently depend on the selected C library.
> But isn't C++11 support purely a gcc problem ?

This software uses std::stod, which suffers from the same problem as
std::to_string with uclibc : GCC currently requires a lot more than
necessary to enable it.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393

So it's just a matter of updating buildroot's
850-libstdcxx-uclibc-c99.patch. Again.
diff mbox

Patch

diff --git a/package/libsigrok/Config.in b/package/libsigrok/Config.in
index 47f812c..8f7e36f 100644
--- a/package/libsigrok/Config.in
+++ b/package/libsigrok/Config.in
@@ -16,6 +16,21 @@  config BR2_PACKAGE_LIBSIGROK
 
 	  http://sigrok.org/wiki/Libsigrok
 
+config BR2_PACKAGE_LIBSIGROKCXX
+	bool "build C++ bindings"
+	select BR2_PACKAGE_GLIBMM
+	depends on BR2_PACKAGE_LIBSIGROK
+	depends on BR2_TOOLCHAIN_BUILDROOT_CXX
+	# C++11 support
+	depends on BR2_TOOLCHAIN_BUILDROOT_GLIBC || BR2_TOOLCHAIN_BUILDROOT_EGLIBC
+	help
+	  Build libsigrok C++ bindings as well.
+
 comment "libsigrok needs a toolchain w/ wchar, threads"
 	depends on BR2_USE_MMU
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "libsigrokcxx needs a toolchain w/ C++, (e)glibc"
+	depends on BR2_PACKAGE_LIBSIGROK
+	depends on !BR2_TOOLCHAIN_BUILDROOT_CXX
+	depends on !BR2_TOOLCHAIN_BUILDROOT_GLIBC && !BR2_TOOLCHAIN_BUILDROOT_EGLIBC
diff --git a/package/libsigrok/libsigrok.mk b/package/libsigrok/libsigrok.mk
index 6bc210e..1e6080d 100644
--- a/package/libsigrok/libsigrok.mk
+++ b/package/libsigrok/libsigrok.mk
@@ -13,7 +13,7 @@  LIBSIGROK_LICENSE_FILES = COPYING
 LIBSIGROK_AUTORECONF = YES
 LIBSIGROK_INSTALL_STAGING = YES
 LIBSIGROK_DEPENDENCIES = libglib2 libzip host-pkgconf
-LIBSIGROK_CONF_OPTS = --disable-bindings --disable-glibtest
+LIBSIGROK_CONF_OPTS = --disable-glibtest --disable-java --disable-python
 
 define LIBSIGROK_ADD_MISSING
 	mkdir -p $(@D)/autostuff
@@ -46,4 +46,11 @@  ifeq ($(BR2_PACKAGE_GLIBMM),y)
 LIBSIGROK_DEPENDENCIES += glibmm
 endif
 
+ifeq ($(BR2_PACKAGE_LIBSIGROKCXX),y)
+LIBSIGROK_CONF_OPTS += --enable-cxx
+LIBSIGROK_DEPENDENCIES += host-autoconf-archive glibmm
+else
+LIBSIGROK_CONF_OPTS += --disable-cxx
+endif
+
 $(eval $(autotools-package))