commit:     6367dfa08fbd26ec86f94b6b28ed6f861f9fd85a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 16 14:25:14 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Feb 16 14:25:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6367dfa0

dev-lang/python: Add USE=jit to 3.13.0_alpha4

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-lang/python/metadata.xml                |  3 +++
 dev-lang/python/python-3.13.0_alpha4.ebuild | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml
index 31350aebeb2b..22ce986e0676 100644
--- a/dev-lang/python/metadata.xml
+++ b/dev-lang/python/metadata.xml
@@ -14,6 +14,9 @@
                        to bootstrap pip and setuptools (if disabled, it will
                        be only possible to use venv `--without-pip`)
                </flag>
+               <flag name="jit">
+                       Enable experimental Just-In-Time compilation support.
+               </flag>
                <flag name="libedit">
                        Link readline extension against 
<pkg>dev-libs/libedit</pkg>
                        instead of <pkg>sys-libs/readline</pkg>

diff --git a/dev-lang/python/python-3.13.0_alpha4.ebuild 
b/dev-lang/python/python-3.13.0_alpha4.ebuild
index 2cd791faab28..08b7d322bbbf 100644
--- a/dev-lang/python/python-3.13.0_alpha4.ebuild
+++ b/dev-lang/python/python-3.13.0_alpha4.ebuild
@@ -2,10 +2,13 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="8"
+
+LLVM_COMPAT=( 16 )
+LLVM_OPTIONAL=1
 WANT_LIBTOOL="none"
 
-inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
-inherit python-utils-r1 toolchain-funcs verify-sig
+inherit autotools check-reqs flag-o-matic llvm-r1 multiprocessing
+inherit pax-utils python-utils-r1 toolchain-funcs verify-sig
 
 MY_PV=${PV/_alpha/a}
 MY_P="Python-${MY_PV%_p*}"
@@ -29,9 +32,10 @@ S="${WORKDIR}/${MY_P}"
 LICENSE="PSF-2"
 SLOT="${PYVER}"
 IUSE="
-       bluetooth build debug +ensurepip examples gdbm libedit
+       bluetooth build debug +ensurepip examples gdbm jit libedit
        +ncurses pgo +readline +sqlite +ssl test tk valgrind
 "
+REQUIRED_USE="jit? ( ${LLVM_REQUIRED_USE} )"
 RESTRICT="!test? ( test )"
 
 # Do not add a dependency on dev-lang/python to this ebuild.
@@ -83,6 +87,12 @@ BDEPEND="
        dev-build/autoconf-archive
        app-alternatives/awk
        virtual/pkgconfig
+       jit? (
+               $(llvm_gen_dep '
+                       sys-devel/clang:${LLVM_SLOT}
+                       sys-devel/llvm:${LLVM_SLOT}
+               ')
+       )
        verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 )
 "
 RDEPEND+="
@@ -108,6 +118,7 @@ pkg_pretend() {
 }
 
 pkg_setup() {
+       use jit && llvm-r1_pkg_setup
        use test && check-reqs_pkg_setup
 }
 
@@ -279,6 +290,7 @@ src_configure() {
                --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
 
                $(use_with debug assertions)
+               $(use_enable jit experimental-jit)
                $(use_enable pgo optimizations)
                $(use_with readline readline "$(usex libedit editline 
readline)")
                $(use_with valgrind)

Reply via email to