diff options
Diffstat (limited to 'recipes-core/openjdk/openjdk-8-common.inc')
| -rw-r--r-- | recipes-core/openjdk/openjdk-8-common.inc | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc index ad39dee..744c062 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" | |||
| 224 | # version is and only add the flags that are appropriate for that GCC | 224 | # version is and only add the flags that are appropriate for that GCC |
| 225 | # version. | 225 | # version. |
| 226 | 226 | ||
| 227 | def version_specific_cflags(d): | 227 | def get_cflags_by_cc_version(d, version): |
| 228 | import re | 228 | if version.isdigit(): |
| 229 | 229 | return d.getVar('FLAGS_GCC%d' % int(version)) or '' | |
| 230 | extraflags = None | 230 | return '' |
| 231 | version = None | ||
| 232 | 231 | ||
| 233 | if bb.data.inherits_class('native', d): | 232 | def get_build_cflags(d): |
| 233 | def get_build_cc_version(build_cc): | ||
| 234 | from subprocess import Popen, PIPE | 234 | from subprocess import Popen, PIPE |
| 235 | 235 | cmd = d.expand('%s -dumpversion' % build_cc).split() | |
| 236 | cmd = d.expand('${CC} -dumpversion').split() | ||
| 237 | cc = Popen(cmd, stdout=PIPE, stderr=PIPE) | 236 | cc = Popen(cmd, stdout=PIPE, stderr=PIPE) |
| 238 | version = cc.communicate()[0].decode('utf-8')[0] | 237 | return cc.communicate()[0].decode('utf-8')[0] |
| 239 | else: | ||
| 240 | # in the cross case, trust that GCCVERSION is correct. This won't | ||
| 241 | # work if the native toolchain is Clang, but as of this writing that | ||
| 242 | # doesn't work anyway. | ||
| 243 | version = d.getVar('GCCVERSION', expand=True)[0] | ||
| 244 | # skip non digit characters at the beginning, e.g. from "linaro-6.2%" | ||
| 245 | match = re.search("\d", version) | ||
| 246 | if match: | ||
| 247 | version = version[match.start():] | ||
| 248 | 238 | ||
| 249 | if version.isdigit(): | 239 | build_cc = d.getVar('BUILD_CC') |
| 250 | extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' | 240 | version = get_build_cc_version(build_cc) |
| 251 | return extraflags | 241 | return get_cflags_by_cc_version(d, version) |
| 252 | return '' | 242 | |
| 243 | def get_target_cflags(d): | ||
| 244 | import re | ||
| 253 | 245 | ||
| 254 | CFLAGS_append = " ${@version_specific_cflags(d)}" | 246 | # in the cross case, trust that GCCVERSION is correct. This won't |
| 255 | CXXFLAGS_append = " ${@version_specific_cflags(d)}" | 247 | # work if the native toolchain is Clang, but as of this writing that |
| 248 | # doesn't work anyway. | ||
| 249 | version = d.getVar('GCCVERSION')[0] | ||
| 250 | # skip non digit characters at the beginning, e.g. from "linaro-6.2%" | ||
| 251 | match = re.search("\d", version) | ||
| 252 | if match: | ||
| 253 | version = version[match.start():] | ||
| 254 | return get_cflags_by_cc_version(d, version) | ||
| 255 | |||
| 256 | |||
| 257 | # flags for -native, and for bits that need a host-tool during -cross | ||
| 258 | BUILD_CFLAGS_append = " ${@get_build_cflags(d)}" | ||
| 259 | BUILD_CXXFLAGS_append = " ${@get_build_cflags(d)}" | ||
| 260 | # flags for -cross | ||
| 261 | TARGET_CFLAGS_append = " ${@get_target_cflags(d)}" | ||
| 262 | TARGET_CXXFLAGS_append = " ${@get_target_cflags(d)}" | ||
