<commit_before>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://0001-Fix-dependencies.patch \
	file://0002-Fix-cjson-library.patch \
	file://0003-Remove-host-library-paths.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 = "r0"

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/
}

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 \<commit_msg>IBM IoTF Embedded C SDK: Fix certificate file not being installed<commit_after>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://0001-Fix-dependencies.patch \
	file://0002-Fix-cjson-library.patch \
	file://0003-Remove-host-library-paths.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 = "r0"

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 \
{'fraction_non_alphanumeric': 0.19474747474747475, 'fraction_numerical': 0.053737373737373736, 'mean_word_length': 4.387377584330794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '933300', 'n_tokens_mistral': 2344, 'n_tokens_neox': 2135, 'n_words': 284}