1{ lib
2, stdenv
3, fetchPypi
4, buildPythonPackage
5, python
6, llvm
7, pythonOlder
8, isPyPy
9, enum34
10, isPy3k
11}:
12
13buildPythonPackage rec {
14 pname = "llvmlite";
15 version = "0.39.1";
16
17 disabled = isPyPy || !isPy3k;
18
19 src = fetchPypi {
20 inherit pname version;
21 sha256 = "sha256-tDq9fILoBSYcQl1QM1vppsT4QmTjTW1uR1IHMAAF1XI=";
22 };
23
24 nativeBuildInputs = [ llvm ];
25 propagatedBuildInputs = lib.optional (pythonOlder "3.4") enum34;
26
27 # Disable static linking
28 # https://github.com/numba/llvmlite/issues/93
29 postPatch = ''
30 substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" ""
31
32 substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope"
33 '';
34
35 # Set directory containing llvm-config binary
36 preConfigure = ''
37 export LLVM_CONFIG=${llvm.dev}/bin/llvm-config
38 '';
39
40 checkPhase = ''
41 ${python.executable} runtests.py
42 '';
43
44 __impureHostDeps = lib.optionals stdenv.isDarwin [ "/usr/lib/libm.dylib" ];
45
46 passthru.llvm = llvm;
47
48 meta = with lib; {
49 description = "A lightweight LLVM python binding for writing JIT compilers";
50 homepage = "http://llvmlite.pydata.org/";
51 license = licenses.bsd2;
52 maintainers = with maintainers; [ fridh ];
53 };
54}