summaryrefslogtreecommitdiffstats
path: root/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc
diff options
context:
space:
mode:
Diffstat (limited to 'external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc')
-rw-r--r--external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch77
-rw-r--r--external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Fix-cjson-library.patch36
-rw-r--r--external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Fix-dependencies.patch121
-rw-r--r--external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Remove-host-library-paths.patch27
-rw-r--r--external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/ibm-iotf-embeddedc_1.0.bb88
5 files changed, 349 insertions, 0 deletions
diff --git a/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch
new file mode 100644
index 00000000..de0522bf
--- /dev/null
+++ b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch
@@ -0,0 +1,77 @@
+From 796c934b3294871cb8ccb566ff6a9ae78d3ea4df Mon Sep 17 00:00:00 2001
+From: Vivek Chandra <vivek.chandrax.amancha@intel.com>
+Date: Wed, 21 Mar 2018 19:45:48 +0530
+Subject: [PATCH] Add additional options to sample apps
+
+---
+ samples/sampleDevice.c | 15 +++++++++------
+ samples/sampleGateway.c | 14 ++++++++++----
+ 2 files changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/samples/sampleDevice.c b/samples/sampleDevice.c
+index e1d78ea..5af14a2 100644
+--- a/samples/sampleDevice.c
++++ b/samples/sampleDevice.c
+@@ -40,7 +40,6 @@ int main(int argc, char const *argv[])
+ int rc = -1;
+
+ iotfclient client;
+-
+ //catch interrupt signal
+ signal(SIGINT, sigHandler);
+ signal(SIGTERM, sigHandler);
+@@ -48,16 +47,20 @@ int main(int argc, char const *argv[])
+ char* configFilePath;
+
+ if(isEMBDCHomeDefined()){
+-
+ getSamplesPath(&configFilePath);
+ configFilePath = realloc(configFilePath,strlen(configFilePath)+15);
+ strcat(configFilePath,"device.cfg");
+ }
+- else{
+- printf("IOT_EMBDC_HOME is not defined\n");
+- printf("Define IOT_EMBDC_HOME to client library path to execute samples\n");
++ //to handle if EMBDCHome not defined
++ else if(argc > 1) {
++ configFilePath = (char*)malloc(sizeof(char)*(strlen(argv[1])+3));
++ strcpy(configFilePath,argv[1]);
++ }
++ else {
++ printf("Pass the absolute path of the config file as command line argument ex: ./sampleDevice <path-to-config>/<config-file-name> or ");
++ printf("Please define IOT_EMBDC_HOME\n");
+ return -1;
+- }
++ }
+
+ rc = initialize_configfile(&client, configFilePath,0);
+ free(configFilePath);
+diff --git a/samples/sampleGateway.c b/samples/sampleGateway.c
+index 0d98f53..202ad45 100644
+--- a/samples/sampleGateway.c
++++ b/samples/sampleGateway.c
+@@ -55,11 +55,17 @@ int main(int argc, char const *argv[])
+ configFilePath = realloc(configFilePath,strlen(configFilePath)+15);
+ strcat(configFilePath,"gateway.cfg");
+ }
+- else{
+- printf("IOT_EMBDC_HOME is not defined\n");
+- printf("Define IOT_EMBDC_HOME to client library path to execute samples\n");
++ //to handle if EMBDCHome not defined
++ else if(argc > 1) {
++ configFilePath = (char*)malloc(sizeof(char)*(strlen(argv[1])+3));
++ strcpy(configFilePath,argv[1]);
++ }
++ else {
++ printf("Pass the absolute path of the config file as command line argument ex: ./sampleGateway <path-to-config>/<config-file-name> or ");
++ printf("Define IOT_EMBDC_HOME to client library path to execute samples\n");
+ return -1;
+- }
++ }
++
+
+ rc = initialize_configfile(&client, configFilePath,1);
+ free(configFilePath);
+--
+2.7.4
+
diff --git a/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Fix-cjson-library.patch b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Fix-cjson-library.patch
new file mode 100644
index 00000000..f6312990
--- /dev/null
+++ b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Fix-cjson-library.patch
@@ -0,0 +1,36 @@
+From af7f5b885d5807b46bdcdb91f78a9dff689b6af8 Mon Sep 17 00:00:00 2001
+From: Scott Ware <scott.r.ware@intel.com>
+Date: Thu, 13 Apr 2017 22:51:10 +0100
+Subject: [PATCH 2/3] Fix cjson library
+
+---
+ src/CMakeLists.txt | 2 +-
+ src/devicemanagementclient.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 43a52cc..d0e4184 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -11,4 +11,4 @@ add_library(iotfdevicemgmt SHARED devicemanagementclient.c)
+ TARGET_LINK_LIBRARIES (iotf_network_tls_wrapper mbedcrypto mbedx509 mbedtls )
+ TARGET_LINK_LIBRARIES (iotfdeviceclient iotfclient iotf_utils iotf_network_tls_wrapper iotfmqtt)
+ TARGET_LINK_LIBRARIES (iotfgatewayclient iotfclient iotf_utils iotf_network_tls_wrapper iotfmqtt)
+-TARGET_LINK_LIBRARIES (iotfdevicemgmt iotfclient iotfdeviceclient cJSON iotf_utils iotf_network_tls_wrapper iotfmqtt)
++TARGET_LINK_LIBRARIES (iotfdevicemgmt iotfclient iotfdeviceclient cjson iotf_utils iotf_network_tls_wrapper iotfmqtt)
+diff --git a/src/devicemanagementclient.c b/src/devicemanagementclient.c
+index 2bb8bc5..13f4b07 100644
+--- a/src/devicemanagementclient.c
++++ b/src/devicemanagementclient.c
+@@ -21,7 +21,7 @@
+
+
+ #include "devicemanagementclient.h"
+-#include "cJSON.h"
++#include "cjson/cJSON.h"
+
+ //Character strings to hold log header and log message to be dumped.
+ char logHdr[LOG_BUF];
+--
+1.9.1
+
diff --git a/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Fix-dependencies.patch b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Fix-dependencies.patch
new file mode 100644
index 00000000..2bc748e4
--- /dev/null
+++ b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Fix-dependencies.patch
@@ -0,0 +1,121 @@
+From 811d81859dd0525a160df4aae83d3f729a7a39ff Mon Sep 17 00:00:00 2001
+From: Scott Ware <scott.r.ware@intel.com>
+Date: Thu, 13 Apr 2017 22:44:45 +0100
+Subject: [PATCH 1/3] Fix dependencies
+
+---
+ lib/CMakeLists.txt | 86 +-----------------------------------------------------
+ src/CMakeLists.txt | 6 ++--
+ 2 files changed, 4 insertions(+), 88 deletions(-)
+
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index fbb1b76..02a3e7e 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -15,88 +15,4 @@ set(src_mqtt
+ MQTTUnsubscribeClient.c
+ )
+
+-set(src_crypto
+- aes.c
+- aesni.c
+- arc4.c
+- asn1parse.c
+- asn1write.c
+- base64.c
+- bignum.c
+- blowfish.c
+- camellia.c
+- ccm.c
+- cipher.c
+- cipher_wrap.c
+- cmac.c
+- ctr_drbg.c
+- des.c
+- dhm.c
+- ecdh.c
+- ecdsa.c
+- ecjpake.c
+- ecp.c
+- ecp_curves.c
+- entropy.c
+- entropy_poll.c
+- error.c
+- gcm.c
+- havege.c
+- hmac_drbg.c
+- md.c
+- md2.c
+- md4.c
+- md5.c
+- md_wrap.c
+- memory_buffer_alloc.c
+- oid.c
+- padlock.c
+- pem.c
+- pk.c
+- pk_wrap.c
+- pkcs12.c
+- pkcs5.c
+- pkparse.c
+- pkwrite.c
+- platform.c
+- ripemd160.c
+- rsa.c
+- sha1.c
+- sha256.c
+- sha512.c
+- threading.c
+- timing.c
+- version.c
+- version_features.c
+- xtea.c
+-)
+-
+-set(src_x509
+- certs.c
+- pkcs11.c
+- x509.c
+- x509_create.c
+- x509_crl.c
+- x509_crt.c
+- x509_csr.c
+- x509write_crt.c
+- x509write_csr.c
+-)
+-
+-set(src_tls
+- debug.c
+- net_sockets.c
+- ssl_cache.c
+- ssl_ciphersuites.c
+- ssl_cli.c
+- ssl_cookie.c
+- ssl_srv.c
+- ssl_ticket.c
+- ssl_tls.c
+-)
+-
+-add_library(cJSON cJSON.c)
+-add_library(mqttlib ${src_mqtt})
+-add_library(mbedcrypto ${src_crypto})
+-add_library(mbedx509 ${src_x509})
+-add_library(mbedtls ${src_tls})
++add_library(iotfmqtt ${src_mqtt})
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index db75a98..43a52cc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -9,6 +9,6 @@ add_library(iotfgatewayclient SHARED gatewayclient.c)
+ add_library(iotfdevicemgmt SHARED devicemanagementclient.c)
+
+ TARGET_LINK_LIBRARIES (iotf_network_tls_wrapper mbedcrypto mbedx509 mbedtls )
+-TARGET_LINK_LIBRARIES (iotfdeviceclient iotfclient iotf_utils iotf_network_tls_wrapper mqttlib)
+-TARGET_LINK_LIBRARIES (iotfgatewayclient iotfclient iotf_utils iotf_network_tls_wrapper mqttlib)
+-TARGET_LINK_LIBRARIES (iotfdevicemgmt iotfclient iotfdeviceclient cJSON iotf_utils iotf_network_tls_wrapper mqttlib)
++TARGET_LINK_LIBRARIES (iotfdeviceclient iotfclient iotf_utils iotf_network_tls_wrapper iotfmqtt)
++TARGET_LINK_LIBRARIES (iotfgatewayclient iotfclient iotf_utils iotf_network_tls_wrapper iotfmqtt)
++TARGET_LINK_LIBRARIES (iotfdevicemgmt iotfclient iotfdeviceclient cJSON iotf_utils iotf_network_tls_wrapper iotfmqtt)
+--
+1.9.1
+
diff --git a/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Remove-host-library-paths.patch b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Remove-host-library-paths.patch
new file mode 100644
index 00000000..622645e4
--- /dev/null
+++ b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Remove-host-library-paths.patch
@@ -0,0 +1,27 @@
+From ffcc01e562a7c016941e153e1540d13d10ce6b6a Mon Sep 17 00:00:00 2001
+From: Scott Ware <scott.r.ware@intel.com>
+Date: Thu, 13 Apr 2017 23:15:53 +0100
+Subject: [PATCH 3/3] Remove host library paths
+
+---
+ CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 87a2c44..5504c49 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -4,8 +4,8 @@ enable_testing()
+
+ option (run_tests "set run_tests to ON if build tests should be run, set to OFF to skip tests" ON)
+ SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage -fPIC ${CMAKE_CXX_FLAGS} ")
+-SET(CMAKE_C_FLAGS "-g -O0 -Wall -W -fprofile-arcs -ftest-coverage -fPIC ${CMAKE_C_FLAGS} -I/usr/local/include")
+-SET(CMAKE_EXE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage ${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
++SET(CMAKE_C_FLAGS "-g -O0 -Wall -W -fprofile-arcs -ftest-coverage -fPIC ${CMAKE_C_FLAGS} ")
++SET(CMAKE_EXE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage ${CMAKE_EXE_LINKER_FLAGS} ")
+
+ if (run_tests)
+ add_subdirectory(test)
+--
+1.9.1
+
diff --git a/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/ibm-iotf-embeddedc_1.0.bb b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/ibm-iotf-embeddedc_1.0.bb
new file mode 100644
index 00000000..c1124944
--- /dev/null
+++ b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/ibm-iotf-embeddedc_1.0.bb
@@ -0,0 +1,88 @@
+DESCRIPTION = "Embedded C client for interacting with the IBM Watson Internet of Things Platform"
+HOMEPAGE = "https://github.com/ibm-messaging/iotf-embeddedc"
+LICENSE = "EPL-1.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=30b3836521b3d65bef598bbc358a3afa"
+
+inherit cmake
+
+DEPENDS = "\
+ mbedtls \
+ cjson \
+"
+
+SRC_URI = "\
+ git://github.com/ibm-watson-iot/iot-embeddedc.git \
+ file://Fix-dependencies.patch \
+ file://Fix-cjson-library.patch \
+ file://Remove-host-library-paths.patch \
+ file://Add-additional-options-to-sample-apps.patch \
+"
+SRCREV = "809af3b63294d0c5302cc15e3652c65843907cf2"
+
+# MQTT Library
+SRC_URI += "git://github.com/eclipse/paho.mqtt.embedded-c.git;destsuffix=git-mqtt;name=mqtt"
+SRCREV_mqtt = "5714645c762177ff08086224a7a9ce0b9d541316"
+
+PR = "r1"
+
+S = "${WORKDIR}/git"
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dbg \
+ ${PN}-dev \
+ ${PN}-samples \
+"
+
+EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS:BOOL=ON -Drun_tests:BOOL=OFF"
+OECMAKE_C_FLAGS_append = " -lm"
+
+do_configure_prepend() {
+ # Configure MQTT library
+ cp ${WORKDIR}/git-mqtt/MQTTPacket/src/* ${S}/lib/
+ cp ${WORKDIR}/git-mqtt/MQTTClient-C/src/MQTTClient.* ${S}/lib/
+ sed -i 's|""|"iotf_network_tls_wrapper.h"|g' ${S}/lib/MQTTClient.h
+}
+
+do_install() {
+ install -d ${D}${libdir}
+ install -m 0644 ${WORKDIR}/build/lib/*.so ${D}${libdir}
+ install -m 0644 ${WORKDIR}/build/src/*.so ${D}${libdir}
+
+ install -d ${D}${includedir}/ibmiotf
+ install -m 0644 ${S}/src/*.h ${D}${includedir}/ibmiotf
+ install -m 0644 ${S}/lib/*.h ${D}${includedir}/ibmiotf
+
+ # Samples
+ install -d ${D}${datadir}/ibmiotfsdk/samples/c
+ install -m 0755 ${WORKDIR}/build/samples/helloWorld ${D}${datadir}/ibmiotfsdk/samples/c/
+ install -m 0755 ${WORKDIR}/build/samples/sampleDevice ${D}${datadir}/ibmiotfsdk/samples/c/
+ install -m 0755 ${WORKDIR}/build/samples/sampleGateway ${D}${datadir}/ibmiotfsdk/samples/c/
+ install -m 0644 ${S}/samples/device.cfg ${D}${datadir}/ibmiotfsdk/samples/c/
+ install -m 0644 ${S}/samples/gateway.cfg ${D}${datadir}/ibmiotfsdk/samples/c/
+ install -m 0644 ${S}/IoTFoundation.pem ${D}${datadir}/ibmiotfsdk/
+}
+
+FILES_${PN} += "\
+ ${libdir}/* \
+"
+
+FILES_${PN}-dev += "\
+ ${includedir}/* \
+"
+
+FILES_${PN}-dbg += "\
+ ${datadir}/ibmiotfsdk/samples/c/.debug \
+"
+
+FILES_${PN}-samples += "\
+ ${datadir}/ibmiotfsdk/samples/c/helloWorld \
+ ${datadir}/ibmiotfsdk/samples/c/sampleDevice \
+ ${datadir}/ibmiotfsdk/samples/c/sampleGateway \
+ ${datadir}/ibmiotfsdk/samples/c/device.cfg \
+ ${datadir}/ibmiotfsdk/samples/c/gateway.cfg \
+ ${datadir}/ibmiotfsdk/IoTFoundation.pem \
+"
+
+INSANE_SKIP_${PN} += "rpaths"
+INSANE_SKIP_${PN}-samples += "rpaths"