1{ lib
2, stdenv
3, fetchFromGitHub
4, buildPythonPackage
5, python
6, llvm
7, pythonOlder
8, isPyPy
9, enum34
10, isPy3k
11}:
12
13buildPythonPackage rec {
14 pname = "llvmlite";
15 # The main dependency of llvmlite is numba, which we currently package an
16 # untagged version of it (for numpy>1.25 support). That numba version
17 # requires at least this version of llvmlite (also not yet officially
18 # released, but at least tagged).
19 version = "0.41.0dev0";
20
21 disabled = isPyPy || !isPy3k;
22
23 src = fetchFromGitHub {
24 owner = "numba";
25 repo = "llvmlite";
26 rev = "v${version}";
27 hash = "sha256-fsH+rqouweNENU+YlWr7m0bC0YdreQLNp1n2rwrOiFw=";
28 };
29
30 nativeBuildInputs = [ llvm ];
31 propagatedBuildInputs = lib.optional (pythonOlder "3.4") enum34;
32
33 # Disable static linking
34 # https://github.com/numba/llvmlite/issues/93
35 postPatch = ''
36 substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" ""
37
38 substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope"
39 '';
40
41 # Set directory containing llvm-config binary
42 preConfigure = ''
43 export LLVM_CONFIG=${llvm.dev}/bin/llvm-config
44 '';
45
46 checkPhase = ''
47 ${python.executable} runtests.py
48 '';
49
50 __impureHostDeps = lib.optionals stdenv.isDarwin [ "/usr/lib/libm.dylib" ];
51
52 passthru.llvm = llvm;
53
54 meta = with lib; {
55 description = "A lightweight LLVM python binding for writing JIT compilers";
56 homepage = "http://llvmlite.pydata.org/";
57 license = licenses.bsd2;
58 maintainers = with maintainers; [ fridh ];
59 };
60}