From 14f01cb946a7c4c84eb7473c2d6d9140e360dd37 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Sat, 7 Jan 2017 22:04:00 +0100 Subject: [PATCH] openzwave: new package Signed-off-by: Hauke Mehrtens Signed-off-by: Stijn Tintel --- utils/openzwave/Makefile | 95 +++++++++++++++++++ ...x-compilation-against-musl-libc-1127.patch | 28 ++++++ utils/openzwave/patches/900_fix-build.patch | 29 ++++++ .../patches/901_no-hidcontroller.patch | 89 +++++++++++++++++ utils/openzwave/patches/902_no-udev.patch | 24 +++++ 5 files changed, 265 insertions(+) create mode 100644 utils/openzwave/Makefile create mode 100644 utils/openzwave/patches/001-unix-fix-compilation-against-musl-libc-1127.patch create mode 100644 utils/openzwave/patches/900_fix-build.patch create mode 100644 utils/openzwave/patches/901_no-hidcontroller.patch create mode 100644 utils/openzwave/patches/902_no-udev.patch diff --git a/utils/openzwave/Makefile b/utils/openzwave/Makefile new file mode 100644 index 000000000..d5e13e51b --- /dev/null +++ b/utils/openzwave/Makefile @@ -0,0 +1,95 @@ +# +# Copyright (C) 2017 Hauke Mehrtens +# Copyright (C) 2016 - 2017 Stijn Tintel +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=openzwave +PKG_REV:=164 +PKG_VERSION:=1.4.$(PKG_REV) +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://old.openzwave.com/downloads +PKG_HASH:=4ecf39787aaf278c203764069b581dbc26094ce57cafeab4a0c1f012d2c0ac69 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/openzwave/default + URL:=http://openzwave.com + MAINTAINER:=Stijn Tintel + DEPENDS:=+libpthread +libstdcpp +endef + +define Package/openzwave/description + Open-ZWave is a library that interfaces with selected Z-Wave PC controllers +endef + +define Package/libopenzwave +$(call Package/openzwave/default) + SECTION:=Libs + CATEGORY:=Libraries + TITLE:=Open-ZWave Library +endef + +define Package/openzwave +$(call Package/openzwave/default) + SECTION:=Utils + CATEGORY:=Utilities + TITLE:=Open-ZWave MinOZW test utility + DEPENDS:=+libopenzwave +openzwave-config +endef + +define Package/openzwave-config +$(call Package/openzwave/default) + SECTION:=Utils + CATEGORY:=Utilities + TITLE:=Open-ZWave Device Configs +endef + +MAKE_FLAGS += \ + LD="$(TARGET_CROSS)g++" \ + PREFIX=$(CONFIGURE_PREFIX) \ + instlibdir=/usr/lib \ + pkgconfigdir=/usr/lib/pkgconfig \ + sysconfdir=/etc/openzwave + +define Build/Prepare + $(call Build/Prepare/Default) + rm $(PKG_BUILD_DIR)/cpp/src/platform/HidController.* + sed -i -e '/hidapi/d;/HidController/d' $(PKG_BUILD_DIR)/distfiles.mk +endef + +define Package/libopenzwave/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenzwave.so* $(1)/usr/lib/ +endef + +define Package/openzwave/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/MinOZW $(1)/usr/bin/ +endef + +define Package/openzwave-config/install + $(INSTALL_DIR) $(1)/etc/ + $(CP) $(PKG_INSTALL_DIR)/etc/openzwave $(1)/etc/ +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/openzwave $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenzwave.* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libopenzwave.pc $(1)/usr/lib/pkgconfig/ +endef + +$(eval $(call BuildPackage,libopenzwave)) +$(eval $(call BuildPackage,openzwave)) +$(eval $(call BuildPackage,openzwave-config)) diff --git a/utils/openzwave/patches/001-unix-fix-compilation-against-musl-libc-1127.patch b/utils/openzwave/patches/001-unix-fix-compilation-against-musl-libc-1127.patch new file mode 100644 index 000000000..3001667ce --- /dev/null +++ b/utils/openzwave/patches/001-unix-fix-compilation-against-musl-libc-1127.patch @@ -0,0 +1,28 @@ +From eab45f0959ccb1deb662c6f8c036651088e2e8d6 Mon Sep 17 00:00:00 2001 +From: Stijn Tintel +Date: Fri, 17 Feb 2017 05:42:25 +0100 +Subject: [PATCH] unix: fix compilation against musl libc (#1127) + +POSIX.1-2001 requires sys/select.h for select() and friends. +Compile-tested on glibc and musl, runtime tested on musl. + +Signed-off-by: Stijn Tintel +--- + cpp/src/platform/unix/SerialControllerImpl.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cpp/src/platform/unix/SerialControllerImpl.cpp b/cpp/src/platform/unix/SerialControllerImpl.cpp +index d95f848..b52b74f 100644 +--- a/cpp/src/platform/unix/SerialControllerImpl.cpp ++++ b/cpp/src/platform/unix/SerialControllerImpl.cpp +@@ -25,6 +25,7 @@ + // along with OpenZWave. If not, see . + // + //----------------------------------------------------------------------------- ++#include + #include + #include + #include "Defs.h" +-- +2.10.2 + diff --git a/utils/openzwave/patches/900_fix-build.patch b/utils/openzwave/patches/900_fix-build.patch new file mode 100644 index 000000000..1081c9802 --- /dev/null +++ b/utils/openzwave/patches/900_fix-build.patch @@ -0,0 +1,29 @@ +--- a/cpp/build/Makefile ++++ b/cpp/build/Makefile +@@ -15,7 +15,7 @@ + # what flags we will use for compiling in debug mode + DEBUG_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -Werror -Wno-error=sequence-point -Wno-sequence-point -ggdb -DDEBUG -fPIC -DSYSCONFDIR="\"$(PREFIX)/etc/openzwave/\"" + # what flags we will use for compiling in release mode +-RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Werror -Wno-format -Wno-error=sequence-point -Wno-sequence-point -O3 -DNDEBUG -fPIC -DSYSCONFDIR="\"$(PREFIX)/etc/openzwave/\"" ++RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-error=sequence-point -Wno-sequence-point -DNDEBUG -fPIC -DSYSCONFDIR="\"/etc/openzwave/\"" + #what flags we will use for linking in debug mode + DEBUG_LDFLAGS := -g + +@@ -139,7 +139,7 @@ $(LIBDIR)/libopenzwave.a: $(patsubst %.c + $(patsubst %.cpp,$(OBJDIR)/%.o,$(indep)) \ + $(OBJDIR)/vers.o + @echo "Linking Static Library" +- @$(AR) $@ $+ ++ @$(AR) q $@ $+ + @$(RANLIB) $@ + + $(LIBDIR)/$(SHARED_LIB_NAME): $(patsubst %.cpp,$(OBJDIR)/%.o,$(tinyxml)) \ +@@ -161,7 +161,7 @@ $(top_builddir)/libopenzwave.pc: $(top_s + -e 's|[@]exec_prefix@|$(PREFIX)/bin|g' \ + -e 's|[@]libdir@|$(instlibdir)|g' \ + -e 's|[@]includedir@|$(PREFIX)/include/openzwave/|g' \ +- -e 's|[@]sysconfdir@|$(PREFIX)/etc/openzwave/|g' \ ++ -e 's|[@]sysconfdir@|/etc/openzwave/|g' \ + -e 's|[@]gitversion@|$(GITVERSION)|g' \ + -e 's|[@]docdir@|$(docdir)/|g' \ + -e 's|[@]VERSION@|$(VERSION)|g' \ diff --git a/utils/openzwave/patches/901_no-hidcontroller.patch b/utils/openzwave/patches/901_no-hidcontroller.patch new file mode 100644 index 000000000..dfacbf039 --- /dev/null +++ b/utils/openzwave/patches/901_no-hidcontroller.patch @@ -0,0 +1,89 @@ +--- a/cpp/src/Driver.cpp ++++ b/cpp/src/Driver.cpp +@@ -37,11 +37,6 @@ + #include "platform/Event.h" + #include "platform/Mutex.h" + #include "platform/SerialController.h" +-#ifdef WINRT +-#include "platform/winRT/HidControllerWinRT.h" +-#else +-#include "platform/HidController.h" +-#endif + #include "platform/Thread.h" + #include "platform/Log.h" + #include "platform/TimeStamp.h" +@@ -223,14 +218,7 @@ m_nonceReportSentAttempt( 0 ) + + initNetworkKeys(false); + +- if( ControllerInterface_Hid == _interface ) +- { +- m_controller = new HidController(); +- } +- else +- { +- m_controller = new SerialController(); +- } ++ m_controller = new SerialController(); + m_controller->SetSignalThreshold( 1 ); + + Options::Get()->GetOptionAsBool( "NotifyTransactions", &m_notifytransactions ); +--- a/cpp/build/Makefile ++++ b/cpp/build/Makefile +@@ -66,16 +66,7 @@ CFLAGS += $(CPPFLAGS) + #where to put the temporary library + LIBDIR ?= $(top_builddir) + +-INCLUDES := -I $(top_srcdir)/cpp/src -I $(top_srcdir)/cpp/tinyxml/ -I $(top_srcdir)/cpp/hidapi/hidapi/ +- +-ifeq ($(UNAME),Darwin) +-SOURCES_HIDAPI =$(top_srcdir)/cpp/hidapi/mac +-else ifeq ($(UNAME),FreeBSD) +-SOURCES_HIDAPI =$(top_srcdir)/cpp/hidapi/libusb +-else +-SOURCES_HIDAPI =$(top_srcdir)/cpp/hidapi/linux +-endif +- ++INCLUDES := -I $(top_srcdir)/cpp/src -I $(top_srcdir)/cpp/tinyxml/ + + SOURCES := $(top_srcdir)/cpp/src $(top_srcdir)/cpp/src/command_classes $(top_srcdir)/cpp/tinyxml \ + $(top_srcdir)/cpp/src/value_classes $(top_srcdir)/cpp/src/platform $(top_srcdir)/cpp/src/platform/unix $(SOURCES_HIDAPI) $(top_srcdir)/cpp/src/aes/ +@@ -85,14 +76,6 @@ VPATH = $(top_srcdir)/cpp/src:$(top_srcd + + tinyxml := $(notdir $(wildcard $(top_srcdir)/cpp/tinyxml/*.cpp)) + +-ifeq ($(UNAME),Darwin) +-hidapi := $(notdir $(wildcard $(top_srcdir)/cpp/hidapi/mac/*.c)) +-else ifeq ($(UNAME),FreeBSD) +-hidapi := $(notdir $(wildcard $(top_srcdir)/cpp/hidapi/libusb/*.c)) +-else +-hidapi := $(notdir $(wildcard $(top_srcdir)/cpp/hidapi/linux/*.c)) # we do not want the libusb version +-endif +- + cclasses := $(notdir $(wildcard $(top_srcdir)/cpp/src/command_classes/*.cpp)) + vclasses := $(notdir $(wildcard $(top_srcdir)/cpp/src/value_classes/*.cpp)) + pform := $(notdir $(wildcard $(top_srcdir)/cpp/src/platform/*.cpp)) \ +@@ -111,7 +94,6 @@ printversion: + + + -include $(patsubst %.cpp,$(DEPDIR)/%.d,$(tinyxml)) +--include $(patsubst %.c,$(DEPDIR)/%.d,$(hidapi)) + -include $(patsubst %.cpp,$(DEPDIR)/%.d,$(cclasses)) + -include $(patsubst %.cpp,$(DEPDIR)/%.d,$(vclasses)) + -include $(patsubst %.cpp,$(DEPDIR)/%.d,$(pform)) +@@ -131,7 +113,6 @@ $(top_srcdir)/cpp/src/vers.cpp: + #$(OBJDIR)/vers.o: $(top_builddir)/vers.cpp + + $(LIBDIR)/libopenzwave.a: $(patsubst %.cpp,$(OBJDIR)/%.o,$(tinyxml)) \ +- $(patsubst %.c,$(OBJDIR)/%.o,$(hidapi)) \ + $(patsubst %.c,$(OBJDIR)/%.o,$(aes)) \ + $(patsubst %.cpp,$(OBJDIR)/%.o,$(cclasses)) \ + $(patsubst %.cpp,$(OBJDIR)/%.o,$(vclasses)) \ +@@ -143,7 +124,6 @@ $(LIBDIR)/libopenzwave.a: $(patsubst %.c + @$(RANLIB) $@ + + $(LIBDIR)/$(SHARED_LIB_NAME): $(patsubst %.cpp,$(OBJDIR)/%.o,$(tinyxml)) \ +- $(patsubst %.c,$(OBJDIR)/%.o,$(hidapi)) \ + $(patsubst %.c,$(OBJDIR)/%.o,$(aes)) \ + $(patsubst %.cpp,$(OBJDIR)/%.o,$(cclasses)) \ + $(patsubst %.cpp,$(OBJDIR)/%.o,$(vclasses)) \ diff --git a/utils/openzwave/patches/902_no-udev.patch b/utils/openzwave/patches/902_no-udev.patch new file mode 100644 index 000000000..c9176d7db --- /dev/null +++ b/utils/openzwave/patches/902_no-udev.patch @@ -0,0 +1,24 @@ +--- a/cpp/src/platform/unix/SerialControllerImpl.cpp ++++ b/cpp/src/platform/unix/SerialControllerImpl.cpp +@@ -34,10 +34,6 @@ + #include "SerialControllerImpl.h" + #include "platform/Log.h" + +-#ifdef __linux__ +-#include +-#endif +- + using namespace OpenZWave; + + //----------------------------------------------------------------------------- +--- a/cpp/build/Makefile ++++ b/cpp/build/Makefile +@@ -59,7 +59,7 @@ endif + + else + LDFLAGS += -shared -Wl,-soname,libopenzwave.so.$(VERSION) +-LIBS += -ludev ++LIBS += + endif + CFLAGS += $(CPPFLAGS) +