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
|
|
|
|
, python
|
|
|
|
, llvm
|
|
|
|
, pythonOlder
|
|
|
|
, isPyPy
|
|
|
|
, enum34
|
2020-06-02 18:00:15 +00:00
|
|
|
, isPy3k
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "llvmlite";
|
2023-08-10 07:59:29 +00:00
|
|
|
# The main dependency of llvmlite is numba, which we currently package an
|
|
|
|
# untagged version of it (for numpy>1.25 support). That numba version
|
|
|
|
# requires at least this version of llvmlite (also not yet officially
|
|
|
|
# released, but at least tagged).
|
|
|
|
version = "0.41.0dev0";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-06-02 18:00:15 +00:00
|
|
|
disabled = isPyPy || !isPy3k;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "numba";
|
|
|
|
repo = "llvmlite";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-fsH+rqouweNENU+YlWr7m0bC0YdreQLNp1n2rwrOiFw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ llvm ];
|
2021-09-18 10:52:07 +00:00
|
|
|
propagatedBuildInputs = lib.optional (pythonOlder "3.4") enum34;
|
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 = ''
|
|
|
|
${python.executable} runtests.py
|
|
|
|
'';
|
|
|
|
|
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; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A lightweight LLVM python binding for writing JIT compilers";
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|