Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/3] Add support for the D programming language
@ 2019-10-24 18:16 Eric Le Bihan
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 1/3] toolchain: add support for D language Eric Le Bihan
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Eric Le Bihan @ 2019-10-24 18:16 UTC (permalink / raw)
  To: buildroot

This small series add supports for the D programming language, available in
GCC since version 9.1.

v1 -> v2:

 - restrict support for Buildroot toolchain to some architectures.
 - add support for external toolchain.

Eric Le Bihan (3):
  toolchain: add support for D language
  package/gcc: add support for D language
  toolchain-external: add support for D language

 package/gcc/Config.in.host                    | 22 +++++++++++++++++++
 package/gcc/gcc-final/gcc-final.mk            |  5 +++++
 toolchain/Config.in                           |  3 +++
 .../pkg-toolchain-external.mk                 |  4 ++++
 .../Config.in.options                         |  8 +++++++
 5 files changed, 42 insertions(+)

--
2.21.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/3] toolchain: add support for D language
  2019-10-24 18:16 [Buildroot] [PATCH v2 0/3] Add support for the D programming language Eric Le Bihan
@ 2019-10-24 18:16 ` Eric Le Bihan
  2019-10-25 17:33   ` Thomas Petazzoni
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 2/3] package/gcc: " Eric Le Bihan
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 3/3] toolchain-external: " Eric Le Bihan
  2 siblings, 1 reply; 9+ messages in thread
From: Eric Le Bihan @ 2019-10-24 18:16 UTC (permalink / raw)
  To: buildroot

Since version 9.1, GCC provides support for the D programming language [1].

So add an option to indicate the selected toolchain supports this
language.

[1] https://dlang.org/

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 toolchain/Config.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 3bc3b1b4b0..c9aa95985f 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -171,6 +171,9 @@ config BR2_ENABLE_LOCALE
 config BR2_INSTALL_LIBSTDCPP
 	bool
 
+config BR2_TOOLCHAIN_HAS_DLANG
+	bool
+
 config BR2_TOOLCHAIN_HAS_FORTRAN
 	bool
 
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 2/3] package/gcc: add support for D language
  2019-10-24 18:16 [Buildroot] [PATCH v2 0/3] Add support for the D programming language Eric Le Bihan
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 1/3] toolchain: add support for D language Eric Le Bihan
@ 2019-10-24 18:16 ` Eric Le Bihan
  2019-10-25 17:33   ` Thomas Petazzoni
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 3/3] toolchain-external: " Eric Le Bihan
  2 siblings, 1 reply; 9+ messages in thread
From: Eric Le Bihan @ 2019-10-24 18:16 UTC (permalink / raw)
  To: buildroot

Since version 9.1, GCC provides support for the D programming language [1].

So add a Kconfig entry to enable support for it.

[1] https://dlang.org/

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/gcc/Config.in.host         | 22 ++++++++++++++++++++++
 package/gcc/gcc-final/gcc-final.mk |  5 +++++
 2 files changed, 27 insertions(+)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 75be7c48cc..aeea21c0fb 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -77,6 +77,19 @@ config BR2_GCC_SUPPORTS_LIBCILKRTS
 	bool
 	default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_8
 
+config BR2_GCC_SUPPORTS_DLANG
+	bool
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	default y if BR2_aarch64
+	default y if BR2_arm
+	default y if BR2_i386
+	default y if BR2_mips || BR2_mipsel
+	default y if BR2_mips64 || BR2_mips64el
+	default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
+	default y if BR2_x86_64
+	default y if BR2_riscv && !BR2_RISCV_64
+
 config BR2_GCC_VERSION
 	string
 	default "5.5.0"     if BR2_GCC_VERSION_5_X
@@ -118,6 +131,15 @@ config BR2_TOOLCHAIN_BUILDROOT_FORTRAN
 	  Fortran language and you want Fortran libraries to be
 	  installed on your target system.
 
+config BR2_TOOLCHAIN_BUILDROOT_DLANG
+	bool "Enable D language support"
+	depends on BR2_GCC_SUPPORTS_DLANG
+	select BR2_TOOLCHAIN_HAS_DLANG
+	help
+	  Enable this option if you want your toolchain to support the
+	  D language and you want D libraries to be installed on your
+	  target system.
+
 config BR2_GCC_ENABLE_LTO
 	bool "Enable compiler link-time-optimization support"
 	select BR2_BINUTILS_ENABLE_LTO
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index f478fde0d7..79c88a5d60 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -55,6 +55,7 @@ endef
 # Languages supported by the cross-compiler
 GCC_FINAL_CROSS_LANGUAGES-y = c
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_LIBSTDCPP) += c++
+GCC_FINAL_CROSS_LANGUAGES-$(BR2_TOOLCHAIN_BUILDROOT_DLANG) += d
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_TOOLCHAIN_BUILDROOT_FORTRAN) += fortran
 GCC_FINAL_CROSS_LANGUAGES = $(subst $(space),$(comma),$(GCC_FINAL_CROSS_LANGUAGES-y))
 
@@ -172,6 +173,10 @@ ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 HOST_GCC_FINAL_USR_LIBS += libstdc++
 endif
 
+ifeq ($(BR2_TOOLCHAIN_BUILDROOT_DLANG),y)
+HOST_GCC_FINAL_USR_LIBS += libgdruntime libgphobos
+endif
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_FORTRAN),y)
 HOST_GCC_FINAL_USR_LIBS += libgfortran
 # fortran needs quadmath on x86 and x86_64
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 3/3] toolchain-external: add support for D language
  2019-10-24 18:16 [Buildroot] [PATCH v2 0/3] Add support for the D programming language Eric Le Bihan
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 1/3] toolchain: add support for D language Eric Le Bihan
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 2/3] package/gcc: " Eric Le Bihan
@ 2019-10-24 18:16 ` Eric Le Bihan
  2019-10-24 19:21   ` Romain Naour
  2019-10-25 17:34   ` Thomas Petazzoni
  2 siblings, 2 replies; 9+ messages in thread
From: Eric Le Bihan @ 2019-10-24 18:16 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 toolchain/toolchain-external/pkg-toolchain-external.mk    | 4 ++++
 .../toolchain-external-custom/Config.in.options           | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index c00211d59c..9c5321ea36 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -148,6 +148,10 @@ ifeq ($(BR2_TOOLCHAIN_HAS_OPENMP),y)
 TOOLCHAIN_EXTERNAL_LIBS += libgomp.so.*
 endif
 
+ifeq ($(BR2_TOOLCHAIN_HAS_DLANG),y)
+TOOLCHAIN_EXTERNAL_LIBS += libgdruntime.so* libgphobos.so*
+endif
+
 TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
 
 
diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
index 83d9ed61d7..f686cb3305 100644
--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
+++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
@@ -415,6 +415,14 @@ config BR2_TOOLCHAIN_EXTERNAL_CXX
 	  support. If you don't know, leave the default value,
 	  Buildroot will tell you if it's correct or not.
 
+config BR2_TOOLCHAIN_EXTERNAL_DLANG
+	bool "Toolchain has D support?"
+	select BR2_TOOLCHAIN_HAS_DLANG
+	help
+	  Select this option if your external toolchain has D
+	  support. If you don't know, leave the default value,
+	  Buildroot will tell you if it's correct or not.
+
 config BR2_TOOLCHAIN_EXTERNAL_FORTRAN
 	bool "Toolchain has Fortran support?"
 	select BR2_TOOLCHAIN_HAS_FORTRAN
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 3/3] toolchain-external: add support for D language
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 3/3] toolchain-external: " Eric Le Bihan
@ 2019-10-24 19:21   ` Romain Naour
  2019-10-24 21:40     ` Eric Le Bihan
  2019-10-25 17:34   ` Thomas Petazzoni
  1 sibling, 1 reply; 9+ messages in thread
From: Romain Naour @ 2019-10-24 19:21 UTC (permalink / raw)
  To: buildroot

Hi Eric,

Le 24/10/2019 ? 20:16, Eric Le Bihan a ?crit?:
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  toolchain/toolchain-external/pkg-toolchain-external.mk    | 4 ++++
>  .../toolchain-external-custom/Config.in.options           | 8 ++++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index c00211d59c..9c5321ea36 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -148,6 +148,10 @@ ifeq ($(BR2_TOOLCHAIN_HAS_OPENMP),y)
>  TOOLCHAIN_EXTERNAL_LIBS += libgomp.so.*
>  endif
>  
> +ifeq ($(BR2_TOOLCHAIN_HAS_DLANG),y)
> +TOOLCHAIN_EXTERNAL_LIBS += libgdruntime.so* libgphobos.so*
> +endif
> +
>  TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
>  
>  
> diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> index 83d9ed61d7..f686cb3305 100644
> --- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> +++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> @@ -415,6 +415,14 @@ config BR2_TOOLCHAIN_EXTERNAL_CXX
>  	  support. If you don't know, leave the default value,
>  	  Buildroot will tell you if it's correct or not.
>  
> +config BR2_TOOLCHAIN_EXTERNAL_DLANG
> +	bool "Toolchain has D support?"
> +	select BR2_TOOLCHAIN_HAS_DLANG
> +	help
> +	  Select this option if your external toolchain has D
> +	  support. If you don't know, leave the default value,
> +	  Buildroot will tell you if it's correct or not.
> +

I believe we need to add a check in the toolchain helper to check if D compiler
is present and is working (as for other language C++ and Fortran [1])

Also D support should be listed in the manual, at least in the "dependencies
target toolchain options" [2].

While adding GCC 9 in Buildroot, I did not add D support because there is
currently not package using it. Did you plan to add new packages using this
language?

[1]:
https://git.buildroot.net/buildroot/tree/toolchain/helpers.mk?id=03fb00f2175cdb4565e26fcb9b3da1c1059de1bd#n339

[2] http://nightly.buildroot.org/manual.html#dependencies-target-toolchain-options

Best regards,
Romain

>  config BR2_TOOLCHAIN_EXTERNAL_FORTRAN
>  	bool "Toolchain has Fortran support?"
>  	select BR2_TOOLCHAIN_HAS_FORTRAN
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 3/3] toolchain-external: add support for D language
  2019-10-24 19:21   ` Romain Naour
@ 2019-10-24 21:40     ` Eric Le Bihan
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Le Bihan @ 2019-10-24 21:40 UTC (permalink / raw)
  To: buildroot

Hi!

On 2019-10-24 21:21, Romain Naour wrote:
> Hi Eric,
>
> Le 24/10/2019 ? 20:16, Eric Le Bihan a ?crit?:
> > Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> > ---
> >  toolchain/toolchain-external/pkg-toolchain-external.mk    | 4 ++++
> >  .../toolchain-external-custom/Config.in.options           | 8 ++++++++
> >  2 files changed, 12 insertions(+)
> >
> > diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> > index c00211d59c..9c5321ea36 100644
> > --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> > +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> > @@ -148,6 +148,10 @@ ifeq ($(BR2_TOOLCHAIN_HAS_OPENMP),y)
> >  TOOLCHAIN_EXTERNAL_LIBS += libgomp.so.*
> >  endif
> >
> > +ifeq ($(BR2_TOOLCHAIN_HAS_DLANG),y)
> > +TOOLCHAIN_EXTERNAL_LIBS += libgdruntime.so* libgphobos.so*
> > +endif
> > +
> >  TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
> >
> >
> > diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> > index 83d9ed61d7..f686cb3305 100644
> > --- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> > +++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> > @@ -415,6 +415,14 @@ config BR2_TOOLCHAIN_EXTERNAL_CXX
> >  	  support. If you don't know, leave the default value,
> >  	  Buildroot will tell you if it's correct or not.
> >
> > +config BR2_TOOLCHAIN_EXTERNAL_DLANG
> > +	bool "Toolchain has D support?"
> > +	select BR2_TOOLCHAIN_HAS_DLANG
> > +	help
> > +	  Select this option if your external toolchain has D
> > +	  support. If you don't know, leave the default value,
> > +	  Buildroot will tell you if it's correct or not.
> > +
>
> I believe we need to add a check in the toolchain helper to check if D compiler
> is present and is working (as for other language C++ and Fortran [1])
>
> Also D support should be listed in the manual, at least in the "dependencies
> target toolchain options" [2].

OK. It will be added in the next version.

> While adding GCC 9 in Buildroot, I did not add D support because there is
> currently not package using it. Did you plan to add new packages using this
> language?

The D programming language has no "killer" application and may be
considered as a niche programming language given that the reference
compiler (DMD) was only targeting x86 and was not fully open-source
until recently. But GDC (GCC-based compiler) and LDC (LLVM-based
compiler) broaden the scope and may increase interest for this language.

DUB [1] the package and build manager is written in D. So adding a
package to build it from source would require having a host variant of
GDC at hand or providing one (which is kind of cumbersome). It is
possible, though, to provide a package of the binary host variant of DUB
(host-dub-bin), not unlike host-{rust,cargo}-bin for Rust.

Meson also supports D.

One popular program written in D is Vibe.d [2], a web and concurrency
framework. Unfortunately, it relies on RDMD [3], a front-end to DMD for
running D programs like scripts, which is not compatible with GDC.

GtkD [4], the binding for Gtk+, on the other hand, uses Make as its
build system and is more GDC-friendly. Latest attempt at cross-compiling
it ended up with some errors, but these should be fixable.

So, no new packages using D on the horizon ATM. I submitted this series
because I think one of Buildroot's strengths is its ability to easily
provide tools for embedded systems. So having a D cross-compiler at hand
may benefit some users for creating new applications.

Thanks for the review!

[1] https://code.dlang.org/packages/dub
[2] https://vibed.org/
[3] https://dlang.org/rdmd.html
[4] https://gtkd.org/

Regards,

--
ELB

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/3] toolchain: add support for D language
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 1/3] toolchain: add support for D language Eric Le Bihan
@ 2019-10-25 17:33   ` Thomas Petazzoni
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2019-10-25 17:33 UTC (permalink / raw)
  To: buildroot

On Thu, 24 Oct 2019 20:16:19 +0200
Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:

> Since version 9.1, GCC provides support for the D programming language [1].
> 
> So add an option to indicate the selected toolchain supports this
> language.
> 
> [1] https://dlang.org/
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  toolchain/Config.in | 3 +++
>  1 file changed, 3 insertions(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 2/3] package/gcc: add support for D language
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 2/3] package/gcc: " Eric Le Bihan
@ 2019-10-25 17:33   ` Thomas Petazzoni
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2019-10-25 17:33 UTC (permalink / raw)
  To: buildroot

On Thu, 24 Oct 2019 20:16:20 +0200
Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:

> Since version 9.1, GCC provides support for the D programming language [1].
> 
> So add a Kconfig entry to enable support for it.
> 
> [1] https://dlang.org/
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  package/gcc/Config.in.host         | 22 ++++++++++++++++++++++
>  package/gcc/gcc-final/gcc-final.mk |  5 +++++
>  2 files changed, 27 insertions(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 3/3] toolchain-external: add support for D language
  2019-10-24 18:16 ` [Buildroot] [PATCH v2 3/3] toolchain-external: " Eric Le Bihan
  2019-10-24 19:21   ` Romain Naour
@ 2019-10-25 17:34   ` Thomas Petazzoni
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2019-10-25 17:34 UTC (permalink / raw)
  To: buildroot

On Thu, 24 Oct 2019 20:16:21 +0200
Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:

> +config BR2_TOOLCHAIN_EXTERNAL_DLANG
> +	bool "Toolchain has D support?"
> +	select BR2_TOOLCHAIN_HAS_DLANG
> +	help
> +	  Select this option if your external toolchain has D
> +	  support. If you don't know, leave the default value,
> +	  Buildroot will tell you if it's correct or not.

This last sentence is not actually true: Buildroot doesn't check if
there is a really a D compiler in the external toolchain, as Romain
pointed out. So I've dropped this last sentence, and applied.

Could you send follow-up patches to address the limitations/issues that
Romain has raised ?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-10-25 17:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-24 18:16 [Buildroot] [PATCH v2 0/3] Add support for the D programming language Eric Le Bihan
2019-10-24 18:16 ` [Buildroot] [PATCH v2 1/3] toolchain: add support for D language Eric Le Bihan
2019-10-25 17:33   ` Thomas Petazzoni
2019-10-24 18:16 ` [Buildroot] [PATCH v2 2/3] package/gcc: " Eric Le Bihan
2019-10-25 17:33   ` Thomas Petazzoni
2019-10-24 18:16 ` [Buildroot] [PATCH v2 3/3] toolchain-external: " Eric Le Bihan
2019-10-24 19:21   ` Romain Naour
2019-10-24 21:40     ` Eric Le Bihan
2019-10-25 17:34   ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox