From 1c6dd516f44375cfd05066535ea653bdff800f60 Mon Sep 17 00:00:00 2001
From: Stefan Schmidt <stefan.schmidt@huawei.com>
Date: Thu, 28 Jan 2021 20:42:19 +0100
Subject: [PATCH] ot-daemon: Add initial recipe for OpenThread posix daemon

The OpenThread repo offers a huge amount of build targets (most of them
for MCUs directly), but for this recipe we only build the Linux native
service and ctl commandline.

This runs as a service on a Linux host and connects to a radio
co-processor for Thread network access.

Closes: https://git.ostc-eu.org/OSTC/planning/core-os/-/issues/35

Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com>
---
 .../openthread/ot-daemon_git.bb               | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 meta-ohos-staging/recipes-connectivity/openthread/ot-daemon_git.bb

diff --git a/meta-ohos-staging/recipes-connectivity/openthread/ot-daemon_git.bb b/meta-ohos-staging/recipes-connectivity/openthread/ot-daemon_git.bb
new file mode 100644
index 00000000..d2508642
--- /dev/null
+++ b/meta-ohos-staging/recipes-connectivity/openthread/ot-daemon_git.bb
@@ -0,0 +1,26 @@
+SUMMARY = "OpenThread Daemon (OT Daemon) is an OpenThread POSIX build mode that runs OpenThread as a service."
+SECTION = "net"
+LICENSE = "BSD-3-Clause & Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=543b6fe90ec5901a683320a36390c65f \
+                    file://third_party/nlbuild-autotools/repo/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+# While we have more third_party code with different licenses here we do not use
+# them in the posix daemon build.
+
+SRC_URI = "gitsm://github.com/openthread/openthread.git;protocol=https"
+
+PV = "0.1+git${SRCPV}"
+SRCREV = "4d50cbadbc3c584c7174f4be41fe65e2016a7ece"
+
+S = "${WORKDIR}/git"
+
+do_compile() {
+    # TODO check again if we could avoid this before upstreaming
+    ./bootstrap
+    oe_runmake -f src/posix/Makefile-posix DAEMON=1 HOST=${BUILD_SYS}
+}
+
+do_install() {
+    install -d ${D}/${sbindir}
+    install -m 755 output/posix/bin/* ${D}/${sbindir}
+}
-- 
GitLab