[yocto] [meta-oic][PATCH resend 4/5] iotivity-sensorboard: Support pkg-config
Philippe Coval
philippe.coval at osg.samsung.com
Thu Jan 18 13:04:15 PST 2018
Since IoTivity-1.3.0
Signed-off-by: Philippe Coval <philippe.coval at osg.samsung.com>
---
.../files/0003-server-Port-to-iotivity-1.2.0.patch | 68 ++++++++++++++++++++++
.../files/0004-build-Use-pkg-config.patch | 48 +++++++++++++++
.../iotivity-sensorboard_1.0.0.bb | 11 ++++
3 files changed, 127 insertions(+)
create mode 100644 recipes-apps/iotivity-sensorboard/files/0003-server-Port-to-iotivity-1.2.0.patch
create mode 100644 recipes-apps/iotivity-sensorboard/files/0004-build-Use-pkg-config.patch
diff --git a/recipes-apps/iotivity-sensorboard/files/0003-server-Port-to-iotivity-1.2.0.patch b/recipes-apps/iotivity-sensorboard/files/0003-server-Port-to-iotivity-1.2.0.patch
new file mode 100644
index 0000000..6f59e6a
--- /dev/null
+++ b/recipes-apps/iotivity-sensorboard/files/0003-server-Port-to-iotivity-1.2.0.patch
@@ -0,0 +1,68 @@
+From dcc5e1fd4204f08126ff940232283347b4963b15 Mon Sep 17 00:00:00 2001
+From: Philippe Coval <philippe.coval at osg.samsung.com>
+Date: Thu, 20 Jul 2017 15:33:36 +0200
+Subject: [PATCH 3/4] server: Port to iotivity-1.2.0+
+
+Bug: https://jira.iotivity.org/browse/IOT-1111
+
+Origin: https://github.com/TizenTeam/meta-oic/tree/iotivity-sensorboard/master
+Signed-off-by: Philippe Coval <philippe.coval at osg.samsung.com>
+---
+ server.cpp | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/server.cpp b/server.cpp
+index 8308577..5cb3215 100644
+--- a/server.cpp
++++ b/server.cpp
+@@ -107,7 +107,6 @@ void IoTServer::temperatureObserverLoop()
+ usleep(1500000);
+ cout << "Temperature Observer Callback" << endl;
+ shared_ptr<OCResourceResponse> resourceResponse(new OCResourceResponse());
+- resourceResponse->setErrorCode(200);
+ resourceResponse->setResourceRepresentation(getTemperatureRepresentation(),
+ EDISON_RESOURCE_INTERFACE);
+ OCStackResult result = OCPlatform::notifyListOfObservers(m_temperatureResource,
+@@ -125,7 +124,6 @@ void IoTServer::lightObserverLoop()
+ usleep(1500000);
+ cout << "Light Observer Callback" << endl;
+ shared_ptr<OCResourceResponse> resourceResponse(new OCResourceResponse());
+- resourceResponse->setErrorCode(200);
+ resourceResponse->setResourceRepresentation(getLightRepresentation(),
+ EDISON_RESOURCE_INTERFACE);
+ OCStackResult result = OCPlatform::notifyListOfObservers(m_ambientLightResource,
+@@ -167,7 +165,6 @@ OCEntityHandlerResult IoTServer::lightEntityHandler(shared_ptr<OCResourceRequest
+ cout << "GET request for ambient light reading" << endl;
+ if (Response)
+ {
+- Response->setErrorCode(200);
+ Response->setResponseResult(OC_EH_OK);
+ Response->setResourceRepresentation(getLightRepresentation());
+ if (OCPlatform::sendResponse(Response) == OC_STACK_OK)
+@@ -224,7 +221,6 @@ OCEntityHandlerResult IoTServer::temperatureEntityHandler(shared_ptr<OCResourceR
+ cout << "GET request for temperature sensor reading" << endl;
+ if (Response)
+ {
+- Response->setErrorCode(200);
+ Response->setResponseResult(OC_EH_OK);
+ Response->setResourceRepresentation(getTemperatureRepresentation());
+ if (OCPlatform::sendResponse(Response) == OC_STACK_OK)
+@@ -305,7 +301,6 @@ OCEntityHandlerResult IoTServer::LEDEntityHandler(shared_ptr<OCResourceRequest>
+ putLEDRepresentation();
+ if (Response)
+ {
+- Response->setErrorCode(200);
+ Response->setResourceRepresentation(getLEDRepresentation());
+ Response->setResponseResult(OC_EH_OK);
+ if (OCPlatform::sendResponse(Response) == OC_STACK_OK)
+@@ -319,7 +314,6 @@ OCEntityHandlerResult IoTServer::LEDEntityHandler(shared_ptr<OCResourceRequest>
+ cout << "GET request for platform LED" << endl;
+ if (Response)
+ {
+- Response->setErrorCode(200);
+ Response->setResourceRepresentation(getLEDRepresentation());
+ Response->setResponseResult(OC_EH_OK);
+ if (OCPlatform::sendResponse(Response) == OC_STACK_OK)
+--
+1.9.1
+
diff --git a/recipes-apps/iotivity-sensorboard/files/0004-build-Use-pkg-config.patch b/recipes-apps/iotivity-sensorboard/files/0004-build-Use-pkg-config.patch
new file mode 100644
index 0000000..12f9323
--- /dev/null
+++ b/recipes-apps/iotivity-sensorboard/files/0004-build-Use-pkg-config.patch
@@ -0,0 +1,48 @@
+From eace0b8280eda68aacbc396b9fe6756298af81b1 Mon Sep 17 00:00:00 2001
+From: Philippe Coval <philippe.coval at osg.samsung.com>
+Date: Thu, 20 Jul 2017 15:22:56 +0200
+Subject: [PATCH 4/4] build: Use pkg-config
+
+Bug: https://jira.iotivity.org/browse/IOT-1111
+Origin: https://github.com/TizenTeam/meta-oic/tree/iotivity-sensorboard/master
+
+Signed-off-by: Philippe Coval <philippe.coval at osg.samsung.com>
+---
+ Makefile | 17 ++++++++---------
+ 1 file changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 5d09cc1..ab3d632 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,19 +1,18 @@
+-YOCTOCXXFLAGS=-I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/ -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/stack -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/ocrandom -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/logger -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/oc_logger
++PKG_CONFIG?=pkg-config
+
+-YOCTOLDFLAGS=-loc -loctbstack -loc_logger -lmraa
+-YOCTOLDFLAGS+=-pthread
++override CXXFLAGS+=$(shell $(PKG_CONFIG) iotivity --cflags)
++override CXXFLAGS+=-std=c++0x
++override LDLIBS+=$(shell $(PKG_CONFIG) iotivity --libs)
++override LDLIBS+=-lmraa
++override LDFLAGS+=-pthread
+
+ all: sensorboard
+
+ %.o: %.cpp
+-ifeq ($(PKG_CONFIG_SYSROOT_DIR),)
+- echo "Error: Yocto cross-toolchain environment not initialized"
+- exit 1
+-endif
+- $(CXX) -std=c++0x -c -o $@ $< $(YOCTOCXXFLAGS)
++ $(CXX) $(CXXFLAGS) -c -o $@ $<
+
+ sensorboard: server.o observer.o
+- $(CXX) -o $@ $^ $(LDFLAGS) $(YOCTOLDFLAGS)
++ $(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+ clean:
+ rm -rf sensorboard *.o
+--
+1.9.1
+
diff --git a/recipes-apps/iotivity-sensorboard/iotivity-sensorboard_1.0.0.bb b/recipes-apps/iotivity-sensorboard/iotivity-sensorboard_1.0.0.bb
index 828c81e..2c7d0cc 100644
--- a/recipes-apps/iotivity-sensorboard/iotivity-sensorboard_1.0.0.bb
+++ b/recipes-apps/iotivity-sensorboard/iotivity-sensorboard_1.0.0.bb
@@ -1,3 +1,4 @@
+PR = "r1"
SUMMARY = "Iotivity SensorBoard"
DESCRIPTION = "Iotivity Server application for Edison which demonstrates Iotivity server capabilities through the integration of an add-on breadboard that hosts temperature, ambient light and LED resources"
HOMEPAGE = "https://www.iotivity.org/"
@@ -8,13 +9,22 @@ LIC_FILES_CHKSUM = "file://server.cpp;beginline=1;endline=19;md5=a692dd0c72bcfa3
SRC_URI = "file://iotivity-sensorboard.tar.gz \
file://0001-Build-Use-LDFLAGS-variable-from-env-and-add-pthread-.patch \
+ file://0003-server-Port-to-iotivity-1.2.0.patch \
+ file://0004-build-Use-pkg-config.patch \
"
+inherit pkgconfig
S = "${WORKDIR}/iotivity-sensorboard"
IOTIVITY_BIN_DIR = "/opt/iotivity"
IOTIVITY_BIN_DIR_D = "${D}${IOTIVITY_BIN_DIR}"
+do_compile_prepend() {
+ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
+ export PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" pkg-config"
+ export LD_FLAGS="${LD_FLAGS}"
+}
+
do_install() {
install -d ${IOTIVITY_BIN_DIR_D}/apps/iotivity-sensorboard
install -c -m 555 ${S}/sensorboard ${IOTIVITY_BIN_DIR_D}/apps/iotivity-sensorboard
@@ -24,3 +34,4 @@ FILES_${PN} = "${IOTIVITY_BIN_DIR}/apps/iotivity-sensorboard/sensorboard"
FILES_${PN}-dbg = "${IOTIVITY_BIN_DIR}/apps/iotivity-sensorboard/.debug"
RDEPENDS_${PN} += "iotivity-resource mraa"
BBCLASSEXTEND = "native nativesdk"
+PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"
--
1.9.1
More information about the yocto
mailing list