diff options
-rw-r--r-- | recipes-core/openjdk/openjdk-8-common.inc | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc index c609232..83828e1 100644 --- a/recipes-core/openjdk/openjdk-8-common.inc +++ b/recipes-core/openjdk/openjdk-8-common.inc | |||
@@ -231,39 +231,27 @@ FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks" | |||
231 | # version is and only add the flags that are appropriate for that GCC | 231 | # version is and only add the flags that are appropriate for that GCC |
232 | # version. | 232 | # version. |
233 | 233 | ||
234 | def version_specific_cflags(d, toolchain): | 234 | def version_specific_cflags(d): |
235 | extraflags = None | 235 | extraflags = None |
236 | version = None | 236 | version = None |
237 | 237 | ||
238 | from subprocess import Popen, PIPE | ||
239 | cmd = d.expand('%s -dumpversion' % toolchain ).split() | ||
240 | cc = Popen(cmd, stdout=PIPE, stderr=PIPE) | ||
241 | version = cc.communicate()[0].decode('utf-8')[0] | ||
242 | |||
243 | if version.isdigit(): | ||
244 | extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' | ||
245 | return extraflags | ||
246 | return '' | ||
247 | |||
248 | python __anonymous() { | ||
249 | if bb.data.inherits_class('native', d): | 238 | if bb.data.inherits_class('native', d): |
250 | toolchain = d.getVar('CC', True) | 239 | from subprocess import Popen, PIPE |
251 | extraflags = version_specific_cflags(d, toolchain) | 240 | |
252 | d.appendVar("CFLAGS", ' ' + extraflags) | 241 | cmd = d.expand('${CC} -dumpversion').split() |
253 | d.appendVar("CXXFLAGS", ' ' + extraflags) | 242 | cc = Popen(cmd, stdout=PIPE, stderr=PIPE) |
243 | version = cc.communicate()[0].decode('utf-8')[0] | ||
254 | else: | 244 | else: |
255 | # in the cross case, trust that GCCVERSION is correct. This won't | 245 | # in the cross case, trust that GCCVERSION is correct. This won't |
256 | # work if the native toolchain is Clang, but as of this writing that | 246 | # work if the native toolchain is Clang, but as of this writing that |
257 | # doesn't work anyway. | 247 | # doesn't work anyway. |
258 | version = d.getVar('GCCVERSION', expand=True)[0] | 248 | version = d.getVar('GCCVERSION', expand=True)[0] |
259 | extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' | ||
260 | d.appendVar("TARGET_CFLAGS", ' ' + extraflags) | ||
261 | d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) | ||
262 | 249 | ||
263 | toolchain = d.getVar('BUILD_CC', True) | 250 | if version.isdigit(): |
264 | extraflags = version_specific_cflags(d, toolchain) | 251 | extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' |
265 | d.appendVar("BUILD_CFLAGS", ' ' + extraflags) | 252 | return extraflags |
266 | d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) | 253 | return '' |
267 | } | ||
268 | 254 | ||
255 | CFLAGS_append = " ${@version_specific_cflags(d)}" | ||
256 | CXXFLAGS_append = " ${@version_specific_cflags(d)}" | ||
269 | CXX_append = " -std=gnu++98" | 257 | CXX_append = " -std=gnu++98" |