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