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