aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/llvm.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r--gnu/packages/llvm.scm74
1 files changed, 73 insertions, 1 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 0d3bff9476..8a9d1d312b 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -8,6 +8,8 @@
;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
+;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -31,6 +33,7 @@
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system cmake)
+ #:use-module (guix build-system emacs)
#:use-module (guix build-system python)
#:use-module (gnu packages)
#:use-module (gnu packages gcc)
@@ -233,7 +236,30 @@ compiler. In LLVM this library is called \"compiler-rt\".")
(substitute* "lib/Driver/ToolChains.cpp"
(("@GLIBC_LIBDIR@")
(string-append libc "/lib")))))
- #t))))))
+ #t)))
+ (add-after 'install 'install-clean-up-/share/clang
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (compl-dir (string-append
+ out "/etc/bash_completion.d")))
+ (with-directory-excursion (string-append out
+ "/share/clang")
+ (for-each
+ (lambda (file)
+ (when (file-exists? file)
+ (delete-file file)))
+ ;; Delete extensions for proprietary text editors.
+ '("clang-format-bbedit.applescript"
+ "clang-format-sublime.py"
+ ;; Delete Emacs extensions: see their respective Emacs
+ ;; Guix package instead.
+ "clang-rename.el" "clang-format.el"))
+ ;; Install bash completion.
+ (when (file-exists? "bash-autocomplete.sh")
+ (mkdir-p compl-dir)
+ (rename-file "bash-autocomplete.sh"
+ (string-append compl-dir "/clang")))))
+ #t)))))
;; Clang supports the same environment variables as GCC.
(native-search-paths
@@ -437,3 +463,49 @@ code analysis tools.")
(description
"This package provides a Python binding to LLVM for use in Numba.")
(license license:bsd-3)))
+
+(define-public emacs-clang-format
+ (package
+ (inherit clang)
+ (name "emacs-clang-format")
+ (build-system emacs-build-system)
+ (inputs
+ `(("clang" ,clang)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'configure
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((clang (assoc-ref inputs "clang")))
+ (copy-file "tools/clang-format/clang-format.el" "clang-format.el")
+ (emacs-substitute-variables "clang-format.el"
+ ("clang-format-executable"
+ (string-append clang "/bin/clang-format"))))
+ #t)))))
+ (synopsis "Format code using clang-format")
+ (description "This package allows to filter code through @code{clang-format}
+to fix its formatting. @code{clang-format} is a tool that formats
+C/C++/Obj-C code according to a set of style options, see
+@url{http://clang.llvm.org/docs/ClangFormatStyleOptions.html}.")))
+
+(define-public emacs-clang-rename
+ (package
+ (inherit clang)
+ (name "emacs-clang-rename")
+ (build-system emacs-build-system)
+ (inputs
+ `(("clang" ,clang)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'configure
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((clang (assoc-ref inputs "clang")))
+ (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el")
+ (emacs-substitute-variables "clang-rename.el"
+ ("clang-rename-binary"
+ (string-append clang "/bin/clang-rename"))))
+ #t)))))
+ (synopsis "Rename every occurrence of a symbol using clang-rename")
+ (description "This package renames every occurrence of a symbol at point
+using @code{clang-rename}.")))