[oe] [meta-java][PATCH 4/9] openjdk-8: fix infrastructure for version host gcc != cross gcc (again)
Richard Leitner
richard.leitner at skidata.com
Mon Aug 13 13:53:50 UTC 2018
On 8/13/18 12:09 PM, André Draszik wrote:
> ...
> diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
> index 4e52448..fb97e97 100644
> --- a/recipes-core/openjdk/openjdk-8-common.inc
> +++ b/recipes-core/openjdk/openjdk-8-common.inc
> @@ -224,32 +224,39 @@ FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
> # version is and only add the flags that are appropriate for that GCC
> # version.
>
> -def version_specific_cflags(d):
> - import re
> -
> - extraflags = None
> - version = None
> +def get_cflags_by_cc_version(d, version):
> + if version.isdigit():
> + return d.getVar('FLAGS_GCC%d' % int(version)) or ''
> + return ''
>
> - if bb.data.inherits_class('native', d):
> +def get_build_cflags(d):
> + def get_build_cc_version(build_cc):
> from subprocess import Popen, PIPE
> -
> - cmd = d.expand('${CC} -dumpversion').split()
> + cmd = d.expand('%s -dumpversion' % build_cc).split()
> cc = Popen(cmd, stdout=PIPE, stderr=PIPE)
> - version = cc.communicate()[0].decode('utf-8')[0]
> - else:
> - # in the cross case, trust that GCCVERSION is correct. This won't
> - # work if the native toolchain is Clang, but as of this writing that
> - # doesn't work anyway.
> - version = d.getVar('GCCVERSION', expand=True)[0]
> - # skip non digit characters at the beginning, e.g. from "linaro-6.2%"
> - match = re.search("\d", version)
> - if match:
> - version = version[match.start():]
> + return cc.communicate()[0].decode('utf-8')[0]
>
> - if version.isdigit():
> - extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or ''
> - return extraflags
> - return ''
> + build_cc = d.getVar('BUILD_CC')
> + version = get_build_cc_version(build_cc)
> + return get_cflags_by_cc_version(d, version)
> +
> +def get_target_cflags(d):
> + import re
First: Thank you for this patch and the reorganization of those functions!
As we will need those functions also for openjdk-7 it would be great if
they are accessible from there too.
The solution which came to my mind first would be to move the content from
openjdk-common.inc to openjdk-7-common.inc (as it's the only file
requiring" it).
Then place those functions inside openjdk-common.inc and require it from
openjdk-7-common.inc and openjdk-8-common.inc.
What do you think about it? Any comments or other ideas?
(fyi: no need to change this patch! I just thought it would be a good
point for starting a discussion about it)
> ...
regards;Richard.L
More information about the Openembedded-devel
mailing list