diff --git a/domoticz-openzwave.patch b/domoticz-openzwave.patch index 939dfbe..e819762 100644 --- a/domoticz-openzwave.patch +++ b/domoticz-openzwave.patch @@ -30,8 +30,8 @@ index ffd8d742..79c708ce 100644 +#include +#include - #ifdef WITH_EXTERNAL_TINYXPATH - # include + #include + #include diff --git a/hardware/openzwave/control_panel/ozwcp.h b/hardware/openzwave/control_panel/ozwcp.h index 29ebc0e3..7a027815 100644 --- a/hardware/openzwave/control_panel/ozwcp.h diff --git a/domoticz-python.patch b/domoticz-python.patch new file mode 100644 index 0000000..e6332de --- /dev/null +++ b/domoticz-python.patch @@ -0,0 +1,76 @@ +From f7b229ce873ff71e2b48e855075153dc1026750d Mon Sep 17 00:00:00 2001 +From: Michael Cronenworth +Date: Mon, 7 Aug 2017 14:37:28 -0500 +Subject: [PATCH] Follow PEP-384 when finding and opening python3 library + +Instead of maintaining a list of all Python versions the Python 3 +standard defines that there MUST be a stable ABI and we can always +rely on a "python3.dll" or a "libpython3.so" existing. + +This also fixes library loading on Linux distributions that use +SO versioned libraries. +--- + hardware/plugins/DelayedLink.h | 28 ++-------------------------- + 1 file changed, 2 insertions(+), 26 deletions(-) + +diff --git a/hardware/plugins/DelayedLink.h b/hardware/plugins/DelayedLink.h +index 25c83f034..ecf19da09 100644 +--- a/hardware/plugins/DelayedLink.h ++++ b/hardware/plugins/DelayedLink.h +@@ -126,16 +126,10 @@ namespace Plugins { + if (!shared_lib_) shared_lib_ = LoadLibrary("python35_d.dll"); + if (!shared_lib_) shared_lib_ = LoadLibrary("python34_d.dll"); + # else +- if (!shared_lib_) shared_lib_ = LoadLibrary("python37.dll"); +- if (!shared_lib_) shared_lib_ = LoadLibrary("python36.dll"); +- if (!shared_lib_) shared_lib_ = LoadLibrary("python35.dll"); +- if (!shared_lib_) shared_lib_ = LoadLibrary("python34.dll"); ++ if (!shared_lib_) shared_lib_ = LoadLibrary("python3.dll"); + # endif + #else +- if (!shared_lib_) FindLibrary("python3.7", true); +- if (!shared_lib_) FindLibrary("python3.6", true); +- if (!shared_lib_) FindLibrary("python3.5", true); +- if (!shared_lib_) FindLibrary("python3.4", true); ++ if (!shared_lib_) FindLibrary("python3", true); + #endif + if (shared_lib_) + { +@@ -232,24 +226,12 @@ namespace Plugins { + library = "lib" + sLibrary + ".so"; + shared_lib_ = dlopen(library.c_str(), RTLD_LAZY | RTLD_GLOBAL); + } +- // look in directories covered by ldconfig but 'm' variant +- if (!shared_lib_) +- { +- library = "lib" + sLibrary + "m.so"; +- shared_lib_ = dlopen(library.c_str(), RTLD_LAZY | RTLD_GLOBAL); +- } + // look in /usr/lib directories + if (!shared_lib_) + { + library = "/usr/lib/" + sLibrary + "/"; + FindLibrary(library, false); + } +- // look in /usr/lib directories but 'm' variant +- if (!shared_lib_) +- { +- library = "/usr/lib/" + sLibrary + "m/"; +- FindLibrary(library, false); +- } + // look in /usr/local/lib directory (handles build from source) + if (!shared_lib_) + { +@@ -257,12 +239,6 @@ namespace Plugins { + shared_lib_ = dlopen(library.c_str(), RTLD_LAZY | RTLD_GLOBAL); + + } +- // look in /usr/local/lib directory (handles build from source) but 'm' variant +- if (!shared_lib_) +- { +- library = "/usr/local/lib/lib" + sLibrary + "m.so"; +- shared_lib_ = dlopen(library.c_str(), RTLD_LAZY | RTLD_GLOBAL); +- } + } + else + { diff --git a/domoticz-tinyxpath.patch b/domoticz-tinyxpath.patch index 8293109..6d4fe3f 100644 --- a/domoticz-tinyxpath.patch +++ b/domoticz-tinyxpath.patch @@ -1,25 +1,26 @@ -From d7e98a8a37b0d878984445788ccf03b0abd8ca54 Mon Sep 17 00:00:00 2001 +From 694241f7905967bf69af3a31265180c00b73e28c Mon Sep 17 00:00:00 2001 From: Michael Cronenworth -Date: Mon, 31 Jul 2017 14:26:44 -0500 +Date: Fri, 11 Aug 2017 10:08:27 -0500 Subject: [PATCH] build: Detect and allow external tinyxpath library usage Signed-off-by: Michael Cronenworth --- - CMakeLists.txt | 53 +++++++++++++++++++++--------- - hardware/AnnaThermostat.cpp | 6 +++- - hardware/RAVEn.cpp | 6 +++- - hardware/openzwave/control_panel/ozwcp.cpp | 6 +++- - hardware/plugins/PluginManager.cpp | 6 +++- - hardware/plugins/Plugins.cpp | 6 +++- - main/LuaCommon.cpp | 11 ++++++- - main/LuaHandler.cpp | 7 +++- - 8 files changed, 78 insertions(+), 23 deletions(-) + CMakeLists.txt | 57 +++++++++++++++++++++--------- + hardware/AnnaThermostat.cpp | 3 +- + hardware/RAVEn.cpp | 3 +- + hardware/openzwave/control_panel/ozwcp.cpp | 3 +- + hardware/plugins/PluginManager.cpp | 3 +- + hardware/plugins/Plugins.cpp | 3 +- + main/LuaCommon.cpp | 7 +++- + main/LuaHandler.cpp | 3 +- + removed from Fedora patch msbuild/domoticz.vcxproj | 6 ++-- + 9 files changed, 62 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index fc558987..81f0b130 100644 +index bc231d8f6..334f203a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -449,22 +449,6 @@ webserver/proxyclient.cpp +@@ -451,22 +451,6 @@ webserver/proxyclient.cpp json/json_reader.cpp json/json_value.cpp json/json_writer.cpp @@ -42,24 +43,13 @@ index fc558987..81f0b130 100644 ) add_executable(domoticz ${domoticz_SRCS}) -@@ -536,6 +520,43 @@ else() +@@ -538,6 +522,47 @@ else() MESSAGE(STATUS "==== LibUSB not found, support for TE923/Voltcraft disabled!") ENDIF(LIBUSB_FOUND) -+pkg_check_modules(TinyXML QUIET tinyxml) -+IF(TinyXML_FOUND) -+ MESSAGE(STATUS "TinyXML found at: ${TinyXML_LIBRARIES}") -+ IF(EXISTS "/usr/include/tinyxpath/xpath_processor.h") -+ MESSAGE(STATUS "TinyXPath found") -+ target_link_libraries(domoticz ${TinyXML_LIBRARIES}) -+ target_link_libraries(domoticz tinyxpath) -+ include_directories(/usr/include/tinyxpath) -+ add_definitions(-DWITH_EXTERNAL_TINYXPATH) -+ else() -+ MESSAGE(STATUS "==== TinyXPath not found, using built-in sources") -+ ENDIF() -+else() -+ MESSAGE(STATUS "==== TinyXML not found, needed for tinyxpath, using built-in sources instead.") ++option(USE_BUILTIN_TINYXPATH "Use builtin tinyxpath library" YES) ++IF(USE_BUILTIN_TINYXPATH) ++ include_directories(tinyxpath) + target_sources( + domoticz + PUBLIC @@ -80,116 +70,129 @@ index fc558987..81f0b130 100644 + tinyxpath/xpath_static.cpp + tinyxpath/xpath_syntax.cpp + ) -+ENDIF(TinyXML_FOUND) -+ ++else() ++ pkg_check_modules(TinyXML QUIET tinyxml) ++ IF(TinyXML_FOUND) ++ MESSAGE(STATUS "TinyXML found at: ${TinyXML_LIBRARIES}") ++ IF(EXISTS "/usr/include/tinyxpath/xpath_processor.h") ++ MESSAGE(STATUS "TinyXPath found") ++ target_link_libraries(domoticz ${TinyXML_LIBRARIES}) ++ target_link_libraries(domoticz tinyxpath) ++ include_directories(/usr/include/tinyxpath) ++ add_definitions(-DWITH_EXTERNAL_TINYXPATH) ++ else() ++ MESSAGE(FATAL_ERROR "TinyXPath not found but USE_BUILTIN_TINYXPATH=NO") ++ ENDIF() ++ else() ++ MESSAGE(FATAL_ERROR "TinyXML not found but USE_BUILTIN_TINYXPATH=NO") ++ ENDIF(TinyXML_FOUND) ++ENDIF(USE_BUILTIN_TINYXPATH) + # # Find MD5/RMD160/SHA library # diff --git a/hardware/AnnaThermostat.cpp b/hardware/AnnaThermostat.cpp -index 9c8cf26e..542661c2 100644 +index 9c8cf26ef..9c91513ba 100644 --- a/hardware/AnnaThermostat.cpp +++ b/hardware/AnnaThermostat.cpp -@@ -8,7 +8,11 @@ +@@ -8,7 +8,8 @@ #include "../main/SQLHelper.h" #include "../httpclient/HTTPClient.h" #include "../main/mainworker.h" -#include "../tinyxpath/tinyxml.h" -+#ifdef WITH_EXTERNAL_TINYXPATH -+# include -+#else -+# include "../tinyxpath/tinyxml.h" -+#endif ++ ++#include #define round(a) ( int ) ( a + .5 ) diff --git a/hardware/RAVEn.cpp b/hardware/RAVEn.cpp -index 3ffe4f72..64b12eb6 100644 +index 3ffe4f724..36f97bffb 100644 --- a/hardware/RAVEn.cpp +++ b/hardware/RAVEn.cpp -@@ -6,7 +6,11 @@ +@@ -6,7 +6,8 @@ #include "../main/RFXtrx.h" #include "../main/localtime_r.h" #include "../main/mainworker.h" -#include "../tinyxpath/tinyxml.h" -+#ifdef WITH_EXTERNAL_TINYXPATH -+# include -+#else -+# include "../tinyxpath/tinyxml.h" -+#endif ++ ++#include //Rainforest RAVEn USB ZigBee Smart Meter Adapter //https://rainforestautomation.com/rfa-z106-raven/ diff --git a/hardware/openzwave/control_panel/ozwcp.cpp b/hardware/openzwave/control_panel/ozwcp.cpp -index 9a948c97..ffd8d742 100644 +index 9a948c976..8fd4f77f0 100644 --- a/hardware/openzwave/control_panel/ozwcp.cpp +++ b/hardware/openzwave/control_panel/ozwcp.cpp -@@ -45,7 +45,11 @@ +@@ -45,11 +45,10 @@ #include "Group.h" #include "Notification.h" -#include "../../tinyxpath/tinyxml.h" -+#ifdef WITH_EXTERNAL_TINYXPATH -+# include -+#else -+# include "../tinyxpath/tinyxml.h" -+#endif - +- #include #include + #include ++#include + + //#include "microhttpd.h" + #include "ozwcp.h" diff --git a/hardware/plugins/PluginManager.cpp b/hardware/plugins/PluginManager.cpp -index d8706ebf..c21c3749 100644 +index ea7bbe48a..9af41e42e 100644 --- a/hardware/plugins/PluginManager.cpp +++ b/hardware/plugins/PluginManager.cpp -@@ -17,7 +17,11 @@ +@@ -5,6 +5,8 @@ + // + #ifdef ENABLE_PYTHON + ++#include ++ + #include "PluginManager.h" + #include "Plugins.h" + #include "PluginMessages.h" +@@ -17,7 +19,6 @@ #include "../main/mainworker.h" #include "../main/EventSystem.h" #include "../json/json.h" -#include "../tinyxpath/tinyxml.h" -+#ifdef WITH_EXTERNAL_TINYXPATH -+# include -+#else -+# include "../tinyxpath/tinyxml.h" -+#endif #include "../main/localtime_r.h" #ifdef WIN32 # include diff --git a/hardware/plugins/Plugins.cpp b/hardware/plugins/Plugins.cpp -index 1d6effbc..947f0001 100644 +index dc2420d6a..8cba255a2 100644 --- a/hardware/plugins/Plugins.cpp +++ b/hardware/plugins/Plugins.cpp -@@ -15,7 +15,11 @@ +@@ -5,6 +5,8 @@ + // + #ifdef ENABLE_PYTHON + ++#include ++ + #include "Plugins.h" + #include "PluginMessages.h" + #include "PluginProtocols.h" +@@ -15,7 +17,6 @@ #include "../main/Logger.h" #include "../main/SQLHelper.h" #include "../main/mainworker.h" -#include "../tinyxpath/tinyxml.h" -+#ifdef WITH_EXTERNAL_TINYXPATH -+# include -+#else -+# include "../tinyxpath/tinyxml.h" -+#endif #include "../main/localtime_r.h" #include "../../notifications/NotificationHelper.h" diff --git a/main/LuaCommon.cpp b/main/LuaCommon.cpp -index ec99429a..d42db0d0 100644 +index ec99429a5..76085aed6 100644 --- a/main/LuaCommon.cpp +++ b/main/LuaCommon.cpp -@@ -16,7 +16,12 @@ extern "C" { +@@ -16,7 +16,8 @@ extern "C" { #endif } -#include "../tinyxpath/xpath_processor.h" -+#ifdef WITH_EXTERNAL_TINYXPATH -+# include -+# include -+#else -+# include "../tinyxpath/xpath_processor.h" -+#endif ++#include ++ #include "../json/json.h" #include "SQLHelper.h" #include "mainworker.h" -@@ -44,7 +49,11 @@ int CLuaCommon::l_domoticz_applyXPath(lua_State* lua_state) +@@ -44,7 +45,11 @@ int CLuaCommon::l_domoticz_applyXPath(lua_State* lua_state) return 0; } TinyXPath::xpath_processor processor(root, xpath.c_str()); @@ -202,23 +205,16 @@ index ec99429a..d42db0d0 100644 return 1; } diff --git a/main/LuaHandler.cpp b/main/LuaHandler.cpp -index 8fdcb278..3e1bbcae 100644 +index 8fdcb278b..a66cafee7 100644 --- a/main/LuaHandler.cpp +++ b/main/LuaHandler.cpp -@@ -16,7 +16,12 @@ extern "C" { +@@ -16,7 +16,8 @@ extern "C" { #endif } -#include "../tinyxpath/xpath_processor.h" -+#ifdef WITH_EXTERNAL_TINYXPATH -+# include -+# include -+#else -+# include "../tinyxpath/xpath_processor.h" -+#endif ++#include ++ #include "../json/json.h" #include "SQLHelper.h" #include "mainworker.h" --- -2.13.3 - diff --git a/domoticz.spec b/domoticz.spec index de30d9b..e62e9b2 100644 --- a/domoticz.spec +++ b/domoticz.spec @@ -1,6 +1,6 @@ Name: domoticz Version: 3.8153 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Open source Home Automation System License: GPLv3+ and ASL 2.0 and Boost and BSD and MIT @@ -11,16 +11,19 @@ Source2: %{name}.conf # Source says its version 3.5876, but it's really 3.8153 Patch1: %{name}-version.patch -# Use system tinyxpath (https://github.com/domoticz/domoticz/pull/1731) +# Use system tinyxpath (https://github.com/domoticz/domoticz/pull/1759) Patch2: %{name}-tinyxpath.patch # Use system openzwave includes Patch3: %{name}-openzwave.patch # Work against Dev branch of OpenZWave upstream Patch4: %{name}-openzwave-Dev.patch +# Fix python detection (https://github.com/domoticz/domoticz/pull/1749) +Patch5: %{name}-python.patch BuildRequires: boost-devel BuildRequires: cmake BuildRequires: curl-devel +BuildRequires: fontpackages-devel BuildRequires: gcc-c++ BuildRequires: git BuildRequires: libopenzwave-devel >= 1.5.0 @@ -40,6 +43,7 @@ Requires(postun): systemd Requires(preun): systemd Requires: google-droid-sans-fonts +Recommends: system-python-libs >= 3.4 Provides: bundled(js-ace) Provides: bundled(js-angularamd) = 0.2.1 @@ -82,11 +86,13 @@ any mobile device %patch2 -p1 -b.tinyxpath %patch3 -p1 -b.openzwave %patch4 -p1 -b.openzwave-Dev +%patch5 -p1 -b.python rm -f hardware/openzwave/*.h rm -rf hardware/openzwave/aes rm -rf hardware/openzwave/command_classes rm -rf hardware/openzwave/platform rm -rf hardware/openzwave/value_classes +rm -rf sqlite/ rm -rf tinyxpath/ @@ -97,6 +103,7 @@ rm -rf tinyxpath/ -DUSE_BUILTIN_LUA=NO \ -DUSE_BUILTIN_MQTT=NO \ -DUSE_BUILTIN_SQLITE=NO \ + -DUSE_BUILTIN_TINYXPATH=NO \ -DUSE_STATIC_BOOST=NO \ -DCMAKE_INSTALL_PREFIX=%{_datadir}/%{name} make %{?_smp_mflags} @@ -136,8 +143,8 @@ ln -s %{_fontdir}/google-droid/DroidSans.ttf \ $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts/ # OpenZWave Control Panel temp file -ln -s %{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml \ - $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml +ln -s %{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml \ + $RPM_BUILD_ROOT%{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml %pre @@ -172,6 +179,10 @@ usermod -G domoticz,dialout domoticz %changelog +* Fri Sep 08 2017 Michael Cronenworth - 3.8153-3 +- Fix OpenZWave control panel symlink (RHBZ#1482266) +- Fix Python detection + * Mon Jul 31 2017 Michael Cronenworth - 3.8153-2 - Fix OpenZWave control panel