aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/openjdk
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/openjdk')
-rw-r--r--recipes-core/openjdk/openjdk-8-common.inc55
-rw-r--r--recipes-core/openjdk/openjdk-8-release-16xbyy.inc3
2 files changed, 33 insertions, 25 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"
# 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
-CFLAGS_append = " ${@version_specific_cflags(d)}"
-CXXFLAGS_append = " ${@version_specific_cflags(d)}"
+ # 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')[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 get_cflags_by_cc_version(d, version)
+
+
+# flags for -native, and for bits that need a host-tool during -cross
+BUILD_CFLAGS_append = " ${@get_build_cflags(d)}"
+BUILD_CXXFLAGS_append = " ${@get_build_cflags(d)}"
+# flags for -cross
+TARGET_CFLAGS_append = " ${@get_target_cflags(d)}"
+TARGET_CXXFLAGS_append = " ${@get_target_cflags(d)}"
diff --git a/recipes-core/openjdk/openjdk-8-release-16xbyy.inc b/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
index fd95e95..36ce073 100644
--- a/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
+++ b/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
@@ -54,7 +54,8 @@ ARM_INSTRUCTION_SET_armv4t = "ARM"
# readdir_r was deprecated in glibc-2.24. Ignore the error for now
# NOTE: When updating the recipe, please check if this is still needed
-CFLAGS_append = " -Wno-error=deprecated-declarations"
+BUILD_CFLAGS_append = " -Wno-error=deprecated-declarations"
+TARGET_CFLAGS_append = " -Wno-error=deprecated-declarations"
# Enable zero mode for arm based builds, as normal hotspot fails to build
PACKAGECONFIG_append_arm = " zero"