2222671 - fix FTBFS due Python3 rebase

2222648 - fix FailToInstall due Perl rebase
This commit is contained in:
Zdenek Dohnal 2023-07-13 16:09:05 +02:00
parent 1da81559a3
commit 74af866c9b
3 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,62 @@
From 939e0db21a5145d6a84eb8922ba3dc3a14fb4572 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Wed, 12 Jul 2023 13:13:38 +0200
Subject: [PATCH] if_python3.c: Fix building dynamic Python3 interpreter
There are new extern global variables defined in python3 development
files, which types are within python3 library, so they break dynamic
python3 interpret Vim plugin.
Since the variables are used in macro `Py_SIZE` which is used in other
python3 headers, the dummy variables have to defined before including
Python.h.
---
src/if_python3.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/if_python3.c b/src/if_python3.c
index 240b88fac..f6704a31e 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -68,6 +68,8 @@
#endif
#define PY_SSIZE_T_CLEAN
+#define PyLong_Type (*py3_PyLong_Type)
+#define PyBool_Type (*py3_PyBool_Type)
#include <Python.h>
@@ -270,7 +272,6 @@ static HINSTANCE hinstPy3 = 0; // Instance of python.dll
# define PyFloat_Type (*py3_PyFloat_Type)
# define PyNumber_Check (*py3_PyNumber_Check)
# define PyNumber_Long (*py3_PyNumber_Long)
-# define PyBool_Type (*py3_PyBool_Type)
# define PyErr_NewException py3_PyErr_NewException
# ifdef Py_DEBUG
# define _Py_NegativeRefcount py3__Py_NegativeRefcount
@@ -448,7 +449,10 @@ static PyTypeObject* py3_PyType_Type;
static PyTypeObject* py3_PyStdPrinter_Type;
static PyTypeObject* py3_PySlice_Type;
static PyTypeObject* py3_PyFloat_Type;
-static PyTypeObject* py3_PyBool_Type;
+PyTypeObject* py3_PyBool_Type;
+# if PY_VERSION_HEX >= 0x030c00b0
+PyTypeObject* py3_PyLong_Type;
+# endif
static int (*py3_PyNumber_Check)(PyObject *);
static PyObject* (*py3_PyNumber_Long)(PyObject *);
static PyObject* (*py3_PyErr_NewException)(char *name, PyObject *base, PyObject *dict);
@@ -624,6 +628,9 @@ static struct
{"PySlice_Type", (PYTHON_PROC*)&py3_PySlice_Type},
{"PyFloat_Type", (PYTHON_PROC*)&py3_PyFloat_Type},
{"PyBool_Type", (PYTHON_PROC*)&py3_PyBool_Type},
+# if PY_VERSION_HEX >= 0x030c00b0
+ {"PyLong_Type", (PYTHON_PROC*)&py3_PyLong_Type},
+# endif
{"PyNumber_Check", (PYTHON_PROC*)&py3_PyNumber_Check},
{"PyNumber_Long", (PYTHON_PROC*)&py3_PyNumber_Long},
{"PyErr_NewException", (PYTHON_PROC*)&py3_PyErr_NewException},
--
2.41.0

48
perl538.patch Normal file
View File

@ -0,0 +1,48 @@
diff --git a/src/if_perl.xs b/src/if_perl.xs
index c69ed9ef1..2cf78b901 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -40,7 +40,7 @@
/* Work around for perl-5.18.
* Don't include "perl\lib\CORE\inline.h" for now,
* include it after Perl_sv_free2 is defined. */
-#ifdef DYNAMIC_PERL
+#if (PERL_REVISION == 5) && (PERL_VERSION >= 18)
# define PERL_NO_INLINE_FUNCTIONS
#endif
@@ -402,14 +402,14 @@ static bool (*Perl_sv_2bool)(pTHX_ SV*);
static IV (*Perl_sv_2iv)(pTHX_ SV*);
static SV* (*Perl_sv_2mortal)(pTHX_ SV*);
# if (PERL_REVISION == 5) && (PERL_VERSION >= 8)
-static char* (*Perl_sv_2pv_flags)(pTHX_ SV*, STRLEN*, I32);
+static char* (*Perl_sv_2pv_flags)(pTHX_ SV*, STRLEN* const, const U32);
static char* (*Perl_sv_2pv_nolen)(pTHX_ SV*);
# else
static char* (*Perl_sv_2pv)(pTHX_ SV*, STRLEN*);
# endif
static char* (*Perl_sv_2pvbyte)(pTHX_ SV*, STRLEN*);
# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
-static char* (*Perl_sv_2pvbyte_flags)(pTHX_ SV*, STRLEN*, I32);
+static char* (*Perl_sv_2pvbyte_flags)(pTHX_ SV*, STRLEN* const, const U32);
# endif
static SV* (*Perl_sv_bless)(pTHX_ SV*, HV*);
# if (PERL_REVISION == 5) && (PERL_VERSION >= 8)
@@ -710,7 +710,7 @@ S_POPMARK(pTHX)
# endif
/* perl-5.34 needs Perl_SvTRUE_common; used in SvTRUE_nomg_NN */
-# if (PERL_REVISION == 5) && (PERL_VERSION >= 34)
+# if (PERL_REVISION == 5) && (PERL_VERSION == 34)
PERL_STATIC_INLINE bool
Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback)
{
@@ -737,7 +737,7 @@ Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback)
# endif
/* perl-5.32 needs Perl_SvTRUE */
-# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+# if (PERL_REVISION == 5) && (PERL_VERSION == 32)
PERL_STATIC_INLINE bool
Perl_SvTRUE(pTHX_ SV *sv) {
if (!LIKELY(sv))

View File

@ -98,6 +98,10 @@ Patch3003: vim-python3-tests.patch
Patch3004: vim-crypto-warning.patch
# don't ever set mouse (Fedora downstream patch)
Patch3005: vim-8.0-copy-paste.patch
# https://github.com/vim/vim/pull/12660
Patch3006: 0001-if_python3.c-Fix-building-dynamic-Python3-interprete.patch
# https://github.com/vim/vim/pull/12575 + https://github.com/vim/vim/pull/12575#issuecomment-1634226250
Patch3007: perl538.patch
# uses autoconf in spec file
@ -408,6 +412,8 @@ perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk
%patch -P 3003 -p1 -b .python-tests
%patch -P 3004 -p1 -b .fips-warning
%patch -P 3005 -p1 -b .copypaste
%patch -P 3006 -p1 -b .python312
%patch -P 3007 -p1 -b .perl538
%build
cd src
@ -1030,6 +1036,10 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%changelog
* Thu Jul 13 2023 Zdenek Dohnal <zdohnal@redhat.com> - 2:9.0.1677-1
- 2222671 - fix FTBFS due Python3 rebase
- 2222648 - fix FailToInstall due Perl rebase
* Tue Jul 11 2023 Zdenek Dohnal <zdohnal@redhat.com> - 2:9.0.1677-1
- patchlevel 1677