4 # Jan-Simon Moeller, jsmoeller@linuxfoundation.org
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.
11 # 'wgtpkg-pack' in af-main-native is required.
12 DEPENDS_append = " af-main-native"
14 # for bindings af-binder is required.
15 DEPENDS_append = " af-binder"
17 # for bindings that use the cmake-apps-module
18 DEPENDS_append = " cmake-apps-module-native"
20 # for hal bindings genskel is required.
21 DEPENDS_append = " af-binder-devtools-native"
23 # Re-enable strip for qmake based projects (default value is "echo")
24 OE_QMAKE_STRIP = "${STRIP}"
26 # Extra build arguments passed to the autobuild script invocations
27 AGLWGT_EXTRA_BUILD_ARGS ?= 'VERBOSE=TRUE BUILD_ARGS="${PARALLEL_MAKE}"'
29 # CMake based widgets that inherit cmake.bbclass will have the
30 # following automatically appended to AGLWGT_EXTRA_BUILD_ARGS as
31 # the value of CONFIGURE_FLAGS. This definition may need to be
32 # extended to include more of what is passed in cmake.bbclass's
33 # do_configure if it is found insufficient. Using the generated
34 # toolchain.cmake file does fix issues with respect to finding the
35 # Qt5 CMake modules that seem difficult to fix otherwise, so at the
36 # very minimum it should be present.
37 AGLWGT_CMAKE_CONFIGURE_ARGS ?= "-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake ${EXTRA_OECMAKE}"
39 # Only widgets with recipe names starting with agl-service- are
40 # assumed to have tests by default, set this to "1" to force
41 # building/packaging of the test widget for other widgets.
42 AGLWGT_HAVE_TESTS ?= "0"
44 # Warning on missing test/debug/coverage packages disabled by default
45 # for now to reduce build output clutter.
46 AGLWGT_PACKAGE_WARN ?= "0"
48 # Whether the widget should be auto-installed on first boot
49 AGLWGT_AUTOINSTALL ?= "1"
52 # These are default keys for development purposes !
53 # Change it for production.
54 WGTPKG_AUTOSIGN_0_agl-sign-wgts ??= "${WORKDIR}/recipe-sysroot-native/usr/share/afm/keys/developer.key.pem:${WORKDIR}/recipe-sysroot-native/usr/share/afm/certs/developer.cert.pem"
55 WGTPKG_AUTOSIGN_1_agl-sign-wgts ??= "${WORKDIR}/recipe-sysroot-native/usr/share/afm/keys/platform.key.pem:${WORKDIR}/recipe-sysroot-native/usr/share/afm/certs/platform.cert.pem"
57 export WGTPKG_AUTOSIGN_0
58 export WGTPKG_AUTOSIGN_1
60 python __anonymous () {
61 # NOTE: AGLWGT_CMAKE_CONFIGURE_ARGS is not updated directly here,
62 # but via the prefunc below to avoid issues around anonymous
63 # python ordering conflicts with e.g. externalsrc.bbclass.
64 if bb.data.inherits_class("cmake", d):
65 d.appendVarFlag('do_compile', 'prefuncs', ' aglwgt_cmake_configure')
68 python aglwgt_cmake_configure () {
69 # Define CONFIGURE_FLAGS appropriately if cmake.bbclass has been
70 # inherited, see description of AGLWGT_CMAKE_CONFIGURE_ARGS above
72 cmake_config_args = d.getVar("AGLWGT_CMAKE_CONFIGURE_ARGS")
73 if bb.data.inherits_class("cmake", d) and cmake_config_args:
74 d.appendVar("AGLWGT_EXTRA_BUILD_ARGS", ' CONFIGURE_ARGS="' + cmake_config_args + '"')
75 d.appendVarFlag("AGLWGT_EXTRA_BUILD_ARGS", "vardeps", " AGLWGT_CMAKE_CONFIGURE_ARGS")
78 do_configure[noexec] = "1"
81 bldcmd=${S}/autobuild/agl/autobuild
82 if [ ! -x "$bldcmd" ]; then
83 bbfatal "Missing autobuild/agl/autobuild script"
86 if [ "${S}" != "${B}" ]; then
92 if ! $bldcmd package BUILD_DIR=${B}/build-release ${AGLWGT_EXTRA_BUILD_ARGS}; then
93 bbwarn "Target: package failed"
96 if ! $bldcmd package-debug BUILD_DIR_DEBUG=${B}/build-debug ${AGLWGT_EXTRA_BUILD_ARGS}; then
97 bbwarn "Target: package-debug failed"
100 if echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then
101 if ! $bldcmd package-test BUILD_DIR_TEST=${B}/build-test ${AGLWGT_EXTRA_BUILD_ARGS}; then
102 bbwarn "Target: package-test failed"
105 if ! $bldcmd package-coverage BUILD_DIR_COVERAGE=${B}/build-coverage ${AGLWGT_EXTRA_BUILD_ARGS}; then
106 bbwarn "Target: package-coverage failed"
111 POST_INSTALL_LEVEL ?= "10"
112 POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
114 EXTRA_WGT_POSTINSTALL ?= ""
116 aglwgt_do_install() {
118 if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]; then
122 if [ "$(find ${B}/build-release -name '*.wgt' -maxdepth 1)" ]; then
123 install -d ${D}/usr/AGL/apps/$DEST
124 install -m 0644 ${B}/build-release/*.wgt ${D}/usr/AGL/apps/$DEST/
126 bbfatal "no package found in widget directory"
129 for t in test debug coverage; do
130 if [ "$(find ${B}/build-${t} -name *-${t}.wgt -maxdepth 1)" ]; then
131 install -d ${D}/usr/AGL/apps/${t}
132 install -m 0644 ${B}/build-${t}/*-${t}.wgt ${D}/usr/AGL/apps/${t}/
133 elif [ "${AGLWGT_PACKAGE_WARN}" = "1" ]; then
134 if [ "$t" != "test" -a "$t" != "coverage" ]; then
135 bbwarn "no package found in ${t} widget directory"
136 elif echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then
137 bbwarn "no package found in ${t} widget directory"
142 if [ "${AGLWGT_AUTOINSTALL}" != "0" ]; then
143 # For now assume autoinstall of the release versions
144 rm -rf ${D}/usr/AGL/apps/autoinstall
145 ln -sf release ${D}/usr/AGL/apps/autoinstall
148 for file in ${D}/usr/AGL/apps/autoinstall/*.wgt; do
149 APP_FILES="${APP_FILES} $(basename $file)";
151 install -d ${D}/${sysconfdir}/agl-postinsts
152 cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
154 for file in ${APP_FILES}; do
155 /usr/bin/afm-install install /usr/AGL/apps/autoinstall/\$file
158 ${EXTRA_WGT_POSTINSTALL}
160 chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
164 PACKAGES += "${PN}-test ${PN}-debug ${PN}-coverage"
167 /usr/AGL/apps/release/*.wgt \
168 /usr/AGL/apps/autoinstall \
169 /usr/AGL/apps/manualinstall \
170 ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
172 FILES_${PN}-test = "/usr/AGL/apps/test/*.wgt"
173 FILES_${PN}-debug = "/usr/AGL/apps/debug/*.wgt"
174 FILES_${PN}-coverage = "/usr/AGL/apps/coverage/*.wgt"
176 # Test widgets need the parent widget and the test framework
177 RDEPENDS_${PN}-test = "${PN} afb-test"
179 EXPORT_FUNCTIONS do_compile do_install