1{ stdenv
2, fetchurl
3, buildPythonPackage
4, python
5, llvm
6, pythonOlder
7, isPyPy
8, enum34
9}:
10
11buildPythonPackage rec {
12 pname = "llvmlite";
13 name = "${pname}-${version}";
14 version = "0.19.0";
15
16 disabled = isPyPy;
17
18 src = fetchurl {
19 url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz";
20 sha256 = "fbaeb3d584e0f6bac82a33776e9b5f0b5b4a3415a03edeff5d66f6176f0edbe2";
21 };
22
23 propagatedBuildInputs = [ llvm ] ++ stdenv.lib.optional (pythonOlder "3.4") enum34;
24
25 # Disable static linking
26 # https://github.com/numba/llvmlite/issues/93
27 patchPhase = ''
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}