From 8efe31ab931bb48f48abf8fc9decce72d0687073 Mon Sep 17 00:00:00 2001
From: Stefan Schmidt <stefan.schmidt@huawei.com>
Date: Fri, 18 Mar 2022 16:34:42 +0100
Subject: [PATCH] ot-br-posix: update package revision and adjust build
 configuration

The new revision does offer more Thread 1.2 features we are starting to
use now. One patch got obsolete and the number of third_party modules
was reduced (and with it the number of license files and licenses).

An additional fix is needed for the systemd unit file to start.

Fixes: https://gitlab.eclipse.org/eclipse/oniro-core/oniro/-/issues/38

Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com>
---
 ...p-Werror-to-avoid-compilation-breaks.patch | 32 ------------
 .../openthread/ot-br-posix_git.bb             | 52 ++++++++++++++-----
 2 files changed, 40 insertions(+), 44 deletions(-)
 delete mode 100644 meta-oniro-staging/recipes-connectivity/openthread/ot-br-posix/0001-build-drop-Werror-to-avoid-compilation-breaks.patch

diff --git a/meta-oniro-staging/recipes-connectivity/openthread/ot-br-posix/0001-build-drop-Werror-to-avoid-compilation-breaks.patch b/meta-oniro-staging/recipes-connectivity/openthread/ot-br-posix/0001-build-drop-Werror-to-avoid-compilation-breaks.patch
deleted file mode 100644
index 32ba4171..00000000
--- a/meta-oniro-staging/recipes-connectivity/openthread/ot-br-posix/0001-build-drop-Werror-to-avoid-compilation-breaks.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 592605f1f1d3b8bf1cbe9371b1e80b7521794dc1 Mon Sep 17 00:00:00 2001
-From: Stefan Schmidt <stefan.schmidt@huawei.com>
-Date: Sat, 6 Feb 2021 12:37:57 +0100
-Subject: [PATCH] build: drop -Werror to avoid compilation breaks.
-
-We had a warning turning into an error and breaking the compilation:
- error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
- 397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
-
-This patch works around this for now. A better way to avoid the warning
-in the first place is needed.
-
-Upstream-Status: Inappropriate [other]
-
-Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com>
----
- CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8bbde8c0..2fe251ce 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -59,7 +59,7 @@ if (OTBR_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
-     target_link_libraries(otbr-config INTERFACE --coverage)
- endif()
- 
--add_compile_options(-Wall -Wextra -Werror -Wfatal-errors -Wno-missing-braces)
-+add_compile_options(-Wall -Wextra -Wfatal-errors -Wno-missing-braces)
- 
- 
- execute_process(
diff --git a/meta-oniro-staging/recipes-connectivity/openthread/ot-br-posix_git.bb b/meta-oniro-staging/recipes-connectivity/openthread/ot-br-posix_git.bb
index 8146f845..4dd0c710 100644
--- a/meta-oniro-staging/recipes-connectivity/openthread/ot-br-posix_git.bb
+++ b/meta-oniro-staging/recipes-connectivity/openthread/ot-br-posix_git.bb
@@ -4,35 +4,63 @@
 
 SUMMARY = "OpenThread Border Router"
 SECTION = "net"
-LICENSE = "BSD-3-Clause & MIT & Apache-2.0"
+LICENSE = "BSD-3-Clause & MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=87109e44b2fda96a8991f27684a7349c \
                     file://third_party/Simple-web-server/repo/LICENSE;md5=852b3f7f320b19f6431487b8b2fb1d74 \
-                    file://third_party/angular-material/repo/LICENSE;md5=3d0c299b7dd4267c3ef21a705cf6a5c6 \
-                    file://third_party/angular/repo/LICENSE.md;md5=0d83982330e37f011a2cef9b15cb43aa \
                     file://third_party/cJSON/repo/LICENSE;md5=218947f77e8cb8e2fa02918dc41c50d0 \
-                    file://third_party/d3js/repo/LICENSE;md5=e863f3b38093ec361d12ed4ff001c403 \
                     file://third_party/http-parser/repo/LICENSE-MIT;md5=9bfa835d048c194ab30487af8d7b3778 \
-                    file://third_party/mdl/repo/LICENSE;md5=6f740e801ce5a08c6c113bf72859bff2 \
                     file://third_party/openthread/repo/LICENSE;md5=543b6fe90ec5901a683320a36390c65f \
                     "
 
 SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=main \
-           file://0001-build-drop-Werror-to-avoid-compilation-breaks.patch \
            file://0001-web-service-ot-client-add-needed-header-for-fd_set-c.patch \
            "
 
-PV = "0.2+git${SRCPV}"
-SRCREV = "5de1086daa12fda3d6d2b8b7d0f8954b709d5f66"
+PV = "0.3.0+git${SRCPV}"
+SRCREV = "9ef4e310b05ca0dbecb549e92ce7caa9d7461f19"
 
 S = "${WORKDIR}/git"
 
-DEPENDS = "autoconf-archive dbus readline avahi jsoncpp boost"
+DEPENDS = "autoconf-archive dbus readline avahi jsoncpp boost libnetfilter-queue"
+RDEPENDS:${PN} = "iproute2 avahi"
 
-inherit cmake systemd
+inherit pkgconfig cmake systemd
 
-SYSTEMD_SERVICE:${PN} = "otbr-agent.service otbr-web.service"
+EXTRA_OECMAKE = "-DBUILD_TESTING=OFF \
+                 -DOTBR_DBUS=ON \
+                 -DOTBR_REST=ON \
+                 -DOTBR_WEB=OFF \
+                 -DCMAKE_LIBRARY_PATH=${libdir} \
+                 -DOTBR_MDNS=avahi \
+                 -DOTBR_BACKBONE_ROUTER=ON \
+                 -DOTBR_BORDER_ROUTING=ON \
+                 -DOTBR_SRP_ADVERTISING_PROXY=ON \
+                 -DOTBR_BORDER_AGENT=ON \
+                 -DOT_SPINEL_RESET_CONNECTION=ON \
+                 -DOT_TREL=ON \
+                 -DOT_MLR=ON \
+                 -DOT_SRP_SERVER=ON \
+                 -DOT_ECDSA=ON \
+                 -DOT_SERVICE=ON \
+                 -DOTBR_DUA_ROUTING=ON \
+                 -DOT_DUA=ON \
+                 -DOT_BORDER_ROUTING_NAT64=ON \
+                 -DOTBR_DNSSD_DISCOVERY_PROXY=ON \
+                 -DOTBR_INFRA_IF_NAME=eth0 \
+                 -DOTBR_NO_AUTO_ATTACH=1 \
+                 -DOT_REFERENCE_DEVICE=ON \
+                 -DOT_DHCP6_CLIENT=ON \
+                 -DOT_DHCP6_SERVER=ON \
+                 "
 
-EXTRA_OECMAKE = "-DBUILD_TESTING=OFF -DOTBR_DBUS=ON -DOTBR_REST=ON -DOTBR_WEB=ON -DCMAKE_LIBRARY_PATH=${libdir}"
+# The service command is not available and thus the systemd unit got stuck in
+# ExecStartPre. We have ensure to have avahi available on the system with
+# (R)DEPENDS above.
+do_install:append() {
+    sed -i -e '/ExecStartPre=service avahi-daemon start/d' ${D}/lib/systemd/system/otbr-agent.service
+}
+
+SYSTEMD_SERVICE:${PN} = "otbr-agent.service"
 
 FILES:${PN} += "${systemd_unitdir}/*"
 FILES:${PN} += "${datadir}/*"
-- 
GitLab