Commit | Line | Data |
---|---|---|
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> |
3e4249ce EB |
18 | ;;; |
19 | ;;; This file is part of GNU Guix. | |
20 | ;;; | |
21 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
22 | ;;; under the terms of the GNU General Public License as published by | |
23 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
24 | ;;; your option) any later version. | |
25 | ;;; | |
26 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
27 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
28 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
29 | ;;; GNU General Public License for more details. | |
30 | ;;; | |
31 | ;;; You should have received a copy of the GNU General Public License | |
32 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
33 | ||
34 | (define-module (gnu packages llvm) | |
35 | #:use-module (guix packages) | |
ac00973c | 36 | #:use-module ((guix licenses) #:prefix license:) |
3e4249ce | 37 | #:use-module (guix download) |
a2cc25ab | 38 | #:use-module (guix git-download) |
3e4249ce EB |
39 | #:use-module (guix utils) |
40 | #:use-module (guix build-system gnu) | |
41 | #:use-module (guix build-system cmake) | |
7628ff1f | 42 | #:use-module (guix build-system emacs) |
8892cac3 | 43 | #:use-module (guix build-system python) |
57c7bfec | 44 | #:use-module (guix build-system trivial) |
3e4249ce | 45 | #:use-module (gnu packages) |
57c7bfec | 46 | #:use-module (gnu packages base) |
fd6ae1b9 LC |
47 | #:use-module (gnu packages gcc) |
48 | #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker | |
ee077430 EB |
49 | #:use-module (gnu packages compression) |
50 | #:use-module (gnu packages libffi) | |
698e91f0 | 51 | #:use-module (gnu packages mpi) |
290b55c5 | 52 | #:use-module (gnu packages onc-rpc) |
3e4249ce | 53 | #:use-module (gnu packages perl) |
698e91f0 | 54 | #:use-module (gnu packages pkg-config) |
3e4249ce | 55 | #:use-module (gnu packages python) |
96a9a8d3 LC |
56 | #:use-module (gnu packages xml) |
57 | #:export (system->llvm-target)) | |
58 | ||
59 | (define* (system->llvm-target #:optional | |
60 | (system (or (and=> (%current-target-system) | |
61 | gnu-triplet->nix-system) | |
62 | (%current-system)))) | |
63 | "Return the LLVM target name that corresponds to SYSTEM, a system type such | |
64 | as \"x86_64-linux\"." | |
65 | ;; See the 'lib/Target' directory of LLVM for a list of supported targets. | |
66 | (letrec-syntax ((matches (syntax-rules (=>) | |
67 | ((_ (system-prefix => target) rest ...) | |
68 | (if (string-prefix? system-prefix system) | |
69 | target | |
70 | (matches rest ...))) | |
71 | ((_) | |
72 | (error "LLVM target for system is unknown" system))))) | |
73 | (matches ("aarch64" => "AArch64") | |
74 | ("armhf" => "ARM") | |
75 | ("mips64el" => "Mips") | |
76 | ("powerpc" => "PowerPC") | |
77 | ("riscv" => "RISCV") | |
78 | ("x86_64" => "X86") | |
3a1c3642 JN |
79 | ("i686" => "X86") |
80 | ("i586" => "X86")))) | |
3e4249ce | 81 | |
cd16014f MB |
82 | (define (llvm-download-uri component version) |
83 | (if (version>=? version "9.0.1") | |
84 | (string-append "https://github.com/llvm/llvm-project/releases/download" | |
85 | "/llvmorg-" version "/" component "-" version ".src.tar.xz") | |
86 | (string-append "https://releases.llvm.org/" version "/" component "-" | |
87 | version ".src.tar.xz"))) | |
88 | ||
193192ca | 89 | (define-public llvm-10 |
3e4249ce EB |
90 | (package |
91 | (name "llvm") | |
193192ca | 92 | (version "10.0.0") |
3e4249ce EB |
93 | (source |
94 | (origin | |
95 | (method url-fetch) | |
cd16014f | 96 | (uri (llvm-download-uri "llvm" version)) |
3e4249ce EB |
97 | (sha256 |
98 | (base32 | |
193192ca | 99 | "1pwgm6cr0xr5a0hrbqs1zvsvvjvy0yq1y47c96804wcs795s90yz")))) |
3e4249ce | 100 | (build-system cmake-build-system) |
50b61ec2 | 101 | (outputs '("out" "opt-viewer")) |
3e4249ce | 102 | (native-inputs |
3ebc0905 | 103 | `(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2 |
3e4249ce | 104 | ("perl" ,perl))) |
ee077430 | 105 | (inputs |
44e8559d EB |
106 | `(("libffi" ,libffi))) |
107 | (propagated-inputs | |
108 | `(("zlib" ,zlib))) ;to use output from llvm-config | |
3e4249ce | 109 | (arguments |
22d0e9b7 | 110 | `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" |
ee077430 | 111 | "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" |
ab78618f | 112 | "-DBUILD_SHARED_LIBS:BOOL=TRUE" |
22897187 | 113 | "-DLLVM_ENABLE_FFI:BOOL=TRUE" |
fc9dbf41 | 114 | "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities |
22897187 | 115 | "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. |
0935fb27 EB |
116 | |
117 | ;; Don't use '-g' during the build, to save space. | |
ab78618f | 118 | #:build-type "Release" |
50b61ec2 JL |
119 | #:phases |
120 | (modify-phases %standard-phases | |
121 | (add-before 'build 'shared-lib-workaround | |
122 | ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen | |
123 | ;; doesn't seem to get the correct rpath to be able to run | |
124 | ;; from the build directory. Set LD_LIBRARY_PATH as a | |
125 | ;; workaround. | |
126 | (lambda _ | |
127 | (setenv "LD_LIBRARY_PATH" | |
128 | (string-append (getcwd) "/lib")) | |
129 | #t)) | |
130 | (add-after 'install 'install-opt-viewer | |
131 | (lambda* (#:key outputs #:allow-other-keys) | |
132 | (let* ((out (assoc-ref outputs "out")) | |
133 | (opt-viewer-out (assoc-ref outputs "opt-viewer")) | |
134 | (opt-viewer-share-dir (string-append opt-viewer-out "/share")) | |
135 | (opt-viewer-dir (string-append opt-viewer-share-dir "/opt-viewer"))) | |
136 | (mkdir-p opt-viewer-share-dir) | |
137 | (rename-file (string-append out "/share/opt-viewer") | |
138 | opt-viewer-dir)) | |
139 | #t))))) | |
ac97dce1 | 140 | (home-page "https://www.llvm.org") |
3e4249ce EB |
141 | (synopsis "Optimizing compiler infrastructure") |
142 | (description | |
e881752c AK |
143 | "LLVM is a compiler infrastructure designed for compile-time, link-time, |
144 | runtime, and idle-time optimization of programs from arbitrary programming | |
145 | languages. It currently supports compilation of C and C++ programs, using | |
146 | front-ends derived from GCC 4.0.1. A new front-end for the C family of | |
147 | languages is in development. The compiler infrastructure includes mirror sets | |
148 | of programming tools as well as libraries with equivalent functionality.") | |
00ede157 | 149 | (license license:asl2.0))) ;with LLVM exceptions, see LICENSE.txt |
f5de2b9a | 150 | |
6b26f915 LC |
151 | (define* (clang-runtime-from-llvm llvm hash |
152 | #:optional (patches '())) | |
b81f5693 AW |
153 | (package |
154 | (name "clang-runtime") | |
155 | (version (package-version llvm)) | |
156 | (source | |
157 | (origin | |
158 | (method url-fetch) | |
cd16014f | 159 | (uri (llvm-download-uri "compiler-rt" version)) |
6b26f915 LC |
160 | (sha256 (base32 hash)) |
161 | (patches (map search-patch patches)))) | |
b81f5693 AW |
162 | (build-system cmake-build-system) |
163 | (native-inputs (package-native-inputs llvm)) | |
164 | (inputs | |
165 | `(("llvm" ,llvm))) | |
166 | (arguments | |
167 | `(;; Don't use '-g' during the build to save space. | |
3b956a33 | 168 | #:build-type "Release" |
3fd9c90c MB |
169 | #:tests? #f ; Tests require gtest |
170 | #:modules ((srfi srfi-1) | |
171 | (ice-9 match) | |
172 | ,@%cmake-build-system-modules) | |
173 | #:phases (modify-phases (@ (guix build cmake-build-system) %standard-phases) | |
174 | (add-after 'set-paths 'hide-glibc | |
175 | ;; Work around https://issues.guix.info/issue/36882. We need to | |
176 | ;; remove glibc from CPLUS_INCLUDE_PATH so that the one hardcoded | |
177 | ;; in GCC, at the bottom of GCC include search-path is used. | |
178 | (lambda* (#:key inputs #:allow-other-keys) | |
179 | (let* ((filters '("libc")) | |
180 | (input-directories | |
181 | (filter-map (lambda (input) | |
182 | (match input | |
183 | ((name . dir) | |
184 | (and (not (member name filters)) | |
185 | dir)))) | |
186 | inputs))) | |
187 | (set-path-environment-variable "CPLUS_INCLUDE_PATH" | |
188 | '("include") | |
189 | input-directories) | |
190 | #t)))))) | |
ac97dce1 | 191 | (home-page "https://compiler-rt.llvm.org") |
b81f5693 AW |
192 | (synopsis "Runtime library for Clang/LLVM") |
193 | (description | |
194 | "The \"clang-runtime\" library provides the implementations of run-time | |
195 | functions for C and C++ programs. It also provides header files that allow C | |
196 | and C++ source code to interface with the \"sanitization\" passes of the clang | |
197 | compiler. In LLVM this library is called \"compiler-rt\".") | |
00ede157 | 198 | (license (package-license llvm)) |
9e6b9ea4 | 199 | |
ac97dce1 | 200 | ;; <https://compiler-rt.llvm.org/> doesn't list MIPS as supported. |
9e6b9ea4 | 201 | (supported-systems (delete "mips64el-linux" %supported-systems)))) |
b81f5693 | 202 | |
3b956a33 | 203 | (define* (clang-from-llvm llvm clang-runtime hash |
9bdbabe9 | 204 | #:key (patches '())) |
3e4249ce EB |
205 | (package |
206 | (name "clang") | |
207 | (version (package-version llvm)) | |
208 | (source | |
209 | (origin | |
210 | (method url-fetch) | |
cd16014f MB |
211 | (uri (llvm-download-uri (if (version>=? version "9.0.1") |
212 | "clang" | |
213 | "cfe") | |
214 | version)) | |
fd6ae1b9 | 215 | (sha256 (base32 hash)) |
3b956a33 | 216 | (patches (map search-patch patches)))) |
3e4249ce EB |
217 | ;; Using cmake allows us to treat llvm as an external library. There |
218 | ;; doesn't seem to be any way to do this with clang's autotools-based | |
219 | ;; build system. | |
220 | (build-system cmake-build-system) | |
221 | (native-inputs (package-native-inputs llvm)) | |
222 | (inputs | |
223 | `(("libxml2" ,libxml2) | |
c92f1c0a | 224 | ("gcc-lib" ,gcc "lib") |
3e4249ce EB |
225 | ,@(package-inputs llvm))) |
226 | (propagated-inputs | |
b81f5693 AW |
227 | `(("llvm" ,llvm) |
228 | ("clang-runtime" ,clang-runtime))) | |
fd6ae1b9 LC |
229 | (arguments |
230 | `(#:configure-flags | |
231 | (list "-DCLANG_INCLUDE_TESTS=True" | |
232 | ||
233 | ;; Find libgcc_s, crtbegin.o, and crtend.o. | |
234 | (string-append "-DGCC_INSTALL_PREFIX=" | |
235 | (assoc-ref %build-inputs "gcc-lib")) | |
236 | ||
237 | ;; Use a sane default include directory. | |
238 | (string-append "-DC_INCLUDE_DIRS=" | |
239 | (assoc-ref %build-inputs "libc") | |
240 | "/include")) | |
241 | ||
94585e88 LC |
242 | ;; Don't use '-g' during the build to save space. |
243 | #:build-type "Release" | |
244 | ||
fd6ae1b9 | 245 | #:phases (modify-phases %standard-phases |
f5cc5de8 MB |
246 | (add-after 'unpack 'add-missing-triplets |
247 | (lambda _ | |
248 | ;; Clang iterates through known triplets to search for | |
249 | ;; GCC's headers, but does not recognize some of the | |
250 | ;; triplets that are used in Guix. | |
251 | (substitute* ,@(if (version>=? version "6.0") | |
252 | '("lib/Driver/ToolChains/Gnu.cpp") | |
253 | '("lib/Driver/ToolChains.cpp")) | |
254 | (("\"aarch64-linux-gnu\"," all) | |
255 | (string-append "\"aarch64-unknown-linux-gnu\", " | |
256 | all)) | |
257 | (("\"arm-linux-gnueabihf\"," all) | |
258 | (string-append all | |
259 | " \"arm-unknown-linux-gnueabihf\",")) | |
260 | (("\"i686-pc-linux-gnu\"," all) | |
261 | (string-append "\"i686-unknown-linux-gnu\", " | |
262 | all))) | |
263 | #t)) | |
5041cc28 MB |
264 | (add-after 'unpack 'set-glibc-file-names |
265 | (lambda* (#:key inputs #:allow-other-keys) | |
266 | (let ((libc (assoc-ref inputs "libc")) | |
267 | (compiler-rt (assoc-ref inputs "clang-runtime")) | |
268 | (gcc (assoc-ref inputs "gcc"))) | |
269 | ,@(cond | |
270 | ((version>=? version "6.0") | |
271 | `(;; Link to libclang_rt files from clang-runtime. | |
9bdbabe9 MB |
272 | (substitute* "lib/Driver/ToolChain.cpp" |
273 | (("getDriver\\(\\)\\.ResourceDir") | |
5041cc28 | 274 | (string-append "\"" compiler-rt "\""))) |
9bdbabe9 | 275 | |
5041cc28 MB |
276 | ;; Make "LibDir" refer to <glibc>/lib so that it |
277 | ;; uses the right dynamic linker file name. | |
278 | (substitute* "lib/Driver/ToolChains/Linux.cpp" | |
279 | (("(^[[:blank:]]+LibDir = ).*" _ declaration) | |
280 | (string-append declaration "\"" libc "/lib\";\n")) | |
9bdbabe9 | 281 | |
5041cc28 MB |
282 | ;; Make clang look for libstdc++ in the right |
283 | ;; location. | |
284 | (("LibStdCXXIncludePathCandidates\\[\\] = \\{") | |
285 | (string-append | |
286 | "LibStdCXXIncludePathCandidates[] = { \"" gcc | |
287 | "/include/c++\",")) | |
496bbeee | 288 | |
5041cc28 MB |
289 | ;; Make sure libc's libdir is on the search path, to |
290 | ;; allow crt1.o & co. to be found. | |
291 | (("@GLIBC_LIBDIR@") | |
292 | (string-append libc "/lib"))))) | |
293 | (else | |
294 | `((substitute* "lib/Driver/Tools.cpp" | |
295 | ;; Patch the 'getLinuxDynamicLinker' function so that | |
296 | ;; it uses the right dynamic linker file name. | |
297 | (("/lib64/ld-linux-x86-64.so.2") | |
298 | (string-append libc | |
299 | ,(glibc-dynamic-linker)))) | |
9bdbabe9 | 300 | |
5041cc28 MB |
301 | ;; Link to libclang_rt files from clang-runtime. |
302 | ;; This substitution needed slight adjustment in 3.8. | |
303 | ,@(if (version>=? version "3.8") | |
304 | '((substitute* "lib/Driver/Tools.cpp" | |
305 | (("TC\\.getDriver\\(\\)\\.ResourceDir") | |
306 | (string-append "\"" compiler-rt "\"")))) | |
307 | '((substitute* "lib/Driver/ToolChain.cpp" | |
308 | (("getDriver\\(\\)\\.ResourceDir") | |
309 | (string-append "\"" compiler-rt "\""))))) | |
9bdbabe9 | 310 | |
5041cc28 MB |
311 | ;; Make sure libc's libdir is on the search path, to |
312 | ;; allow crt1.o & co. to be found. | |
313 | (substitute* "lib/Driver/ToolChains.cpp" | |
314 | (("@GLIBC_LIBDIR@") | |
315 | (string-append libc "/lib")))))) | |
316 | #t))) | |
1c7372a5 PN |
317 | (add-after 'install 'install-clean-up-/share/clang |
318 | (lambda* (#:key outputs #:allow-other-keys) | |
319 | (let* ((out (assoc-ref outputs "out")) | |
320 | (compl-dir (string-append | |
321 | out "/etc/bash_completion.d"))) | |
322 | (with-directory-excursion (string-append out | |
323 | "/share/clang") | |
ad8a4a66 PN |
324 | (for-each |
325 | (lambda (file) | |
326 | (when (file-exists? file) | |
327 | (delete-file file))) | |
328 | ;; Delete extensions for proprietary text editors. | |
329 | '("clang-format-bbedit.applescript" | |
330 | "clang-format-sublime.py" | |
331 | ;; Delete Emacs extensions: see their respective Emacs | |
332 | ;; Guix package instead. | |
333 | "clang-rename.el" "clang-format.el")) | |
1c7372a5 | 334 | ;; Install bash completion. |
ad8a4a66 PN |
335 | (when (file-exists? "bash-autocomplete.sh") |
336 | (mkdir-p compl-dir) | |
337 | (rename-file "bash-autocomplete.sh" | |
338 | (string-append compl-dir "/clang"))))) | |
1c7372a5 | 339 | #t))))) |
ef11ac87 LC |
340 | |
341 | ;; Clang supports the same environment variables as GCC. | |
342 | (native-search-paths | |
343 | (list (search-path-specification | |
f42bfc7a | 344 | (variable "C_INCLUDE_PATH") |
ef11ac87 | 345 | (files '("include"))) |
f42bfc7a MB |
346 | (search-path-specification |
347 | (variable "CPLUS_INCLUDE_PATH") | |
348 | (files '("include/c++" "include"))) | |
ef11ac87 LC |
349 | (search-path-specification |
350 | (variable "LIBRARY_PATH") | |
351 | (files '("lib" "lib64"))))) | |
352 | ||
ac97dce1 | 353 | (home-page "https://clang.llvm.org") |
3e4249ce EB |
354 | (synopsis "C language family frontend for LLVM") |
355 | (description | |
356 | "Clang is a compiler front end for the C, C++, Objective-C and | |
357 | Objective-C++ programming languages. It uses LLVM as its back end. The Clang | |
358 | project includes the Clang front end, the Clang static analyzer, and several | |
359 | code analysis tools.") | |
00ede157 MB |
360 | (license (if (version>=? version "9.0") |
361 | license:asl2.0 ;with LLVM exceptions | |
362 | license:ncsa)))) | |
1204c510 | 363 | |
57c7bfec MO |
364 | (define (make-clang-toolchain clang) |
365 | (package | |
366 | (name (string-append (package-name clang) "-toolchain")) | |
367 | (version (package-version clang)) | |
368 | (source #f) | |
369 | (build-system trivial-build-system) | |
370 | (arguments | |
371 | '(#:modules ((guix build union)) | |
372 | #:builder (begin | |
373 | (use-modules (ice-9 match) | |
374 | (srfi srfi-26) | |
375 | (guix build union)) | |
376 | ||
377 | (let ((out (assoc-ref %outputs "out"))) | |
378 | ||
379 | (match %build-inputs | |
380 | (((names . directories) ...) | |
381 | (union-build out directories))) | |
382 | ||
383 | (union-build (assoc-ref %outputs "debug") | |
384 | (list (assoc-ref %build-inputs | |
385 | "libc-debug"))) | |
386 | (union-build (assoc-ref %outputs "static") | |
387 | (list (assoc-ref %build-inputs | |
388 | "libc-static"))) | |
389 | #t)))) | |
390 | ||
391 | (native-search-paths (package-native-search-paths clang)) | |
392 | (search-paths (package-search-paths clang)) | |
393 | ||
394 | (license (package-license clang)) | |
395 | (home-page "https://clang.llvm.org") | |
396 | (synopsis "Complete Clang toolchain for C/C++ development") | |
397 | (description "This package provides a complete Clang toolchain for C/C++ | |
398 | development to be installed in user profiles. This includes Clang, as well as | |
399 | libc (headers and binaries, plus debugging symbols in the @code{debug} | |
400 | output), and Binutils.") | |
401 | (outputs '("out" "debug" "static")) | |
402 | (inputs `(("clang" ,clang) | |
403 | ("ld-wrapper" ,(car (assoc-ref (%final-inputs) "ld-wrapper"))) | |
404 | ("binutils" ,binutils) | |
405 | ("libc" ,glibc) | |
406 | ("libc-debug" ,glibc "debug") | |
407 | ("libc-static" ,glibc "static"))))) | |
408 | ||
193192ca LC |
409 | (define-public clang-runtime-10 |
410 | (clang-runtime-from-llvm | |
411 | llvm-10 | |
412 | "0x9c531k6ww21s2mkdwqx1vbdjmx6d4wmfb8gdbj0wqa796sczba")) | |
413 | ||
414 | (define-public clang-10 | |
415 | (clang-from-llvm llvm-10 clang-runtime-10 | |
416 | "08fbxa2a0kr3ni35ckppj0kyvlcyaywrhpqwcdrdy0z900mhcnw8" | |
417 | #:patches '("clang-10.0-libc-search-path.patch"))) | |
418 | ||
419 | (define-public clang-toolchain-10 | |
420 | (make-clang-toolchain clang-10)) | |
421 | ||
422 | (define-public llvm-9 | |
423 | (package | |
424 | (inherit llvm-10) | |
425 | (version "9.0.1") | |
426 | (source | |
427 | (origin | |
428 | (method url-fetch) | |
429 | (uri (llvm-download-uri "llvm" version)) | |
430 | (sha256 | |
431 | (base32 | |
432 | "16hwp3qa54c3a3v7h8nlw0fh5criqh0hlr1skybyk0cz70gyx880")))))) | |
433 | ||
434 | (define-public clang-runtime-9 | |
b81f5693 | 435 | (clang-runtime-from-llvm |
193192ca | 436 | llvm-9 |
af88972b MB |
437 | "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2" |
438 | '("clang-runtime-9-libsanitizer-mode-field.patch"))) | |
b81f5693 | 439 | |
193192ca LC |
440 | (define-public clang-9 |
441 | (clang-from-llvm llvm-9 clang-runtime-9 | |
00ede157 MB |
442 | "0ls2h3iv4finqyflyhry21qhc9cm9ga7g1zq21020p065qmm2y2p" |
443 | #:patches '("clang-9.0-libc-search-path.patch"))) | |
d199a4c7 | 444 | |
193192ca LC |
445 | (define-public clang-toolchain-9 |
446 | (make-clang-toolchain clang-9)) | |
57c7bfec | 447 | |
193192ca LC |
448 | ;; Default LLVM and Clang version. |
449 | (define-public llvm llvm-9) | |
450 | (define-public clang-runtime clang-runtime-9) | |
451 | (define-public clang clang-9) | |
452 | (define-public clang-toolchain clang-toolchain-9) | |
00ede157 MB |
453 | |
454 | (define-public llvm-8 | |
96d5a206 DT |
455 | (package |
456 | (inherit llvm) | |
00ede157 | 457 | (version "8.0.0") |
96d5a206 DT |
458 | (source (origin |
459 | (method url-fetch) | |
cd16014f | 460 | (uri (llvm-download-uri "llvm" version)) |
96d5a206 DT |
461 | (sha256 |
462 | (base32 | |
00ede157 MB |
463 | "0k124sxkfhfi1rca6kzkdraf4axhx99x3cw2rk55056628dvwwl8")))) |
464 | (license license:ncsa))) | |
96d5a206 | 465 | |
00ede157 | 466 | (define-public clang-runtime-8 |
96d5a206 | 467 | (clang-runtime-from-llvm |
00ede157 | 468 | llvm-8 |
af88972b MB |
469 | "1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl" |
470 | '("clang-runtime-9-libsanitizer-mode-field.patch"))) | |
96d5a206 | 471 | |
00ede157 MB |
472 | (define-public clang-8 |
473 | (clang-from-llvm llvm-8 clang-runtime-8 | |
474 | "0svk1f70hvpwrjp6x5i9kqwrqwxnmcrw5s7f4cxyd100mdd12k08" | |
475 | #:patches '("clang-7.0-libc-search-path.patch"))) | |
96d5a206 | 476 | |
00ede157 MB |
477 | (define-public clang-toolchain-8 |
478 | (make-clang-toolchain clang-8)) | |
96d5a206 | 479 | |
4289d1d7 MB |
480 | (define-public llvm-7 |
481 | (package | |
00ede157 | 482 | (inherit llvm-8) |
4289d1d7 MB |
483 | (version "7.0.1") |
484 | (source (origin | |
485 | (method url-fetch) | |
cd16014f | 486 | (uri (llvm-download-uri "llvm" version)) |
4289d1d7 MB |
487 | (sha256 |
488 | (base32 | |
489 | "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3")))))) | |
490 | ||
491 | (define-public clang-runtime-7 | |
492 | (clang-runtime-from-llvm | |
493 | llvm-7 | |
af88972b MB |
494 | "065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq" |
495 | '("clang-runtime-9-libsanitizer-mode-field.patch"))) | |
4289d1d7 MB |
496 | |
497 | (define-public clang-7 | |
501672d7 | 498 | (clang-from-llvm llvm-7 clang-runtime-7 |
4289d1d7 MB |
499 | "067lwggnbg0w1dfrps790r5l6k8n5zwhlsw7zb6zvmfpwpfn4nx4" |
500 | #:patches '("clang-7.0-libc-search-path.patch"))) | |
501 | ||
57c7bfec MO |
502 | (define-public clang-toolchain-7 |
503 | (make-clang-toolchain clang-7)) | |
504 | ||
d199a4c7 MB |
505 | (define-public llvm-6 |
506 | (package | |
00ede157 | 507 | (inherit llvm-7) |
d199a4c7 MB |
508 | (version "6.0.1") |
509 | (source (origin | |
510 | (method url-fetch) | |
cd16014f | 511 | (uri (llvm-download-uri "llvm" version)) |
d199a4c7 MB |
512 | (sha256 |
513 | (base32 | |
514 | "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn")))))) | |
515 | ||
516 | (define-public clang-runtime-6 | |
517 | (clang-runtime-from-llvm | |
518 | llvm-6 | |
af88972b MB |
519 | "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl" |
520 | '("clang-runtime-9-libsanitizer-mode-field.patch"))) | |
d199a4c7 MB |
521 | |
522 | (define-public clang-6 | |
501672d7 | 523 | (clang-from-llvm llvm-6 clang-runtime-6 |
148df605 | 524 | "0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w" |
9bdbabe9 | 525 | #:patches '("clang-6.0-libc-search-path.patch"))) |
3b956a33 | 526 | |
57c7bfec MO |
527 | (define-public clang-toolchain-6 |
528 | (make-clang-toolchain clang-6)) | |
529 | ||
584da12d | 530 | (define-public llvm-3.9.1 |
00ede157 | 531 | (package (inherit llvm-6) |
584da12d RJ |
532 | (name "llvm") |
533 | (version "3.9.1") | |
534 | (source | |
535 | (origin | |
536 | (method url-fetch) | |
cd16014f | 537 | (uri (llvm-download-uri "llvm" version)) |
584da12d RJ |
538 | (sha256 |
539 | (base32 | |
a6046f24 MB |
540 | "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z")))) |
541 | (outputs '("out")) | |
542 | (arguments | |
543 | (substitute-keyword-arguments (package-arguments llvm) | |
544 | ((#:phases phases) | |
545 | `(modify-phases ,phases | |
546 | (delete 'install-opt-viewer))))))) | |
584da12d RJ |
547 | |
548 | (define-public clang-runtime-3.9.1 | |
549 | (clang-runtime-from-llvm | |
550 | llvm-3.9.1 | |
6b26f915 | 551 | "16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk" |
af88972b MB |
552 | '("clang-runtime-3.9-libsanitizer-mode-field.patch" |
553 | "clang-runtime-asan-build-fixes.patch" | |
0627f93d | 554 | "clang-runtime-esan-build-fixes.patch" |
1a2d8d06 | 555 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
584da12d RJ |
556 | |
557 | (define-public clang-3.9.1 | |
558 | (clang-from-llvm llvm-3.9.1 clang-runtime-3.9.1 | |
559 | "0qsyyb40iwifhhlx9a3drf8z6ni6zwyk3bvh0kx2gs6yjsxwxi76" | |
9bdbabe9 MB |
560 | #:patches '("clang-3.8-libc-search-path.patch"))) |
561 | ||
562 | (define-public llvm-3.8 | |
a6046f24 | 563 | (package (inherit llvm-3.9.1) |
9bdbabe9 MB |
564 | (name "llvm") |
565 | (version "3.8.1") | |
566 | (source | |
567 | (origin | |
568 | (method url-fetch) | |
cd16014f | 569 | (uri (llvm-download-uri "llvm" version)) |
9bdbabe9 MB |
570 | (sha256 |
571 | (base32 | |
572 | "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf")))))) | |
573 | ||
574 | (define-public clang-runtime-3.8 | |
575 | (clang-runtime-from-llvm | |
576 | llvm-3.8 | |
577 | "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d" | |
0627f93d | 578 | '("clang-runtime-asan-build-fixes.patch" |
af88972b | 579 | "clang-runtime-3.8-libsanitizer-mode-field.patch" |
1a2d8d06 | 580 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
9bdbabe9 MB |
581 | |
582 | (define-public clang-3.8 | |
583 | (clang-from-llvm llvm-3.8 clang-runtime-3.8 | |
584 | "1prc72xmkgx8wrzmrr337776676nhsp1qd3mw2bvb22bzdnq7lsc" | |
585 | #:patches '("clang-3.8-libc-search-path.patch"))) | |
584da12d | 586 | |
3b956a33 | 587 | (define-public llvm-3.7 |
00ede157 | 588 | (package (inherit llvm-3.8) |
3b956a33 EB |
589 | (version "3.7.1") |
590 | (source | |
591 | (origin | |
592 | (method url-fetch) | |
cd16014f | 593 | (uri (llvm-download-uri "llvm" version)) |
3b956a33 EB |
594 | (sha256 |
595 | (base32 | |
596 | "1masakdp9g2dan1yrazg7md5am2vacbkb3nahb3dchpc1knr8xxy")))))) | |
597 | ||
598 | (define-public clang-runtime-3.7 | |
599 | (clang-runtime-from-llvm | |
600 | llvm-3.7 | |
6b26f915 | 601 | "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx" |
0627f93d | 602 | '("clang-runtime-asan-build-fixes.patch" |
af88972b | 603 | "clang-runtime-3.8-libsanitizer-mode-field.patch" |
1a2d8d06 | 604 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
3b956a33 EB |
605 | |
606 | (define-public clang-3.7 | |
607 | (clang-from-llvm llvm-3.7 clang-runtime-3.7 | |
9bdbabe9 MB |
608 | "0x065d0w9b51xvdjxwfzjxng0gzpbx45fgiaxpap45ragi61dqjn" |
609 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
3ebc0905 EB |
610 | |
611 | (define-public llvm-3.6 | |
00ede157 | 612 | (package (inherit llvm-3.7) |
3ebc0905 EB |
613 | (version "3.6.2") |
614 | (source | |
615 | (origin | |
616 | (method url-fetch) | |
cd16014f | 617 | (uri (llvm-download-uri "llvm" version)) |
3ebc0905 EB |
618 | (sha256 |
619 | (base32 | |
620 | "153vcvj8gvgwakzr4j0kndc0b7wn91c2g1vy2vg24s6spxcc23gn")))))) | |
621 | ||
622 | (define-public clang-runtime-3.6 | |
623 | (clang-runtime-from-llvm | |
624 | llvm-3.6 | |
6b26f915 | 625 | "11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg" |
af88972b | 626 | '("clang-runtime-asan-build-fixes.patch"))) |
3ebc0905 EB |
627 | |
628 | (define-public clang-3.6 | |
629 | (clang-from-llvm llvm-3.6 clang-runtime-3.6 | |
9bdbabe9 MB |
630 | "1wwr8s6lzr324hv4s1k6na4j5zv6n9kdhi14s4kb9b13d93814df" |
631 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
1204c510 MW |
632 | |
633 | (define-public llvm-3.5 | |
00ede157 | 634 | (package (inherit llvm-3.6) |
a53c486d | 635 | (version "3.5.2") |
1204c510 MW |
636 | (source |
637 | (origin | |
638 | (method url-fetch) | |
cd16014f | 639 | (uri (llvm-download-uri "llvm" version)) |
6ba4eca2 RW |
640 | (patches |
641 | (search-patches "llvm-3.5-fix-clang-build-with-gcc5.patch")) | |
1204c510 MW |
642 | (sha256 |
643 | (base32 | |
a53c486d | 644 | "0xf5q17kkxsrm2gsi93h4pwlv663kji73r2g4asb97klsmb626a4")))))) |
1204c510 | 645 | |
b81f5693 | 646 | (define-public clang-runtime-3.5 |
290b55c5 RW |
647 | (let ((runtime (clang-runtime-from-llvm |
648 | llvm-3.5 | |
649 | "1hsdnzzdr5kglz6fnv3lcsjs222zjsy14y8ax9dy6zqysanplbal" | |
650 | '("clang-runtime-asan-build-fixes.patch" | |
651 | "clang-3.5-libsanitizer-ustat-fix.patch")))) | |
652 | (package | |
653 | (inherit runtime) | |
654 | (arguments | |
655 | (substitute-keyword-arguments (package-arguments runtime) | |
656 | ((#:phases phases '%standard-phases) | |
657 | `(modify-phases ,phases | |
658 | ;; glibc no longer includes rpc/xdr.h, so we use the headers from | |
659 | ;; libtirpc. | |
660 | (add-after 'unpack 'find-rpc-includes | |
661 | (lambda* (#:key inputs #:allow-other-keys) | |
662 | (setenv "CPATH" | |
663 | (string-append (assoc-ref inputs "libtirpc") | |
664 | "/include/tirpc/:" | |
665 | (or (getenv "CPATH") ""))) | |
666 | (setenv "CPLUS_INCLUDE_PATH" | |
667 | (string-append (assoc-ref inputs "libtirpc") | |
668 | "/include/tirpc/:" | |
669 | (or (getenv "CPLUS_INCLUDE_PATH") ""))) | |
670 | #t)))))) | |
671 | (inputs | |
672 | `(("libtirpc" ,libtirpc) | |
673 | ("llvm" ,llvm-3.5)))))) | |
b81f5693 | 674 | |
1204c510 | 675 | (define-public clang-3.5 |
b81f5693 | 676 | (clang-from-llvm llvm-3.5 clang-runtime-3.5 |
9bdbabe9 MB |
677 | "0846h8vn3zlc00jkmvrmy88gc6ql6014c02l4jv78fpvfigmgssg" |
678 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
921cb13a RW |
679 | |
680 | (define-public llvm-for-extempore | |
b1cb8b5d | 681 | (package (inherit llvm-3.8) |
7355634d | 682 | (name "llvm-for-extempore") |
921cb13a RW |
683 | (source |
684 | (origin | |
b1cb8b5d GL |
685 | (method url-fetch) |
686 | (uri (string-append "http://extempore.moso.com.au/extras/" | |
687 | "llvm-3.8.0.src-patched-for-extempore.tar.xz")) | |
688 | (sha256 | |
689 | (base32 | |
690 | "1svdl6fxn8l01ni8mpm0bd5h856ahv3h9sdzgmymr6fayckjvqzs")))) | |
39162ee4 RW |
691 | ;; Extempore refuses to build on architectures other than x86_64 |
692 | (supported-systems '("x86_64-linux")))) | |
8892cac3 | 693 | |
52f9c3b8 MB |
694 | (define-public libcxx |
695 | (package | |
696 | (name "libcxx") | |
00ede157 | 697 | (version "9.0.1") |
52f9c3b8 MB |
698 | (source |
699 | (origin | |
700 | (method url-fetch) | |
701 | (uri (llvm-download-uri "libcxx" version)) | |
702 | (sha256 | |
703 | (base32 | |
00ede157 | 704 | "0d2bj5i6mk4caq7skd5nsdmz8c2m5w5anximl5wz3x32p08zz089")))) |
52f9c3b8 | 705 | (build-system cmake-build-system) |
40a461fd MB |
706 | (arguments |
707 | `(#:phases | |
708 | (modify-phases (@ (guix build cmake-build-system) %standard-phases) | |
709 | (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH | |
710 | (lambda* (#:key inputs #:allow-other-keys) | |
711 | (let ((gcc (assoc-ref inputs "gcc"))) | |
712 | ;; Hide GCC's C++ headers so that they do not interfere with | |
713 | ;; the ones we are attempting to build. | |
714 | (setenv "CPLUS_INCLUDE_PATH" | |
715 | (string-join (delete (string-append gcc "/include/c++") | |
716 | (string-split (getenv "CPLUS_INCLUDE_PATH") | |
717 | #\:)) | |
718 | ":")) | |
719 | (format #t | |
720 | "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%" | |
721 | (getenv "CPLUS_INCLUDE_PATH")) | |
722 | #t)))))) | |
52f9c3b8 MB |
723 | (native-inputs |
724 | `(("clang" ,clang) | |
725 | ("llvm" ,llvm))) | |
726 | (home-page "https://libcxx.llvm.org") | |
727 | (synopsis "C++ standard library") | |
728 | (description | |
729 | "This package provides an implementation of the C++ standard library for | |
730 | use with Clang, targeting C++11, C++14 and above.") | |
731 | (license license:expat))) | |
732 | ||
733 | ;; Libcxx files specifically used by PySide2. | |
734 | (define-public libcxx-6 | |
735 | (package | |
736 | (inherit libcxx) | |
737 | (version (package-version llvm-6)) | |
738 | (source | |
739 | (origin | |
740 | (inherit (package-source libcxx)) | |
741 | (uri (llvm-download-uri "libcxx" version)) | |
742 | (sha256 | |
743 | (base32 | |
744 | "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n")))) | |
745 | (native-inputs | |
746 | `(("clang" ,clang-6) | |
747 | ("llvm" ,llvm-6))))) | |
748 | ||
749 | (define-public libclc | |
750 | (package | |
751 | (name "libclc") | |
00ede157 | 752 | (version "9.0.1") |
52f9c3b8 MB |
753 | (source |
754 | (origin | |
755 | (method git-fetch) | |
756 | (uri (git-reference | |
757 | (url "https://github.com/llvm/llvm-project.git") | |
758 | (commit (string-append "llvmorg-" version)))) | |
759 | (file-name (git-file-name name version)) | |
760 | (sha256 | |
761 | (base32 | |
00ede157 | 762 | "1d1qayvrvvc1di7s7jfxnjvxq2az4lwq1sw1b2gq2ic0nksvajz0")))) |
52f9c3b8 MB |
763 | (build-system cmake-build-system) |
764 | (arguments | |
765 | `(#:configure-flags | |
766 | (list (string-append "-DLLVM_CLANG=" | |
767 | (assoc-ref %build-inputs "clang") | |
768 | "/bin/clang") | |
769 | (string-append "-DPYTHON=" | |
770 | (assoc-ref %build-inputs "python") | |
771 | "/bin/python3")) | |
772 | #:phases | |
773 | (modify-phases %standard-phases | |
774 | (add-after 'unpack 'chdir | |
775 | (lambda _ (chdir "libclc") #t))))) | |
776 | (native-inputs | |
777 | `(("clang" ,clang) | |
778 | ("llvm" ,llvm) | |
779 | ("python" ,python))) | |
780 | (home-page "https://libclc.llvm.org") | |
781 | (synopsis "Libraries for the OpenCL programming language") | |
782 | (description | |
783 | "This package provides an implementation of the OpenCL library | |
784 | requirements according to version 1.1 of the OpenCL specification.") | |
785 | ;; Apache license 2.0 with LLVM exception | |
786 | (license license:asl2.0))) | |
787 | ||
788 | (define-public libomp | |
789 | (package | |
790 | (name "libomp") | |
00ede157 | 791 | (version "9.0.1") |
52f9c3b8 MB |
792 | (source (origin |
793 | (method url-fetch) | |
794 | (uri (llvm-download-uri "openmp" version)) | |
795 | (sha256 | |
796 | (base32 | |
00ede157 | 797 | "1knafnpp0f7hylx8q20lkd6g1sf0flly572dayc5d5kghh7hd52w")) |
52f9c3b8 MB |
798 | (file-name (string-append "libomp-" version ".tar.xz")))) |
799 | (build-system cmake-build-system) | |
800 | ;; XXX: Note this gets built with GCC because building with Clang itself | |
801 | ;; fails (missing <atomic>, even when libcxx is added as an input.) | |
802 | (arguments | |
803 | '(#:configure-flags '("-DLIBOMP_USE_HWLOC=ON" | |
804 | "-DOPENMP_TEST_C_COMPILER=clang" | |
805 | "-DOPENMP_TEST_CXX_COMPILER=clang++") | |
806 | #:test-target "check-libomp")) | |
807 | (native-inputs | |
808 | `(("clang" ,clang) | |
809 | ("llvm" ,llvm) | |
810 | ("perl" ,perl) | |
811 | ("pkg-config" ,pkg-config))) | |
812 | (inputs | |
813 | `(("hwloc" ,hwloc "lib"))) | |
814 | (home-page "https://openmp.llvm.org") | |
815 | (synopsis "OpenMP run-time support library") | |
816 | (description | |
817 | "This package provides the run-time support library developed by the LLVM | |
818 | project for the OpenMP multi-theaded programming extension. This package | |
819 | notably provides @file{libgomp.so}, which is has a binary interface compatible | |
820 | with that of libgomp, the GNU Offloading and Multi Processing Library.") | |
821 | (license license:expat))) | |
822 | ||
8892cac3 RW |
823 | (define-public python-llvmlite |
824 | (package | |
825 | (name "python-llvmlite") | |
66087272 | 826 | (version "0.30.0") |
8892cac3 RW |
827 | (source |
828 | (origin | |
829 | (method url-fetch) | |
830 | (uri (pypi-uri "llvmlite" version)) | |
831 | (sha256 | |
832 | (base32 | |
66087272 | 833 | "01wspdc0xhnydl66jyhyr4ii16h3fnw6mjihiwnnxdxg9j6kkajf")))) |
8892cac3 | 834 | (build-system python-build-system) |
66087272 BG |
835 | (arguments |
836 | ;; FIXME: One test fails unable to find libm.so | |
837 | ;; https://github.com/numba/llvmlite/issues/537 | |
838 | `(#:tests? #f)) | |
8892cac3 RW |
839 | (inputs |
840 | `(("llvm" | |
841 | ,(package | |
4289d1d7 | 842 | (inherit llvm-7) |
8892cac3 | 843 | (source (origin |
4289d1d7 | 844 | (inherit (package-source llvm-7)) |
8892cac3 RW |
845 | (patches |
846 | (list | |
847 | (origin | |
848 | (method url-fetch) | |
849 | (uri (string-append "https://raw.githubusercontent.com/numba/" | |
850 | "llvmlite/v" version "/conda-recipes/" | |
f9325407 | 851 | "D47188-svml-VF.patch")) |
8892cac3 RW |
852 | (sha256 |
853 | (base32 | |
f9325407 | 854 | "0wxhgb61k17f0zg2m0726sf3hppm41f8jar2kkg2n8sl5cnjj9mr"))) |
8892cac3 RW |
855 | (origin |
856 | (method url-fetch) | |
857 | (uri (string-append "https://raw.githubusercontent.com/numba/" | |
858 | "llvmlite/v" version "/conda-recipes/" | |
859 | "twine_cfg_undefined_behavior.patch")) | |
860 | (sha256 | |
861 | (base32 | |
7a20877a | 862 | "07h71n2m1mn9zcfgw04zglffknplb233zqbcd6pckq0wygkrxflp"))))))))))) |
8892cac3 RW |
863 | (home-page "http://llvmlite.pydata.org") |
864 | (synopsis "Wrapper around basic LLVM functionality") | |
865 | (description | |
866 | "This package provides a Python binding to LLVM for use in Numba.") | |
867 | (license license:bsd-3))) | |
7628ff1f | 868 | |
67eebb19 LC |
869 | (define (package-elisp-from-package source-package package-name |
870 | source-files) | |
871 | "Return a package definition named PACKAGE-NAME that packages the Emacs Lisp | |
872 | SOURCE-FILES found in SOURCE-PACKAGE." | |
873 | (let ((orig (package-source source-package))) | |
874 | (package | |
875 | (inherit source-package) | |
876 | (name package-name) | |
877 | (build-system emacs-build-system) | |
878 | (source (origin | |
879 | (method (origin-method orig)) | |
880 | (uri (origin-uri orig)) | |
881 | (sha256 (origin-sha256 orig)) | |
882 | (file-name (string-append package-name "-" | |
883 | (package-version source-package))) | |
884 | (modules '((guix build utils) | |
885 | (srfi srfi-1) | |
886 | (ice-9 ftw))) | |
887 | (snippet | |
888 | `(let* ((source-files (quote ,source-files)) | |
889 | (basenames (map basename source-files))) | |
890 | (map copy-file | |
891 | source-files basenames) | |
892 | (map delete-file-recursively | |
893 | (fold delete | |
894 | (scandir ".") | |
895 | (append '("." "..") basenames))) | |
896 | #t))))))) | |
897 | ||
7628ff1f TG |
898 | (define-public emacs-clang-format |
899 | (package | |
900 | (inherit clang) | |
901 | (name "emacs-clang-format") | |
902 | (build-system emacs-build-system) | |
903 | (inputs | |
904 | `(("clang" ,clang))) | |
905 | (arguments | |
906 | `(#:phases | |
907 | (modify-phases %standard-phases | |
908 | (add-after 'unpack 'configure | |
909 | (lambda* (#:key inputs #:allow-other-keys) | |
910 | (let ((clang (assoc-ref inputs "clang"))) | |
911 | (copy-file "tools/clang-format/clang-format.el" "clang-format.el") | |
912 | (emacs-substitute-variables "clang-format.el" | |
913 | ("clang-format-executable" | |
914 | (string-append clang "/bin/clang-format")))) | |
915 | #t))))) | |
916 | (synopsis "Format code using clang-format") | |
3bb22e54 | 917 | (description "This package filters code through @code{clang-format} |
7628ff1f TG |
918 | to fix its formatting. @code{clang-format} is a tool that formats |
919 | C/C++/Obj-C code according to a set of style options, see | |
3bdcc668 | 920 | @url{https://clang.llvm.org/docs/ClangFormatStyleOptions.html}."))) |
51002b72 PN |
921 | |
922 | (define-public emacs-clang-rename | |
923 | (package | |
924 | (inherit clang) | |
925 | (name "emacs-clang-rename") | |
926 | (build-system emacs-build-system) | |
927 | (inputs | |
928 | `(("clang" ,clang))) | |
929 | (arguments | |
930 | `(#:phases | |
931 | (modify-phases %standard-phases | |
932 | (add-after 'unpack 'configure | |
933 | (lambda* (#:key inputs #:allow-other-keys) | |
934 | (let ((clang (assoc-ref inputs "clang"))) | |
935 | (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el") | |
936 | (emacs-substitute-variables "clang-rename.el" | |
937 | ("clang-rename-binary" | |
938 | (string-append clang "/bin/clang-rename")))) | |
939 | #t))))) | |
940 | (synopsis "Rename every occurrence of a symbol using clang-rename") | |
941 | (description "This package renames every occurrence of a symbol at point | |
942 | using @code{clang-rename}."))) |