[yocto] Detecting build type within recipe (target, native or nativesdk)

ChenQi Qi.Chen at windriver.com
Thu Jul 25 19:04:54 PDT 2013


On 07/26/2013 07:57 AM, Christian Gagneraud wrote:
> Hi there,
>
> Is there a way to detect what kind of build is going on (target, 
> native or nativesdk) from within a recipe or a class?
>
> Basically when using 'BBCLASSEXTEND = "native nativesdk"', how can I 
> tweak the build behaviour depending of the build type?
>
> Does anyone know an example recipe I could use as a reference for 
> doing these kind of things?
>
> Regards,
> Chris
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>
>
1. Use suffixes such as _class-native, _class-target, etc.
I think this is the preferred way.
Please grep the repo for more info.

2. Use ${PN} value.
e.g. (from dpkg.inc)
do_install_append () {
         if [ "${PN}" = "dpkg-native" ]; then
                 # update-alternatives doesn't have an offline mode
                 rm ${D}${bindir}/update-alternatives
                 sed -i -e 
's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env nativeperl|' 
${D}${bindir}/dpkg-*
         else
                 mv ${D}${bindir}/update-alternatives ${D}${sbindir}
                 sed -i -e 
's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env perl|' 
${D}${bindir}/dpkg-*
         fi
}

Best Regards,
Chen Qi




More information about the yocto mailing list