From 67139759d7d1824419947ccb574d0461f200ed6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Thu, 22 Sep 2022 07:55:02 +0700 Subject: [PATCH] kore: fix build for Python 3.11 (not ready yet) --- srcpkgs/kore/patches/python-3.11.patch | 35 ++++++++++++++++++++++++++ srcpkgs/kore/template | 12 ++++----- 2 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 srcpkgs/kore/patches/python-3.11.patch diff --git a/srcpkgs/kore/patches/python-3.11.patch b/srcpkgs/kore/patches/python-3.11.patch new file mode 100644 index 000000000000..899679ef082c --- /dev/null +++ b/srcpkgs/kore/patches/python-3.11.patch @@ -0,0 +1,35 @@ +diff --git a/src/python.c b/src/python.c +index ab0f3c6..526d443 100644 +--- a/src/python.c ++++ b/src/python.c +@@ -1192,8 +1192,14 @@ python_coro_trace(const char *label, struct python_coro *coro) + + gen = (PyGenObject *)coro->obj; + +- if (gen->gi_frame != NULL && gen->gi_frame->f_code != NULL) { +- code = gen->gi_frame->f_code; ++#if PY_VERSION_HEX < 0x030B0000 ++ code = NULL; ++ if (gen->gi_frame != NULL) ++ code = gen->gi_frame->f_code; ++#else ++ code = gen->gi_code; ++#endif ++ if (code != NULL) { + func = PyUnicode_AsUTF8AndSize(code->co_name, NULL); + file = PyUnicode_AsUTF8AndSize(code->co_filename, NULL); + +@@ -1206,8 +1206,13 @@ python_coro_trace(const char *label, struct python_coro *coro) + fname = "unknown"; + } + ++#if PY_VERSION_HEX <= 0x030B0000 + if (gen->gi_frame != NULL) + line = PyFrame_GetLineNumber(gen->gi_frame); ++#else ++ if (code != NULL) ++ line = PyCode_Addr2Line(code, 0); ++#endif + else + line = -1; + diff --git a/srcpkgs/kore/template b/srcpkgs/kore/template index 715f92118e9d..9128432317a3 100644 --- a/srcpkgs/kore/template +++ b/srcpkgs/kore/template @@ -6,9 +6,10 @@ revision=1 archs="x86_64* aarch64* ppc64*" build_style=gnu-makefile make_use_env=yes -make_build_args="CURL=1 TASKS=1 PGSQL=1 JSONRPC=1 ACME=1" -hostmakedepends="postgresql-libs-devel" -makedepends="openssl-devel libcurl-devel postgresql-libs-devel yajl-devel" +make_build_args="CURL=1 TASKS=1 PGSQL=1 JSONRPC=1 ACME=1 PYTHON=1" +hostmakedepends="postgresql-libs-devel python3" +makedepends="openssl-devel libcurl-devel postgresql-libs-devel yajl-devel + python3-devel" short_desc="Easy to use web platform for writing scalable web APIs in C" maintainer="Helmut Pozimski " license="ISC" @@ -23,10 +24,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then makedepends+=" musl-legacy-compat" fi -if [ -z "$CROSS_BUILD" ]; then - makedepends+=" python3-devel" - make_build_args+=" PYTHON=1" -fi +LDFLAGS=-lpython3 post_install() { vlicense LICENSE