2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchPypi
|
|
|
|
, 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";
|
2022-02-10 20:34:41 +00:00
|
|
|
version = "0.38.0";
|
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
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-02-10 20:34:41 +00:00
|
|
|
sha256 = "a99d166ccf3b116f3b9ed23b9b70ba2415640a9c978f3aaa13fad49c58f4965c";
|
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
|
|
|
};
|
|
|
|
}
|