1
0
Fork 0

dev-python/llvmlite: add 0.39.1

I pilfered some patches from the Gentoo Science Overlay. They make other
improvements too, and I should include them here, but my standards are
low.
This commit is contained in:
Ryan Fox 2023-01-16 03:02:24 -08:00
parent 941fb17f00
commit 887033b98a
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
5 changed files with 153 additions and 2 deletions

View File

@ -1,3 +1,7 @@
AUX llvmlite-0.39.1-allow-py3.11.patch 273 BLAKE2B ef32f9abba749baa0e3cc8f682ef0dc975a560cf094dc7c02a922a3fc86429461bcb3a46e19110177f0ceebf42cbfc6a74977552f103ea51b6996b5ad2504081 SHA512 5f26b9929d9bf50937ca7f2b2dc7fd290561e12451b81cec26a861d2d875a2656a1600f49e90cdddd7f0ba10433a18f5191c6d664c8d8303c0d02cefd0994943
AUX llvmlite-0.39.1-llvm12.patch 3756 BLAKE2B 192559fcd9fd7c0f39358af0991c6fa856a963dcd54af29238fa529cbe1d4355257ca29f8adab129aa3898dd9322dd5b1cacde134f686ec14022ae4362d9cad0 SHA512 fceed3d30a6426ab614e8c2cce9b81e63394143eb75aab2baf9c7fd55984250d9293e724a539a10f89dd3c36e59701bbb31816c13604ebcef4b4a1e72e03aa03
AUX llvmlite-9999-830.patch 45913 BLAKE2B 086bd23a287238197906a1c85b63d2eeadcd56cab70e918f32f82f9e47cb710b060317656f39509162919dfa5b1c41e22dd78cdf9403d01361490bfb46a5fb0b SHA512 22d5edc9adb9050fc57d56df6e44f0c02765d11d460cc59ba69fa41d14273ec5e5d476049bb5afcf0ee616ab553dd95977e82cfc1430a85690c908be9d3e97c2
EBUILD llvmlite-9999.ebuild 840 BLAKE2B 9946594da07688154f02649946979e5256d4dc309bb8707b8258833be464bd6b4a01974325b6699da37c1188756f6d36402e77b809c29e505df73c81a58d629c SHA512 d97f7b95c7cd97072d1154e23a8dfedb063ef4bcad9339c05755a694be37d68d7a989a2826ab6e0cc663bf0fe43463b78c2b14380606093b16573dd30120d468
DIST llvmlite-0.39.1.gh.tar.gz 237119 BLAKE2B c2538994a6b9116d9a124ad8b8fff9c06d654bcdd345fb25251505b7577c6dffdfa56c9226250dbc2de6253cf6154523ec0d3cd849697a66cabf5b522c5e76ca SHA512 16b341300e4034aff4ce9553fec6b5923b9f4cb261c1ec0ee2cef6d87addcbebe8f4805dbc2fb30f357800fa029c3b6fc8ed62a5fdaad7c262e723c3b9c4ad32
EBUILD llvmlite-0.39.1.ebuild 807 BLAKE2B 99fd12df0d9e349dd7281fa230b0bcf925e3b31f1f65fdde46ced1c8dd3615fda2a7532362e8421059094b24860cabd7695f464dbbed5033bce466aea82983df SHA512 3e18857da84a8a786cd9e15c6f87e78f7c9fd5bf9a4f027f1f62c1e99dc2121b6a0f3d734941b9785dcd43e998576ddaafc97cc47c88523155396071337455f1
EBUILD llvmlite-9999.ebuild 840 BLAKE2B fad17ec0434a4ce05ac7ae73aacefa241c2efd7f7e17df041039956be3c3c2533a9c8e37229c8a21ec1d16b2771d79f0899f1d6daae96aea3b52eb5d62975989 SHA512 7b1666d0a2bdd7b64d804e0da00390c344aa775b669771f16c1503fa4de532126a83ab2abfb8b52639a3bfabd7abd57a18369bd8f07a477b498b9e03b01f34c3
MISC metadata.xml 367 BLAKE2B 90089234b5aa1e0ced1e8c5ee6f011209b3e09fb9943bfeffa433fc933398a4f4fe12e0ac74e3f17c1f11331bb39fabc38c9268743e3096cf4cd2b906ba90d42 SHA512 4e4f263e8efc77f803291c78d3dd98c096e584e918c79cba9c8a929bb36939efbe7a0f1fb299806980143c23fb1144b08051dd553a80a889a5c53406d32d72b4

View File

@ -0,0 +1,13 @@
diff --git a/setup.py b/setup.py
index 02b1604..a45c9b8 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,7 @@ except ImportError:
min_python_version = "3.7"
-max_python_version = "3.11" # exclusive
+max_python_version = "3.12" # exclusive
def _guard_py_ver():

View File

@ -0,0 +1,97 @@
From 1d928ebcd59b23b5050234a2bf71f9be7f5f6bd1 Mon Sep 17 00:00:00 2001
From: Richard Barnes <rbarnes@umn.edu>
Date: Wed, 1 Dec 2021 10:29:08 -0700
Subject: [PATCH] Enable LLVM-12 and LLVM-13
---
ffi/build.py | 5 ++---
ffi/targets.cpp | 2 ++
llvmlite/tests/test_binding.py | 19 ++++++++++++++++---
3 files changed, 20 insertions(+), 6 deletions(-)
Index: llvmlite-0.39.0/ffi/build.py
===================================================================
--- llvmlite-0.39.0.orig/ffi/build.py
+++ llvmlite-0.39.0/ffi/build.py
@@ -163,9 +163,8 @@ def main_posix(kind, library_ext):
print(msg)
print(warning + '\n')
else:
-
- if not out.startswith('11'):
- msg = ("Building llvmlite requires LLVM 11.x.x, got "
+ if not (out.startswith('11') or out.startswith('12') or out.startswith('13')):
+ msg = ("Building llvmlite requires LLVM 11-13.x.x, got "
"{!r}. Be sure to set LLVM_CONFIG to the right executable "
"path.\nRead the documentation at "
"http://llvmlite.pydata.org/ for more information about "
Index: llvmlite-0.39.0/ffi/targets.cpp
===================================================================
--- llvmlite-0.39.0.orig/ffi/targets.cpp
+++ llvmlite-0.39.0/ffi/targets.cpp
@@ -204,7 +204,9 @@ LLVMPY_CreateTargetMachine(LLVMTargetRef
rm = Reloc::DynamicNoPIC;
TargetOptions opt;
+#if LLVM_VERSION_MAJOR < 12
opt.PrintMachineCode = PrintMC;
+#endif
opt.MCOptions.ABIName = ABIName;
bool jit = JIT;
Index: llvmlite-0.39.0/llvmlite/tests/test_binding.py
===================================================================
--- llvmlite-0.39.0.orig/llvmlite/tests/test_binding.py
+++ llvmlite-0.39.0/llvmlite/tests/test_binding.py
@@ -18,6 +18,16 @@ from llvmlite.binding import ffi
from llvmlite.tests import TestCase
+def clean_string_whitespace(x: str) -> str:
+ # Remove trailing whitespace from the end of each line
+ x = re.sub(r"\s+$", "", x, flags=re.MULTILINE)
+ # Remove intermediate blank lines
+ x = re.sub(r"\n\s*\n", r"\n", x, flags=re.MULTILINE)
+ # Remove extraneous whitespace from the beginning and end of the string
+ x = x.strip()
+ return x
+
+
# arvm7l needs extra ABI symbols to link successfully
if platform.machine() == 'armv7l':
llvm.load_library_permanently('libgcc_s.so.1')
@@ -555,7 +565,10 @@ class TestMisc(BaseTest):
bd = ir.IRBuilder(fn.append_basic_block(name="<>!*''#"))
bd.ret(ir.Constant(ir.IntType(32), 12345))
asm = str(mod)
- self.assertEqual(asm, asm_nonalphanum_blocklabel)
+ self.assertEqual(
+ clean_string_whitespace(asm),
+ clean_string_whitespace(asm_nonalphanum_blocklabel)
+ )
def test_global_context(self):
gcontext1 = llvm.context.get_global_context()
@@ -640,7 +653,7 @@ class TestMisc(BaseTest):
def test_version(self):
major, minor, patch = llvm.llvm_version_info
# one of these can be valid
- valid = [(11,)]
+ valid = [(11,), (12,), (13,)]
self.assertIn((major,), valid)
self.assertIn(patch, range(10))
Index: llvmlite-0.39.0/ffi/passmanagers.cpp
===================================================================
--- llvmlite-0.39.0.orig/ffi/passmanagers.cpp
+++ llvmlite-0.39.0/ffi/passmanagers.cpp
@@ -17,9 +17,6 @@
#include "llvm-c/Transforms/IPO.h"
#include "llvm-c/Transforms/Scalar.h"
#include "llvm/IR/LegacyPassManager.h"
-#if LLVM_VERSION_MAJOR > 11
-#include "llvm/IR/RemarkStreamer.h"
-#endif
#include "llvm/IR/LLVMRemarkStreamer.h"
#include "llvm/Remarks/RemarkStreamer.h"
#include "llvm/Transforms/IPO.h"

View File

@ -0,0 +1,37 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{8..11} )
inherit distutils-r1
if [[ ${PV} == 9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/numba/llvmlite.git"
else
SRC_URI="https://github.com/numba/llvmlite/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
KEYWORDS="~amd64"
fi
DESCRIPTION="Lightweight LLVM bindings for Python"
HOMEPAGE="https://llvmlite.pydata.org/"
LICENSE="BSD-2"
SLOT="0"
RESTRICT="test"
DEPEND=""
RDEPEND="${DEPEND}"
BDEPEND="sys-devel/llvm:13"
PATCHES=(
"${FILESDIR}/${P}-llvm12.patch"
"${FILESDIR}/${P}-allow-py3.11.patch"
)
python_compile() {
export "LLVM_CONFIG=${EPREFIX}/usr/lib/llvm/13/bin/llvm-config"
distutils-r1_python_compile
}

View File

@ -1,4 +1,4 @@
# Copyright 1999-2022 Gentoo Authors
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8