[Add basic opensync build support]

[Description]
Add basic opensync build support
1.Add basic opensync v2.0.5 build back
2.Add opensync v3.2.x build support(v3.2.7 test ok)
3.Default disable opensync build

[Release-log]
N/A

diff --git a/recipes-common/mesh-agent/mesh-agent.bbappend b/recipes-common/mesh-agent/mesh-agent.bbappend
new file mode 100644
index 0000000..957517c
--- /dev/null
+++ b/recipes-common/mesh-agent/mesh-agent.bbappend
@@ -0,0 +1,36 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "\
+file://enabling_dhcp_lease_resync.patch;apply=no \
+file://meshagent-enable-ovs-default.patch;apply=no \
+"
+
+DEPENDS_append_dunfell = " safec trower-base64"
+RDEPENDS_${PN}_append_dunfell = " bash"
+
+# we need to patch to code for mesh-agent
+do_turris_meshagent_patches() {
+    cd ${S}
+    if [ ! -e patch_applied ]; then
+        bbnote "Patching enabling_dhcp_lease_resync.patch"
+        patch  -p1 < ${WORKDIR}/enabling_dhcp_lease_resync.patch ${S}/source/MeshAgentSsp/cosa_mesh_apis.c
+
+        bbnote "Patching meshagent-enable-ovs-default.patch"
+        patch  -p1 < ${WORKDIR}/meshagent-enable-ovs-default.patch ${S}/source/MeshAgentSsp/cosa_mesh_apis.c
+
+        touch patch_applied
+    fi
+}
+addtask turris_meshagent_patches after do_unpack before do_configure
+
+do_install_append () {
+       install -D -m 0644 ${S}/systemd_units/meshAgent.service ${D}${systemd_unitdir}/system/meshAgent.service
+}
+
+FILES_${PN}_append = "${systemd_unitdir}/system/meshAgent.service"
+
+CFLAGS_append = " -D_PLATFORM_TURRIS_"
+
+LDFLAGS_append_dunfell = " -lsyscfg -lsysevent -lbreakpadwrapper -lsafec-3.5.1"
+
+LDFLAGS_remove_dunfell = "-lsafec-3.5"