domoticz/domoticz-tinyxpath.patch
Michael Cronenworth 8f1bf90803 Update to 2020.2
2020-04-27 08:23:46 -05:00

196 lines
6.3 KiB
Diff

From 694241f7905967bf69af3a31265180c00b73e28c Mon Sep 17 00:00:00 2001
From: Michael Cronenworth <mike@cchtml.com>
Date: Fri, 11 Aug 2017 10:08:27 -0500
Subject: [PATCH] build: Detect and allow external tinyxpath library usage
Signed-off-by: Michael Cronenworth <mike@cchtml.com>
---
CMakeLists.txt | 57 +++++++++++++++++++++---------
removed from Fedora patch hardware/AnnaThermostat.cpp | 3 +-
removed from Fedora patch hardware/RAVEn.cpp | 3 +-
removed from Fedora patch hardware/openzwave/control_panel/ozwcp.cpp | 3 +-
removed from Fedora patch hardware/plugins/PluginManager.cpp | 3 +-
removed from Fedora patch hardware/plugins/Plugins.cpp | 3 +-
removed from Fedora patch main/LuaCommon.cpp | 7 +++-
removed from Fedora patch 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 bc231d8f6..334f203a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -365,22 +365,6 @@
webserver/server.cpp
webserver/Websockets.cpp
webserver/WebsocketHandler.cpp
-tinyxpath/action_store.cpp
-tinyxpath/htmlutil.cpp
-tinyxpath/lex_util.cpp
-tinyxpath/node_set.cpp
-tinyxpath/tinystr.cpp
-tinyxpath/tinyxml.cpp
-tinyxpath/tinyxmlerror.cpp
-tinyxpath/tinyxmlparser.cpp
-tinyxpath/tokenlist.cpp
-tinyxpath/xml_util.cpp
-tinyxpath/xpath_expression.cpp
-tinyxpath/xpath_processor.cpp
-tinyxpath/xpath_stream.cpp
-tinyxpath/xpath_stack.cpp
-tinyxpath/xpath_static.cpp
-tinyxpath/xpath_syntax.cpp
)
add_executable(domoticz ${domoticz_SRCS})
@@ -682,6 +666,47 @@
ENDIF(LIBUSB_FOUND)
endif(WITH_LIBUSB)
+option(USE_BUILTIN_TINYXPATH "Use builtin tinyxpath library" YES)
+IF(USE_BUILTIN_TINYXPATH)
+ include_directories(tinyxpath)
+ target_sources(
+ domoticz
+ PUBLIC
+ tinyxpath/action_store.cpp
+ tinyxpath/htmlutil.cpp
+ tinyxpath/lex_util.cpp
+ tinyxpath/node_set.cpp
+ tinyxpath/tinystr.cpp
+ tinyxpath/tinyxml.cpp
+ tinyxpath/tinyxmlerror.cpp
+ tinyxpath/tinyxmlparser.cpp
+ tinyxpath/tokenlist.cpp
+ tinyxpath/xml_util.cpp
+ tinyxpath/xpath_expression.cpp
+ tinyxpath/xpath_processor.cpp
+ tinyxpath/xpath_stream.cpp
+ tinyxpath/xpath_stack.cpp
+ tinyxpath/xpath_static.cpp
+ tinyxpath/xpath_syntax.cpp
+ )
+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)
+
## support lua popen on Linux platforms
#IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# SET(OperatingSystem "Linux")
--- a/hardware/openzwave/control_panel/ozwcp.cpp 2020-03-22 09:16:16.000000000 -0500
+++ b/hardware/openzwave/control_panel/ozwcp.cpp 2020-03-24 10:53:04.968630391 -0500
@@ -49,7 +49,7 @@
#include <sys/stat.h>
#include <fstream>
#include <iostream>
-#include "../../../tinyxpath/tinyxml.h"
+#include <tinyxml.h>
//#include "microhttpd.h"
#include "ozwcp.h"
--- a/hardware/plugins/PluginManager.cpp 2020-03-22 09:16:16.000000000 -0500
+++ b/hardware/plugins/PluginManager.cpp 2020-03-24 13:53:05.305852598 -0500
@@ -21,11 +21,12 @@
#include "../../main/Logger.h"
#include "../../main/SQLHelper.h"
#include "../../main/WebServer.h"
-#include "../../tinyxpath/tinyxml.h"
#ifdef WIN32
+# include "../../tinyxpath/tinyxml.h"
# include <direct.h>
#else
# include <sys/stat.h>
+# include <tinyxml.h>
#endif
#include "DelayedLink.h"
--- a/hardware/plugins/Plugins.cpp 2020-03-22 09:16:16.000000000 -0500
+++ b/hardware/plugins/Plugins.cpp 2020-03-24 13:45:46.056965796 -0500
@@ -16,10 +16,11 @@
#include "../../main/SQLHelper.h"
#include "../../main/mainworker.h"
#include "../../main/localtime_r.h"
-#include "../../tinyxpath/tinyxml.h"
#include "../../notifications/NotificationHelper.h"
+#include <tinyxml.h>
+
#define ADD_STRING_TO_DICT(pDict, key, value) \
{ \
PyObject* pObj = Py_BuildValue("s", value.c_str()); \
--- a/hardware/AnnaThermostat.cpp 2020-03-22 09:16:16.000000000 -0500
+++ b/hardware/AnnaThermostat.cpp 2020-03-24 10:41:00.530030798 -0500
@@ -9,7 +9,7 @@
#include "../httpclient/HTTPClient.h"
#include "../main/mainworker.h"
-#include "../tinyxpath/tinyxml.h"
+#include <tinyxml.h>
#define round(a) ( int ) ( a + .5 )
--- a/hardware/EcoDevices.cpp 2020-03-22 09:16:16.000000000 -0500
+++ b/hardware/EcoDevices.cpp 2020-03-24 10:47:20.095926641 -0500
@@ -33,11 +33,11 @@
#include "hardwaretypes.h"
#include "../main/localtime_r.h"
#include "../httpclient/HTTPClient.h"
-#include "../tinyxpath/tinyxml.h"
-#include "../tinyxpath/xpath_static.h"
#include "../webserver/Base64.h"
#include "../main/json_helper.h"
#include <sstream>
+#include <tinyxml.h>
+#include <xpath_static.h>
#ifdef _DEBUG
#define DEBUG_EcoDevices
--- a/hardware/OnkyoAVTCP.cpp 2018-06-23 09:18:06.000000000 -0500
+++ b/hardware/OnkyoAVTCP.cpp 2018-07-08 14:21:06.884163094 -0500
@@ -3,15 +3,15 @@
#include "../main/Logger.h"
#include "../main/Helper.h"
#include "../main/SQLHelper.h"
-#include <iostream>
#include "../main/localtime_r.h"
#include "../main/mainworker.h"
#include "../hardware/hardwaretypes.h"
-#include <json/json.h>
-#include "../tinyxpath/tinyxml.h"
#include "../main/WebServer.h"
+#include <iostream>
#include <sstream>
+#include <json/json.h>
+#include <tinyxml.h>
#define RETRY_DELAY 30
--- a/hardware/RAVEn.cpp 2020-03-22 09:16:16.000000000 -0500
+++ b/hardware/RAVEn.cpp 2020-03-24 12:55:59.616310732 -0500
@@ -5,8 +5,8 @@
#include "../main/Logger.h"
#include "../main/mainworker.h"
#include "../main/RFXtrx.h"
-#include "../tinyxpath/tinyxml.h"
#include "hardwaretypes.h"
+#include <tinyxml.h>
//Rainforest RAVEn USB ZigBee Smart Meter Adapter
//https://rainforestautomation.com/rfa-z106-raven/