about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/llvmlite/default.nix
blob: 925c449ae9988f94245cc09d09cc46a84503a75f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ lib
, stdenv
, fetchFromGitHub
, buildPythonPackage
, python
, llvm
, pythonOlder
, isPyPy
, enum34
, isPy3k
}:

buildPythonPackage rec {
  pname = "llvmlite";
  # The main dependency of llvmlite is numba, which we currently package an
  # untagged version of it (for numpy>1.25 support). That numba version
  # requires at least this version of llvmlite (also not yet officially
  # released, but at least tagged).
  version = "0.41.0dev0";
  format = "setuptools";

  disabled = isPyPy || !isPy3k;

  src = fetchFromGitHub {
    owner = "numba";
    repo = "llvmlite";
    rev = "v${version}";
    hash = "sha256-fsH+rqouweNENU+YlWr7m0bC0YdreQLNp1n2rwrOiFw=";
  };

  nativeBuildInputs = [ llvm ];
  propagatedBuildInputs = lib.optional (pythonOlder "3.4") enum34;

  # Disable static linking
  # https://github.com/numba/llvmlite/issues/93
  postPatch = ''
    substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" ""

    substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope"
  '';

  # Set directory containing llvm-config binary
  preConfigure = ''
    export LLVM_CONFIG=${llvm.dev}/bin/llvm-config
  '';

  checkPhase = ''
    ${python.executable} runtests.py
  '';

  __impureHostDeps = lib.optionals stdenv.isDarwin [ "/usr/lib/libm.dylib" ];

  passthru.llvm = llvm;

  meta = with lib; {
    description = "A lightweight LLVM python binding for writing JIT compilers";
    homepage = "http://llvmlite.pydata.org/";
    license = licenses.bsd2;
    maintainers = with maintainers; [ fridh ];
  };
}