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