diff --git a/abi_symbols b/abi_symbols --- a/abi_symbols +++ b/abi_symbols @@ -1461,6 +1461,7 @@ libkvipythoncore.so:__bss_start libkvipythoncore.so:_edata libkvipythoncore.so:_end +libkvipythoncore.so:python_init libkviraweditor.so:KVIrc_module_info libkviraweditor.so:__bss_start libkviraweditor.so:_edata diff --git a/abi_used_libs b/abi_used_libs --- a/abi_used_libs +++ b/abi_used_libs @@ -28,7 +28,7 @@ libperl.so libphonon4qt5.so.4 libpthread.so.0 -libpython2.7.so.1.0 +libpython3.9.so.1.0 libssl.so.1.1 libstdc++.so.6 libtheoradec.so.1 diff --git a/abi_used_symbols b/abi_used_symbols --- a/abi_used_symbols +++ b/abi_used_symbols @@ -3675,22 +3675,22 @@ libpthread.so.0:send libpthread.so.0:sigaction libpthread.so.0:write -libpython2.7.so.1.0:PyArg_ParseTuple -libpython2.7.so.1.0:PyCObject_FromVoidPtr -libpython2.7.so.1.0:PyErr_Occurred -libpython2.7.so.1.0:PyEval_InitThreads -libpython2.7.so.1.0:PyEval_RestoreThread -libpython2.7.so.1.0:PyEval_SaveThread -libpython2.7.so.1.0:PyImport_AppendInittab -libpython2.7.so.1.0:PyModule_AddObject -libpython2.7.so.1.0:PyRun_SimpleStringFlags -libpython2.7.so.1.0:PyThreadState_Swap -libpython2.7.so.1.0:Py_BuildValue -libpython2.7.so.1.0:Py_EndInterpreter -libpython2.7.so.1.0:Py_Finalize -libpython2.7.so.1.0:Py_InitModule4_64 -libpython2.7.so.1.0:Py_Initialize -libpython2.7.so.1.0:Py_NewInterpreter +libpython3.9.so.1.0:PyArg_ParseTuple +libpython3.9.so.1.0:PyCapsule_New +libpython3.9.so.1.0:PyErr_Occurred +libpython3.9.so.1.0:PyEval_InitThreads +libpython3.9.so.1.0:PyEval_RestoreThread +libpython3.9.so.1.0:PyEval_SaveThread +libpython3.9.so.1.0:PyImport_AppendInittab +libpython3.9.so.1.0:PyModule_AddObject +libpython3.9.so.1.0:PyModule_Create2 +libpython3.9.so.1.0:PyRun_SimpleStringFlags +libpython3.9.so.1.0:PyThreadState_Swap +libpython3.9.so.1.0:Py_BuildValue +libpython3.9.so.1.0:Py_EndInterpreter +libpython3.9.so.1.0:Py_Finalize +libpython3.9.so.1.0:Py_Initialize +libpython3.9.so.1.0:Py_NewInterpreter libssl.so.1.1:OPENSSL_init_ssl libssl.so.1.1:SSL_CIPHER_description libssl.so.1.1:SSL_CIPHER_get_bits diff --git a/files/0001-Add-support-for-Python-3.patch b/files/0001-Add-support-for-Python-3.patch new file mode 100644 --- /dev/null +++ b/files/0001-Add-support-for-Python-3.patch @@ -0,0 +1,115 @@ +From dbe8ef6dad916124c3714abc469403ed9991261c Mon Sep 17 00:00:00 2001 +From: wodim +Date: Sat, 26 Aug 2017 15:02:56 +0200 +Subject: [PATCH] Add support for Python 3 + +--- + CMakeLists.txt | 7 ++---- + src/modules/python/libkvipython.cpp | 26 ++++++++++++++++++++ + src/modules/pythoncore/kvircmodule.cpp | 2 +- + src/modules/pythoncore/pythonheaderwrapper.h | 6 +++++ + 4 files changed, 35 insertions(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 57df293..1e07dd1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -67,9 +67,6 @@ set(CMAKE_KVIRC_BUILD_CPU ${CMAKE_SYSTEM_PROCESSOR}) + set(CMAKE_KVIRC_BUILD_COMPILER ${CMAKE_CXX_COMPILER}) + set(CMAKE_KVIRC_BUILD_COMPILER_FLAGS ${CMAKE_CXX_FLAGS}) + +-# Prefer Python 2.7 over 3.x (which is currently incompatible) - GitHub issue #2020 +-set(Python_ADDITIONAL_VERSIONS "2.7") +- + # Suffix for GNU/Linux + set(LIB_SUFFIX + CACHE STRING "Define suffix of directory name (32/64)" +@@ -751,10 +748,10 @@ endif() + # Check for Python support + option(WANT_PYTHON "Compile Python support" ON) + if(WANT_PYTHON) +- find_package(PythonLibs 2.7) ++ find_package(PythonLibs) + if(PYTHONLIBS_FOUND) + set(COMPILE_PYTHON_SUPPORT 1) +- set(CMAKE_STATUS_PYTHON_SUPPORT "Yes") ++ set(CMAKE_STATUS_PYTHON_SUPPORT "Yes, Python ${PYTHONLIBS_VERSION_STRING}") + list(APPEND LIBS ${PYTHON_LIBRARIES}) + include_directories(${PYTHON_INCLUDE_DIRS}) + else() +diff --git a/src/modules/python/libkvipython.cpp b/src/modules/python/libkvipython.cpp +index 6bdd56a80..700e8939b 100644 +--- a/src/modules/python/libkvipython.cpp ++++ b/src/modules/python/libkvipython.cpp +@@ -502,6 +502,31 @@ static bool python_kvs_fnc_isAvailable(KviKvsModuleFunctionCall * c) + return true; + } + ++/* ++ @doc: python.version ++ @type: ++ function ++ @title: ++ $python.version ++ @short: ++ Check which version of Python is supported in this build of KVIrc ++ @syntax: ++ $python.version ++ @description: ++ Returns which major version of Python is KVIrc linked to ([b]2[/b] or [b]3[/b]) ++ or [b]0[/b] if Python is not supported at all. ++*/ ++ ++static bool python_kvs_fnc_version(KviKvsModuleFunctionCall * c) ++{ ++#ifdef COMPILE_PYTHON_SUPPORT ++ c->returnValue()->setInteger(PY_MAJOR_VERSION); ++#else ++ c->returnValue()->setBoolean(false); ++#endif ++ return true; ++} ++ + static bool python_module_init(KviModule * m) + { + // register the command anyway +@@ -509,6 +534,7 @@ static bool python_module_init(KviModule * m) + KVSM_REGISTER_SIMPLE_COMMAND(m, "destroy", python_kvs_cmd_destroy); + + KVSM_REGISTER_FUNCTION(m, "isAvailable", python_kvs_fnc_isAvailable); ++ KVSM_REGISTER_FUNCTION(m, "version", python_kvs_fnc_version); + #ifdef COMPILE_PYTHON_SUPPORT + g_pPythonCoreModule = g_pModuleManager->getModule("pythoncore"); + #endif +diff --git a/src/modules/pythoncore/kvircmodule.cpp b/src/modules/pythoncore/kvircmodule.cpp +index 8937b6a63..659345d7e 100644 +--- a/src/modules/pythoncore/kvircmodule.cpp ++++ b/src/modules/pythoncore/kvircmodule.cpp +@@ -423,7 +423,7 @@ PyMODINIT_FUNC python_init() + else + { + // Create a CObject containing the API pointer array's address +- PyObject * pC_API_Object = PyCObject_FromVoidPtr(PyKVIrc_API, nullptr); ++ PyObject * pC_API_Object = PyCapsule_New((void *)PyKVIrc_API, "kvirc._C_API", nullptr); + if(pC_API_Object) + PyModule_AddObject(pModule, "_C_API", pC_API_Object); + } +diff --git a/src/modules/pythoncore/pythonheaderwrapper.h b/src/modules/pythoncore/pythonheaderwrapper.h +index 47f60d361..2b34066c3 100644 +--- a/src/modules/pythoncore/pythonheaderwrapper.h ++++ b/src/modules/pythoncore/pythonheaderwrapper.h +@@ -1,6 +1,12 @@ + #ifndef _PYTHONHEADERWRAPPER_H_ + #define _PYTHONHEADERWRAPPER_H_ + ++// As of Python 3, something inside defines a struct with a member ++// called "slots" which conflicts with the builtin Qt keyword. But since we ++// include stuff from KVIrc itself back into the python module, we can't just ++// use QT_NO_KEYWORDS. ++#undef slots ++ + // See http://stackoverflow.com/questions/16200997/why-doesnt-include-python-h-work and http://stackoverflow.com/questions/19716859/puzzling-dependency-of-boost-python-1-54-debug-build-to-python27-lib-on-window + + #if defined(_DEBUG) && defined(_MSC_VER) +-- +2.25.0 diff --git a/files/0001-Replace-FindPythonLibs-with-FindPython3-in-CMake.patch b/files/0001-Replace-FindPythonLibs-with-FindPython3-in-CMake.patch new file mode 100644 --- /dev/null +++ b/files/0001-Replace-FindPythonLibs-with-FindPython3-in-CMake.patch @@ -0,0 +1,43 @@ +From 2c881f711d518bbe4db95bf183ddc946c12f7751 Mon Sep 17 00:00:00 2001 +From: Alexey Sokolov +Date: Sun, 29 Dec 2019 23:26:31 +0000 +Subject: [PATCH] Replace FindPythonLibs with FindPython3 in CMake + +--- + CMakeLists.txt | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1e07dd1..7e3607d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -34,7 +34,7 @@ + ############################################################################### + + # Minimum CMake version +-cmake_minimum_required(VERSION 3.1.0) ++cmake_minimum_required(VERSION 3.12.0) + + # Name of the project + project(kvirc) +@@ -748,12 +748,12 @@ endif() + # Check for Python support + option(WANT_PYTHON "Compile Python support" ON) + if(WANT_PYTHON) +- find_package(PythonLibs) +- if(PYTHONLIBS_FOUND) ++ find_package(Python3 COMPONENTS Development) ++ if(Python3_FOUND) + set(COMPILE_PYTHON_SUPPORT 1) +- set(CMAKE_STATUS_PYTHON_SUPPORT "Yes, Python ${PYTHONLIBS_VERSION_STRING}") +- list(APPEND LIBS ${PYTHON_LIBRARIES}) +- include_directories(${PYTHON_INCLUDE_DIRS}) ++ set(CMAKE_STATUS_PYTHON_SUPPORT "Yes, Python ${Python3_VERSION}") ++ list(APPEND LIBS ${Python3_LIBRARIES}) ++ include_directories(${Python3_INCLUDE_DIRS}) + else() + set(CMAKE_STATUS_PYTHON_SUPPORT "No, not found.") + endif() + +-- +2.25.0 diff --git a/files/0001-Stop-unsetting-_DEBUG-when-including-Python.h.patch b/files/0001-Stop-unsetting-_DEBUG-when-including-Python.h.patch new file mode 100644 --- /dev/null +++ b/files/0001-Stop-unsetting-_DEBUG-when-including-Python.h.patch @@ -0,0 +1,32 @@ +From 79dbba4260113b453fcea155881ecb4c6f82963b Mon Sep 17 00:00:00 2001 +From: Alexey Sokolov +Date: Mon, 30 Dec 2019 07:32:51 +0000 +Subject: [PATCH] Stop unsetting _DEBUG when including Python.h + +Because of https://stackoverflow.com/questions/59126760/building-a-python-c-extension-on-windows-with-a-debug-python-installation +--- + src/modules/pythoncore/pythonheaderwrapper.h | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/src/modules/pythoncore/pythonheaderwrapper.h b/src/modules/pythoncore/pythonheaderwrapper.h +index 2b34066c3..173e3c289 100644 +--- a/src/modules/pythoncore/pythonheaderwrapper.h ++++ b/src/modules/pythoncore/pythonheaderwrapper.h +@@ -7,14 +7,6 @@ + // use QT_NO_KEYWORDS. + #undef slots + +-// See http://stackoverflow.com/questions/16200997/why-doesnt-include-python-h-work and http://stackoverflow.com/questions/19716859/puzzling-dependency-of-boost-python-1-54-debug-build-to-python27-lib-on-window +- +-#if defined(_DEBUG) && defined(_MSC_VER) +-# undef _DEBUG +-# include +-# define _DEBUG 1 +-#else +-# include +-#endif ++#include + + #endif +-- +2.25.0 diff --git a/files/0001-This-is-not-necessary-anymore.patch b/files/0001-This-is-not-necessary-anymore.patch new file mode 100644 --- /dev/null +++ b/files/0001-This-is-not-necessary-anymore.patch @@ -0,0 +1,55 @@ +From 77983c1ac38efa87a3c644b3918dd1648040aee0 Mon Sep 17 00:00:00 2001 +From: wodim +Date: Mon, 1 Apr 2019 15:02:39 +0200 +Subject: [PATCH] This is not necessary anymore + +--- + src/modules/python/libkvipython.cpp | 26 -------------------------- + 1 file changed, 26 deletions(-) + +diff --git a/src/modules/python/libkvipython.cpp b/src/modules/python/libkvipython.cpp +index 700e8939b..6bdd56a80 100644 +--- a/src/modules/python/libkvipython.cpp ++++ b/src/modules/python/libkvipython.cpp +@@ -502,31 +502,6 @@ static bool python_kvs_fnc_isAvailable(KviKvsModuleFunctionCall * c) + return true; + } + +-/* +- @doc: python.version +- @type: +- function +- @title: +- $python.version +- @short: +- Check which version of Python is supported in this build of KVIrc +- @syntax: +- $python.version +- @description: +- Returns which major version of Python is KVIrc linked to ([b]2[/b] or [b]3[/b]) +- or [b]0[/b] if Python is not supported at all. +-*/ +- +-static bool python_kvs_fnc_version(KviKvsModuleFunctionCall * c) +-{ +-#ifdef COMPILE_PYTHON_SUPPORT +- c->returnValue()->setInteger(PY_MAJOR_VERSION); +-#else +- c->returnValue()->setBoolean(false); +-#endif +- return true; +-} +- + static bool python_module_init(KviModule * m) + { + // register the command anyway +@@ -534,7 +509,6 @@ static bool python_module_init(KviModule * m) + KVSM_REGISTER_SIMPLE_COMMAND(m, "destroy", python_kvs_cmd_destroy); + + KVSM_REGISTER_FUNCTION(m, "isAvailable", python_kvs_fnc_isAvailable); +- KVSM_REGISTER_FUNCTION(m, "version", python_kvs_fnc_version); + #ifdef COMPILE_PYTHON_SUPPORT + g_pPythonCoreModule = g_pModuleManager->getModule("pythoncore"); + #endif +-- +2.25.0 diff --git a/files/series b/files/series new file mode 100644 --- /dev/null +++ b/files/series @@ -0,0 +1,5 @@ +0001-Add-support-for-Python-3.patch +0001-This-is-not-necessary-anymore.patch +0001-Replace-FindPythonLibs-with-FindPython3-in-CMake.patch +0001-Stop-unsetting-_DEBUG-when-including-Python.h.patch +Fix-build-with-Qt-5.15.patch diff --git a/package.yml b/package.yml --- a/package.yml +++ b/package.yml @@ -1,8 +1,9 @@ name : kvirc version : 5.0.0 -release : 6 +release : 7 source : - https://github.com/kvirc/KVIrc/archive/5.0.0.tar.gz : 452e683760221055f117d2ab4359aa432e01ce5d5e3abe80772b7a13a78b594a +homepage : https://www.kvirc.net/ license : GPL-2.0-or-later component : network.irc summary : The KVIrc IRC Client @@ -15,6 +16,7 @@ - pkgconfig(Qt5X11Extras) - pkgconfig(enchant-2) - pkgconfig(phonon4qt5) + - pkgconfig(python3) - pkgconfig(xcb) - pkgconfig(theora) - pkgconfig(vorbis) @@ -26,7 +28,7 @@ - kxmlgui-devel libsplit : no setup : | - %patch -p1 < $pkgfiles/Fix-build-with-Qt-5.15.patch + %apply_patches %cmake_ninja \ -DUSE_ENV_FLAGS=ON \ -DWANT_DCC_VIDEO=ON \ diff --git a/pspec_x86_64.xml b/pspec_x86_64.xml --- a/pspec_x86_64.xml +++ b/pspec_x86_64.xml @@ -1,9 +1,10 @@ kvirc + https://www.kvirc.net/ - Joshua Strobl - joshua@getsol.us + Algent Albrahimi + algent@protonmail.com GPL-2.0-or-later network.irc @@ -2314,12 +2315,12 @@ - - 2021-06-15 + + 2021-08-28 5.0.0 Packaging update - Joshua Strobl - joshua@getsol.us + Algent Albrahimi + algent@protonmail.com \ No newline at end of file