From e5603c9ef5c6a07e613abf28481bd373687333d3 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 3 Jun 2020 14:42:53 +0100 Subject: [PATCH 1/7] openzwave: take ownership Signed-off-by: David Woodhouse --- utils/openzwave/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/openzwave/Makefile b/utils/openzwave/Makefile index 0783466fe..a0b2ee6db 100644 --- a/utils/openzwave/Makefile +++ b/utils/openzwave/Makefile @@ -21,7 +21,7 @@ include $(INCLUDE_DIR)/package.mk define Package/openzwave/default URL:=http://openzwave.com - MAINTAINER:= + MAINTAINER:=David Woodhouse DEPENDS:=+libpthread +libstdcpp endef From ea8f5a173bb4d518dcaabbcbc4560cdda3f23901 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 4 Jun 2020 20:01:29 +0100 Subject: [PATCH 2/7] openzwave: update to 1.6.1134 Signed-off-by: David Woodhouse --- utils/openzwave/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/openzwave/Makefile b/utils/openzwave/Makefile index a0b2ee6db..950735746 100644 --- a/utils/openzwave/Makefile +++ b/utils/openzwave/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openzwave -PKG_VERSION:=1.6.1063 +PKG_VERSION:=1.6.1134 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://old.openzwave.com/downloads -PKG_HASH:=8b1b674f825cd3623d2aa9c286edbb05c0ff6537d5d3ee891ae98e21d28de26b +PKG_HASH:=719e904f5ac022772db81517e918d7994562d68a2820dd161b5c419c39f167d8 PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk From 160038e7539e9755344ca3dd4fc6376f74392b3a Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 3 Jun 2020 17:12:56 +0100 Subject: [PATCH 3/7] cereal: new package Signed-off-by: David Woodhouse --- libs/cereal/Makefile | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 libs/cereal/Makefile diff --git a/libs/cereal/Makefile b/libs/cereal/Makefile new file mode 100644 index 000000000..6a2d07557 --- /dev/null +++ b/libs/cereal/Makefile @@ -0,0 +1,44 @@ +# +# Copyright © 2020 David Woodhouse +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=cereal +PKG_VERSION:=1.3.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=v$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/USCiLab/cereal/archive/ +PKG_HASH:=329ea3e3130b026c03a4acc50e168e7daff4e6e661bc6a7dfec0d77b570851d5 + +PKG_MAINTAINER:=David Woodhouse +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=LICENSE + +CMAKE_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +CMAKE_OPTIONS += -DCMAKE_CXX_FLAGS=-latomic -DWITH_WERROR=OFF -DSKIP_PORTABILITY_TEST=ON -DSKIP_PERFORMANCE_COMPARISON=ON + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + + +define Package/cereal + BUILDONLY:=1 + SECTION:=devel + CATEGORY:=Development + SUBMENU:=Libraries + TITLE:=Cereal is a library of C++ header files for serialization + URL:=https://github.com/USCilab/cereal +endef + + +define Package/cereal/description + Cereal is a library of C++ headers for serialization +endef + +$(eval $(call BuildPackage,cereal)) From 201c0162cea90d472fc32c1ddd778932adb842f8 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 3 Jun 2020 15:37:56 +0100 Subject: [PATCH 4/7] minizip: new package Signed-off-by: David Woodhouse --- libs/minizip/Makefile | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 libs/minizip/Makefile diff --git a/libs/minizip/Makefile b/libs/minizip/Makefile new file mode 100644 index 000000000..039a80fa4 --- /dev/null +++ b/libs/minizip/Makefile @@ -0,0 +1,61 @@ +# +# Copyright © 2020 David Woodhouse +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=minizip +PKG_VERSION:=2.9.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/nmoinvaz/minizip/archive/ +PKG_HASH:=f64b2d228a03673a8ec36a53402e2108437226fd9170d49b7f0c0bca94708b93 + +PKG_MAINTAINER:=David Woodhouse +PKG_LICENSE:=Zlib +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_PARALLEL:=1 + +CMAKE_OPTIONS:=-DINSTALL_INC_DIR=/usr/include/minizip -DMZ_BZIP2=OFF -DBUILD_SHARED_LIBS=ON + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/minizip + TITLE:=Fork of the popular zip manipulation library found in the zlib distribution + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+zlib + URL:=https://github.com/nmoinvaz/minizip +endef + +define Package/minizip-dev + SECTION:=devel + CATEGORY:=Development + SUBMENU:=Libraries + DEPENDS:=minizip + TITLE:=Development files for the minizip library +endef + +define Package/minizip/description + minizip is a zip manipulation library written in C that is supported on Windows, macOS, and Linux +endef + +define Package/minizip/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libminizip.so.* $(1)/usr/lib/ +endef + +TARGET_CXXFLAGS += -flto + +define Build/InstallDev + $(call Build/InstallDev/cmake,$(1)) + $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/minizip.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/minizip.pc +endef + +$(eval $(call BuildPackage,minizip)) From 845ff3695307553ee66766e493d49adee1de120f Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 3 Jun 2020 14:42:36 +0100 Subject: [PATCH 5/7] domoticz: take ownership Signed-off-by: David Woodhouse --- utils/domoticz/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/domoticz/Makefile b/utils/domoticz/Makefile index 95d3c9eaf..5bb61088f 100644 --- a/utils/domoticz/Makefile +++ b/utils/domoticz/Makefile @@ -32,7 +32,7 @@ define Package/domoticz CATEGORY:=Utilities TITLE:=Open Source Home Automation System URL:=http://domoticz.com/ - MAINTAINER:= + MAINTAINER:=David Woodhouse USERID:=domoticz=6144:domoticz=6144 DEPENDS:= \ +boost \ From 4a5ddf720218db0cab4b9c68464b14654943d086 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 3 Jun 2020 14:41:46 +0100 Subject: [PATCH 6/7] domoticz: Fix libmosquitto dependency, use dynamic libjsoncpp. Domoticz doesn't use libmosquittopp any more as it was deprecated. It has its own copy. It can also use the system libjsoncpp, so do that too. Signed-off-by: David Woodhouse --- utils/domoticz/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/domoticz/Makefile b/utils/domoticz/Makefile index 5bb61088f..ac3955413 100644 --- a/utils/domoticz/Makefile +++ b/utils/domoticz/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=domoticz PKG_VERSION:=2020.1 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/archive/$(PKG_VERSION)/$(PKG_SOURCE) @@ -39,8 +39,9 @@ define Package/domoticz +boost-date_time \ +boost-system \ +boost-thread \ + +jsoncpp \ +libcurl \ - +libmosquittopp \ + +libmosquitto \ +libopenssl \ +libopenzwave \ +libsqlite3 \ @@ -59,6 +60,7 @@ CMAKE_OPTIONS += \ -DCMAKE_BUILD_TYPE=Release \ -DUSE_BUILTIN_MQTT=no \ -DUSE_BUILTIN_SQLITE=no \ + -DUSE_BUILTIN_JSONCPP=no \ -DUSE_STATIC_BOOST=no \ -DUSE_STATIC_LIBSTDCXX=no \ -DUSE_STATIC_OPENZWAVE=no \ From 27e5626bc56f78b7de8dcb9724518911573218e9 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 3 Jun 2020 15:02:22 +0100 Subject: [PATCH 7/7] domoticz: update to 2020.2 Signed-off-by: David Woodhouse --- utils/domoticz/Makefile | 12 +- .../patches/011-openzwave-include.patch | 129 ++++++++++++++++++ .../patches/012-minizip-overflow.patch | 46 +++++++ 3 files changed, 183 insertions(+), 4 deletions(-) create mode 100644 utils/domoticz/patches/011-openzwave-include.patch create mode 100644 utils/domoticz/patches/012-minizip-overflow.patch diff --git a/utils/domoticz/Makefile b/utils/domoticz/Makefile index ac3955413..e5cbe8c46 100644 --- a/utils/domoticz/Makefile +++ b/utils/domoticz/Makefile @@ -8,17 +8,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=domoticz -PKG_VERSION:=2020.1 -PKG_RELEASE:=3 +PKG_VERSION:=2020.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/archive/$(PKG_VERSION)/$(PKG_SOURCE) -PKG_HASH:=d0c17b2082dad8a8caeed888b7d4c191975e74a2808b5d078305f5327b82442d +PKG_HASH:=a02f589daad4eebff1f5e93815c1acd1864cf068f8f5c3185bcdd20207ae395e PKG_LICENSE:=GPL-3.0 PKG_LICENSE_FILES:=License.txt -PKG_BUILD_DEPENDS:=python3 +PKG_BUILD_DEPENDS:=python3 minizip cereal PKG_BUILD_PARALLEL:=1 PKG_USE_MIPS16:=0 @@ -41,6 +41,8 @@ define Package/domoticz +boost-thread \ +jsoncpp \ +libcurl \ + +minizip \ + +lua5.3 \ +libmosquitto \ +libopenssl \ +libopenzwave \ @@ -61,6 +63,8 @@ CMAKE_OPTIONS += \ -DUSE_BUILTIN_MQTT=no \ -DUSE_BUILTIN_SQLITE=no \ -DUSE_BUILTIN_JSONCPP=no \ + -DUSE_BUILTIN_MINIZIP=no \ + -DUSE_LUA_STATIC=no \ -DUSE_STATIC_BOOST=no \ -DUSE_STATIC_LIBSTDCXX=no \ -DUSE_STATIC_OPENZWAVE=no \ diff --git a/utils/domoticz/patches/011-openzwave-include.patch b/utils/domoticz/patches/011-openzwave-include.patch new file mode 100644 index 000000000..ce0af4bfa --- /dev/null +++ b/utils/domoticz/patches/011-openzwave-include.patch @@ -0,0 +1,129 @@ +From 632695fe3ee704c1c1c539d79172ac0f9f9ce77b Mon Sep 17 00:00:00 2001 +From: David Woodhouse +Date: Thu, 4 Jun 2020 12:41:27 +0100 +Subject: [PATCH] Fix up OpenZWave include path handling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The path specified by the pkg-config file will be, for example, +/usr/include/openzwave. + +That directory needs to be on the compiler's include path, because +OpenZWave's own include files assume they can include each other +simply as (e.g.) "ValueIDIndexes.h"; not "openzwave/ValueIDIndexes.h" + +Our own files do include though, which means that +the *parent* directory needs to be on the compilers's include path +too. We generally get lucky because /usr/include is automatically +included, so we find /usr/include/openzwave/Foo.h anyway. + +Fix our C files to rely on the correct include path discovered from +pkg-config, and to include OpenZWave headers by name without the +erroneous openzwave/ prefix. + +That means we can fix the ../open-zwave-read-only static build to use +the header files directly from there just like it does the static +library .a file, without requiring the 'sudo make install' step — and +without suffering a mismatch of static openzwave build vs. headers of +a different version that were installed on the system, which could +previously happen. + +Tested with both static and dynamic builds of OpenZWave. +--- + CMakeLists.txt | 11 ++++------- + hardware/OpenZWave.cpp | 8 ++++---- + hardware/openzwave/control_panel/ozwcp.cpp | 10 +++++----- + hardware/openzwave/control_panel/ozwcp.h | 4 ++-- + 4 files changed, 15 insertions(+), 18 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fa5b3099d..1f4b6fb57 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -694,6 +694,7 @@ endif(WITH_LIBUSB) + # + if(USE_STATIC_OPENZWAVE) + find_library(OpenZWave NAMES libopenzwave.a HINTS "../open-zwave-read-only" "../open-zwave-read-only/cpp/build") ++ find_path(OPENZWAVE_INCLUDE_DIRS NAMES OZWException.h HINTS "../open-zwave-read-only/cpp/src") + set(OPENZWAVE_LIB ${OpenZWave}) + else() + pkg_check_modules(OPENZWAVE libopenzwave) +@@ -707,16 +708,12 @@ IF(OpenZWave) + message(STATUS "OpenZWave library found at: ${OpenZWave}") + target_link_libraries(domoticz ${OpenZWave}) + +- find_path(OPENZWAVE_INCLUDE_DIRS NAMES openzwave/Manager.h) ++ find_path(OPENZWAVE_INCLUDE_DIRS NAMES OZWException.h) + if (OPENZWAVE_INCLUDE_DIRS) +- IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") +- include_directories(${OPENZWAVE_INCLUDE_DIRS}) +- ELSE() +- include_directories(${OPENZWAVE_INCLUDE_DIRS}/openzwave) +- ENDIF() ++ include_directories(${OPENZWAVE_INCLUDE_DIRS}) + message(STATUS "OpenZWave includes found at: ${OPENZWAVE_INCLUDE_DIRS}") + else() +- message(FATAL_ERROR "OpenZWave includes not found. Did you not issue 'sudo make install' after building OpenZWave?") ++ message(FATAL_ERROR "OpenZWave includes not found.") + endif (OPENZWAVE_INCLUDE_DIRS) + add_definitions(-DWITH_OPENZWAVE) + ELSE() +diff --git a/hardware/OpenZWave.cpp b/hardware/OpenZWave.cpp +index 272e3d0a7..a226a8924 100644 +--- a/hardware/OpenZWave.cpp ++++ b/hardware/OpenZWave.cpp +@@ -22,10 +22,10 @@ + #include "../main/localtime_r.h" + + //OpenZWave includes +-#include +-#include +-#include +-#include ++#include ++#include ++#include ++#include + + #include "ZWaveCommands.h" + +diff --git a/hardware/openzwave/control_panel/ozwcp.cpp b/hardware/openzwave/control_panel/ozwcp.cpp +index 0b21a9cf3..5e401b2f1 100644 +--- a/hardware/openzwave/control_panel/ozwcp.cpp ++++ b/hardware/openzwave/control_panel/ozwcp.cpp +@@ -39,11 +39,11 @@ + #include + #include + #include +-#include +-#include +-#include +-#include +-#include ++#include ++#include ++#include ++#include ++#include + #include "../../../main/Logger.h" + + #include +diff --git a/hardware/openzwave/control_panel/ozwcp.h b/hardware/openzwave/control_panel/ozwcp.h +index ebfef1791..96d14b3bf 100644 +--- a/hardware/openzwave/control_panel/ozwcp.h ++++ b/hardware/openzwave/control_panel/ozwcp.h +@@ -38,8 +38,8 @@ + + #include + #include +-#include +-#include ++#include ++#include + + #define MAX_NODES 255 + +-- +2.26.2 + diff --git a/utils/domoticz/patches/012-minizip-overflow.patch b/utils/domoticz/patches/012-minizip-overflow.patch new file mode 100644 index 000000000..f5b41e667 --- /dev/null +++ b/utils/domoticz/patches/012-minizip-overflow.patch @@ -0,0 +1,46 @@ +From 3c23a7863c0b01273d4c36423769443ea7e4a7bb Mon Sep 17 00:00:00 2001 +From: David Woodhouse +Date: Fri, 5 Jun 2020 15:02:41 +0100 +Subject: [PATCH 1/2] unzip: reduce file name size to 65535 to work with + external minizip +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The external minizip project has changed the unzGetCurrentFileInfo() +function to take a uint16_t as the filename size, instead of a uLong +as in the original version in zlib. + +(Reported as https://github.com/nmoinvaz/minizip/issues/490 but it +was 3½ years ago and might be too late to fix it now, although changing +it back to a *larger* type is a lot safer than reducing the size, and +perhaps they should.) + +This means that our 65536-byte buffer gets truncated to zero, as the +compiler tells us when we build agaisnt the external minizip: + +domoticz/main/unzip_stream.h:140:50: warning: conversion from ‘long unsigned int’ to ‘uint16_t’ {aka ‘short unsigned int’} changes value from ‘65536’ to ‘0’ [-Woverflow] + 140 | unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0); + | ^~~~~~~~~~~~ + +Reduce the buffer size to 65535 bytes instead. +--- + main/unzip_stream.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/main/unzip_stream.h b/main/unzip_stream.h +index 136fcefd9..813f2489a 100644 +--- a/main/unzip_stream.h ++++ b/main/unzip_stream.h +@@ -135,7 +135,7 @@ namespace clx { + basic_unzip_stream& open(handler_type h) { + handler_ = h; + if (handler_) { +- char path[65536]; ++ char path[65535]; + unz_file_info info; + unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0); + path_ = path; +-- +2.26.2 +