Possibility to copy wgt without installing them
[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         ${S}/conf.d/autobuild/agl/autobuild package BUILD_DIR=${B} DEST=${B}/package || \
22         ( bbwarn "Your makefile must support the 'make package' target" ; \
23           bbwarn "and generate a .wgt file using wgtpack in the"; \
24           bbwarn "subfolder ./package/ !" ; \
25           bbwarn "Fix your package as it will not work within the SDK" ; \
26           bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes" \
27         )
28 }
29
30 python () {
31     d.setVarFlag('do_aglwgt_deploy', 'fakeroot', '1')
32 }
33
34
35 POST_INSTALL_LEVEL ?= "10"
36 POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
37
38 EXTRA_WGT_POSTINSTALL ?= ""
39
40 do_aglwgt_deploy() {
41     if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]
42     then
43         install -d ${D}/usr/AGL/apps/manualinstall
44         install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/manualinstall
45     else
46         install -d ${D}/usr/AGL/apps/autoinstall
47         install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/autoinstall
48     fi
49
50     APP_FILES=""
51     for file in ${D}/usr/AGL/apps/autoinstall/*.wgt;do
52         APP_FILES="${APP_FILES} $(basename $file)";
53     done
54     install -d ${D}/${sysconfdir}/agl-postinsts
55     cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
56 #!/bin/sh -e
57 for file in ${APP_FILES}; do
58     /usr/bin/afm-install install /usr/AGL/apps/autoinstall/\$file
59 done
60 sync
61 ${EXTRA_WGT_POSTINSTALL}
62 EOF
63     chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
64 }
65
66 FILES_${PN} += "/usr/AGL/apps/autoinstall/*.wgt \
67     /usr/AGL/apps/manualinstall/*.wgt \
68     ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
69     "
70
71 do_install() {
72 }
73
74 addtask aglwgt_deploy  before do_package after do_install
75 addtask aglwgt_package before do_aglwgt_deploy after do_compile