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