From 7628ff1fc04e2a338660e9c40c094e914e0f4b62 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Mon, 12 Nov 2018 22:27:41 +0100 Subject: gnu: emacs-clang-format: Inherit from clang. * gnu/packages/emacs.scm (emacs-clang-format): Remove. * gnu/packages/llvm.scm (emacs-clang-format): Add. --- gnu/packages/llvm.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gnu/packages/llvm.scm') diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index d237a05a84..6a452f48c6 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -7,6 +7,8 @@ ;;; Copyright © 2017 Roel Janssen ;;; Copyright © 2018 Marius Bakke ;;; Copyright © 2018 Tobias Geerinckx-Rice +;;; Copyright © 2018 Tim Gesthuizen +;;; Copyright © 2018 Pierre Neidhardt ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,6 +32,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) @@ -433,3 +436,27 @@ 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}."))) -- cgit v1.2.3 From 51002b723dbd24805f5071c895b0c9cd6c7bf395 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Mon, 26 Nov 2018 12:42:39 +0100 Subject: gnu: Add emacs-clang-rename. * gnu/packages/llvm.scm (emacs-clang-rename): New variable. --- gnu/packages/llvm.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'gnu/packages/llvm.scm') diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 6a452f48c6..276a89c2a0 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -460,3 +460,25 @@ code analysis tools.") 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}."))) -- cgit v1.2.3 From 1c7372a5aadea84165376a4b8e2664b67a663c56 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Mon, 26 Nov 2018 14:51:40 +0100 Subject: gnu: clang-from-llvm: Clean up share/clang folder. * gnu/packages/llvm.scm (clang-from-llvm): Remove useless files, install completion. --- gnu/packages/llvm.scm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'gnu/packages/llvm.scm') diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 276a89c2a0..0b12f736a9 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -235,7 +235,26 @@ 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") + ;; Delete extensions for proprietary text editors. + (delete-file "clang-format-bbedit.applescript") + (delete-file "clang-format-sublime.py") + ;; Delete Emacs extensions: see their respective Emacs + ;; Guix package instead. + (delete-file "clang-rename.el") + (delete-file "clang-format.el") + ;; Install bash completion. + (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 -- cgit v1.2.3 From ad8a4a666d1012f1ace44fc55d35e8f87a0c8cf9 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Wed, 28 Nov 2018 13:41:50 +0100 Subject: gnu: clang-from-llvm: Fix install for clang-3.*. * gnu/packages/llvm.scm (clang-from-llvm): Fix install for clang-3.*. --- gnu/packages/llvm.scm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'gnu/packages/llvm.scm') diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 0b12f736a9..dace546a47 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -243,17 +243,21 @@ compiler. In LLVM this library is called \"compiler-rt\".") out "/etc/bash_completion.d"))) (with-directory-excursion (string-append out "/share/clang") - ;; Delete extensions for proprietary text editors. - (delete-file "clang-format-bbedit.applescript") - (delete-file "clang-format-sublime.py") - ;; Delete Emacs extensions: see their respective Emacs - ;; Guix package instead. - (delete-file "clang-rename.el") - (delete-file "clang-format.el") + (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. - (mkdir-p compl-dir) - (rename-file "bash-autocomplete.sh" - (string-append compl-dir "/clang")))) + (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. -- cgit v1.2.3