meta-environment: Add bbappend to supply BSP specific settings
[meta-kc-bsp.git] / recipes-core / meta / meta-environment.bbappend
1 # Create custom settings script to become included by environment script
2
3 fakeroot do_create_kc_sdk_file() {
4         mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
5         script=${D}${SDKPATHNATIVE}/environment-setup.d/kcbsp.sh
6
7         echo 'basename -- "$0$ZSH_VERSION" | grep -q "^environment-setup$" && echo "$SHELL" | grep -q "/\(\([bd]ash\)\|\([k]sh\)\)$" && ENV=$0 POSIXLY_CORRECT=1 exec $SHELL -i' >> $script
8         echo 'basename -- "$0$ZSH_VERSION" | grep -q "^environment-setup$" && echo "Usage: . $0" && exit 1' >> $script
9         echo 'echo "Applying environment settings..."' >> $script
10         echo 'echo "Version ${DISTRO_VERSION}-${DISTRO_BUILD}"' >> $script
11         echo 'export PS1="[$ARCH] $PS1"' >> $script
12
13         echo 'SDK_PATH=$OECORE_NATIVE_SYSROOT/usr' >> $script
14         echo 'alias opkg-target="LD_LIBRARY_PATH=$SDK_PATH/lib $SDK_PATH/bin/opkg-cl -f $SDKTARGETSYSROOT/etc/opkg.conf -o $SDKTARGETSYSROOT"' >> $script
15
16         sed -i -e 's:${SDKPATHNATIVE}:$OECORE_NATIVE_SYSROOT:g' ${script}
17 }
18
19 # Deploy generic link for environment setup
20
21 do_install_append () {
22         mkdir -p ${D}/${SDKPATH}/
23         cd ${D}/${SDKPATH}/
24         ln -sf environment-setup-${REAL_MULTIMACH_TARGET_SYS} environment-setup
25         cd -
26 }
27
28 FILES_${PN} += " \
29         ${SDKPATH}/environment-setup \
30         "
31
32 addtask create_kc_sdk_file after do_install before do_package
33