OpenSync

出自 flip the world
於 2019年2月28日 (四) 15:34 由 Tommy (對話 | 貢獻) 所做的修訂 (Yocto)
前往: 導覽搜尋

ESPlorer

Yocto

  • tree
opensync
├── files
│   ├── opensync-master.zip
│   └── protobuf-c.patch
├── opensync.bb

  • opensync.bb
#
# Copyright (C) 2019 Tommy C. Liu
#

SUMMARY = "Opensync"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://opensync-master.zip \
           file://protobuf-c.patch"

S = "${WORKDIR}/opensync-master"
DEPENDS = "mosquitto libev jansson openssl protobuf-c libpcap"

INHIBIT_PACKAGE_STRIP = "1"

DIST_NAME = "zynq"
CPU_TYPE = "arm"

EXTRA_OEMAKE = "DIST_NAME='${DIST_NAME}' CPU_TYPE='${CPU_TYPE}' STRIP='${STRIP}' LD='${LD}' CC='${CC}' CFLAGS='${CFLAGS} -DCONFIG_INET_GRE_USE_GRETAP -DTARGET_NAME="\"$(TARGET)\""' LDFLAGS='${LDFLAGS} -Iljansson'"


do_install() {
             install -d ${D}/${bindir}
             install -m 0755 ${S}/work/native-${DIST_NAME}-${CPU_TYPE}/rootfs/usr/plume/bin/* ${D}/${bindir}
}
  • files - protobuf-c.patch
diff -Nur a/src/lib/datapipeline/src/dppline.c b/src/lib/datapipeline/src/dppline.c
--- a/src/lib/datapipeline/src/dppline.c        2019-01-31 16:28:16.706026178 +0800
+++ b/src/lib/datapipeline/src/dppline.c        2019-02-01 12:07:44.301173505 +0800
@@ -27,7 +27,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <protobuf-c.h>
+#include <protobuf-c/protobuf-c.h>
 #include <unistd.h>

 #include "target.h"

OpenWrt

  • Makefile
#
# Copyright (C) 2019 Tommy C. Liu
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=opensync
PKG_VERSION:=master
PKG_RELEASE:=1
PKG_MAINTAINER:=Tommy C. Liu <tommy.using@gmail.com>

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz

PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=docs/LICENSE

PKG_USE_MIPS16:=0
#PKG_AUTOMAKE_PATHS:=src

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/plume-design/opensync
PKG_SOURCE_VERSION:=e368be0df2763895ed7877ae9e802c40fd38af40
PKG_MIRROR_HASH:=2036cedd366c9f38583986d27b1aabb49a0e120641cc9e9023c83e4ac5dae5ed

include $(INCLUDE_DIR)/package.mk
#CONFIGURE_PATH:=src
#MAKE_PATH:=src

define Package/opensync
  SECTION:=net
  CATEGORY:=Network
  SUBMENU:=wireless
  TITLE:=Cloud-agnostic software for the delivery, curation, and management of services for the modern home.
  URL:=https://github.com/plume-design/opensync
  DEPENDS:=+jansson +libev +libprotobuf-c +libopenssl +libmosquitto +zlib
  CFLAGS="$(TARGET_CFLAGS) -Wall"
endef

define Package/opensync/description
It acts as a silicon, CPE, and cloud-agnostic connection between in-home hardware devices and the cloud. It provides modern utilities for collecting measurements and statistics from devices, controlling and managing devices, and provides capabilities for specific services including Wi-Fi meshing, access control, cyber security, parental controls, and IoT onboarding and telemetry.
endef

define Build/Compile
        $(call Build/Compile/Default)
endef

define Package/opensync/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/work/native/bin/* $(1)/usr/sbin/
endef

$(eval $(call BuildPackage,opensync))
  • patche - 000-arm-mk.patch
diff -Nur build/arm.mk build.new/arm.mk
--- a/build/arm.mk	1970-01-01 08:00:00.000000000 +0800
+++ b/build.new/arm.mk	2019-01-30 14:07:56.003034972 +0800
@@ -0,0 +1,61 @@
+# Copyright (c) 2015, Plume Design Inc. All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#    1. Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#    2. Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in the
+#       documentation and/or other materials provided with the distribution.
+#    3. Neither the name of the Plume Design Inc. nor the
+#       names of its contributors may be used to endorse or promote products
+#       derived from this software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL Plume Design Inc. BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#
+# native configuration
+#
+
+BUILD_SHARED_LIB = n
+
+DIST_NAME = $(shell if [ -e /etc/os-release ]; then . /etc/os-release; echo $$ID$$VERSION_ID; fi)
+ifneq ($(DIST_NAME),)
+endif
+
+SDK_ROOTFS     = $(OBJDIR)/rootfs
+
+CC             = arm-none-eabi-gcc
+CXX            = arm-none-eabi-g++
+AR             = arm-none-eabi-ar
+STRIP          = arm-none-eabi-strip -g
+
+
+# Includes
+CFLAGS += -I/usr/include/protobuf-c
+# Flags
+CFLAGS += -O3 -pipe
+CFLAGS += -rdynamic
+CFLAGS += -fno-caller-saves
+CFLAGS += -fno-strict-aliasing
+CFLAGS += -fasynchronous-unwind-tables
+CFLAGS += -Wno-error=unused-but-set-variable
+CFLAGS += -Wno-error=cpp
+
+# Defines
+CFLAGS += -D_U_="__attribute__((unused))"
+
+export CC
+export CXX
+export CFLAGS
+export LIBS
+
  • patche - 001-ssize.patch
diff -Nur a/src/lib/read_until/inc/read_until.h b/src/lib/read_until/inc/read_until.h
--- a/src/lib/read_until/inc/read_until.h	2019-01-30 14:26:18.296457064 +0800
+++ b/src/lib/read_until/inc/read_until.h	2019-01-30 14:25:59.911734213 +0800
@@ -29,6 +29,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
 
 /**
  * This is quite similar to fgets() except that it works with non-blocking I/O
Binary files /home/tommy/Projects/plume/openwrt/build_dir/target-arm_cortex-a9+neon_musl_eabi/opensync-master/src/lib/read_until/inc/.read_until.h.swp and /home/tommy/Projects/plume/openwrt/build_dir/target-arm_cortex-a9+neon_musl_eabi/opensync-master.new/src/lib/read_until/inc/.read_until.h.swp differ
  • patche - 002-protobuf-c.patch
diff -Nur a/src/lib/datapipeline/src/dppline.c b/src/lib/datapipeline/src/dppline.c
--- a/src/lib/datapipeline/src/dppline.c	2019-01-30 14:56:43.275897685 +0800
+++ b/src/lib/datapipeline/src/dppline.c	2019-01-30 14:56:11.527669148 +0800
@@ -27,7 +27,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <protobuf-c.h>
+#include <protobuf-c/protobuf-c.h>
 #include <unistd.h>
 
 #include "target.h"