All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] Config.in: add symbols for BR2_HOST_GCC_AT_LEAST_X_Y
@ 2015-12-31  0:34 Arnout Vandecappelle
  2015-12-31  0:35 ` Arnout Vandecappelle
  2015-12-31  9:33 ` Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2015-12-31  0:34 UTC (permalink / raw)
  To: buildroot

From: Arnout Vandecappelle <arnout@mind.be>

Some host packages need a recent gcc version. Add symbols to Config.in
to specify the HOSTCC version. The values are passed through the
environment, and this environment is generated in a new support script.

Also update the documentation to mention the new symbols.

[Thomas: simplify by using only make logic instead of an external
shell script.]

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
v4: Further simplification by Arnout: no post-processing is needed for
    4.X versions if we keep the space in "4 9". Also use extended regex
    to simplify the sed script a little.
v3: Alternative version by Thomas that removes the external shell
    script.
v2: Use a single environment variable and select statements (Yann)
    This makes the shell script ridiculously simple. I've tried to move
    it to the Makefile, but then all the additional quoting etc. makes
    it complicated again.
---
 Config.in                                 | 24 ++++++++++++++++++++++++
 Makefile                                  |  9 +++++++++
 docs/manual/adding-packages-directory.txt |  7 +++++++
 3 files changed, 40 insertions(+)

diff --git a/Config.in b/Config.in
index 9513cc1..f6f9b85 100644
--- a/Config.in
+++ b/Config.in
@@ -18,6 +18,30 @@ config BR2_EXTERNAL
 	string
 	option env="BR2_EXTERNAL"
 
+# Hidden config symbols for packages to check system gcc version
+config BR2_HOST_GCC_VERSION
+	string
+	option env="HOST_GCC_VERSION"
+
+config BR2_HOST_GCC_AT_LEAST_4_7
+	bool
+	default y if BR2_HOST_GCC_VERSION = "4 7"
+
+config BR2_HOST_GCC_AT_LEAST_4_8
+	bool
+	default y if BR2_HOST_GCC_VERSION = "4 8"
+	select BR2_HOST_GCC_AT_LEAST_4_7
+
+config BR2_HOST_GCC_AT_LEAST_4_9
+	bool
+	default y if BR2_HOST_GCC_VERSION = "4 9"
+	select BR2_HOST_GCC_AT_LEAST_4_8
+
+config BR2_HOST_GCC_AT_LEAST_5
+	bool
+	default y if BR2_HOST_GCC_VERSION = "5"
+	select BR2_HOST_GCC_AT_LEAST_4_9
+
 # Hidden boolean selected by packages in need of Java in order to build
 # (example: xbmc)
 config BR2_NEEDS_HOST_JAVA
diff --git a/Makefile b/Makefile
index 1d69192..80e94a2 100644
--- a/Makefile
+++ b/Makefile
@@ -293,6 +293,14 @@ HOSTRANLIB := $(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranli
 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
 
+HOSTCC_VERSION := $(shell $(HOSTCC_NOCCACHE) --version | \
+	sed -n -r 's/^.* ([0-9]*)\.([0-9]*)\.([0-9]*)[ ]*.*/\1 \2/p')
+
+# For gcc >= 5.x, we only need the major version.
+ifneq ($(firstword $(HOSTCC_VERSION)),4)
+HOSTCC_VERSION := $(firstword $(HOSTCC_VERSION))
+endif
+
 # Make sure pkg-config doesn't look outside the buildroot tree
 HOST_PKG_CONFIG_PATH := $(PKG_CONFIG_PATH)
 unexport PKG_CONFIG_PATH
@@ -724,6 +732,7 @@ COMMON_CONFIG_ENV = \
 	KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
 	BR2_CONFIG=$(BR2_CONFIG) \
 	BR2_EXTERNAL=$(BR2_EXTERNAL) \
+	HOST_GCC_VERSION="$(HOSTCC_VERSION)" \
 	SKIP_LEGACY=
 
 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
diff --git a/docs/manual/adding-packages-directory.txt b/docs/manual/adding-packages-directory.txt
index 139123e..c2d9f75 100644
--- a/docs/manual/adding-packages-directory.txt
+++ b/docs/manual/adding-packages-directory.txt
@@ -283,6 +283,13 @@ use in the comment.
 ** Comment string: +gcc >= X.Y+ and/or `gcc <= X.Y` (replace
    +X.Y+ with the proper version)
 
+* Host GCC version
+** Dependency symbol: +BR2_HOST_GCC_AT_LEAST_X_Y+, (replace
+   +X_Y+ with the proper version, see +Config.in+)
+** Comment string: no comment to be added
+** Note that it is usually not the package itself that has a minimum
+   host GCC version, but rather a host-package on which it depends.
+
 * C library
 ** Dependency symbol: +BR2_TOOLCHAIN_USES_GLIBC+,
    +BR2_TOOLCHAIN_USES_MUSL+, +BR2_TOOLCHAIN_USES_UCLIBC+
-- 
2.6.4

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

* [Buildroot] [PATCH] Config.in: add symbols for BR2_HOST_GCC_AT_LEAST_X_Y
  2015-12-31  0:34 [Buildroot] [PATCH] Config.in: add symbols for BR2_HOST_GCC_AT_LEAST_X_Y Arnout Vandecappelle
@ 2015-12-31  0:35 ` Arnout Vandecappelle
  2015-12-31  9:33 ` Thomas Petazzoni
  1 sibling, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2015-12-31  0:35 UTC (permalink / raw)
  To: buildroot

 Sorry, forgot to add -v4.

 Regards,
 Arnout

On 31-12-15 01:34, Arnout Vandecappelle (Essensium/Mind) wrote:
> From: Arnout Vandecappelle <arnout@mind.be>
> 
> Some host packages need a recent gcc version. Add symbols to Config.in
> to specify the HOSTCC version. The values are passed through the
> environment, and this environment is generated in a new support script.
> 
> Also update the documentation to mention the new symbols.
> 
> [Thomas: simplify by using only make logic instead of an external
> shell script.]
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> v4: Further simplification by Arnout: no post-processing is needed for
>     4.X versions if we keep the space in "4 9". Also use extended regex
>     to simplify the sed script a little.
> v3: Alternative version by Thomas that removes the external shell
>     script.
> v2: Use a single environment variable and select statements (Yann)
>     This makes the shell script ridiculously simple. I've tried to move
>     it to the Makefile, but then all the additional quoting etc. makes
>     it complicated again.
[snip]

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH] Config.in: add symbols for BR2_HOST_GCC_AT_LEAST_X_Y
  2015-12-31  0:34 [Buildroot] [PATCH] Config.in: add symbols for BR2_HOST_GCC_AT_LEAST_X_Y Arnout Vandecappelle
  2015-12-31  0:35 ` Arnout Vandecappelle
@ 2015-12-31  9:33 ` Thomas Petazzoni
  2015-12-31 10:07   ` Arnout Vandecappelle
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2015-12-31  9:33 UTC (permalink / raw)
  To: buildroot

Dear Arnout Vandecappelle (Essensium/Mind),

On Thu, 31 Dec 2015 01:34:13 +0100, Arnout Vandecappelle
(Essensium/Mind) wrote:
> From: Arnout Vandecappelle <arnout@mind.be>
> 
> Some host packages need a recent gcc version. Add symbols to Config.in
> to specify the HOSTCC version. The values are passed through the
> environment, and this environment is generated in a new support script.
> 
> Also update the documentation to mention the new symbols.
> 
> [Thomas: simplify by using only make logic instead of an external
> shell script.]
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> v4: Further simplification by Arnout: no post-processing is needed for
>     4.X versions if we keep the space in "4 9". Also use extended regex
>     to simplify the sed script a little.
> v3: Alternative version by Thomas that removes the external shell
>     script.
> v2: Use a single environment variable and select statements (Yann)
>     This makes the shell script ridiculously simple. I've tried to move
>     it to the Makefile, but then all the additional quoting etc. makes
>     it complicated again.
> ---
>  Config.in                                 | 24 ++++++++++++++++++++++++
>  Makefile                                  |  9 +++++++++
>  docs/manual/adding-packages-directory.txt |  7 +++++++
>  3 files changed, 40 insertions(+)

I had also thought about keeping the space in the value, but found the
"subst" wasn't too bad. But well, I agree that your solution further
simplifies the thing.

I'm glad we've been able to move from a somewhat complicated and
convoluted solution (a shell script that generates a list of
environment variables) to a solution that is in fact completely trivial.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH] Config.in: add symbols for BR2_HOST_GCC_AT_LEAST_X_Y
  2015-12-31  9:33 ` Thomas Petazzoni
@ 2015-12-31 10:07   ` Arnout Vandecappelle
  0 siblings, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2015-12-31 10:07 UTC (permalink / raw)
  To: buildroot



On 31-12-15 10:33, Thomas Petazzoni wrote:
> Dear Arnout Vandecappelle (Essensium/Mind),
> 
> On Thu, 31 Dec 2015 01:34:13 +0100, Arnout Vandecappelle
> (Essensium/Mind) wrote:
>> From: Arnout Vandecappelle <arnout@mind.be>
>>
>> Some host packages need a recent gcc version. Add symbols to Config.in
>> to specify the HOSTCC version. The values are passed through the
>> environment, and this environment is generated in a new support script.
>>
>> Also update the documentation to mention the new symbols.
>>
>> [Thomas: simplify by using only make logic instead of an external
>> shell script.]
>>
>> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> ---
>> v4: Further simplification by Arnout: no post-processing is needed for
>>     4.X versions if we keep the space in "4 9". Also use extended regex
>>     to simplify the sed script a little.
>> v3: Alternative version by Thomas that removes the external shell
>>     script.
>> v2: Use a single environment variable and select statements (Yann)
>>     This makes the shell script ridiculously simple. I've tried to move
>>     it to the Makefile, but then all the additional quoting etc. makes
>>     it complicated again.
>> ---
>>  Config.in                                 | 24 ++++++++++++++++++++++++
>>  Makefile                                  |  9 +++++++++
>>  docs/manual/adding-packages-directory.txt |  7 +++++++
>>  3 files changed, 40 insertions(+)
> 
> I had also thought about keeping the space in the value, but found the
> "subst" wasn't too bad. But well, I agree that your solution further
> simplifies the thing.
> 
> I'm glad we've been able to move from a somewhat complicated and
> convoluted solution (a shell script that generates a list of
> environment variables) to a solution that is in fact completely trivial.

 And that we don't have to generate Kconfig files :-)

 Regards,
 Arnout

-- 
Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

end of thread, other threads:[~2015-12-31 10:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-31  0:34 [Buildroot] [PATCH] Config.in: add symbols for BR2_HOST_GCC_AT_LEAST_X_Y Arnout Vandecappelle
2015-12-31  0:35 ` Arnout Vandecappelle
2015-12-31  9:33 ` Thomas Petazzoni
2015-12-31 10:07   ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.