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