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