xref: /OK3568_Linux_fs/yocto/poky/meta/classes/multilib_header.bbclass (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1inherit 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#
8oe_multilib_header() {
9
10	case ${HOST_OS} in
11	*-musl*)
12		return
13		;;
14	*)
15	esac
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
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
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.
45oe_multilib_header:class-native () {
46	return
47}
48
49# Nor do we need multilib headers for nativesdk builds.
50oe_multilib_header:class-nativesdk () {
51	return
52}
53