diff options
Diffstat (limited to 'meta/classes/multilib_header.bbclass')
-rw-r--r-- | meta/classes/multilib_header.bbclass | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/classes/multilib_header.bbclass b/meta/classes/multilib_header.bbclass new file mode 100644 index 0000000000..5ee0a2d562 --- /dev/null +++ b/meta/classes/multilib_header.bbclass | |||
@@ -0,0 +1,54 @@ | |||
1 | inherit siteinfo | ||
2 | |||
3 | # If applicable on the architecture, this routine will rename the header and | ||
4 | # add a unique identifier to the name for the ABI/bitsize that is being used. | ||
5 | # A wrapper will be generated for the architecture that knows how to call | ||
6 | # all of the ABI variants for that given architecture. | ||
7 | # | ||
8 | oe_multilib_header() { | ||
9 | |||
10 | case ${HOST_OS} in | ||
11 | *-musl*) | ||
12 | return | ||
13 | ;; | ||
14 | *) | ||
15 | esac | ||
16 | # We use | ||
17 | # For ARM: We don't support multilib builds. | ||
18 | # For MIPS: "n32" is a special case, which needs to be | ||
19 | # distinct from both 64-bit and 32-bit. | ||
20 | case ${TARGET_ARCH} in | ||
21 | arm*) return | ||
22 | ;; | ||
23 | mips*) case "${MIPSPKGSFX_ABI}" in | ||
24 | "-n32") | ||
25 | ident=n32 | ||
26 | ;; | ||
27 | *) | ||
28 | ident=${SITEINFO_BITS} | ||
29 | ;; | ||
30 | esac | ||
31 | ;; | ||
32 | *) ident=${SITEINFO_BITS} | ||
33 | esac | ||
34 | if echo ${TARGET_ARCH} | grep -q arm; then | ||
35 | return | ||
36 | fi | ||
37 | for each_header in "$@" ; do | ||
38 | if [ ! -f "${D}/${includedir}/$each_header" ]; then | ||
39 | bberror "oe_multilib_header: Unable to find header $each_header." | ||
40 | continue | ||
41 | fi | ||
42 | stem=$(echo $each_header | sed 's#\.h$##') | ||
43 | # if mips64/n32 set ident to n32 | ||
44 | mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h | ||
45 | |||
46 | sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header | ||
47 | done | ||
48 | } | ||
49 | |||
50 | # Dependencies on arch variables like MIPSPKGSFX_ABI can be problematic. | ||
51 | # We don't need multilib headers for native builds so brute force things. | ||
52 | oe_multilib_header_class-native () { | ||
53 | return | ||
54 | } | ||