From bb3dcf4228fb457939680dc9df3df2bda681abfb Mon Sep 17 00:00:00 2001 From: André Draszik Date: Mon, 13 Aug 2018 16:09:18 +0100 Subject: openjdk-build-helper: move c compiler flags retrieval to here (from openjdk-8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Icedtea 7 and OpenJDK 7 will need to apply new compiler flags for certain compiler version without breaking support for older (host) compilers. Move here so that the same code can be re-used. Signed-off-by: André Draszik Signed-off-by: Richard Leitner --- recipes-core/openjdk/openjdk-8-common.inc | 45 +++---------------------------- 1 file changed, 4 insertions(+), 41 deletions(-) (limited to 'recipes-core/openjdk') diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc index 0c77d7c..1c33a3b 100644 --- a/recipes-core/openjdk/openjdk-8-common.inc +++ b/recipes-core/openjdk/openjdk-8-common.inc @@ -219,46 +219,9 @@ FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks" FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks" FLAGS_GCC8 = "-fno-lifetime-dse -fno-delete-null-pointer-checks -Wno-error=return-type" -# All supported cross compilers support the compiler flags that were -# added to make compilation with gcc6 work. But the host compiler for -# native compilation is a different story: it may be too old (for example, -# gcc 4.9.2 on Debian Wheezy). In that case we need to check what the -# version is and only add the flags that are appropriate for that GCC -# version. - -def get_cflags_by_cc_version(d, version): - if version.isdigit(): - return d.getVar('FLAGS_GCC%d' % int(version)) or '' - return '' - -def get_build_cflags(d): - def get_build_cc_version(build_cc): - from subprocess import Popen, PIPE - cmd = d.expand('%s -dumpversion' % build_cc).split() - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) - return cc.communicate()[0].decode('utf-8')[0] - - 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 - - # 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)}" +BUILD_CFLAGS_append = " ${@openjdk_build_helper_get_build_cflags(d)}" +BUILD_CXXFLAGS_append = " ${@openjdk_build_helper_get_build_cflags(d)}" # flags for -cross -TARGET_CFLAGS_append = " ${@get_target_cflags(d)}" -TARGET_CXXFLAGS_append = " ${@get_target_cflags(d)}" +TARGET_CFLAGS_append = " ${@openjdk_build_helper_get_target_cflags(d)}" +TARGET_CXXFLAGS_append = " ${@openjdk_build_helper_get_target_cflags(d)}" -- cgit v1.2.3-54-g00ecf