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