diff options
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r-- | gnu/packages/llvm.scm | 159 |
1 files changed, 144 insertions, 15 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index add7f1b40c..8a9d1d312b 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -1,12 +1,15 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org> +;;; Copyright © 2014, 2016, 2018 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com> -;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017 Roel Janssen <roel@gnu.org> ;;; 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. ;;; @@ -30,6 +33,8 @@ #: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) #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker @@ -64,6 +69,7 @@ "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" "-DBUILD_SHARED_LIBS:BOOL=TRUE" "-DLLVM_ENABLE_FFI:BOOL=TRUE" + "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. ;; Don't use '-g' during the build, to save space. @@ -89,16 +95,25 @@ languages is in development. The compiler infrastructure includes mirror sets of programming tools as well as libraries with equivalent functionality.") (license license:ncsa))) -(define-public llvm-with-rtti - (package (inherit llvm) - (name "llvm-with-rtti") +;; FIXME: This package is here to prevent many rebuilds on x86_64 and i686 +;; from commit fc9dbf41311d99d0fd8befc789ea7c0e35911890. Update users of +;; this in the next rebuild cycle. +(define-public llvm-without-rtti + (package + (inherit llvm) (arguments - (substitute-keyword-arguments (package-arguments llvm) - ((#:configure-flags flags) - `(append '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" - "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" - "-DLLVM_REQUIRES_RTTI=1") - ,flags)))))) + `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" + "-DBUILD_SHARED_LIBS:BOOL=TRUE" + "-DLLVM_ENABLE_FFI:BOOL=TRUE" + "-DLLVM_INSTALL_UTILS=ON") + #:build-type "Release" + #:phases (modify-phases %standard-phases + (add-before 'build 'shared-lib-workaround + (lambda _ + (setenv "LD_LIBRARY_PATH" + (string-append (getcwd) "/lib")) + #t))))))) (define* (clang-runtime-from-llvm llvm hash #:optional (patches '())) @@ -221,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 @@ -269,7 +307,8 @@ code analysis tools.") llvm-3.9.1 "16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk" '("clang-runtime-asan-build-fixes.patch" - "clang-runtime-esan-build-fixes.patch"))) + "clang-runtime-esan-build-fixes.patch" + "clang-3.5-libsanitizer-ustat-fix.patch"))) (define-public clang-3.9.1 (clang-from-llvm llvm-3.9.1 clang-runtime-3.9.1 @@ -293,7 +332,8 @@ code analysis tools.") (clang-runtime-from-llvm llvm-3.8 "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d" - '("clang-runtime-asan-build-fixes.patch"))) + '("clang-runtime-asan-build-fixes.patch" + "clang-3.5-libsanitizer-ustat-fix.patch"))) (define-public clang-3.8 (clang-from-llvm llvm-3.8 clang-runtime-3.8 @@ -316,7 +356,8 @@ code analysis tools.") (clang-runtime-from-llvm llvm-3.7 "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx" - '("clang-runtime-asan-build-fixes.patch"))) + '("clang-runtime-asan-build-fixes.patch" + "clang-3.5-libsanitizer-ustat-fix.patch"))) (define-public clang-3.7 (clang-from-llvm llvm-3.7 clang-runtime-3.7 @@ -380,3 +421,91 @@ code analysis tools.") (patches (list (search-patch "llvm-for-extempore.patch"))))) ;; Extempore refuses to build on architectures other than x86_64 (supported-systems '("x86_64-linux")))) + +(define-public python-llvmlite + (package + (name "python-llvmlite") + (version "0.24.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "llvmlite" version)) + (sha256 + (base32 + "01zwjlc3c5mhrwmv4b73zgbskwqps9ly0nrh54bbj1f1l72f839j")))) + (build-system python-build-system) + (inputs + `(("llvm" + ,(package + (inherit llvm) + (source (origin + (inherit (package-source llvm)) + (patches + (list + (origin + (method url-fetch) + (uri (string-append "https://raw.githubusercontent.com/numba/" + "llvmlite/v" version "/conda-recipes/" + "D47188-svml.patch")) + (sha256 + (base32 + "0mrj24jvkv3hjcmyg98zmvmyl1znlh2j63rdr69f6g7s96d2pfv1"))) + (origin + (method url-fetch) + (uri (string-append "https://raw.githubusercontent.com/numba/" + "llvmlite/v" version "/conda-recipes/" + "twine_cfg_undefined_behavior.patch")) + (sha256 + (base32 + "07h71n2m1mn9zcfgw04zglffknplb233zqbcd6pckq0wygkrxflp"))))))))))) + (home-page "http://llvmlite.pydata.org") + (synopsis "Wrapper around basic LLVM functionality") + (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}."))) |