diff mbox

[2/4,v2] package/kvm-unit-tests: introduce _ARCH_SUPPORTS

Message ID 0d5c040b902f29f870a4a941f1850d7c29e43144.1499522760.git.yann.morin.1998@free.fr
State Changes Requested
Headers show

Commit Message

Yann E. MORIN July 8, 2017, 2:08 p.m. UTC
Move all architecture options to their own symbol, so that it is easier
to add more variants in the future.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Cyril Bur <cyrilbur@gmail.com>
---
 package/kvm-unit-tests/Config.in | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Arnout Vandecappelle July 8, 2017, 3:41 p.m. UTC | #1
On 08-07-17 16:08, Yann E. MORIN wrote:
> Move all architecture options to their own symbol, so that it is easier
> to add more variants in the future.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Cyril Bur <cyrilbur@gmail.com>
> ---
>  package/kvm-unit-tests/Config.in | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
> index 7eab0c25d6..0283e97dfc 100644
> --- a/package/kvm-unit-tests/Config.in
> +++ b/package/kvm-unit-tests/Config.in
> @@ -1,15 +1,17 @@
> -config BR2_PACKAGE_KVM_UNIT_TESTS
> -	bool "kvm-unit-tests"
> +config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
> +	bool
> +	default y if BR2_cortex_a7 || BR2_cortex_a12 || \
> +		BR2_cortex_a15 || BR2_cortex_a17
> +	default y if BR2_powerpc64 || BR2_powerpc64le
>  	# on i386 and x86-64, __builtin_reachable is used, so we need
>  	# gcc 4.5 at least. on i386, we use the target gcc, while on
>  	# x86-64 we use the host gcc (see .mk file for details)
>  	# On ARM, it uses virtualization extensions
> -	depends on BR2_cortex_a7 || BR2_cortex_a12 || \
> -		BR2_cortex_a15 || BR2_cortex_a17 || \
> -		(BR2_i386 && BR2_TOOLCHAIN_GCC_AT_LEAST_4_5) || \
> -		BR2_powerpc64 || \
> -		BR2_powerpc64le || \
> -		(BR2_x86_64 && BR2_HOST_GCC_AT_LEAST_4_5)
> +	default y if (BR2_i386 || BR2_x86_64) && BR2_TOOLCHAIN_GCC_AT_LEAST_4_5

 GCC is *not* an arch dependency, so this should just be

	default y if BR2_i386
	default y if BR2_powerpc64 || BR2_powerpc64le
	default y if BR2_x86_64

> +
> +config BR2_PACKAGE_KVM_UNIT_TESTS
> +	bool "kvm-unit-tests"
> +	depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
>  	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64=y
>  	help
>  	  kvm-unit-tests is a project as old as KVM. As its name

 And here

	depends on !((BR2_i386 || BR2_x86_64) || BR2_TOOLCHAIN_GCC_AT_LEAST_4_5

with the big comment above it.

 And also the comment is missing at the moment - which is probably why you
didn't notice that it's not an architecture dependency.


 Regards,
 Arnout
Yann E. MORIN July 8, 2017, 4:30 p.m. UTC | #2
Arnout, All,

On 2017-07-08 17:41 +0200, Arnout Vandecappelle spake thusly:
> On 08-07-17 16:08, Yann E. MORIN wrote:
> > Move all architecture options to their own symbol, so that it is easier
> > to add more variants in the future.
> > 
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Cyril Bur <cyrilbur@gmail.com>
> > ---
> >  package/kvm-unit-tests/Config.in | 18 ++++++++++--------
> >  1 file changed, 10 insertions(+), 8 deletions(-)
> > 
> > diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
> > index 7eab0c25d6..0283e97dfc 100644
> > --- a/package/kvm-unit-tests/Config.in
> > +++ b/package/kvm-unit-tests/Config.in
> > @@ -1,15 +1,17 @@
> > -config BR2_PACKAGE_KVM_UNIT_TESTS
> > -	bool "kvm-unit-tests"
> > +config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
> > +	bool
> > +	default y if BR2_cortex_a7 || BR2_cortex_a12 || \
> > +		BR2_cortex_a15 || BR2_cortex_a17
> > +	default y if BR2_powerpc64 || BR2_powerpc64le
> >  	# on i386 and x86-64, __builtin_reachable is used, so we need
> >  	# gcc 4.5 at least. on i386, we use the target gcc, while on
> >  	# x86-64 we use the host gcc (see .mk file for details)
> >  	# On ARM, it uses virtualization extensions
> > -	depends on BR2_cortex_a7 || BR2_cortex_a12 || \
> > -		BR2_cortex_a15 || BR2_cortex_a17 || \
> > -		(BR2_i386 && BR2_TOOLCHAIN_GCC_AT_LEAST_4_5) || \
> > -		BR2_powerpc64 || \
> > -		BR2_powerpc64le || \
> > -		(BR2_x86_64 && BR2_HOST_GCC_AT_LEAST_4_5)
> > +	default y if (BR2_i386 || BR2_x86_64) && BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
> 
>  GCC is *not* an arch dependency, so this should just be

Yet we already use similar construct in other packages, like host-go:

    config BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
        depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || [...]

or like kodi:

     config BR2_PACKAGE_KODI_ARCH_SUPPORTS
        default y if (BR2_arm || (BR2_mipsel && BR2_TOOLCHAIN_USES_GLIBC) || [...]

or with libsigsegv:

    config BR2_PACKAGE_LIBSIGSEGV_ARCH_SUPPORTS
        default y if BR2_TOOLCHAIN_USES_GLIBC
        default y if BR2_TOOLCHAIN_USES_MUSL
        default y if BR2_TOOLCHAIN_USES_UCLIBC && [...archs...]

or libunwind, openal (interesting case), openblas, protobuf.

Arguaby, none of the above have a dependency on gcc, but some are on the
C library, and others are on toolchain features...

> 	default y if BR2_i386
> 	default y if BR2_powerpc64 || BR2_powerpc64le
> 	default y if BR2_x86_64
> 
> > +
> > +config BR2_PACKAGE_KVM_UNIT_TESTS
> > +	bool "kvm-unit-tests"
> > +	depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
> >  	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64=y
> >  	help
> >  	  kvm-unit-tests is a project as old as KVM. As its name
> 
>  And here
> 
> 	depends on !((BR2_i386 || BR2_x86_64) || BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
> 
> with the big comment above it.
> 
>  And also the comment is missing at the moment - which is probably why you
> didn't notice that it's not an architecture dependency.

OK, will add.

Thanks!

Regards,
Yann E. MORIN.

> 
>  Regards,
>  Arnout
> 
> -- 
> 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
Thomas Petazzoni July 9, 2017, 4:03 p.m. UTC | #3
Hello,

On Sat, 8 Jul 2017 18:30:45 +0200, Yann E. MORIN wrote:

> >  GCC is *not* an arch dependency, so this should just be  
> 
> Yet we already use similar construct in other packages, like host-go:
> 
>     config BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
>         depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || [...]
> 
> or like kodi:
> 
>      config BR2_PACKAGE_KODI_ARCH_SUPPORTS
>         default y if (BR2_arm || (BR2_mipsel && BR2_TOOLCHAIN_USES_GLIBC) || [...]
> 
> or with libsigsegv:
> 
>     config BR2_PACKAGE_LIBSIGSEGV_ARCH_SUPPORTS
>         default y if BR2_TOOLCHAIN_USES_GLIBC
>         default y if BR2_TOOLCHAIN_USES_MUSL
>         default y if BR2_TOOLCHAIN_USES_UCLIBC && [...archs...]
> 
> or libunwind, openal (interesting case), openblas, protobuf.
> 
> Arguaby, none of the above have a dependency on gcc, but some are on the
> C library, and others are on toolchain features...

Yes, but see what I replied to Carlos about adding a
BR2_PACKAGE_LINUX_PAM_ARCH_SUPPORTS option, which would have encoded
non-architecture dependencies.

Thomas
Yann E. MORIN July 9, 2017, 4:16 p.m. UTC | #4
Thomas, All,

On 2017-07-09 18:03 +0200, Thomas Petazzoni spake thusly:
> On Sat, 8 Jul 2017 18:30:45 +0200, Yann E. MORIN wrote:
> > >  GCC is *not* an arch dependency, so this should just be  
> > Yet we already use similar construct in other packages, like [...]
[--SNIP--]
> > Arguaby, none of the above have a dependency on gcc, but some are on the
> > C library, and others are on toolchain features...
> 
> Yes, but see what I replied to Carlos about adding a
> BR2_PACKAGE_LINUX_PAM_ARCH_SUPPORTS option, which would have encoded
> non-architecture dependencies.

And it looks like I agree as I addressed Arnout's comment in v3. ;-)

I was just pointing out that we are not entirely consistent with this
rule, as some packages have such non-arch dependencies in their
_ARCH_SUPPORT symbols.

I'll try to find some time to fix them. :-)

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
index 7eab0c25d6..0283e97dfc 100644
--- a/package/kvm-unit-tests/Config.in
+++ b/package/kvm-unit-tests/Config.in
@@ -1,15 +1,17 @@ 
-config BR2_PACKAGE_KVM_UNIT_TESTS
-	bool "kvm-unit-tests"
+config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
+	bool
+	default y if BR2_cortex_a7 || BR2_cortex_a12 || \
+		BR2_cortex_a15 || BR2_cortex_a17
+	default y if BR2_powerpc64 || BR2_powerpc64le
 	# on i386 and x86-64, __builtin_reachable is used, so we need
 	# gcc 4.5 at least. on i386, we use the target gcc, while on
 	# x86-64 we use the host gcc (see .mk file for details)
 	# On ARM, it uses virtualization extensions
-	depends on BR2_cortex_a7 || BR2_cortex_a12 || \
-		BR2_cortex_a15 || BR2_cortex_a17 || \
-		(BR2_i386 && BR2_TOOLCHAIN_GCC_AT_LEAST_4_5) || \
-		BR2_powerpc64 || \
-		BR2_powerpc64le || \
-		(BR2_x86_64 && BR2_HOST_GCC_AT_LEAST_4_5)
+	default y if (BR2_i386 || BR2_x86_64) && BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
+
+config BR2_PACKAGE_KVM_UNIT_TESTS
+	bool "kvm-unit-tests"
+	depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
 	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64=y
 	help
 	  kvm-unit-tests is a project as old as KVM. As its name