Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | # For MIPS: "n32" is a special case, which needs to be |
| 17 | # distinct from both 64-bit and 32-bit. |
| 18 | case ${TARGET_ARCH} in |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | mips*) case "${MIPSPKGSFX_ABI}" in |
| 20 | "-n32") |
| 21 | ident=n32 |
| 22 | ;; |
| 23 | *) |
| 24 | ident=${SITEINFO_BITS} |
| 25 | ;; |
| 26 | esac |
| 27 | ;; |
| 28 | *) ident=${SITEINFO_BITS} |
| 29 | esac |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | for each_header in "$@" ; do |
| 31 | if [ ! -f "${D}/${includedir}/$each_header" ]; then |
| 32 | bberror "oe_multilib_header: Unable to find header $each_header." |
| 33 | continue |
| 34 | fi |
| 35 | stem=$(echo $each_header | sed 's#\.h$##') |
| 36 | # if mips64/n32 set ident to n32 |
| 37 | mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h |
| 38 | |
| 39 | sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header |
| 40 | done |
| 41 | } |
| 42 | |
| 43 | # Dependencies on arch variables like MIPSPKGSFX_ABI can be problematic. |
| 44 | # We don't need multilib headers for native builds so brute force things. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 45 | oe_multilib_header:class-native () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | return |
| 47 | } |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 48 | |
| 49 | # Nor do we need multilib headers for nativesdk builds. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 50 | oe_multilib_header:class-nativesdk () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 51 | return |
| 52 | } |