1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 buildPythonPackage, 6 isPyPy, 7 pythonAtLeast, 8 9 setuptools, 10 11 cmake, 12 ninja, 13 14 llvm_20, 15 libxml2, 16 17 # tests 18 pytestCheckHook, 19 20 withStaticLLVM ? true, 21}: 22 23let 24 llvm = llvm_20; 25in 26 27buildPythonPackage rec { 28 pname = "llvmlite"; 29 version = "0.45.0"; 30 pyproject = true; 31 32 disabled = isPyPy || pythonAtLeast "3.14"; 33 34 src = fetchFromGitHub { 35 owner = "numba"; 36 repo = "llvmlite"; 37 tag = "v${version}"; 38 hash = "sha256-xONYpDGsx6lhbAjAqwFx5Vo3PxeFsblhZxkxTSjMWOE="; 39 }; 40 41 build-system = [ setuptools ]; 42 43 nativeBuildInputs = [ 44 cmake 45 ninja 46 ]; 47 48 buildInputs = [ llvm ] ++ lib.optionals withStaticLLVM [ libxml2.dev ]; 49 50 nativeCheckInputs = [ pytestCheckHook ]; 51 52 dontUseCmakeConfigure = true; 53 54 # https://github.com/NixOS/nixpkgs/issues/255262 55 preCheck = '' 56 cd $out 57 ''; 58 59 env.LLVMLITE_SHARED = !withStaticLLVM; 60 61 passthru = lib.optionalAttrs (!withStaticLLVM) { inherit llvm; }; 62 63 meta = { 64 changelog = "https://github.com/numba/llvmlite/blob/v${version}/CHANGE_LOG"; 65 description = "Lightweight LLVM python binding for writing JIT compilers"; 66 downloadPage = "https://github.com/numba/llvmlite"; 67 homepage = "http://llvmlite.pydata.org/"; 68 license = lib.licenses.bsd2; 69 }; 70}