binutils-cross-testsuite_2.39.bb 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. require binutils.inc
  2. require binutils-${PV}.inc
  3. BPN = "binutils"
  4. DEPENDS += "dejagnu-native expect-native"
  5. DEPENDS += "binutils-native"
  6. deltask do_compile
  7. deltask do_install
  8. inherit nopackages
  9. do_configure[dirs] += "${B}/ld ${B}/bfd"
  10. do_configure() {
  11. # create config.h, oe enables initfini-array by default
  12. echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h
  13. }
  14. # target depends
  15. DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils"
  16. DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}gcc"
  17. DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs"
  18. DEPENDS += "virtual/${MLPREFIX}libc"
  19. python check_prepare() {
  20. def suffix_sys(sys):
  21. if sys.endswith("-linux"):
  22. return sys + "-gnu"
  23. return sys
  24. def generate_site_exp(d, suite):
  25. content = []
  26. content.append('set srcdir "{0}/{1}"'.format(d.getVar("S"), suite))
  27. content.append('set objdir "{0}/{1}"'.format(d.getVar("B"), suite))
  28. content.append('set build_alias "{0}"'.format(d.getVar("BUILD_SYS")))
  29. content.append('set build_triplet {0}'.format(d.getVar("BUILD_SYS")))
  30. # use BUILD here since HOST=TARGET
  31. content.append('set host_alias "{0}"'.format(d.getVar("BUILD_SYS")))
  32. content.append('set host_triplet {0}'.format(d.getVar("BUILD_SYS")))
  33. content.append('set target_alias "{0}"'.format(d.getVar("TARGET_SYS")))
  34. content.append('set target_triplet {0}'.format(suffix_sys(d.getVar("TARGET_SYS"))))
  35. content.append("set development true")
  36. content.append("set experimental false")
  37. content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"'))
  38. content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
  39. content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
  40. content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
  41. if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64":
  42. # oe patches binutils to have the default mips64 abi as 64bit, but
  43. # skips gas causing issues with the ld test suite (which uses gas)
  44. content.append('set ASFLAGS "-64"')
  45. return "\n".join(content)
  46. for i in ["binutils", "gas", "ld"]:
  47. builddir = os.path.join(d.getVar("B"), i)
  48. if not os.path.isdir(builddir):
  49. os.makedirs(builddir)
  50. with open(os.path.join(builddir, "site.exp"), "w") as f:
  51. f.write(generate_site_exp(d, i))
  52. }
  53. CHECK_TARGETS ??= "binutils gas ld"
  54. do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld"
  55. do_check[prefuncs] += "check_prepare"
  56. do_check[nostamp] = "1"
  57. do_check() {
  58. export LC_ALL=C
  59. for i in ${CHECK_TARGETS}; do
  60. (cd ${B}/$i; runtest \
  61. --tool $i \
  62. --srcdir ${S}/$i/testsuite \
  63. --ignore 'plugin.exp' \
  64. || true)
  65. done
  66. }
  67. addtask check after do_configure