Add the afb-test binding in the devel AGL image
[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 # for hal bindings genskel is required.
19 DEPENDS_append = " af-binder-devtools-native"
20
21 EXTRA_OECMAKE_append_agl-ptest = " -DBUILD_TEST_WGT=TRUE"
22
23 do_aglwgt_package()  {
24         cd ${B}
25         ${S}/conf.d/autobuild/agl/autobuild package BUILD_DIR=${B} DEST=${B}/package VERBOSE=TRUE || \
26         make package || \
27         ( bbwarn "Your makefile must support the 'make package' target" ; \
28           bbwarn "and generate a .wgt file using wgtpack in the"; \
29           bbwarn "subfolder ./package/ !" ; \
30           bbwarn "Fix your package as it will not work within the SDK" ; \
31           bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes" \
32         )
33 }
34
35 python () {
36     d.setVarFlag('do_aglwgt_deploy', 'fakeroot', '1')
37 }
38
39
40 POST_INSTALL_LEVEL ?= "10"
41 POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
42
43 EXTRA_WGT_POSTINSTALL ?= ""
44
45 do_aglwgt_deploy() {
46     TEST_WGT="*-test.wgt"
47     if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]
48     then
49         install -d ${D}/usr/AGL/apps/manualinstall
50         install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/manualinstall
51     else
52         install -d ${D}/usr/AGL/apps/autoinstall
53         install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/autoinstall
54
55         if [ "$(find ${D}/usr/AGL/apps/autoinstall -name ${TEST_WGT})" ]
56         then
57                 install -d ${D}/usr/AGL/apps/testwgt
58                 mv ${D}/usr/AGL/apps/autoinstall/*-test.wgt ${D}/usr/AGL/apps/testwgt
59         fi
60     fi
61
62     APP_FILES=""
63     for file in ${D}/usr/AGL/apps/autoinstall/*.wgt;do
64         APP_FILES="${APP_FILES} $(basename $file)";
65     done
66     install -d ${D}/${sysconfdir}/agl-postinsts
67     cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
68 #!/bin/sh -e
69 for file in ${APP_FILES}; do
70     /usr/bin/afm-install install /usr/AGL/apps/autoinstall/\$file
71 done
72 sync
73 ${EXTRA_WGT_POSTINSTALL}
74 EOF
75     chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
76 }
77
78 FILES_${PN} += "/usr/AGL/apps/autoinstall/*.wgt \
79     /usr/AGL/apps/manualinstall/*.wgt \
80     /usr/AGL/apps/testwgt/*.wgt \
81     ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
82     "
83
84 do_install() {
85 }
86
87 addtask aglwgt_deploy  before do_package after do_install
88 addtask aglwgt_package before do_aglwgt_deploy after do_compile