2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2023-08-10 07:59:29 +00:00
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, isPyPy
|
2024-01-13 08:15:51 +00:00
|
|
|
, pythonAtLeast
|
|
|
|
|
|
|
|
# build-system
|
|
|
|
, llvm
|
|
|
|
, setuptools
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, python
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "llvmlite";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "0.42.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-02-29 20:09:43 +00:00
|
|
|
hash = "sha256-vN2npyAyN6C340l69YSRtRJrAe4EHSqh4SCgWfeSQaQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
llvm
|
|
|
|
setuptools
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Disable static linking
|
|
|
|
# https://github.com/numba/llvmlite/issues/93
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" ""
|
|
|
|
|
|
|
|
substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope"
|
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Set directory containing llvm-config binary
|
|
|
|
preConfigure = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
export LLVM_CONFIG=${llvm.dev}/bin/llvm-config
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
checkPhase = ''
|
2024-01-13 08:15:51 +00:00
|
|
|
runHook preCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
${python.executable} runtests.py
|
2024-01-13 08:15:51 +00:00
|
|
|
runHook postCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
__impureHostDeps = lib.optionals stdenv.isDarwin [ "/usr/lib/libm.dylib" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
passthru.llvm = llvm;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2024-01-13 08:15:51 +00:00
|
|
|
changelog = "https://github.com/numba/llvmlite/blob/v${version}/CHANGE_LOG";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A 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/";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = licenses.bsd2;
|
|
|
|
maintainers = with maintainers; [ fridh ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|