1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 buildPythonPackage, 6 isPyPy, 7 pythonAtLeast, 8 9 setuptools, 10 11 # tests 12 pytestCheckHook, 13 llvm, 14 libxml2, 15 16 withStaticLLVM ? true, 17}: 18 19buildPythonPackage rec { 20 pname = "llvmlite"; 21 version = "0.44.0"; 22 pyproject = true; 23 24 disabled = isPyPy || pythonAtLeast "3.14"; 25 26 src = fetchFromGitHub { 27 owner = "numba"; 28 repo = "llvmlite"; 29 tag = "v${version}"; 30 hash = "sha256-ZIA/JfK9ZP00Zn6SZuPus30Xw10hn3DArHCkzBZAUV0="; 31 }; 32 33 build-system = [ setuptools ]; 34 35 buildInputs = [ llvm ] ++ lib.optionals withStaticLLVM [ libxml2.dev ]; 36 37 postPatch = lib.optionalString withStaticLLVM '' 38 substituteInPlace ffi/build.py --replace-fail "--system-libs --libs all" "--system-libs --libs --link-static all" 39 ''; 40 41 # Set directory containing llvm-config binary 42 env.LLVM_CONFIG = "${llvm.dev}/bin/llvm-config"; 43 44 nativeCheckInputs = [ pytestCheckHook ]; 45 46 # https://github.com/NixOS/nixpkgs/issues/255262 47 preCheck = '' 48 cd $out 49 ''; 50 51 __impureHostDeps = lib.optionals stdenv.hostPlatform.isDarwin [ "/usr/lib/libm.dylib" ]; 52 53 passthru = lib.optionalAttrs (!withStaticLLVM) { inherit llvm; }; 54 55 meta = { 56 changelog = "https://github.com/numba/llvmlite/blob/v${version}/CHANGE_LOG"; 57 description = "Lightweight LLVM python binding for writing JIT compilers"; 58 downloadPage = "https://github.com/numba/llvmlite"; 59 homepage = "http://llvmlite.pydata.org/"; 60 license = lib.licenses.bsd2; 61 }; 62}