1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 isPyPy,
7 pythonAtLeast,
8
9 # build-system
10 llvm,
11 setuptools,
12
13 # tests
14 python,
15}:
16
17buildPythonPackage rec {
18 pname = "llvmlite";
19 version = "0.43.0";
20 pyproject = true;
21
22 disabled = isPyPy || pythonAtLeast "3.13";
23
24 src = fetchFromGitHub {
25 owner = "numba";
26 repo = "llvmlite";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-5QBSRDb28Bui9IOhGofj+c7Rk7J5fNv5nPksEPY/O5o=";
29 };
30
31 nativeBuildInputs = [
32 llvm
33 setuptools
34 ];
35
36 # Disable static linking
37 # https://github.com/numba/llvmlite/issues/93
38 postPatch = ''
39 substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" ""
40
41 substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope"
42 '';
43
44 # Set directory containing llvm-config binary
45 preConfigure = ''
46 export LLVM_CONFIG=${llvm.dev}/bin/llvm-config
47 '';
48
49 checkPhase = ''
50 runHook preCheck
51 ${python.executable} runtests.py
52 runHook postCheck
53 '';
54
55 __impureHostDeps = lib.optionals stdenv.isDarwin [ "/usr/lib/libm.dylib" ];
56
57 passthru.llvm = llvm;
58
59 meta = with lib; {
60 changelog = "https://github.com/numba/llvmlite/blob/v${version}/CHANGE_LOG";
61 description = "Lightweight LLVM python binding for writing JIT compilers";
62 downloadPage = "https://github.com/numba/llvmlite";
63 homepage = "http://llvmlite.pydata.org/";
64 license = licenses.bsd2;
65 };
66}