diff --git a/0001-if_python3.c-Fixing-linker-errors-in-dynamically-lin.patch b/0001-if_python3.c-Fixing-linker-errors-in-dynamically-lin.patch new file mode 100644 index 0000000..65f06bc --- /dev/null +++ b/0001-if_python3.c-Fixing-linker-errors-in-dynamically-lin.patch @@ -0,0 +1,137 @@ +From 4fb89067dca5cee1611461badcbb80a1a36ae963 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Wed, 15 Jul 2020 10:45:26 +0200 +Subject: [PATCH] if_python3.c: Fixing linker errors in dynamically linked + python3 interpreter + +--- + src/if_python3.c | 31 +++++++++++++++++++++++-------- + 1 file changed, 23 insertions(+), 8 deletions(-) + +diff --git a/src/if_python3.c b/src/if_python3.c +index d540226b3..8c85708da 100644 +--- a/src/if_python3.c ++++ b/src/if_python3.c +@@ -203,6 +203,9 @@ typedef PySliceObject PySliceObject_T; + # define PySys_GetObject py3_PySys_GetObject + # define PySys_SetArgv py3_PySys_SetArgv + # define PyType_Ready py3_PyType_Ready ++# if PY_VERSION_HEX >= 0x030800f0 ++# define PyType_HasFeature py3_PyType_HasFeature ++# endif + #undef Py_BuildValue + # define Py_BuildValue py3_Py_BuildValue + # define Py_SetPythonHome py3_Py_SetPythonHome +@@ -233,6 +236,9 @@ typedef PySliceObject PySliceObject_T; + # define PyBytes_FromString py3_PyBytes_FromString + # undef PyBytes_FromStringAndSize + # define PyBytes_FromStringAndSize py3_PyBytes_FromStringAndSize ++# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030800f0 ++# define _Py_Dealloc py3__Py_Dealloc ++# endif + # define PyFloat_FromDouble py3_PyFloat_FromDouble + # define PyFloat_AsDouble py3_PyFloat_AsDouble + # define PyObject_GenericGetAttr py3_PyObject_GenericGetAttr +@@ -247,12 +253,11 @@ typedef PySliceObject PySliceObject_T; + # ifdef Py_DEBUG + # define _Py_NegativeRefcount py3__Py_NegativeRefcount + # define _Py_RefTotal (*py3__Py_RefTotal) +-# define _Py_Dealloc py3__Py_Dealloc + # define PyModule_Create2TraceRefs py3_PyModule_Create2TraceRefs + # else + # define PyModule_Create2 py3_PyModule_Create2 + # endif +-# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC) ++# if (defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030800f0) && !defined(Py_DEBUG_NO_PYMALLOC) + # define _PyObject_DebugMalloc py3__PyObject_DebugMalloc + # define _PyObject_DebugFree py3__PyObject_DebugFree + # else +@@ -282,7 +287,7 @@ typedef PySliceObject PySliceObject_T; + # define PyCapsule_New py3_PyCapsule_New + # define PyCapsule_GetPointer py3_PyCapsule_GetPointer + +-# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC) ++# if (defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030800f0) && !defined(Py_DEBUG_NO_PYMALLOC) + # undef PyObject_NEW + # define PyObject_NEW(type, typeobj) \ + ( (type *) PyObject_Init( \ +@@ -352,6 +357,9 @@ static PyObject* (*py3_PyObject_Repr)(PyObject *); + static PyObject* (*py3_PyObject_GetItem)(PyObject *, PyObject *); + static int (*py3_PyObject_IsTrue)(PyObject *); + static PyObject* (*py3_Py_BuildValue)(char *, ...); ++# if PY_VERSION_HEX >= 0x030800f0 ++static int (*py3_PyType_HasFeature)(PyTypeObject *o, int feature); ++# endif + static int (*py3_PyType_Ready)(PyTypeObject *type); + static int (*py3_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item); + static PyObject* (*py3_PyUnicode_FromString)(const char *u); +@@ -396,6 +404,9 @@ static char* (*py3_PyBytes_AsString)(PyObject *bytes); + static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, Py_ssize_t *length); + static PyObject* (*py3_PyBytes_FromString)(char *str); + static PyObject* (*py3_PyBytes_FromStringAndSize)(char *str, Py_ssize_t length); ++# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030800f0 ++static void (*py3__Py_Dealloc)(PyObject *obj); ++# endif + static PyObject* (*py3_PyFloat_FromDouble)(double num); + static double (*py3_PyFloat_AsDouble)(PyObject *); + static PyObject* (*py3_PyObject_GenericGetAttr)(PyObject *obj, PyObject *name); +@@ -414,12 +425,11 @@ static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *); + # ifdef Py_DEBUG + static void (*py3__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op); + static Py_ssize_t* py3__Py_RefTotal; +-static void (*py3__Py_Dealloc)(PyObject *obj); + static PyObject* (*py3_PyModule_Create2TraceRefs)(struct PyModuleDef* module, int module_api_version); + # else + static PyObject* (*py3_PyModule_Create2)(struct PyModuleDef* module, int module_api_version); + # endif +-# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC) ++# if (defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030800f0) && !defined(Py_DEBUG_NO_PYMALLOC) + static void (*py3__PyObject_DebugFree)(void*); + static void* (*py3__PyObject_DebugMalloc)(size_t); + # else +@@ -525,6 +535,9 @@ static struct + {"PyObject_IsTrue", (PYTHON_PROC*)&py3_PyObject_IsTrue}, + {"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong}, + {"PyDict_New", (PYTHON_PROC*)&py3_PyDict_New}, ++# if PY_VERSION_HEX >= 0x030800f0 ++ {"PyType_HasFeature", (PYTHON_PROC*)&py3_PyType_HasFeature}, ++# endif + {"PyType_Ready", (PYTHON_PROC*)&py3_PyType_Ready}, + {"PyDict_SetItemString", (PYTHON_PROC*)&py3_PyDict_SetItemString}, + {"PyLong_AsLong", (PYTHON_PROC*)&py3_PyLong_AsLong}, +@@ -562,6 +575,9 @@ static struct + {"PyBytes_AsStringAndSize", (PYTHON_PROC*)&py3_PyBytes_AsStringAndSize}, + {"PyBytes_FromString", (PYTHON_PROC*)&py3_PyBytes_FromString}, + {"PyBytes_FromStringAndSize", (PYTHON_PROC*)&py3_PyBytes_FromStringAndSize}, ++# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030800f0 ++ {"_Py_Dealloc", (PYTHON_PROC*)&py3__Py_Dealloc}, ++# endif + {"PyFloat_FromDouble", (PYTHON_PROC*)&py3_PyFloat_FromDouble}, + {"PyFloat_AsDouble", (PYTHON_PROC*)&py3_PyFloat_AsDouble}, + {"PyObject_GenericGetAttr", (PYTHON_PROC*)&py3_PyObject_GenericGetAttr}, +@@ -578,12 +594,11 @@ static struct + # ifdef Py_DEBUG + {"_Py_NegativeRefcount", (PYTHON_PROC*)&py3__Py_NegativeRefcount}, + {"_Py_RefTotal", (PYTHON_PROC*)&py3__Py_RefTotal}, +- {"_Py_Dealloc", (PYTHON_PROC*)&py3__Py_Dealloc}, + {"PyModule_Create2TraceRefs", (PYTHON_PROC*)&py3_PyModule_Create2TraceRefs}, + # else + {"PyModule_Create2", (PYTHON_PROC*)&py3_PyModule_Create2}, + # endif +-# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC) ++# if (defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030800f0) && !defined(Py_DEBUG_NO_PYMALLOC) + {"_PyObject_DebugFree", (PYTHON_PROC*)&py3__PyObject_DebugFree}, + {"_PyObject_DebugMalloc", (PYTHON_PROC*)&py3__PyObject_DebugMalloc}, + # else +@@ -777,7 +792,7 @@ static int python_end_called = FALSE; + static void + call_PyObject_Free(void *p) + { +-#if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC) ++# if (defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030800f0) && !defined(Py_DEBUG_NO_PYMALLOC) + _PyObject_DebugFree(p); + #else + PyObject_Free(p); +-- +2.25.4 + diff --git a/vim.spec b/vim.spec index 149f298..7e0d7a6 100644 --- a/vim.spec +++ b/vim.spec @@ -21,7 +21,7 @@ Summary: The VIM editor URL: http://www.vim.org/ Name: vim Version: %{baseversion}.%{patchlevel} -Release: 1%{?dist} +Release: 2%{?dist} License: Vim and MIT Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2 Source1: vim.sh @@ -62,6 +62,8 @@ Patch3017: vim-python3-tests.patch # fips warning Patch3018: vim-crypto-warning.patch Patch3019: vim-lua-ftbfs.patch +# fix dynamic python3 linking with python3.8 +Patch3020: 0001-if_python3.c-Fixing-linker-errors-in-dynamically-lin.patch # gcc is no longer in buildroot by default BuildRequires: gcc @@ -250,6 +252,7 @@ perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk %patch3017 -p1 -b .python-tests %patch3018 -p1 %patch3019 -p1 -b .lua-ftbfs +%patch3020 -p1 -b .python38-ftbfs %build cd src @@ -299,19 +302,6 @@ make clean mv -f os_unix.h.save os_unix.h mv -f ex_cmds.c.save ex_cmds.c -# python introduced incompatible change in getting linker flags for compiling programs -# which use C python API. Remove %%if after F31 going EOL and leave the single export here. -# This LDFLAGS settings needs to be before vim+gvim configuration and after vi configuration -# to prevent vi (doesn't have python embedded interpreter) be linked with python. -# When assigning to LDFLAGS, we join the current LDFLAGS with python linker flags - it is -# because we already defined LDFLAGS above when Lua linker flag was added. If the manual -# Lua linker flag adding goes away, use %%{build_ldflags} in the concatenation instead of LDFLAGS -%if 0%{?fedora} > 31 || 0%{?rhel} > 8 -export LDFLAGS="%{build_ldflags} $(python3-config --libs --embed)" -%else -export LDFLAGS="%{build_ldflags} $(python3-config --libs)" -%endif - # More configure options: # --enable-xim - enabling X Input Method - international input module for X, # it is for multibyte languages in Vim with X @@ -789,7 +779,10 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags %{_datadir}/icons/locolor/*/apps/* %changelog -* Mon Jul 13 2020 Zdenek Dohnal - 2:8.2.1199-1 +* Wed Jul 15 2020 Zdenek Dohnal - 2:8.2.1199-1 +- fix python3 dynamic linking with python >= 3.8 + +* Tue Jul 14 2020 Zdenek Dohnal - 2:8.2.1199-1 - FTBFS with Lua - backported patch from upstream pull request to prevent linking with lua * Mon Jul 13 2020 Zdenek Dohnal - 2:8.2.1199-1