2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildPythonPackage,
|
|
|
|
isPyPy,
|
|
|
|
pythonAtLeast,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
setuptools,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
2024-09-19 14:19:46 +00:00
|
|
|
pytestCheckHook,
|
|
|
|
llvm,
|
|
|
|
libxml2,
|
|
|
|
|
|
|
|
withStaticLLVM ? true,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "llvmlite";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.43.0";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
disabled = isPyPy || pythonAtLeast "3.13";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "numba";
|
|
|
|
repo = "llvmlite";
|
2024-01-13 08:15:51 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-5QBSRDb28Bui9IOhGofj+c7Rk7J5fNv5nPksEPY/O5o=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
build-system = [ setuptools ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
buildInputs = [ llvm ] ++ lib.optionals withStaticLLVM [ libxml2.dev ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
postPatch = lib.optionalString withStaticLLVM ''
|
|
|
|
substituteInPlace ffi/build.py --replace-fail "--system-libs --libs all" "--system-libs --libs --link-static all"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Set directory containing llvm-config binary
|
2024-09-19 14:19:46 +00:00
|
|
|
env.LLVM_CONFIG = "${llvm.dev}/bin/llvm-config";
|
|
|
|
|
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
# https://github.com/NixOS/nixpkgs/issues/255262
|
|
|
|
preCheck = ''
|
|
|
|
cd $out
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
__impureHostDeps = lib.optionals stdenv.hostPlatform.isDarwin [ "/usr/lib/libm.dylib" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
passthru = lib.optionalAttrs (!withStaticLLVM) { inherit llvm; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
meta = {
|
2024-01-13 08:15:51 +00:00
|
|
|
changelog = "https://github.com/numba/llvmlite/blob/v${version}/CHANGE_LOG";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Lightweight LLVM python binding for writing JIT compilers";
|
2024-01-13 08:15:51 +00:00
|
|
|
downloadPage = "https://github.com/numba/llvmlite";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://llvmlite.pydata.org/";
|
2024-09-19 14:19:46 +00:00
|
|
|
license = lib.licenses.bsd2;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|