Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | inherit siteinfo |
| 8 | |
| 9 | # If applicable on the architecture, this routine will rename the header and |
| 10 | # add a unique identifier to the name for the ABI/bitsize that is being used. |
| 11 | # A wrapper will be generated for the architecture that knows how to call |
| 12 | # all of the ABI variants for that given architecture. |
| 13 | # |
| 14 | oe_multilib_header() { |
| 15 | |
| 16 | case ${HOST_OS} in |
| 17 | *-musl*) |
| 18 | return |
| 19 | ;; |
| 20 | *) |
| 21 | esac |
| 22 | # For MIPS: "n32" is a special case, which needs to be |
| 23 | # distinct from both 64-bit and 32-bit. |
| 24 | case ${TARGET_ARCH} in |
| 25 | mips*) case "${MIPSPKGSFX_ABI}" in |
| 26 | "-n32") |
| 27 | ident=n32 |
| 28 | ;; |
| 29 | *) |
| 30 | ident=${SITEINFO_BITS} |
| 31 | ;; |
| 32 | esac |
| 33 | ;; |
| 34 | *) ident=${SITEINFO_BITS} |
| 35 | esac |
| 36 | for each_header in "$@" ; do |
| 37 | if [ ! -f "${D}/${includedir}/$each_header" ]; then |
| 38 | bberror "oe_multilib_header: Unable to find header $each_header." |
| 39 | continue |
| 40 | fi |
| 41 | stem=$(echo $each_header | sed 's#\.h$##') |
| 42 | # if mips64/n32 set ident to n32 |
| 43 | mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h |
| 44 | |
| 45 | sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header |
| 46 | done |
| 47 | } |
| 48 | |
| 49 | # Dependencies on arch variables like MIPSPKGSFX_ABI can be problematic. |
| 50 | # We don't need multilib headers for native builds so brute force things. |
| 51 | oe_multilib_header:class-native () { |
| 52 | return |
| 53 | } |
| 54 | |
| 55 | # Nor do we need multilib headers for nativesdk builds. |
| 56 | oe_multilib_header:class-nativesdk () { |
| 57 | return |
| 58 | } |