Add a patch to fix build with Python 3.9 (RHBZ#1842068)

This commit is contained in:
Björn Esser 2020-05-30 18:50:50 +02:00
parent 30232d67a1
commit 0cb4a4b473
2 changed files with 41 additions and 0 deletions

34
domoticz-python39.patch Normal file
View File

@ -0,0 +1,34 @@
Index: domoticz-2020.2/hardware/plugins/DelayedLink.h
===================================================================
--- domoticz-2020.2.orig/hardware/plugins/DelayedLink.h
+++ domoticz-2020.2/hardware/plugins/DelayedLink.h
@@ -14,6 +14,16 @@
#include <frameobject.h>
#include "../../main/Helper.h"
+#ifndef _Py_DEC_REFTOTAL
+ /* _Py_DEC_REFTOTAL macro has been removed from Python 3.9 by:
+ https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924 */
+# ifdef Py_REF_DEBUG
+# define _Py_DEC_REFTOTAL _Py_RefTotal--
+# else
+# define _Py_DEC_REFTOTAL
+# endif
+#endif
+
#if PY_VERSION_HEX >= 0x030800f0
static inline void
py3__Py_DECREF(const char *filename, int lineno, PyObject *op)
Index: domoticz-2020.2/CMakeLists.txt
===================================================================
--- domoticz-2020.2.orig/CMakeLists.txt
+++ domoticz-2020.2/CMakeLists.txt
@@ -744,7 +744,7 @@ else()
message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support")
endif (TELLDUSCORE_INCLUDE)
-target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm ${MQTT_LIBRARIES} ${LUA_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES})
+target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread -lpython3.9 -lcrypt -lpthread -ldl -lutil -lm -lm ${MQTT_LIBRARIES} ${LUA_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES})
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(domoticz -lresolv)

View File

@ -23,6 +23,9 @@ Patch2: %{name}-openzwave.patch
Patch3: %{name}-python.patch
# Python 3.8 linking fix
Patch4: %{name}-python38.patch
# _Py_DEC_REFTOTAL macro has been removed from Python 3.9 by:
# https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924
Patch5: %{name}-python39.patch
BuildRequires: boost-devel
BuildRequires: cereal-devel
@ -98,6 +101,9 @@ any mobile device
%if 0%{?fedora} >= 32
%patch4 -p1 -b.python38
%endif
%if 0%{?fedora} >= 33
%patch5 -p1 -b.python39
%endif
rm -f hardware/openzwave/*.h
rm -rf hardware/openzwave/aes
rm -rf hardware/openzwave/command_classes
@ -236,6 +242,7 @@ usermod -G domoticz,dialout domoticz
%changelog
* Sat May 30 2020 Björn Esser <besser82@fedoraproject.org> - 2020.2-3
- Rebuild (jsoncpp)
- Add a patch to fix build with Python 3.9 (RHBZ#1842068)
* Mon Apr 27 2020 Michael Cronenworth <mike@cchtml.com> - 2020.2-2
- Link against older minizip