summary refs log tree commit diff
path: root/gnu/packages/llvm.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2021-08-12 00:30:27 +0200
committerMarius Bakke <marius@gnu.org>2021-08-12 00:30:27 +0200
commitc4133c43c7cfe2476ebfae87f9e4d10d96de9bc7 (patch)
tree47bd773d2f434384b54e56916c1a287dd8e51511 /gnu/packages/llvm.scm
parentffa01e68859bb7a6daa9fcffdc8d77ca35db4bc0 (diff)
parent4eb0a5146ae5a195a29c79f586fcc1e58f7fa69b (diff)
downloadguix-c4133c43c7cfe2476ebfae87f9e4d10d96de9bc7.tar.gz
Merge branch 'master' into core-updates-frozen
 Conflicts:
	gnu/packages/algebra.scm
	gnu/packages/games.scm
	gnu/packages/golang.scm
	gnu/packages/kerberos.scm
	gnu/packages/mail.scm
	gnu/packages/python.scm
	gnu/packages/ruby.scm
	gnu/packages/scheme.scm
	gnu/packages/tex.scm
	gnu/packages/tls.scm
	gnu/packages/version-control.scm
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r--gnu/packages/llvm.scm39
1 files changed, 39 insertions, 0 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 4107117c76..d829634634 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1253,6 +1253,45 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.")
      "This package provides a Python binding to LLVM for use in Numba.")
     (license license:bsd-3)))
 
+(define-public (clang-python-bindings clang)
+  "Return a package for the Python bindings of CLANG."
+  (package
+    (inherit clang)
+    (name "python-clang")
+    (build-system python-build-system)
+    (outputs '("out"))
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (add-before 'build 'change-directory
+                    (lambda _
+                      (chdir "bindings/python")))
+                  (add-before 'build 'create-setup-py
+                    (lambda _
+                      ;; Generate a basic "setup.py", enough so it can be
+                      ;; built and installed.
+                      (with-output-to-file "setup.py"
+                        (lambda ()
+                          (display "from setuptools import setup
+setup(name=\"clang\", packages=[\"clang\"])\n")))))
+                  (add-before 'build 'set-libclang-file-name
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      ;; Record the absolute file name of libclang.so.
+                      (let ((clang (assoc-ref inputs "clang")))
+                        (substitute* "clang/cindex.py"
+                          (("libclang\\.so")
+                           (string-append clang "/lib/libclang.so")))))))))
+    (inputs `(("clang" ,clang)))
+    (synopsis "Python bindings to libclang")))
+
+(define-public python-clang-10
+  (clang-python-bindings clang-10))
+
+(define-public python-clang-11
+  (clang-python-bindings clang-11))
+
+(define-public python-clang-12
+  (clang-python-bindings clang-12))
+
 (define-public emacs-clang-format
   (package
     (inherit clang)