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> |
286bea0d | 4 | ;;; Copyright © 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> |
ee077430 | 5 | ;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com> |
9f0ce5ec | 6 | ;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net> |
584da12d | 7 | ;;; Copyright © 2017 Roel Janssen <roel@gnu.org> |
d199a4c7 | 8 | ;;; Copyright © 2018, 2019 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> |
3e4249ce EB |
14 | ;;; |
15 | ;;; This file is part of GNU Guix. | |
16 | ;;; | |
17 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
18 | ;;; under the terms of the GNU General Public License as published by | |
19 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
20 | ;;; your option) any later version. | |
21 | ;;; | |
22 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
23 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | ;;; GNU General Public License for more details. | |
26 | ;;; | |
27 | ;;; You should have received a copy of the GNU General Public License | |
28 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
29 | ||
30 | (define-module (gnu packages llvm) | |
31 | #:use-module (guix packages) | |
ac00973c | 32 | #:use-module ((guix licenses) #:prefix license:) |
3e4249ce | 33 | #:use-module (guix download) |
a2cc25ab | 34 | #:use-module (guix git-download) |
3e4249ce EB |
35 | #:use-module (guix utils) |
36 | #:use-module (guix build-system gnu) | |
37 | #:use-module (guix build-system cmake) | |
7628ff1f | 38 | #:use-module (guix build-system emacs) |
8892cac3 | 39 | #:use-module (guix build-system python) |
3e4249ce | 40 | #:use-module (gnu packages) |
fd6ae1b9 LC |
41 | #:use-module (gnu packages gcc) |
42 | #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker | |
ee077430 EB |
43 | #:use-module (gnu packages compression) |
44 | #:use-module (gnu packages libffi) | |
698e91f0 | 45 | #:use-module (gnu packages mpi) |
3e4249ce | 46 | #:use-module (gnu packages perl) |
698e91f0 | 47 | #:use-module (gnu packages pkg-config) |
3e4249ce | 48 | #:use-module (gnu packages python) |
96a9a8d3 LC |
49 | #:use-module (gnu packages xml) |
50 | #:export (system->llvm-target)) | |
51 | ||
52 | (define* (system->llvm-target #:optional | |
53 | (system (or (and=> (%current-target-system) | |
54 | gnu-triplet->nix-system) | |
55 | (%current-system)))) | |
56 | "Return the LLVM target name that corresponds to SYSTEM, a system type such | |
57 | as \"x86_64-linux\"." | |
58 | ;; See the 'lib/Target' directory of LLVM for a list of supported targets. | |
59 | (letrec-syntax ((matches (syntax-rules (=>) | |
60 | ((_ (system-prefix => target) rest ...) | |
61 | (if (string-prefix? system-prefix system) | |
62 | target | |
63 | (matches rest ...))) | |
64 | ((_) | |
65 | (error "LLVM target for system is unknown" system))))) | |
66 | (matches ("aarch64" => "AArch64") | |
67 | ("armhf" => "ARM") | |
68 | ("mips64el" => "Mips") | |
69 | ("powerpc" => "PowerPC") | |
70 | ("riscv" => "RISCV") | |
71 | ("x86_64" => "X86") | |
72 | ("i686" => "X86")))) | |
3e4249ce | 73 | |
f5de2b9a | 74 | (define-public llvm-8 |
3e4249ce EB |
75 | (package |
76 | (name "llvm") | |
c5296e20 | 77 | (version "8.0.0") |
3e4249ce EB |
78 | (source |
79 | (origin | |
80 | (method url-fetch) | |
3bdcc668 | 81 | (uri (string-append "https://llvm.org/releases/" |
3e4249ce EB |
82 | version "/llvm-" version ".src.tar.xz")) |
83 | (sha256 | |
84 | (base32 | |
c5296e20 | 85 | "0k124sxkfhfi1rca6kzkdraf4axhx99x3cw2rk55056628dvwwl8")))) |
3e4249ce EB |
86 | (build-system cmake-build-system) |
87 | (native-inputs | |
3ebc0905 | 88 | `(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2 |
3e4249ce | 89 | ("perl" ,perl))) |
ee077430 | 90 | (inputs |
44e8559d EB |
91 | `(("libffi" ,libffi))) |
92 | (propagated-inputs | |
93 | `(("zlib" ,zlib))) ;to use output from llvm-config | |
3e4249ce | 94 | (arguments |
22d0e9b7 | 95 | `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" |
ee077430 | 96 | "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" |
ab78618f | 97 | "-DBUILD_SHARED_LIBS:BOOL=TRUE" |
22897187 | 98 | "-DLLVM_ENABLE_FFI:BOOL=TRUE" |
fc9dbf41 | 99 | "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities |
22897187 | 100 | "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. |
0935fb27 EB |
101 | |
102 | ;; Don't use '-g' during the build, to save space. | |
ab78618f EB |
103 | #:build-type "Release" |
104 | #:phases (modify-phases %standard-phases | |
105 | (add-before 'build 'shared-lib-workaround | |
106 | ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen | |
107 | ;; doesn't seem to get the correct rpath to be able to run | |
108 | ;; from the build directory. Set LD_LIBRARY_PATH as a | |
109 | ;; workaround. | |
110 | (lambda _ | |
111 | (setenv "LD_LIBRARY_PATH" | |
112 | (string-append (getcwd) "/lib")) | |
113 | #t))))) | |
ac97dce1 | 114 | (home-page "https://www.llvm.org") |
3e4249ce EB |
115 | (synopsis "Optimizing compiler infrastructure") |
116 | (description | |
e881752c AK |
117 | "LLVM is a compiler infrastructure designed for compile-time, link-time, |
118 | runtime, and idle-time optimization of programs from arbitrary programming | |
119 | languages. It currently supports compilation of C and C++ programs, using | |
120 | front-ends derived from GCC 4.0.1. A new front-end for the C family of | |
121 | languages is in development. The compiler infrastructure includes mirror sets | |
122 | of programming tools as well as libraries with equivalent functionality.") | |
ac00973c | 123 | (license license:ncsa))) |
3e4249ce | 124 | |
f5de2b9a IP |
125 | (define-public llvm llvm-8) |
126 | ||
6b26f915 LC |
127 | (define* (clang-runtime-from-llvm llvm hash |
128 | #:optional (patches '())) | |
b81f5693 AW |
129 | (package |
130 | (name "clang-runtime") | |
131 | (version (package-version llvm)) | |
132 | (source | |
133 | (origin | |
134 | (method url-fetch) | |
3bdcc668 | 135 | (uri (string-append "https://llvm.org/releases/" |
b81f5693 | 136 | version "/compiler-rt-" version ".src.tar.xz")) |
6b26f915 LC |
137 | (sha256 (base32 hash)) |
138 | (patches (map search-patch patches)))) | |
b81f5693 AW |
139 | (build-system cmake-build-system) |
140 | (native-inputs (package-native-inputs llvm)) | |
141 | (inputs | |
142 | `(("llvm" ,llvm))) | |
143 | (arguments | |
144 | `(;; Don't use '-g' during the build to save space. | |
3b956a33 EB |
145 | #:build-type "Release" |
146 | #:tests? #f)) ; Tests require gtest | |
ac97dce1 | 147 | (home-page "https://compiler-rt.llvm.org") |
b81f5693 AW |
148 | (synopsis "Runtime library for Clang/LLVM") |
149 | (description | |
150 | "The \"clang-runtime\" library provides the implementations of run-time | |
151 | functions for C and C++ programs. It also provides header files that allow C | |
152 | and C++ source code to interface with the \"sanitization\" passes of the clang | |
153 | compiler. In LLVM this library is called \"compiler-rt\".") | |
ac00973c | 154 | (license license:ncsa) |
9e6b9ea4 | 155 | |
ac97dce1 | 156 | ;; <https://compiler-rt.llvm.org/> doesn't list MIPS as supported. |
9e6b9ea4 | 157 | (supported-systems (delete "mips64el-linux" %supported-systems)))) |
b81f5693 | 158 | |
3b956a33 | 159 | (define* (clang-from-llvm llvm clang-runtime hash |
9bdbabe9 | 160 | #:key (patches '())) |
3e4249ce EB |
161 | (package |
162 | (name "clang") | |
163 | (version (package-version llvm)) | |
164 | (source | |
165 | (origin | |
166 | (method url-fetch) | |
3bdcc668 | 167 | (uri (string-append "https://llvm.org/releases/" |
3e4249ce | 168 | version "/cfe-" version ".src.tar.xz")) |
fd6ae1b9 | 169 | (sha256 (base32 hash)) |
3b956a33 | 170 | (patches (map search-patch patches)))) |
3e4249ce EB |
171 | ;; Using cmake allows us to treat llvm as an external library. There |
172 | ;; doesn't seem to be any way to do this with clang's autotools-based | |
173 | ;; build system. | |
174 | (build-system cmake-build-system) | |
175 | (native-inputs (package-native-inputs llvm)) | |
176 | (inputs | |
177 | `(("libxml2" ,libxml2) | |
c92f1c0a | 178 | ("gcc-lib" ,gcc "lib") |
3e4249ce EB |
179 | ,@(package-inputs llvm))) |
180 | (propagated-inputs | |
b81f5693 AW |
181 | `(("llvm" ,llvm) |
182 | ("clang-runtime" ,clang-runtime))) | |
fd6ae1b9 LC |
183 | (arguments |
184 | `(#:configure-flags | |
185 | (list "-DCLANG_INCLUDE_TESTS=True" | |
186 | ||
187 | ;; Find libgcc_s, crtbegin.o, and crtend.o. | |
188 | (string-append "-DGCC_INSTALL_PREFIX=" | |
189 | (assoc-ref %build-inputs "gcc-lib")) | |
190 | ||
191 | ;; Use a sane default include directory. | |
192 | (string-append "-DC_INCLUDE_DIRS=" | |
193 | (assoc-ref %build-inputs "libc") | |
194 | "/include")) | |
195 | ||
94585e88 LC |
196 | ;; Don't use '-g' during the build to save space. |
197 | #:build-type "Release" | |
198 | ||
fd6ae1b9 LC |
199 | #:phases (modify-phases %standard-phases |
200 | (add-after | |
201 | 'unpack 'set-glibc-file-names | |
202 | (lambda* (#:key inputs #:allow-other-keys) | |
b81f5693 AW |
203 | (let ((libc (assoc-ref inputs "libc")) |
204 | (compiler-rt (assoc-ref inputs "clang-runtime"))) | |
9bdbabe9 MB |
205 | (case (string->number ,(version-major |
206 | (package-version clang-runtime))) | |
d199a4c7 | 207 | ((or 6 7) |
9bdbabe9 MB |
208 | ;; Link to libclang_rt files from clang-runtime. |
209 | (substitute* "lib/Driver/ToolChain.cpp" | |
210 | (("getDriver\\(\\)\\.ResourceDir") | |
211 | (string-append "\"" compiler-rt "\""))) | |
212 | ||
213 | ;; Make "LibDir" refer to <glibc>/lib so that it | |
214 | ;; uses the right dynamic linker file name. | |
215 | (substitute* "lib/Driver/ToolChains/Linux.cpp" | |
216 | (("(^[[:blank:]]+LibDir = ).*" _ declaration) | |
217 | (string-append declaration "\"" libc "/lib\";\n")) | |
218 | ||
219 | ;; Make sure libc's libdir is on the search path, to | |
220 | ;; allow crt1.o & co. to be found. | |
221 | (("@GLIBC_LIBDIR@") | |
222 | (string-append libc "/lib")))) | |
223 | ((3) | |
224 | (substitute* "lib/Driver/Tools.cpp" | |
225 | ;; Patch the 'getLinuxDynamicLinker' function so that | |
226 | ;; it uses the right dynamic linker file name. | |
227 | (("/lib64/ld-linux-x86-64.so.2") | |
228 | (string-append libc | |
229 | ,(glibc-dynamic-linker)))) | |
230 | ||
231 | ;; Link to libclang_rt files from clang-runtime. | |
232 | ;; This substitution needed slight adjustment in 3.8. | |
233 | (if (< 3.8 (string->number ,(version-major+minor | |
234 | (package-version | |
235 | clang-runtime)))) | |
236 | (substitute* "lib/Driver/Tools.cpp" | |
237 | (("TC\\.getDriver\\(\\)\\.ResourceDir") | |
238 | (string-append "\"" compiler-rt "\""))) | |
239 | (substitute* "lib/Driver/ToolChain.cpp" | |
240 | (("getDriver\\(\\)\\.ResourceDir") | |
241 | (string-append "\"" compiler-rt "\"")))) | |
242 | ||
243 | ;; Make sure libc's libdir is on the search path, to | |
244 | ;; allow crt1.o & co. to be found. | |
245 | (substitute* "lib/Driver/ToolChains.cpp" | |
246 | (("@GLIBC_LIBDIR@") | |
247 | (string-append libc "/lib"))))) | |
1c7372a5 PN |
248 | #t))) |
249 | (add-after 'install 'install-clean-up-/share/clang | |
250 | (lambda* (#:key outputs #:allow-other-keys) | |
251 | (let* ((out (assoc-ref outputs "out")) | |
252 | (compl-dir (string-append | |
253 | out "/etc/bash_completion.d"))) | |
254 | (with-directory-excursion (string-append out | |
255 | "/share/clang") | |
ad8a4a66 PN |
256 | (for-each |
257 | (lambda (file) | |
258 | (when (file-exists? file) | |
259 | (delete-file file))) | |
260 | ;; Delete extensions for proprietary text editors. | |
261 | '("clang-format-bbedit.applescript" | |
262 | "clang-format-sublime.py" | |
263 | ;; Delete Emacs extensions: see their respective Emacs | |
264 | ;; Guix package instead. | |
265 | "clang-rename.el" "clang-format.el")) | |
1c7372a5 | 266 | ;; Install bash completion. |
ad8a4a66 PN |
267 | (when (file-exists? "bash-autocomplete.sh") |
268 | (mkdir-p compl-dir) | |
269 | (rename-file "bash-autocomplete.sh" | |
270 | (string-append compl-dir "/clang"))))) | |
1c7372a5 | 271 | #t))))) |
ef11ac87 LC |
272 | |
273 | ;; Clang supports the same environment variables as GCC. | |
274 | (native-search-paths | |
275 | (list (search-path-specification | |
276 | (variable "CPATH") | |
277 | (files '("include"))) | |
278 | (search-path-specification | |
279 | (variable "LIBRARY_PATH") | |
280 | (files '("lib" "lib64"))))) | |
281 | ||
ac97dce1 | 282 | (home-page "https://clang.llvm.org") |
3e4249ce EB |
283 | (synopsis "C language family frontend for LLVM") |
284 | (description | |
285 | "Clang is a compiler front end for the C, C++, Objective-C and | |
286 | Objective-C++ programming languages. It uses LLVM as its back end. The Clang | |
287 | project includes the Clang front end, the Clang static analyzer, and several | |
288 | code analysis tools.") | |
ac00973c | 289 | (license license:ncsa))) |
1204c510 | 290 | |
9f0ce5ec RW |
291 | (define-public libcxx |
292 | (package | |
293 | (name "libcxx") | |
294 | (version (package-version llvm)) | |
295 | (source | |
296 | (origin | |
297 | (method url-fetch) | |
298 | (uri (string-append "http://llvm.org/releases/" | |
299 | version "/libcxx-" version ".src.tar.xz")) | |
300 | (sha256 | |
301 | (base32 | |
4980b0b5 | 302 | "1qlx3wlxrnc5cwc1fcfc2vhfsl7j4294hi8y5kxj8hy8wxsjd462")))) |
9f0ce5ec RW |
303 | (build-system cmake-build-system) |
304 | (native-inputs | |
305 | `(("clang" ,clang) | |
306 | ("llvm" ,llvm))) | |
307 | (home-page "https://libcxx.llvm.org") | |
308 | (synopsis "C++ standard library") | |
309 | (description | |
310 | "This package provides an implementation of the C++ standard library for | |
311 | use with Clang, targeting C++11, C++14 and above.") | |
312 | (license license:expat))) | |
313 | ||
a2cc25ab RW |
314 | (define-public libclc |
315 | (package | |
316 | (name "libclc") | |
317 | (version (package-version llvm)) | |
318 | (source | |
319 | (origin | |
320 | (method git-fetch) | |
321 | (uri (git-reference | |
322 | (url "https://github.com/llvm/llvm-project.git") | |
323 | (commit (string-append "llvmorg-" version)))) | |
324 | (sha256 | |
325 | (base32 | |
326 | "052h16wjcnqginzp7ki4il2xmm25v9nyk0wcz7cg03gbryhl7aqa")))) | |
327 | (build-system cmake-build-system) | |
328 | (arguments | |
329 | `(#:configure-flags | |
330 | (list (string-append "-DLLVM_CLANG=" | |
331 | (assoc-ref %build-inputs "clang") | |
332 | "/bin/clang") | |
333 | (string-append "-DPYTHON=" | |
334 | (assoc-ref %build-inputs "python") | |
335 | "/bin/python3")) | |
336 | #:phases | |
337 | (modify-phases %standard-phases | |
338 | (add-after 'unpack 'chdir | |
339 | (lambda _ (chdir "libclc") #t))))) | |
340 | (native-inputs | |
341 | `(("clang" ,clang) | |
342 | ("llvm" ,llvm) | |
343 | ("python" ,python))) | |
344 | (home-page "https://libclc.llvm.org") | |
345 | (synopsis "Libraries for the OpenCL programming language") | |
346 | (description | |
347 | "This package provides an implementation of the OpenCL library | |
348 | requirements according to version 1.1 of the OpenCL specification.") | |
349 | ;; Apache license 2.0 with LLVM exception | |
350 | (license license:asl2.0))) | |
351 | ||
698e91f0 LC |
352 | (define-public libomp |
353 | (package | |
354 | (name "libomp") | |
355 | (version (package-version llvm)) | |
356 | (source (origin | |
357 | (method url-fetch) | |
69e3512b | 358 | (uri (string-append "https://releases.llvm.org/" |
698e91f0 LC |
359 | version "/openmp-" version |
360 | ".src.tar.xz")) | |
361 | (sha256 | |
362 | (base32 | |
e2170c31 | 363 | "1mf9cpgvix34xlpv0inkgl3qmdvgvp96f7sksqizri0n5xfp1cgp")) |
698e91f0 LC |
364 | (file-name (string-append "libomp-" version ".tar.xz")))) |
365 | (build-system cmake-build-system) | |
366 | ;; XXX: Note this gets built with GCC because building with Clang itself | |
367 | ;; fails (missing <atomic>, even when libcxx is added as an input.) | |
368 | (arguments | |
369 | '(#:configure-flags '("-DLIBOMP_USE_HWLOC=ON" | |
370 | "-DOPENMP_TEST_C_COMPILER=clang" | |
371 | "-DOPENMP_TEST_CXX_COMPILER=clang++") | |
9338cbdb | 372 | #:test-target "check-libomp")) |
698e91f0 LC |
373 | (native-inputs |
374 | `(("clang" ,clang) | |
375 | ("llvm" ,llvm) | |
376 | ("perl" ,perl) | |
377 | ("pkg-config" ,pkg-config))) | |
378 | (inputs | |
379 | `(("hwloc" ,hwloc "lib"))) | |
380 | (home-page "https://openmp.llvm.org") | |
381 | (synopsis "OpenMP run-time support library") | |
382 | (description | |
383 | "This package provides the run-time support library developed by the LLVM | |
384 | project for the OpenMP multi-theaded programming extension. This package | |
385 | notably provides @file{libgomp.so}, which is has a binary interface compatible | |
386 | with that of libgomp, the GNU Offloading and Multi Processing Library.") | |
387 | (license license:expat))) | |
388 | ||
b81f5693 AW |
389 | (define-public clang-runtime |
390 | (clang-runtime-from-llvm | |
391 | llvm | |
c5296e20 | 392 | "1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl")) |
b81f5693 | 393 | |
1204c510 | 394 | (define-public clang |
b81f5693 | 395 | (clang-from-llvm llvm clang-runtime |
c5296e20 | 396 | "0svk1f70hvpwrjp6x5i9kqwrqwxnmcrw5s7f4cxyd100mdd12k08" |
d199a4c7 MB |
397 | #:patches '("clang-7.0-libc-search-path.patch"))) |
398 | ||
4289d1d7 MB |
399 | (define-public llvm-7 |
400 | (package | |
401 | (inherit llvm) | |
402 | (version "7.0.1") | |
403 | (source (origin | |
404 | (method url-fetch) | |
405 | (uri (string-append "https://llvm.org/releases/" | |
406 | version "/llvm-" version ".src.tar.xz")) | |
407 | (sha256 | |
408 | (base32 | |
409 | "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3")))))) | |
410 | ||
411 | (define-public clang-runtime-7 | |
412 | (clang-runtime-from-llvm | |
413 | llvm-7 | |
414 | "065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq")) | |
415 | ||
416 | (define-public clang-7 | |
417 | (clang-from-llvm llvm-7 clang-runtime | |
418 | "067lwggnbg0w1dfrps790r5l6k8n5zwhlsw7zb6zvmfpwpfn4nx4" | |
419 | #:patches '("clang-7.0-libc-search-path.patch"))) | |
420 | ||
d199a4c7 MB |
421 | (define-public llvm-6 |
422 | (package | |
423 | (inherit llvm) | |
424 | (version "6.0.1") | |
425 | (source (origin | |
426 | (method url-fetch) | |
427 | (uri (string-append "https://llvm.org/releases/" | |
428 | version "/llvm-" version ".src.tar.xz")) | |
429 | (sha256 | |
430 | (base32 | |
431 | "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn")))))) | |
432 | ||
433 | (define-public clang-runtime-6 | |
434 | (clang-runtime-from-llvm | |
435 | llvm-6 | |
436 | "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl")) | |
437 | ||
438 | (define-public clang-6 | |
439 | (clang-from-llvm llvm-6 clang-runtime | |
148df605 | 440 | "0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w" |
9bdbabe9 | 441 | #:patches '("clang-6.0-libc-search-path.patch"))) |
3b956a33 | 442 | |
8b5107d2 JS |
443 | ;; Libcxx files specifically used by PySide2. |
444 | (define-public libcxx-6 | |
445 | (package | |
446 | (inherit libcxx) | |
447 | (version (package-version llvm-6)) | |
448 | (source | |
449 | (origin | |
450 | (inherit (package-source libcxx)) | |
451 | (uri (string-append "http://llvm.org/releases/" | |
452 | version "/libcxx-" version ".src.tar.xz")) | |
453 | (sha256 | |
454 | (base32 | |
455 | "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n")))) | |
456 | (native-inputs | |
457 | `(("clang" ,clang-6) | |
458 | ("llvm" ,llvm-6))))) | |
459 | ||
584da12d RJ |
460 | (define-public llvm-3.9.1 |
461 | (package (inherit llvm) | |
462 | (name "llvm") | |
463 | (version "3.9.1") | |
464 | (source | |
465 | (origin | |
466 | (method url-fetch) | |
3bdcc668 | 467 | (uri (string-append "https://llvm.org/releases/" |
584da12d RJ |
468 | version "/llvm-" version ".src.tar.xz")) |
469 | (sha256 | |
470 | (base32 | |
471 | "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z")))))) | |
472 | ||
473 | (define-public clang-runtime-3.9.1 | |
474 | (clang-runtime-from-llvm | |
475 | llvm-3.9.1 | |
6b26f915 LC |
476 | "16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk" |
477 | '("clang-runtime-asan-build-fixes.patch" | |
0627f93d | 478 | "clang-runtime-esan-build-fixes.patch" |
1a2d8d06 | 479 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
584da12d RJ |
480 | |
481 | (define-public clang-3.9.1 | |
482 | (clang-from-llvm llvm-3.9.1 clang-runtime-3.9.1 | |
483 | "0qsyyb40iwifhhlx9a3drf8z6ni6zwyk3bvh0kx2gs6yjsxwxi76" | |
9bdbabe9 MB |
484 | #:patches '("clang-3.8-libc-search-path.patch"))) |
485 | ||
486 | (define-public llvm-3.8 | |
487 | (package (inherit llvm) | |
488 | (name "llvm") | |
489 | (version "3.8.1") | |
490 | (source | |
491 | (origin | |
492 | (method url-fetch) | |
493 | (uri (string-append "https://llvm.org/releases/" | |
494 | version "/llvm-" version ".src.tar.xz")) | |
495 | (sha256 | |
496 | (base32 | |
497 | "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf")))))) | |
498 | ||
499 | (define-public clang-runtime-3.8 | |
500 | (clang-runtime-from-llvm | |
501 | llvm-3.8 | |
502 | "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d" | |
0627f93d | 503 | '("clang-runtime-asan-build-fixes.patch" |
1a2d8d06 | 504 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
9bdbabe9 MB |
505 | |
506 | (define-public clang-3.8 | |
507 | (clang-from-llvm llvm-3.8 clang-runtime-3.8 | |
508 | "1prc72xmkgx8wrzmrr337776676nhsp1qd3mw2bvb22bzdnq7lsc" | |
509 | #:patches '("clang-3.8-libc-search-path.patch"))) | |
584da12d | 510 | |
3b956a33 EB |
511 | (define-public llvm-3.7 |
512 | (package (inherit llvm) | |
513 | (version "3.7.1") | |
514 | (source | |
515 | (origin | |
516 | (method url-fetch) | |
3bdcc668 | 517 | (uri (string-append "https://llvm.org/releases/" |
3b956a33 EB |
518 | version "/llvm-" version ".src.tar.xz")) |
519 | (sha256 | |
520 | (base32 | |
521 | "1masakdp9g2dan1yrazg7md5am2vacbkb3nahb3dchpc1knr8xxy")))))) | |
522 | ||
523 | (define-public clang-runtime-3.7 | |
524 | (clang-runtime-from-llvm | |
525 | llvm-3.7 | |
6b26f915 | 526 | "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx" |
0627f93d | 527 | '("clang-runtime-asan-build-fixes.patch" |
1a2d8d06 | 528 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
3b956a33 EB |
529 | |
530 | (define-public clang-3.7 | |
531 | (clang-from-llvm llvm-3.7 clang-runtime-3.7 | |
9bdbabe9 MB |
532 | "0x065d0w9b51xvdjxwfzjxng0gzpbx45fgiaxpap45ragi61dqjn" |
533 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
3ebc0905 EB |
534 | |
535 | (define-public llvm-3.6 | |
536 | (package (inherit llvm) | |
537 | (version "3.6.2") | |
538 | (source | |
539 | (origin | |
540 | (method url-fetch) | |
3bdcc668 | 541 | (uri (string-append "https://llvm.org/releases/" |
3ebc0905 EB |
542 | version "/llvm-" version ".src.tar.xz")) |
543 | (sha256 | |
544 | (base32 | |
545 | "153vcvj8gvgwakzr4j0kndc0b7wn91c2g1vy2vg24s6spxcc23gn")))))) | |
546 | ||
547 | (define-public clang-runtime-3.6 | |
548 | (clang-runtime-from-llvm | |
549 | llvm-3.6 | |
6b26f915 LC |
550 | "11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg" |
551 | '("clang-runtime-asan-build-fixes.patch"))) | |
3ebc0905 EB |
552 | |
553 | (define-public clang-3.6 | |
554 | (clang-from-llvm llvm-3.6 clang-runtime-3.6 | |
9bdbabe9 MB |
555 | "1wwr8s6lzr324hv4s1k6na4j5zv6n9kdhi14s4kb9b13d93814df" |
556 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
1204c510 MW |
557 | |
558 | (define-public llvm-3.5 | |
559 | (package (inherit llvm) | |
a53c486d | 560 | (version "3.5.2") |
1204c510 MW |
561 | (source |
562 | (origin | |
563 | (method url-fetch) | |
3bdcc668 | 564 | (uri (string-append "https://llvm.org/releases/" |
1204c510 | 565 | version "/llvm-" version ".src.tar.xz")) |
6ba4eca2 RW |
566 | (patches |
567 | (search-patches "llvm-3.5-fix-clang-build-with-gcc5.patch")) | |
1204c510 MW |
568 | (sha256 |
569 | (base32 | |
a53c486d | 570 | "0xf5q17kkxsrm2gsi93h4pwlv663kji73r2g4asb97klsmb626a4")))))) |
1204c510 | 571 | |
b81f5693 AW |
572 | (define-public clang-runtime-3.5 |
573 | (clang-runtime-from-llvm | |
574 | llvm-3.5 | |
6b26f915 | 575 | "1hsdnzzdr5kglz6fnv3lcsjs222zjsy14y8ax9dy6zqysanplbal" |
286bea0d LC |
576 | '("clang-runtime-asan-build-fixes.patch" |
577 | "clang-3.5-libsanitizer-ustat-fix.patch"))) | |
b81f5693 | 578 | |
1204c510 | 579 | (define-public clang-3.5 |
b81f5693 | 580 | (clang-from-llvm llvm-3.5 clang-runtime-3.5 |
9bdbabe9 MB |
581 | "0846h8vn3zlc00jkmvrmy88gc6ql6014c02l4jv78fpvfigmgssg" |
582 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
921cb13a RW |
583 | |
584 | (define-public llvm-for-extempore | |
585 | (package (inherit llvm-3.7) | |
7355634d | 586 | (name "llvm-for-extempore") |
921cb13a RW |
587 | (source |
588 | (origin | |
589 | (inherit (package-source llvm-3.7)) | |
39162ee4 RW |
590 | (patches (list (search-patch "llvm-for-extempore.patch"))))) |
591 | ;; Extempore refuses to build on architectures other than x86_64 | |
592 | (supported-systems '("x86_64-linux")))) | |
8892cac3 RW |
593 | |
594 | (define-public python-llvmlite | |
595 | (package | |
596 | (name "python-llvmlite") | |
f9325407 | 597 | (version "0.27.1") |
8892cac3 RW |
598 | (source |
599 | (origin | |
600 | (method url-fetch) | |
601 | (uri (pypi-uri "llvmlite" version)) | |
602 | (sha256 | |
603 | (base32 | |
f9325407 | 604 | "1aq003zbyjnz4q1118h6qx5lfimc8s5fvgskl75j12gxd6pc78a8")))) |
8892cac3 RW |
605 | (build-system python-build-system) |
606 | (inputs | |
607 | `(("llvm" | |
608 | ,(package | |
4289d1d7 | 609 | (inherit llvm-7) |
8892cac3 | 610 | (source (origin |
4289d1d7 | 611 | (inherit (package-source llvm-7)) |
8892cac3 RW |
612 | (patches |
613 | (list | |
614 | (origin | |
615 | (method url-fetch) | |
616 | (uri (string-append "https://raw.githubusercontent.com/numba/" | |
617 | "llvmlite/v" version "/conda-recipes/" | |
f9325407 | 618 | "D47188-svml-VF.patch")) |
8892cac3 RW |
619 | (sha256 |
620 | (base32 | |
f9325407 | 621 | "0wxhgb61k17f0zg2m0726sf3hppm41f8jar2kkg2n8sl5cnjj9mr"))) |
8892cac3 RW |
622 | (origin |
623 | (method url-fetch) | |
624 | (uri (string-append "https://raw.githubusercontent.com/numba/" | |
625 | "llvmlite/v" version "/conda-recipes/" | |
626 | "twine_cfg_undefined_behavior.patch")) | |
627 | (sha256 | |
628 | (base32 | |
7a20877a | 629 | "07h71n2m1mn9zcfgw04zglffknplb233zqbcd6pckq0wygkrxflp"))))))))))) |
8892cac3 RW |
630 | (home-page "http://llvmlite.pydata.org") |
631 | (synopsis "Wrapper around basic LLVM functionality") | |
632 | (description | |
633 | "This package provides a Python binding to LLVM for use in Numba.") | |
634 | (license license:bsd-3))) | |
7628ff1f | 635 | |
67eebb19 LC |
636 | (define (package-elisp-from-package source-package package-name |
637 | source-files) | |
638 | "Return a package definition named PACKAGE-NAME that packages the Emacs Lisp | |
639 | SOURCE-FILES found in SOURCE-PACKAGE." | |
640 | (let ((orig (package-source source-package))) | |
641 | (package | |
642 | (inherit source-package) | |
643 | (name package-name) | |
644 | (build-system emacs-build-system) | |
645 | (source (origin | |
646 | (method (origin-method orig)) | |
647 | (uri (origin-uri orig)) | |
648 | (sha256 (origin-sha256 orig)) | |
649 | (file-name (string-append package-name "-" | |
650 | (package-version source-package))) | |
651 | (modules '((guix build utils) | |
652 | (srfi srfi-1) | |
653 | (ice-9 ftw))) | |
654 | (snippet | |
655 | `(let* ((source-files (quote ,source-files)) | |
656 | (basenames (map basename source-files))) | |
657 | (map copy-file | |
658 | source-files basenames) | |
659 | (map delete-file-recursively | |
660 | (fold delete | |
661 | (scandir ".") | |
662 | (append '("." "..") basenames))) | |
663 | #t))))))) | |
664 | ||
7628ff1f TG |
665 | (define-public emacs-clang-format |
666 | (package | |
667 | (inherit clang) | |
668 | (name "emacs-clang-format") | |
669 | (build-system emacs-build-system) | |
670 | (inputs | |
671 | `(("clang" ,clang))) | |
672 | (arguments | |
673 | `(#:phases | |
674 | (modify-phases %standard-phases | |
675 | (add-after 'unpack 'configure | |
676 | (lambda* (#:key inputs #:allow-other-keys) | |
677 | (let ((clang (assoc-ref inputs "clang"))) | |
678 | (copy-file "tools/clang-format/clang-format.el" "clang-format.el") | |
679 | (emacs-substitute-variables "clang-format.el" | |
680 | ("clang-format-executable" | |
681 | (string-append clang "/bin/clang-format")))) | |
682 | #t))))) | |
683 | (synopsis "Format code using clang-format") | |
684 | (description "This package allows to filter code through @code{clang-format} | |
685 | to fix its formatting. @code{clang-format} is a tool that formats | |
686 | C/C++/Obj-C code according to a set of style options, see | |
3bdcc668 | 687 | @url{https://clang.llvm.org/docs/ClangFormatStyleOptions.html}."))) |
51002b72 PN |
688 | |
689 | (define-public emacs-clang-rename | |
690 | (package | |
691 | (inherit clang) | |
692 | (name "emacs-clang-rename") | |
693 | (build-system emacs-build-system) | |
694 | (inputs | |
695 | `(("clang" ,clang))) | |
696 | (arguments | |
697 | `(#:phases | |
698 | (modify-phases %standard-phases | |
699 | (add-after 'unpack 'configure | |
700 | (lambda* (#:key inputs #:allow-other-keys) | |
701 | (let ((clang (assoc-ref inputs "clang"))) | |
702 | (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el") | |
703 | (emacs-substitute-variables "clang-rename.el" | |
704 | ("clang-rename-binary" | |
705 | (string-append clang "/bin/clang-rename")))) | |
706 | #t))))) | |
707 | (synopsis "Rename every occurrence of a symbol using clang-rename") | |
708 | (description "This package renames every occurrence of a symbol at point | |
709 | using @code{clang-rename}."))) |