ab3416a0d95a3992e51fcaab18256c622ea73c84
[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}/autobuild/agl/autobuild package BUILD_DIR=${B} DEST=${B} VERBOSE=TRUE || \
29         ( ${S}/conf.d/autobuild/agl/autobuild package BUILD_DIR=${B} DEST=${B}/package VERBOSE=TRUE && \
30           ( bbwarn "OBSOLETE: Your autobuild script should be located in :" ; \
31             bbwarn "autobuild/agl/ from the project root source folder"; \
32             bbwarn "and generate a .wgt file using wgtpack in the build"; \
33             bbwarn "root folder calling:" ; \
34             bbwarn "./autobuild/agl/autobuild package DEST=<BUILDDIR>" ; \
35             bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes" \
36           )
37         ) ||
38         ( bbwarn "OBSOLETE: You must have an autobuild script located in:" ; \
39           bbwarn "autobuild/agl/ from the project root source folder"; \
40           bbwarn "with filename autobuild which should generate"; \
41           bbwarn "a .wgt file using wgtpack in the build"; \
42           bbwarn "root folder calling:" ; \
43           bbwarn "./autobuild/agl/autobuild package DEST=<BUILDDIR>" ; \
44           bbwarn "Fix your package as it will not work within the SDK" ; \
45           bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes"; \
46           make package)
47 }
48
49 python () {
50     d.setVarFlag('do_aglwgt_deploy', 'fakeroot', '1')
51 }
52
53
54 POST_INSTALL_LEVEL ?= "10"
55 POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
56
57 EXTRA_WGT_POSTINSTALL ?= ""
58
59 do_aglwgt_deploy() {
60     TEST_WGT="*-test.wgt"
61     if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]
62     then
63         install -d ${D}/usr/AGL/apps/manualinstall
64         install -m 0644 ${B}/*.wgt ${D}/usr/AGL/apps/manualinstall || \
65         install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/manualinstall
66     else
67         install -d ${D}/usr/AGL/apps/autoinstall
68         install -m 0644 ${B}/*.wgt ${D}/usr/AGL/apps/autoinstall || \
69         install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/autoinstall
70
71         if [ "$(find ${D}/usr/AGL/apps/autoinstall -name ${TEST_WGT})" ]
72         then
73                 install -d ${D}/usr/AGL/apps/testwgt
74                 mv ${D}/usr/AGL/apps/autoinstall/*-test.wgt ${D}/usr/AGL/apps/testwgt
75         fi
76     fi
77
78     APP_FILES=""
79     for file in ${D}/usr/AGL/apps/autoinstall/*.wgt;do
80         APP_FILES="${APP_FILES} $(basename $file)";
81     done
82     install -d ${D}/${sysconfdir}/agl-postinsts
83     cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
84 #!/bin/sh -e
85 for file in ${APP_FILES}; do
86     /usr/bin/afm-install install /usr/AGL/apps/autoinstall/\$file
87 done
88 sync
89 ${EXTRA_WGT_POSTINSTALL}
90 EOF
91     chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
92 }
93
94 FILES_${PN} += "/usr/AGL/apps/autoinstall/*.wgt \
95     /usr/AGL/apps/manualinstall/*.wgt \
96     /usr/AGL/apps/testwgt/*.wgt \
97     ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
98     "
99
100 do_install() {
101 }
102
103 addtask aglwgt_deploy  before do_package after do_install
104 addtask aglwgt_package before do_aglwgt_deploy after do_compile
105
106