gnu: Add kristall.
[jackhill/guix/guix.git] / gnu / packages / llvm.scm
CommitLineData
3e4249ce 1;;; GNU Guix --- Functional package management for GNU
fc9dbf41 2;;; Copyright © 2014, 2016, 2018 Eric Bavier <bavier@member.fsf.org>
1204c510 3;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
193192ca 4;;; Copyright © 2015, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
ee077430 5;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com>
290b55c5 6;;; Copyright © 2016, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
584da12d 7;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
a6046f24 8;;; Copyright © 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
e2170c31 9;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
0627f93d 10;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
7628ff1f
TG
11;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
12;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
c5296e20 13;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
5dea5cbc 14;;; Copyright © 2019 Arm Ltd <David.Truby@arm.com>
57c7bfec 15;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
66087272 16;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
b1cb8b5d 17;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
851a7caf 18;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
3e4249ce
EB
19;;;
20;;; This file is part of GNU Guix.
21;;;
22;;; GNU Guix is free software; you can redistribute it and/or modify it
23;;; under the terms of the GNU General Public License as published by
24;;; the Free Software Foundation; either version 3 of the License, or (at
25;;; your option) any later version.
26;;;
27;;; GNU Guix is distributed in the hope that it will be useful, but
28;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30;;; GNU General Public License for more details.
31;;;
32;;; You should have received a copy of the GNU General Public License
33;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34
35(define-module (gnu packages llvm)
36 #:use-module (guix packages)
ac00973c 37 #:use-module ((guix licenses) #:prefix license:)
3e4249ce 38 #:use-module (guix download)
a2cc25ab 39 #:use-module (guix git-download)
3e4249ce
EB
40 #:use-module (guix utils)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system cmake)
7628ff1f 43 #:use-module (guix build-system emacs)
8892cac3 44 #:use-module (guix build-system python)
57c7bfec 45 #:use-module (guix build-system trivial)
3e4249ce 46 #:use-module (gnu packages)
57c7bfec 47 #:use-module (gnu packages base)
fd6ae1b9
LC
48 #:use-module (gnu packages gcc)
49 #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker
ee077430 50 #:use-module (gnu packages compression)
f11733bd 51 #:use-module (gnu packages libedit)
ee077430 52 #:use-module (gnu packages libffi)
f11733bd 53 #:use-module (gnu packages lua)
698e91f0 54 #:use-module (gnu packages mpi)
f11733bd 55 #:use-module (gnu packages ncurses)
290b55c5 56 #:use-module (gnu packages onc-rpc)
3e4249ce 57 #:use-module (gnu packages perl)
698e91f0 58 #:use-module (gnu packages pkg-config)
3e4249ce 59 #:use-module (gnu packages python)
f11733bd 60 #:use-module (gnu packages swig)
96a9a8d3
LC
61 #:use-module (gnu packages xml)
62 #:export (system->llvm-target))
63
64(define* (system->llvm-target #:optional
65 (system (or (and=> (%current-target-system)
66 gnu-triplet->nix-system)
67 (%current-system))))
68 "Return the LLVM target name that corresponds to SYSTEM, a system type such
69as \"x86_64-linux\"."
70 ;; See the 'lib/Target' directory of LLVM for a list of supported targets.
71 (letrec-syntax ((matches (syntax-rules (=>)
72 ((_ (system-prefix => target) rest ...)
73 (if (string-prefix? system-prefix system)
74 target
75 (matches rest ...)))
76 ((_)
77 (error "LLVM target for system is unknown" system)))))
78 (matches ("aarch64" => "AArch64")
79 ("armhf" => "ARM")
80 ("mips64el" => "Mips")
81 ("powerpc" => "PowerPC")
82 ("riscv" => "RISCV")
83 ("x86_64" => "X86")
3a1c3642
JN
84 ("i686" => "X86")
85 ("i586" => "X86"))))
3e4249ce 86
abcdf6bf 87(define (llvm-uri component version)
cd16014f
MB
88 (if (version>=? version "9.0.1")
89 (string-append "https://github.com/llvm/llvm-project/releases/download"
90 "/llvmorg-" version "/" component "-" version ".src.tar.xz")
91 (string-append "https://releases.llvm.org/" version "/" component "-"
92 version ".src.tar.xz")))
93
6b26f915
LC
94(define* (clang-runtime-from-llvm llvm hash
95 #:optional (patches '()))
b81f5693
AW
96 (package
97 (name "clang-runtime")
98 (version (package-version llvm))
99 (source
100 (origin
101 (method url-fetch)
abcdf6bf 102 (uri (llvm-uri "compiler-rt" version))
6b26f915
LC
103 (sha256 (base32 hash))
104 (patches (map search-patch patches))))
b81f5693
AW
105 (build-system cmake-build-system)
106 (native-inputs (package-native-inputs llvm))
107 (inputs
108 `(("llvm" ,llvm)))
109 (arguments
110 `(;; Don't use '-g' during the build to save space.
3b956a33 111 #:build-type "Release"
3fd9c90c
MB
112 #:tests? #f ; Tests require gtest
113 #:modules ((srfi srfi-1)
114 (ice-9 match)
115 ,@%cmake-build-system-modules)
116 #:phases (modify-phases (@ (guix build cmake-build-system) %standard-phases)
117 (add-after 'set-paths 'hide-glibc
118 ;; Work around https://issues.guix.info/issue/36882. We need to
119 ;; remove glibc from CPLUS_INCLUDE_PATH so that the one hardcoded
120 ;; in GCC, at the bottom of GCC include search-path is used.
121 (lambda* (#:key inputs #:allow-other-keys)
122 (let* ((filters '("libc"))
123 (input-directories
124 (filter-map (lambda (input)
125 (match input
126 ((name . dir)
127 (and (not (member name filters))
128 dir))))
129 inputs)))
130 (set-path-environment-variable "CPLUS_INCLUDE_PATH"
131 '("include")
132 input-directories)
133 #t))))))
ac97dce1 134 (home-page "https://compiler-rt.llvm.org")
b81f5693
AW
135 (synopsis "Runtime library for Clang/LLVM")
136 (description
137 "The \"clang-runtime\" library provides the implementations of run-time
138functions for C and C++ programs. It also provides header files that allow C
139and C++ source code to interface with the \"sanitization\" passes of the clang
140compiler. In LLVM this library is called \"compiler-rt\".")
00ede157 141 (license (package-license llvm))
9e6b9ea4 142
ac97dce1 143 ;; <https://compiler-rt.llvm.org/> doesn't list MIPS as supported.
9e6b9ea4 144 (supported-systems (delete "mips64el-linux" %supported-systems))))
b81f5693 145
3b956a33 146(define* (clang-from-llvm llvm clang-runtime hash
77a87ad4
LC
147 #:key (patches '()) tools-extra)
148 "Produce Clang with dependencies on LLVM and CLANG-RUNTIME, and applying the
149given PATCHES. When TOOLS-EXTRA is given, it must point to the
150'clang-tools-extra' tarball, which contains code for 'clang-tidy', 'pp-trace',
151'modularize', and other tools."
3e4249ce
EB
152 (package
153 (name "clang")
154 (version (package-version llvm))
155 (source
156 (origin
157 (method url-fetch)
abcdf6bf 158 (uri (llvm-uri (if (version>=? version "9.0.1")
cd16014f
MB
159 "clang"
160 "cfe")
161 version))
fd6ae1b9 162 (sha256 (base32 hash))
3b956a33 163 (patches (map search-patch patches))))
3e4249ce
EB
164 ;; Using cmake allows us to treat llvm as an external library. There
165 ;; doesn't seem to be any way to do this with clang's autotools-based
166 ;; build system.
167 (build-system cmake-build-system)
77a87ad4 168 (outputs (if tools-extra '("out" "extra") '("out")))
3e4249ce
EB
169 (native-inputs (package-native-inputs llvm))
170 (inputs
171 `(("libxml2" ,libxml2)
c92f1c0a 172 ("gcc-lib" ,gcc "lib")
77a87ad4
LC
173 ,@(package-inputs llvm)
174 ,@(if tools-extra
175 `(("clang-tools-extra" ,tools-extra))
176 '())))
3e4249ce 177 (propagated-inputs
b81f5693
AW
178 `(("llvm" ,llvm)
179 ("clang-runtime" ,clang-runtime)))
fd6ae1b9
LC
180 (arguments
181 `(#:configure-flags
182 (list "-DCLANG_INCLUDE_TESTS=True"
183
184 ;; Find libgcc_s, crtbegin.o, and crtend.o.
185 (string-append "-DGCC_INSTALL_PREFIX="
186 (assoc-ref %build-inputs "gcc-lib"))
187
188 ;; Use a sane default include directory.
189 (string-append "-DC_INCLUDE_DIRS="
190 (assoc-ref %build-inputs "libc")
191 "/include"))
192
94585e88
LC
193 ;; Don't use '-g' during the build to save space.
194 #:build-type "Release"
195
fd6ae1b9 196 #:phases (modify-phases %standard-phases
77a87ad4
LC
197 ,@(if tools-extra
198 `((add-after 'unpack 'add-tools-extra
199 (lambda* (#:key inputs #:allow-other-keys)
200 ;; Unpack the 'clang-tools-extra' tarball under
201 ;; tools/.
202 (let ((extra (assoc-ref inputs
203 "clang-tools-extra")))
204 (invoke "tar" "xf" extra)
205 (rename-file ,(string-append
206 "clang-tools-extra-"
207 (package-version llvm)
208 ".src")
209 "tools/extra")
210 #t)))
211 (add-after 'install 'move-extra-tools
212 (lambda* (#:key outputs #:allow-other-keys)
213 ;; Move the extra tools to the "extra" output.
214 ;; These programs alone weigh in at 296 MiB,
215 ;; because they statically-link a whole bunch of
216 ;; Clang libraries.
217 (let* ((out (assoc-ref outputs "out"))
218 (extra (assoc-ref outputs "extra"))
219 (bin (string-append out "/bin"))
220 (bin* (string-append extra "/bin"))
221 (lib (string-append out "/lib")))
222 (define (move program)
223 (rename-file (string-append bin "/" program)
224 (string-append bin* "/"
225 program)))
226
227 (mkdir-p bin*)
228 (for-each move
229 '("clang-apply-replacements"
230 "clang-change-namespace"
231 "clangd"
232 "clang-doc"
233 "clang-include-fixer"
234 "clang-move"
235 "clang-query"
236 "clang-reorder-fields"
237 "clang-tidy"
238 "find-all-symbols"
239 "modularize"
240 "pp-trace"))
241
242 ;; Remove MiBs of .a files coming from
243 ;; 'clang-tools-extra'.
244 (for-each (lambda (component)
245 (delete-file
246 (string-append lib "/libclang"
247 component ".a")))
248 '("ApplyReplacements"
249 "ChangeNamespace"
250 "Daemon"
251 "DaemonTweaks"
252 "Doc"
253 "IncludeFixer"
254 "IncludeFixerPlugin"
255 "Move"))
256 (for-each delete-file
257 (find-files
258 lib
259 "^(libfindAllSymbols|libclangTidy)"))
260 #t))))
261 '())
f5cc5de8
MB
262 (add-after 'unpack 'add-missing-triplets
263 (lambda _
264 ;; Clang iterates through known triplets to search for
265 ;; GCC's headers, but does not recognize some of the
266 ;; triplets that are used in Guix.
267 (substitute* ,@(if (version>=? version "6.0")
268 '("lib/Driver/ToolChains/Gnu.cpp")
269 '("lib/Driver/ToolChains.cpp"))
270 (("\"aarch64-linux-gnu\"," all)
271 (string-append "\"aarch64-unknown-linux-gnu\", "
272 all))
273 (("\"arm-linux-gnueabihf\"," all)
274 (string-append all
275 " \"arm-unknown-linux-gnueabihf\","))
276 (("\"i686-pc-linux-gnu\"," all)
277 (string-append "\"i686-unknown-linux-gnu\", "
278 all)))
279 #t))
5041cc28
MB
280 (add-after 'unpack 'set-glibc-file-names
281 (lambda* (#:key inputs #:allow-other-keys)
282 (let ((libc (assoc-ref inputs "libc"))
283 (compiler-rt (assoc-ref inputs "clang-runtime"))
284 (gcc (assoc-ref inputs "gcc")))
285 ,@(cond
286 ((version>=? version "6.0")
287 `(;; Link to libclang_rt files from clang-runtime.
9bdbabe9
MB
288 (substitute* "lib/Driver/ToolChain.cpp"
289 (("getDriver\\(\\)\\.ResourceDir")
5041cc28 290 (string-append "\"" compiler-rt "\"")))
9bdbabe9 291
5041cc28
MB
292 ;; Make "LibDir" refer to <glibc>/lib so that it
293 ;; uses the right dynamic linker file name.
294 (substitute* "lib/Driver/ToolChains/Linux.cpp"
295 (("(^[[:blank:]]+LibDir = ).*" _ declaration)
296 (string-append declaration "\"" libc "/lib\";\n"))
9bdbabe9 297
5041cc28
MB
298 ;; Make clang look for libstdc++ in the right
299 ;; location.
300 (("LibStdCXXIncludePathCandidates\\[\\] = \\{")
301 (string-append
302 "LibStdCXXIncludePathCandidates[] = { \"" gcc
303 "/include/c++\","))
496bbeee 304
5041cc28
MB
305 ;; Make sure libc's libdir is on the search path, to
306 ;; allow crt1.o & co. to be found.
307 (("@GLIBC_LIBDIR@")
308 (string-append libc "/lib")))))
309 (else
310 `((substitute* "lib/Driver/Tools.cpp"
311 ;; Patch the 'getLinuxDynamicLinker' function so that
312 ;; it uses the right dynamic linker file name.
313 (("/lib64/ld-linux-x86-64.so.2")
314 (string-append libc
315 ,(glibc-dynamic-linker))))
9bdbabe9 316
5041cc28
MB
317 ;; Link to libclang_rt files from clang-runtime.
318 ;; This substitution needed slight adjustment in 3.8.
319 ,@(if (version>=? version "3.8")
320 '((substitute* "lib/Driver/Tools.cpp"
321 (("TC\\.getDriver\\(\\)\\.ResourceDir")
322 (string-append "\"" compiler-rt "\""))))
323 '((substitute* "lib/Driver/ToolChain.cpp"
324 (("getDriver\\(\\)\\.ResourceDir")
325 (string-append "\"" compiler-rt "\"")))))
9bdbabe9 326
5041cc28
MB
327 ;; Make sure libc's libdir is on the search path, to
328 ;; allow crt1.o & co. to be found.
329 (substitute* "lib/Driver/ToolChains.cpp"
330 (("@GLIBC_LIBDIR@")
331 (string-append libc "/lib"))))))
332 #t)))
f91046ce
MB
333 ,@(if (version>=? version "10")
334 `((add-after 'install 'adjust-cmake-file
335 (lambda* (#:key outputs #:allow-other-keys)
336 (let ((out (assoc-ref outputs "out")))
337 ;; Clang generates a CMake file with "targets"
338 ;; for each installed library file. Downstream
339 ;; consumers of the CMake interface can use this
340 ;; to get absolute library locations. Including
341 ;; this file will needlessly assert that _all_
342 ;; libraries are available, which causes problems
343 ;; in Guix because some are removed (see the
344 ;; move-extra-tools phase). Thus, remove the
345 ;; asserts so that the main functionality works.
346 (substitute*
347 (string-append
348 out
349 "/lib/cmake/clang/ClangTargets-release.cmake")
350 (("list\\(APPEND _IMPORT_CHECK_TARGETS.*" all)
351 (string-append "# Disabled by Guix.\n#" all)))
352 #t))))
353 '())
0d3063f4
MB
354 ,@(if (version>? version "3.8")
355 `((add-after 'install 'symlink-cfi_blacklist
356 (lambda* (#:key inputs outputs #:allow-other-keys)
357 (let* ((out (assoc-ref outputs "out"))
358 (lib-share (string-append out "/lib/clang/"
359 ,version "/share"))
360 (compiler-rt (assoc-ref inputs "clang-runtime"))
361 ;; The location varies between Clang versions.
362 (cfi-blacklist
363 (cond
364 ((file-exists?
365 (string-append compiler-rt "/cfi_blacklist.txt"))
366 (string-append compiler-rt "/cfi_blacklist.txt"))
367 (else (string-append compiler-rt
368 "/share/cfi_blacklist.txt")))))
369 (mkdir-p lib-share)
370 ;; Symlink cfi_blacklist.txt to where Clang expects
371 ;; to find it.
372 (symlink cfi-blacklist
373 (string-append lib-share "/cfi_blacklist.txt"))
374 #t))))
375 '())
1c7372a5
PN
376 (add-after 'install 'install-clean-up-/share/clang
377 (lambda* (#:key outputs #:allow-other-keys)
378 (let* ((out (assoc-ref outputs "out"))
379 (compl-dir (string-append
380 out "/etc/bash_completion.d")))
381 (with-directory-excursion (string-append out
382 "/share/clang")
ad8a4a66
PN
383 (for-each
384 (lambda (file)
385 (when (file-exists? file)
386 (delete-file file)))
387 ;; Delete extensions for proprietary text editors.
388 '("clang-format-bbedit.applescript"
389 "clang-format-sublime.py"
390 ;; Delete Emacs extensions: see their respective Emacs
391 ;; Guix package instead.
392 "clang-rename.el" "clang-format.el"))
1c7372a5 393 ;; Install bash completion.
ad8a4a66
PN
394 (when (file-exists? "bash-autocomplete.sh")
395 (mkdir-p compl-dir)
396 (rename-file "bash-autocomplete.sh"
397 (string-append compl-dir "/clang")))))
1c7372a5 398 #t)))))
ef11ac87
LC
399
400 ;; Clang supports the same environment variables as GCC.
401 (native-search-paths
402 (list (search-path-specification
f42bfc7a 403 (variable "C_INCLUDE_PATH")
ef11ac87 404 (files '("include")))
f42bfc7a
MB
405 (search-path-specification
406 (variable "CPLUS_INCLUDE_PATH")
407 (files '("include/c++" "include")))
ef11ac87
LC
408 (search-path-specification
409 (variable "LIBRARY_PATH")
410 (files '("lib" "lib64")))))
411
ac97dce1 412 (home-page "https://clang.llvm.org")
3e4249ce
EB
413 (synopsis "C language family frontend for LLVM")
414 (description
415 "Clang is a compiler front end for the C, C++, Objective-C and
416Objective-C++ programming languages. It uses LLVM as its back end. The Clang
417project includes the Clang front end, the Clang static analyzer, and several
418code analysis tools.")
00ede157
MB
419 (license (if (version>=? version "9.0")
420 license:asl2.0 ;with LLVM exceptions
421 license:ncsa))))
1204c510 422
57c7bfec
MO
423(define (make-clang-toolchain clang)
424 (package
425 (name (string-append (package-name clang) "-toolchain"))
426 (version (package-version clang))
427 (source #f)
428 (build-system trivial-build-system)
429 (arguments
430 '(#:modules ((guix build union))
431 #:builder (begin
432 (use-modules (ice-9 match)
433 (srfi srfi-26)
434 (guix build union))
435
436 (let ((out (assoc-ref %outputs "out")))
437
438 (match %build-inputs
439 (((names . directories) ...)
440 (union-build out directories)))
441
b6684507
LC
442 ;; Create 'cc' and 'c++' so that one can use it as a
443 ;; drop-in replacement for the default tool chain and
444 ;; have configure scripts find the compiler.
445 (symlink "clang" (string-append out "/bin/cc"))
446 (symlink "clang++" (string-append out "/bin/c++"))
447
57c7bfec
MO
448 (union-build (assoc-ref %outputs "debug")
449 (list (assoc-ref %build-inputs
450 "libc-debug")))
451 (union-build (assoc-ref %outputs "static")
452 (list (assoc-ref %build-inputs
453 "libc-static")))
454 #t))))
455
61a5380b
LC
456 (native-search-paths
457 (append (package-native-search-paths clang)
458 (list (search-path-specification ;copied from glibc
459 (variable "GUIX_LOCPATH")
460 (files '("lib/locale"))))))
57c7bfec
MO
461 (search-paths (package-search-paths clang))
462
463 (license (package-license clang))
464 (home-page "https://clang.llvm.org")
465 (synopsis "Complete Clang toolchain for C/C++ development")
466 (description "This package provides a complete Clang toolchain for C/C++
467development to be installed in user profiles. This includes Clang, as well as
468libc (headers and binaries, plus debugging symbols in the @code{debug}
469output), and Binutils.")
470 (outputs '("out" "debug" "static"))
471 (inputs `(("clang" ,clang)
472 ("ld-wrapper" ,(car (assoc-ref (%final-inputs) "ld-wrapper")))
473 ("binutils" ,binutils)
474 ("libc" ,glibc)
475 ("libc-debug" ,glibc "debug")
476 ("libc-static" ,glibc "static")))))
477
7f79358d 478(define-public llvm-11
f1db068a
MB
479 (package
480 (name "llvm")
7f79358d 481 (version "11.0.0")
f1db068a
MB
482 (source
483 (origin
484 (method url-fetch)
485 (uri (llvm-uri "llvm" version))
486 (sha256
487 (base32
7f79358d 488 "0s94lwil98w7zb7cjrbnxli0z7gklb312pkw74xs1d6zk346hgwi"))))
f1db068a
MB
489 (build-system cmake-build-system)
490 (outputs '("out" "opt-viewer"))
491 (native-inputs
492 `(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2
493 ("perl" ,perl)))
494 (inputs
495 `(("libffi" ,libffi)))
496 (propagated-inputs
497 `(("zlib" ,zlib))) ;to use output from llvm-config
498 (arguments
499 `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE"
500 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
501 "-DBUILD_SHARED_LIBS:BOOL=TRUE"
502 "-DLLVM_ENABLE_FFI:BOOL=TRUE"
503 "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities
504 "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc.
505
506 ;; Don't use '-g' during the build, to save space.
507 #:build-type "Release"
508 #:phases
509 (modify-phases %standard-phases
510 (add-before 'build 'shared-lib-workaround
511 ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen
512 ;; doesn't seem to get the correct rpath to be able to run
513 ;; from the build directory. Set LD_LIBRARY_PATH as a
514 ;; workaround.
515 (lambda _
516 (setenv "LD_LIBRARY_PATH"
517 (string-append (getcwd) "/lib"))
518 #t))
519 (add-after 'install 'install-opt-viewer
520 (lambda* (#:key outputs #:allow-other-keys)
521 (let* ((out (assoc-ref outputs "out"))
522 (opt-viewer-out (assoc-ref outputs "opt-viewer"))
523 (opt-viewer-share-dir (string-append opt-viewer-out "/share"))
524 (opt-viewer-dir (string-append opt-viewer-share-dir "/opt-viewer")))
525 (mkdir-p opt-viewer-share-dir)
526 (rename-file (string-append out "/share/opt-viewer")
527 opt-viewer-dir))
528 #t)))))
529 (home-page "https://www.llvm.org")
530 (synopsis "Optimizing compiler infrastructure")
531 (description
532 "LLVM is a compiler infrastructure designed for compile-time, link-time,
533runtime, and idle-time optimization of programs from arbitrary programming
534languages. It currently supports compilation of C and C++ programs, using
535front-ends derived from GCC 4.0.1. A new front-end for the C family of
536languages is in development. The compiler infrastructure includes mirror sets
537of programming tools as well as libraries with equivalent functionality.")
538 (license license:asl2.0))) ;with LLVM exceptions, see LICENSE.txt
539
7f79358d
MB
540(define-public clang-runtime-11
541 (clang-runtime-from-llvm
542 llvm-11
543 "0d5j5l8phwqjjscmk8rmqn0i2i0abl537gdbkagl8fjpzy1gyjip"))
544
545(define-public clang-11
546 (clang-from-llvm llvm-11 clang-runtime-11
547 "02ajkij85966vd150iy246mv16dsaph1kfi0y8wnncp8w6nar5hg"
548 #:patches '("clang-11.0-libc-search-path.patch")
549 #:tools-extra
550 (origin
551 (method url-fetch)
552 (uri (llvm-uri "clang-tools-extra"
553 (package-version llvm-11)))
554 (sha256
555 (base32
556 "02bcwwn54661madhq4nxc069s7p7pj5gpqi8ww50w3anbpviilzy")))))
557
558(define-public clang-toolchain-11
559 (make-clang-toolchain clang-11))
560
561(define-public llvm-10
562 (package
563 (inherit llvm-11)
564 (version "10.0.0")
565 (source
566 (origin
567 (method url-fetch)
568 (uri (llvm-uri "llvm" version))
569 (sha256
570 (base32
571 "1pwgm6cr0xr5a0hrbqs1zvsvvjvy0yq1y47c96804wcs795s90yz"))))))
572
193192ca
LC
573(define-public clang-runtime-10
574 (clang-runtime-from-llvm
575 llvm-10
576 "0x9c531k6ww21s2mkdwqx1vbdjmx6d4wmfb8gdbj0wqa796sczba"))
577
578(define-public clang-10
579 (clang-from-llvm llvm-10 clang-runtime-10
580 "08fbxa2a0kr3ni35ckppj0kyvlcyaywrhpqwcdrdy0z900mhcnw8"
77a87ad4
LC
581 #:patches '("clang-10.0-libc-search-path.patch")
582 #:tools-extra
583 (origin
584 (method url-fetch)
abcdf6bf 585 (uri (llvm-uri "clang-tools-extra"
77a87ad4
LC
586 (package-version llvm-10)))
587 (sha256
588 (base32
589 "074ija5s2jsdn0k035r2dzmryjmqxdnyg4xwvaqych2bazv8rpxc")))))
193192ca
LC
590
591(define-public clang-toolchain-10
592 (make-clang-toolchain clang-10))
593
594(define-public llvm-9
595 (package
596 (inherit llvm-10)
597 (version "9.0.1")
598 (source
599 (origin
600 (method url-fetch)
abcdf6bf 601 (uri (llvm-uri "llvm" version))
193192ca
LC
602 (sha256
603 (base32
851a7caf
JK
604 "16hwp3qa54c3a3v7h8nlw0fh5criqh0hlr1skybyk0cz70gyx880"))
605 (patch-flags '("-p2"))
606 (patches (search-patches
ff2f8611 607 "llvm-9-fix-bitcast-miscompilation.patch"
851a7caf
JK
608 "llvm-9-fix-scev-miscompilation.patch"
609 "llvm-9-fix-lpad-miscompilation.patch"))))))
193192ca
LC
610
611(define-public clang-runtime-9
b81f5693 612 (clang-runtime-from-llvm
193192ca 613 llvm-9
af88972b
MB
614 "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2"
615 '("clang-runtime-9-libsanitizer-mode-field.patch")))
b81f5693 616
193192ca
LC
617(define-public clang-9
618 (clang-from-llvm llvm-9 clang-runtime-9
00ede157
MB
619 "0ls2h3iv4finqyflyhry21qhc9cm9ga7g1zq21020p065qmm2y2p"
620 #:patches '("clang-9.0-libc-search-path.patch")))
d199a4c7 621
193192ca
LC
622(define-public clang-toolchain-9
623 (make-clang-toolchain clang-9))
57c7bfec 624
00ede157 625(define-public llvm-8
96d5a206 626 (package
f1db068a 627 (inherit llvm-9)
00ede157 628 (version "8.0.0")
96d5a206
DT
629 (source (origin
630 (method url-fetch)
abcdf6bf 631 (uri (llvm-uri "llvm" version))
96d5a206
DT
632 (sha256
633 (base32
00ede157
MB
634 "0k124sxkfhfi1rca6kzkdraf4axhx99x3cw2rk55056628dvwwl8"))))
635 (license license:ncsa)))
96d5a206 636
00ede157 637(define-public clang-runtime-8
96d5a206 638 (clang-runtime-from-llvm
00ede157 639 llvm-8
af88972b
MB
640 "1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl"
641 '("clang-runtime-9-libsanitizer-mode-field.patch")))
96d5a206 642
00ede157
MB
643(define-public clang-8
644 (clang-from-llvm llvm-8 clang-runtime-8
645 "0svk1f70hvpwrjp6x5i9kqwrqwxnmcrw5s7f4cxyd100mdd12k08"
646 #:patches '("clang-7.0-libc-search-path.patch")))
96d5a206 647
00ede157
MB
648(define-public clang-toolchain-8
649 (make-clang-toolchain clang-8))
96d5a206 650
4289d1d7
MB
651(define-public llvm-7
652 (package
00ede157 653 (inherit llvm-8)
4289d1d7
MB
654 (version "7.0.1")
655 (source (origin
656 (method url-fetch)
abcdf6bf 657 (uri (llvm-uri "llvm" version))
4289d1d7
MB
658 (sha256
659 (base32
660 "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3"))))))
661
662(define-public clang-runtime-7
663 (clang-runtime-from-llvm
664 llvm-7
af88972b
MB
665 "065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq"
666 '("clang-runtime-9-libsanitizer-mode-field.patch")))
4289d1d7
MB
667
668(define-public clang-7
501672d7 669 (clang-from-llvm llvm-7 clang-runtime-7
4289d1d7
MB
670 "067lwggnbg0w1dfrps790r5l6k8n5zwhlsw7zb6zvmfpwpfn4nx4"
671 #:patches '("clang-7.0-libc-search-path.patch")))
672
57c7bfec
MO
673(define-public clang-toolchain-7
674 (make-clang-toolchain clang-7))
675
d199a4c7
MB
676(define-public llvm-6
677 (package
00ede157 678 (inherit llvm-7)
d199a4c7
MB
679 (version "6.0.1")
680 (source (origin
681 (method url-fetch)
abcdf6bf 682 (uri (llvm-uri "llvm" version))
d199a4c7
MB
683 (sha256
684 (base32
685 "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"))))))
686
687(define-public clang-runtime-6
688 (clang-runtime-from-llvm
689 llvm-6
af88972b
MB
690 "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl"
691 '("clang-runtime-9-libsanitizer-mode-field.patch")))
d199a4c7
MB
692
693(define-public clang-6
501672d7 694 (clang-from-llvm llvm-6 clang-runtime-6
148df605 695 "0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w"
9bdbabe9 696 #:patches '("clang-6.0-libc-search-path.patch")))
3b956a33 697
57c7bfec
MO
698(define-public clang-toolchain-6
699 (make-clang-toolchain clang-6))
700
584da12d 701(define-public llvm-3.9.1
00ede157 702 (package (inherit llvm-6)
584da12d
RJ
703 (name "llvm")
704 (version "3.9.1")
705 (source
706 (origin
707 (method url-fetch)
abcdf6bf 708 (uri (llvm-uri "llvm" version))
584da12d
RJ
709 (sha256
710 (base32
a6046f24
MB
711 "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z"))))
712 (outputs '("out"))
713 (arguments
714 (substitute-keyword-arguments (package-arguments llvm)
715 ((#:phases phases)
716 `(modify-phases ,phases
717 (delete 'install-opt-viewer)))))))
584da12d
RJ
718
719(define-public clang-runtime-3.9.1
720 (clang-runtime-from-llvm
721 llvm-3.9.1
6b26f915 722 "16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk"
af88972b
MB
723 '("clang-runtime-3.9-libsanitizer-mode-field.patch"
724 "clang-runtime-asan-build-fixes.patch"
0627f93d 725 "clang-runtime-esan-build-fixes.patch"
1a2d8d06 726 "clang-3.5-libsanitizer-ustat-fix.patch")))
584da12d
RJ
727
728(define-public clang-3.9.1
729 (clang-from-llvm llvm-3.9.1 clang-runtime-3.9.1
730 "0qsyyb40iwifhhlx9a3drf8z6ni6zwyk3bvh0kx2gs6yjsxwxi76"
9bdbabe9
MB
731 #:patches '("clang-3.8-libc-search-path.patch")))
732
733(define-public llvm-3.8
a6046f24 734 (package (inherit llvm-3.9.1)
9bdbabe9
MB
735 (name "llvm")
736 (version "3.8.1")
737 (source
738 (origin
739 (method url-fetch)
abcdf6bf 740 (uri (llvm-uri "llvm" version))
9bdbabe9
MB
741 (sha256
742 (base32
743 "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf"))))))
744
745(define-public clang-runtime-3.8
746 (clang-runtime-from-llvm
747 llvm-3.8
748 "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d"
0627f93d 749 '("clang-runtime-asan-build-fixes.patch"
af88972b 750 "clang-runtime-3.8-libsanitizer-mode-field.patch"
1a2d8d06 751 "clang-3.5-libsanitizer-ustat-fix.patch")))
9bdbabe9
MB
752
753(define-public clang-3.8
754 (clang-from-llvm llvm-3.8 clang-runtime-3.8
755 "1prc72xmkgx8wrzmrr337776676nhsp1qd3mw2bvb22bzdnq7lsc"
756 #:patches '("clang-3.8-libc-search-path.patch")))
584da12d 757
3b956a33 758(define-public llvm-3.7
00ede157 759 (package (inherit llvm-3.8)
3b956a33
EB
760 (version "3.7.1")
761 (source
762 (origin
763 (method url-fetch)
abcdf6bf 764 (uri (llvm-uri "llvm" version))
3b956a33
EB
765 (sha256
766 (base32
767 "1masakdp9g2dan1yrazg7md5am2vacbkb3nahb3dchpc1knr8xxy"))))))
768
769(define-public clang-runtime-3.7
770 (clang-runtime-from-llvm
771 llvm-3.7
6b26f915 772 "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"
0627f93d 773 '("clang-runtime-asan-build-fixes.patch"
af88972b 774 "clang-runtime-3.8-libsanitizer-mode-field.patch"
1a2d8d06 775 "clang-3.5-libsanitizer-ustat-fix.patch")))
3b956a33
EB
776
777(define-public clang-3.7
778 (clang-from-llvm llvm-3.7 clang-runtime-3.7
9bdbabe9
MB
779 "0x065d0w9b51xvdjxwfzjxng0gzpbx45fgiaxpap45ragi61dqjn"
780 #:patches '("clang-3.5-libc-search-path.patch")))
3ebc0905
EB
781
782(define-public llvm-3.6
00ede157 783 (package (inherit llvm-3.7)
3ebc0905
EB
784 (version "3.6.2")
785 (source
786 (origin
787 (method url-fetch)
abcdf6bf 788 (uri (llvm-uri "llvm" version))
3ebc0905
EB
789 (sha256
790 (base32
791 "153vcvj8gvgwakzr4j0kndc0b7wn91c2g1vy2vg24s6spxcc23gn"))))))
792
793(define-public clang-runtime-3.6
794 (clang-runtime-from-llvm
795 llvm-3.6
6b26f915 796 "11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg"
af88972b 797 '("clang-runtime-asan-build-fixes.patch")))
3ebc0905
EB
798
799(define-public clang-3.6
800 (clang-from-llvm llvm-3.6 clang-runtime-3.6
9bdbabe9
MB
801 "1wwr8s6lzr324hv4s1k6na4j5zv6n9kdhi14s4kb9b13d93814df"
802 #:patches '("clang-3.5-libc-search-path.patch")))
1204c510
MW
803
804(define-public llvm-3.5
00ede157 805 (package (inherit llvm-3.6)
a53c486d 806 (version "3.5.2")
1204c510
MW
807 (source
808 (origin
809 (method url-fetch)
abcdf6bf 810 (uri (llvm-uri "llvm" version))
6ba4eca2
RW
811 (patches
812 (search-patches "llvm-3.5-fix-clang-build-with-gcc5.patch"))
1204c510
MW
813 (sha256
814 (base32
a53c486d 815 "0xf5q17kkxsrm2gsi93h4pwlv663kji73r2g4asb97klsmb626a4"))))))
1204c510 816
b81f5693 817(define-public clang-runtime-3.5
290b55c5
RW
818 (let ((runtime (clang-runtime-from-llvm
819 llvm-3.5
820 "1hsdnzzdr5kglz6fnv3lcsjs222zjsy14y8ax9dy6zqysanplbal"
821 '("clang-runtime-asan-build-fixes.patch"
5f022a51 822 "clang-runtime-3.5-libsanitizer-mode-field.patch"
290b55c5
RW
823 "clang-3.5-libsanitizer-ustat-fix.patch"))))
824 (package
825 (inherit runtime)
826 (arguments
827 (substitute-keyword-arguments (package-arguments runtime)
828 ((#:phases phases '%standard-phases)
829 `(modify-phases ,phases
830 ;; glibc no longer includes rpc/xdr.h, so we use the headers from
831 ;; libtirpc.
832 (add-after 'unpack 'find-rpc-includes
833 (lambda* (#:key inputs #:allow-other-keys)
834 (setenv "CPATH"
835 (string-append (assoc-ref inputs "libtirpc")
836 "/include/tirpc/:"
837 (or (getenv "CPATH") "")))
838 (setenv "CPLUS_INCLUDE_PATH"
839 (string-append (assoc-ref inputs "libtirpc")
840 "/include/tirpc/:"
841 (or (getenv "CPLUS_INCLUDE_PATH") "")))
842 #t))))))
843 (inputs
844 `(("libtirpc" ,libtirpc)
845 ("llvm" ,llvm-3.5))))))
b81f5693 846
1204c510 847(define-public clang-3.5
b81f5693 848 (clang-from-llvm llvm-3.5 clang-runtime-3.5
9bdbabe9
MB
849 "0846h8vn3zlc00jkmvrmy88gc6ql6014c02l4jv78fpvfigmgssg"
850 #:patches '("clang-3.5-libc-search-path.patch")))
921cb13a 851
f1db068a
MB
852;; Default LLVM and Clang version.
853(define-public llvm llvm-9)
854(define-public clang-runtime clang-runtime-9)
855(define-public clang clang-9)
856(define-public clang-toolchain clang-toolchain-9)
857
858(define-public lld
859 (package
860 (name "lld")
8937cd05 861 (version "11.0.0")
f1db068a
MB
862 (source (origin
863 (method url-fetch)
864 (uri (llvm-uri "lld" version))
865 (sha256
866 (base32
8937cd05 867 "077xyh7sij6mhp4dc4kdcmp9whrpz332fa12rwxnzp3wgd5bxrzg"))))
f1db068a
MB
868 (build-system cmake-build-system)
869 (inputs
8937cd05 870 `(("llvm" ,llvm-11)))
f1db068a
MB
871 (arguments
872 `(#:build-type "Release"
873 ;; TODO: Tests require the lit tool, which isn't installed by the LLVM
874 ;; package.
875 #:tests? #f))
876 (home-page "https://lld.llvm.org/")
877 (synopsis "Linker from the LLVM project")
878 (description "LLD is a high-performance linker, built as a set of reusable
879components which highly leverage existing libraries in the larger LLVM Project.")
880 (license license:asl2.0))) ; With LLVM exception
881
f11733bd
MB
882(define-public lldb
883 (package
884 (name "lldb")
885 (version "11.0.0")
886 (source (origin
887 (method url-fetch)
888 (uri (llvm-uri "lldb" version))
889 (sha256
890 (base32
891 "0wic9lyb2la9bkzdc13szkm4f793w1mddp50xvh237iraygw0w45"))))
892 (build-system cmake-build-system)
893 (arguments
894 `(#:configure-flags '("-DCMAKE_CXX_COMPILER=clang++")))
895 (native-inputs
896 `(("pkg-config" ,pkg-config)
897 ("swig" ,swig)))
898 (inputs
899 `(("clang" ,clang-11)
900 ("llvm" ,llvm-11)
901
902 ;; Optional (but recommended) inputs.
903 ("curses" ,ncurses)
904 ("editline" ,libedit)
905 ("liblzma" ,xz)
906 ("libxml2" ,libxml2)
907 ("lua" ,lua)
908 ("python" ,python)))
909 (home-page "https://lldb.llvm.org/")
910 (synopsis "Low level debugger")
911 (description
912 "LLDB is a high performance debugger built as a set of reusable components
913which highly leverage existing libraries in the larger LLVM project.")
914 (license license:asl2.0))) ;with LLVM exceptions
915
52f9c3b8
MB
916(define-public libcxx
917 (package
918 (name "libcxx")
00ede157 919 (version "9.0.1")
52f9c3b8
MB
920 (source
921 (origin
922 (method url-fetch)
abcdf6bf 923 (uri (llvm-uri "libcxx" version))
52f9c3b8
MB
924 (sha256
925 (base32
00ede157 926 "0d2bj5i6mk4caq7skd5nsdmz8c2m5w5anximl5wz3x32p08zz089"))))
52f9c3b8 927 (build-system cmake-build-system)
40a461fd
MB
928 (arguments
929 `(#:phases
930 (modify-phases (@ (guix build cmake-build-system) %standard-phases)
931 (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
932 (lambda* (#:key inputs #:allow-other-keys)
933 (let ((gcc (assoc-ref inputs "gcc")))
934 ;; Hide GCC's C++ headers so that they do not interfere with
935 ;; the ones we are attempting to build.
936 (setenv "CPLUS_INCLUDE_PATH"
937 (string-join (delete (string-append gcc "/include/c++")
938 (string-split (getenv "CPLUS_INCLUDE_PATH")
939 #\:))
940 ":"))
941 (format #t
942 "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
943 (getenv "CPLUS_INCLUDE_PATH"))
944 #t))))))
52f9c3b8
MB
945 (native-inputs
946 `(("clang" ,clang)
947 ("llvm" ,llvm)))
948 (home-page "https://libcxx.llvm.org")
949 (synopsis "C++ standard library")
950 (description
951 "This package provides an implementation of the C++ standard library for
952use with Clang, targeting C++11, C++14 and above.")
953 (license license:expat)))
954
955;; Libcxx files specifically used by PySide2.
956(define-public libcxx-6
957 (package
958 (inherit libcxx)
959 (version (package-version llvm-6))
960 (source
961 (origin
962 (inherit (package-source libcxx))
abcdf6bf 963 (uri (llvm-uri "libcxx" version))
52f9c3b8
MB
964 (sha256
965 (base32
966 "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
967 (native-inputs
968 `(("clang" ,clang-6)
969 ("llvm" ,llvm-6)))))
970
971(define-public libclc
972 (package
973 (name "libclc")
00ede157 974 (version "9.0.1")
52f9c3b8
MB
975 (source
976 (origin
977 (method git-fetch)
978 (uri (git-reference
b0e7b699 979 (url "https://github.com/llvm/llvm-project")
52f9c3b8
MB
980 (commit (string-append "llvmorg-" version))))
981 (file-name (git-file-name name version))
982 (sha256
983 (base32
00ede157 984 "1d1qayvrvvc1di7s7jfxnjvxq2az4lwq1sw1b2gq2ic0nksvajz0"))))
52f9c3b8
MB
985 (build-system cmake-build-system)
986 (arguments
987 `(#:configure-flags
988 (list (string-append "-DLLVM_CLANG="
989 (assoc-ref %build-inputs "clang")
990 "/bin/clang")
991 (string-append "-DPYTHON="
992 (assoc-ref %build-inputs "python")
993 "/bin/python3"))
994 #:phases
995 (modify-phases %standard-phases
996 (add-after 'unpack 'chdir
997 (lambda _ (chdir "libclc") #t)))))
998 (native-inputs
999 `(("clang" ,clang)
1000 ("llvm" ,llvm)
1001 ("python" ,python)))
1002 (home-page "https://libclc.llvm.org")
1003 (synopsis "Libraries for the OpenCL programming language")
1004 (description
1005 "This package provides an implementation of the OpenCL library
1006requirements according to version 1.1 of the OpenCL specification.")
1007 ;; Apache license 2.0 with LLVM exception
1008 (license license:asl2.0)))
1009
1010(define-public libomp
1011 (package
1012 (name "libomp")
00ede157 1013 (version "9.0.1")
52f9c3b8
MB
1014 (source (origin
1015 (method url-fetch)
abcdf6bf 1016 (uri (llvm-uri "openmp" version))
52f9c3b8
MB
1017 (sha256
1018 (base32
00ede157 1019 "1knafnpp0f7hylx8q20lkd6g1sf0flly572dayc5d5kghh7hd52w"))
52f9c3b8
MB
1020 (file-name (string-append "libomp-" version ".tar.xz"))))
1021 (build-system cmake-build-system)
1022 ;; XXX: Note this gets built with GCC because building with Clang itself
1023 ;; fails (missing <atomic>, even when libcxx is added as an input.)
1024 (arguments
1025 '(#:configure-flags '("-DLIBOMP_USE_HWLOC=ON"
1026 "-DOPENMP_TEST_C_COMPILER=clang"
1027 "-DOPENMP_TEST_CXX_COMPILER=clang++")
1028 #:test-target "check-libomp"))
1029 (native-inputs
1030 `(("clang" ,clang)
1031 ("llvm" ,llvm)
1032 ("perl" ,perl)
1033 ("pkg-config" ,pkg-config)))
1034 (inputs
1035 `(("hwloc" ,hwloc "lib")))
1036 (home-page "https://openmp.llvm.org")
1037 (synopsis "OpenMP run-time support library")
1038 (description
1039 "This package provides the run-time support library developed by the LLVM
1040project for the OpenMP multi-theaded programming extension. This package
1041notably provides @file{libgomp.so}, which is has a binary interface compatible
1042with that of libgomp, the GNU Offloading and Multi Processing Library.")
1043 (license license:expat)))
1044
8892cac3
RW
1045(define-public python-llvmlite
1046 (package
1047 (name "python-llvmlite")
66087272 1048 (version "0.30.0")
8892cac3
RW
1049 (source
1050 (origin
1051 (method url-fetch)
1052 (uri (pypi-uri "llvmlite" version))
1053 (sha256
1054 (base32
66087272 1055 "01wspdc0xhnydl66jyhyr4ii16h3fnw6mjihiwnnxdxg9j6kkajf"))))
8892cac3 1056 (build-system python-build-system)
66087272
BG
1057 (arguments
1058 ;; FIXME: One test fails unable to find libm.so
1059 ;; https://github.com/numba/llvmlite/issues/537
1060 `(#:tests? #f))
8892cac3
RW
1061 (inputs
1062 `(("llvm"
6ee74687
CB
1063 ,(let ((patches-commit "486edd5fb2a6667feb5c865f300c0da73785434a"))
1064 (package
1065 (inherit llvm-7)
1066 (source
1067 (origin
1068 (inherit (package-source llvm-7))
1069 (patches
1070 (list
1071 (origin
1072 (method url-fetch)
1073 (uri (string-append
1074 "https://raw.githubusercontent.com/numba/"
1075 "llvmlite/" patches-commit "/conda-recipes/"
1076 "D47188-svml-VF.patch"))
1077 (sha256
1078 (base32
1079 "0wxhgb61k17f0zg2m0726sf3hppm41f8jar2kkg2n8sl5cnjj9mr")))
1080 (origin
1081 (method url-fetch)
1082 (uri (string-append
1083 "https://raw.githubusercontent.com/numba/"
1084 "llvmlite/" patches-commit "/conda-recipes/"
1085 "twine_cfg_undefined_behavior.patch"))
1086 (sha256
1087 (base32
1088 "07h71n2m1mn9zcfgw04zglffknplb233zqbcd6pckq0wygkrxflp"))))))))))))
8892cac3
RW
1089 (home-page "http://llvmlite.pydata.org")
1090 (synopsis "Wrapper around basic LLVM functionality")
1091 (description
1092 "This package provides a Python binding to LLVM for use in Numba.")
1093 (license license:bsd-3)))
7628ff1f
TG
1094
1095(define-public emacs-clang-format
1096 (package
1097 (inherit clang)
1098 (name "emacs-clang-format")
1099 (build-system emacs-build-system)
1100 (inputs
1101 `(("clang" ,clang)))
1102 (arguments
1103 `(#:phases
1104 (modify-phases %standard-phases
1105 (add-after 'unpack 'configure
1106 (lambda* (#:key inputs #:allow-other-keys)
1107 (let ((clang (assoc-ref inputs "clang")))
1108 (copy-file "tools/clang-format/clang-format.el" "clang-format.el")
1109 (emacs-substitute-variables "clang-format.el"
1110 ("clang-format-executable"
1111 (string-append clang "/bin/clang-format"))))
1112 #t)))))
1113 (synopsis "Format code using clang-format")
3bb22e54 1114 (description "This package filters code through @code{clang-format}
7628ff1f
TG
1115to fix its formatting. @code{clang-format} is a tool that formats
1116C/C++/Obj-C code according to a set of style options, see
3bdcc668 1117@url{https://clang.llvm.org/docs/ClangFormatStyleOptions.html}.")))
51002b72
PN
1118
1119(define-public emacs-clang-rename
1120 (package
1121 (inherit clang)
1122 (name "emacs-clang-rename")
1123 (build-system emacs-build-system)
1124 (inputs
1125 `(("clang" ,clang)))
1126 (arguments
1127 `(#:phases
1128 (modify-phases %standard-phases
1129 (add-after 'unpack 'configure
1130 (lambda* (#:key inputs #:allow-other-keys)
1131 (let ((clang (assoc-ref inputs "clang")))
1132 (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el")
1133 (emacs-substitute-variables "clang-rename.el"
1134 ("clang-rename-binary"
1135 (string-append clang "/bin/clang-rename"))))
1136 #t)))))
1137 (synopsis "Rename every occurrence of a symbol using clang-rename")
1138 (description "This package renames every occurrence of a symbol at point
1139using @code{clang-rename}.")))