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