aglwgt.bbclass: fix bashism
[AGL/meta-agl.git] / meta-app-framework / classes / aglwgt.bbclass
1 #
2 # aglwgt bbclass
3 #
4 # Jan-Simon Moeller, jsmoeller@linuxfoundation.org
5 #
6 # This class expects a "make package" target in the makefile
7 # which creates the wgt files in the package/ subfolder.
8 # The makefile needs to use wgtpkg-pack.
9 #
10
11
12 # 'wgtpkg-pack' in af-main-native is required.
13 DEPENDS_append = " af-main-native"
14
15 # for bindings  af-binder is required.
16 DEPENDS_append = " af-binder"
17
18 do_aglwgt_package()  {
19         cd ${B}
20         make package || ( \
21           bbwarn "Your makefile must support the 'make package' target" ; \
22           bbwarn "and generate a .wgt file using wgtpack in the"; \
23           bbwarn "subfolder ./package/ !" ; \
24           bbwarn "Fix your package as it will not work within the SDK" ; \
25           bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes" \
26                         )
27 }
28
29 python () {
30     d.setVarFlag('do_aglwgt_deploy', 'fakeroot', '1')
31 }
32
33
34 POST_INSTALL_LEVEL ?= "10"
35 POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
36
37 EXTRA_WGT_POSTINSTALL ?= ""
38
39 do_aglwgt_deploy() {
40     install -d ${D}/usr/AGL/apps
41     install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/
42     APP_FILES=""
43     for file in ${D}/usr/AGL/apps/*.wgt;do
44         APP_FILES="${APP_FILES} $(basename $file)";
45     done
46     install -d ${D}/${sysconfdir}/agl-postinsts
47     cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
48 #!/bin/sh -e
49 for file in ${APP_FILES}; do
50     /usr/bin/afm-install install /usr/AGL/apps/\$file
51 done
52 sync
53 ${EXTRA_WGT_POSTINSTALL}
54 EOF
55     chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
56 }
57
58 FILES_${PN} += "/usr/AGL/apps/*.wgt ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}"
59
60 addtask aglwgt_deploy  before do_package after do_install
61 addtask aglwgt_package before do_aglwgt_deploy after do_compile