Enable test about objcopy if it supports the --add-symbol parameter

This fixes building in old systems like centos 6.

(With tweaks by Philip Withnall.)

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1895
This commit is contained in:
Ignacio Casal Quinteiro 2019-11-20 21:32:33 +01:00 committed by Philip Withnall
parent 653d3e2c5d
commit 5fe61e8c46

View File

@ -585,10 +585,15 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
# Support for --add-symbol was added to LLVM objcopy in 2019 # Support for --add-symbol was added to LLVM objcopy in 2019
# (https://reviews.llvm.org/D58234). FIXME: This test could be enabled for # (https://reviews.llvm.org/D58234). FIXME: This test could be enabled for
# LLVM once that support is in a stable release. # LLVM once that support is in a stable release.
objcopy_supports_add_symbol = false
objcopy = find_program('objcopy', required : false) objcopy = find_program('objcopy', required : false)
if objcopy.found()
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
endif
ld = find_program('ld', required : false) ld = find_program('ld', required : false)
if build_machine.system() == 'linux' and cc.get_id() == 'gcc' and objcopy.found() and ld.found() if build_machine.system() == 'linux' and cc.get_id() == 'gcc' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
test_gresource_binary = custom_target('test5.gresource', test_gresource_binary = custom_target('test5.gresource',
input : 'test5.gresource.xml', input : 'test5.gresource.xml',
output : 'test5.gresource', output : 'test5.gresource',