recipe-tools: changed the recipes for libnmapp and sys-mon

After a short analysis I have noticed that the library and the app
are not build as intended. To build the app and the lib also from
command line using an SDK, the make files needed to be updated.

This commit then adapted the recipes accordingly to build the
correct versions

BugzID: 69904

Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmueller 2021-03-10 11:44:17 +01:00
parent 0d0e949a2a
commit 4562017be0
3 changed files with 82 additions and 34 deletions

View File

@ -4,42 +4,21 @@ DEPENDS_class-native += "cpputest"
BUILD_CFLAGS +="-I${CPPUTEST_HOME}/include"
BUILD_CPPFLAGS +="-I${CPPUTEST_HOME}/include"
TEST_LIBRARY ?= "0"
do_compile_append_class-native() {
bbplain "building UNIT TEST ${BPN}..."
export CPPUTEST_HOME="${base_prefix}/usr/lib/cpputest/"
export CPPUTEST_ADDITIONAL_CFLAGS=" ${BUILD_CFLAGS}"
export CPPUTEST_ADDITIONAL_CPPFLAGS=" ${BUILD_CPPFLAGS}"
export CPPUTEST_ADDITIONAL_CXXFLAGS=" ${BUILD_CXXFLAGS}"
export CPPUTEST_ADDITIONAL_LDFLAGS=" ${BUILD_LDFLAGS}"
export UNITTEST_OUTPUT_XML=1
export BUILD_CONFIG="test"
export UNITTEST_OUTPUT_XML=0
export USE_INITSYS_DUMMY=1
export BUILD_CONFIG="utest"
export BUILD_TARGET="host"
export SYSROOT=${STAGING_DIR_HOST}
export SILENCE=""
oe_runmake -f Makefile.utest.mk
if [ "${TEST_LIBRARY}" = "1" ]; then
export BUILD_TARGET=host
export BUILD_CONFIG=test
oe_runmake -f Makefile.host.mk
fi
}
do_install_append_class-native () {
if [ "${TEST_LIBRARY}" = "1" ]; then
# Install headers
libname=$(ls ${D}${includedir})
install -d ${D}${includedir}/$libname-test
install -d ${D}${includedir}/$libname-test/mocks
install -d ${D}${includedir}/$libname-test/utils
cp -r ${S}/src/* ${D}${includedir}/$libname-test
cp -r ${S}/tests/mocks/* ${D}${includedir}/$libname-test/mocks
cp -r ${S}/tests/utils/* ${D}${includedir}/$libname-test/utils
# Install test library
install -m 644 ${B}/test/host/*.a ${D}${libdir}
fi
}
BBCLASSEXTEND = "native nativesdk"

View File

@ -13,20 +13,29 @@ LIB_PKG_NAME = "libnmapp.a"
DEPENDS_append = " libevent"
DEPENDS_class-target += "systemd"
# performs the unit test of the library
inherit unittests
# Required to add the libary to the SDK.
# ${PN}-dev depends on ${PN} which is empty because
# only the static library is built
ALLOW_EMPTY_${PN} = "1"
inherit unittests
TEST_LIBRARY = "1"
S = "${WORKDIR}/git"
B = "${S}/build"
do_install() {
do_compile_class-target() {
bbplain "building TARGET ${BPN}..."
export SILENCE=""
export BUILD_TARGET=target
export BUILD_CONFIG=rls
export USE_INITSYS_DUMMY=0
export SYSROOT=${STAGING_DIR_TARGET}
oe_runmake -f Makefile
}
do_install_class-target() {
install -d ${D}${libdir}
install -m 644 ${B}/rls/target/${LIB_PKG_NAME} ${D}${libdir}
@ -34,3 +43,32 @@ do_install() {
cp -r ${S}/include/${LIB_SHORT_NAME}/* ${D}${includedir}/${LIB_SHORT_NAME}
}
do_compile_class-native() {
bbplain "building NATIVE ${BPN} (test version)..."
export SILENCE=""
export USE_INITSYS_DUMMY=1
export BUILD_TARGET=host
export BUILD_CONFIG=test
export SYSROOT=${STAGING_DIR_HOST}
oe_runmake -f Makefile.host.mk
}
do_install_class-native() {
# Setup directories
install -d ${D}${includedir}/${LIB_SHORT_NAME}
install -d ${D}${includedir}/${LIB_SHORT_NAME}-test
install -d ${D}${includedir}/${LIB_SHORT_NAME}-test/mocks
install -d ${D}${includedir}/${LIB_SHORT_NAME}-test/utils
install -d ${D}${libdir}
# Install headers
cp -r ${S}/include/${LIB_SHORT_NAME}/* ${D}${includedir}/${LIB_SHORT_NAME}
cp -r ${S}/src/* ${D}${includedir}/${LIB_SHORT_NAME}-test
cp -r ${S}/tests/mocks/* ${D}${includedir}/${LIB_SHORT_NAME}-test/mocks
cp -r ${S}/tests/utils/* ${D}${includedir}/${LIB_SHORT_NAME}-test/utils
# Install rls and test library
install -m 644 ${B}/test/host/*.a ${D}${libdir}
}

View File

@ -12,17 +12,32 @@ SRC_URI_append = " \
PV = "0.0.1+git${SRCPV}"
inherit systemd
inherit unittests
DEPENDS_append = " libnmapp"
inherit systemd
# performs the unit test of the app
inherit unittests
S = "${WORKDIR}/git/apps/sys-mon"
B = "${S}/build"
SYSTEMD_SERVICE_${PN} = "sys-mon.service"
do_compile_class-target() {
bbplain "building TARGET ${BPN}..."
export SILENCE=""
export BUILD_TARGET=target
export BUILD_CONFIG=rls
export SYSROOT=${STAGING_DIR_TARGET}
export SYSROOT_HOST=${STAGING_DIR_HOST}
oe_runmake -f Makefile
}
FILES_${PN} += " \
${bindir}/sys-mon \
${systemd_system_unitdir}/sys-mon.service \
@ -38,3 +53,19 @@ do_install () {
install -d ${D}${systemd_system_unitdir}
install -m 644 ${WORKDIR}/${BPN}.service ${D}${systemd_system_unitdir}
}
do_compile_class-native() {
bbplain "building NATIVE ${BPN}..."
export SILENCE=""
export USE_INITSYS_DUMMY=1
export BUILD_TARGET=host
export BUILD_CONFIG=rls
export SYSROOT=${STAGING_DIR_HOST}
oe_runmake -f Makefile.host.mk
}
do_install_class-native() {
bbplain "Skipping native installation of ${BPN}..."
}