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 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>
18 ;;; This file is part of GNU Guix.
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33 (define-module (gnu packages llvm)
34 #:use-module (guix packages)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix utils)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system cmake)
41 #:use-module (guix build-system emacs)
42 #:use-module (guix build-system python)
43 #:use-module (guix build-system trivial)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages base)
46 #:use-module (gnu packages gcc)
47 #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker
48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages libffi)
50 #:use-module (gnu packages mpi)
51 #:use-module (gnu packages onc-rpc)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages xml)
56 #:export (system->llvm-target))
58 (define* (system->llvm-target #:optional
59 (system (or (and=> (%current-target-system)
60 gnu-triplet->nix-system)
62 "Return the LLVM target name that corresponds to SYSTEM, a system type such
64 ;; See the 'lib/Target' directory of LLVM for a list of supported targets.
65 (letrec-syntax ((matches (syntax-rules (=>)
66 ((_ (system-prefix => target) rest ...)
67 (if (string-prefix? system-prefix system)
71 (error "LLVM target for system is unknown" system)))))
72 (matches ("aarch64" => "AArch64")
74 ("mips64el" => "Mips")
75 ("powerpc" => "PowerPC")
80 (define (llvm-download-uri component version)
81 (if (version>=? version "9.0.1")
82 (string-append "https://github.com/llvm/llvm-project/releases/download"
83 "/llvmorg-" version "/" component "-" version ".src.tar.xz")
84 (string-append "https://releases.llvm.org/" version "/" component "-"
85 version ".src.tar.xz")))
94 (uri (llvm-download-uri "llvm" version))
97 "16hwp3qa54c3a3v7h8nlw0fh5criqh0hlr1skybyk0cz70gyx880"))))
98 (build-system cmake-build-system)
100 `(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2
103 `(("libffi" ,libffi)))
105 `(("zlib" ,zlib))) ;to use output from llvm-config
107 `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE"
108 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
109 "-DBUILD_SHARED_LIBS:BOOL=TRUE"
110 "-DLLVM_ENABLE_FFI:BOOL=TRUE"
111 "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities
112 "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc.
114 ;; Don't use '-g' during the build, to save space.
115 #:build-type "Release"
116 #:phases (modify-phases %standard-phases
117 (add-before 'build 'shared-lib-workaround
118 ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen
119 ;; doesn't seem to get the correct rpath to be able to run
120 ;; from the build directory. Set LD_LIBRARY_PATH as a
123 (setenv "LD_LIBRARY_PATH"
124 (string-append (getcwd) "/lib"))
126 (home-page "https://www.llvm.org")
127 (synopsis "Optimizing compiler infrastructure")
129 "LLVM is a compiler infrastructure designed for compile-time, link-time,
130 runtime, and idle-time optimization of programs from arbitrary programming
131 languages. It currently supports compilation of C and C++ programs, using
132 front-ends derived from GCC 4.0.1. A new front-end for the C family of
133 languages is in development. The compiler infrastructure includes mirror sets
134 of programming tools as well as libraries with equivalent functionality.")
135 (license license:asl2.0))) ;with LLVM exceptions, see LICENSE.txt
137 (define* (clang-runtime-from-llvm llvm hash
138 #:optional (patches '()))
140 (name "clang-runtime")
141 (version (package-version llvm))
145 (uri (llvm-download-uri "compiler-rt" version))
146 (sha256 (base32 hash))
147 (patches (map search-patch patches))))
148 (build-system cmake-build-system)
149 (native-inputs (package-native-inputs llvm))
153 `(;; Don't use '-g' during the build to save space.
154 #:build-type "Release"
155 #:tests? #f)) ; Tests require gtest
156 (home-page "https://compiler-rt.llvm.org")
157 (synopsis "Runtime library for Clang/LLVM")
159 "The \"clang-runtime\" library provides the implementations of run-time
160 functions for C and C++ programs. It also provides header files that allow C
161 and C++ source code to interface with the \"sanitization\" passes of the clang
162 compiler. In LLVM this library is called \"compiler-rt\".")
163 (license (package-license llvm))
165 ;; <https://compiler-rt.llvm.org/> doesn't list MIPS as supported.
166 (supported-systems (delete "mips64el-linux" %supported-systems))))
168 (define* (clang-from-llvm llvm clang-runtime hash
172 (version (package-version llvm))
176 (uri (llvm-download-uri (if (version>=? version "9.0.1")
180 (sha256 (base32 hash))
181 (patches (map search-patch patches))))
182 ;; Using cmake allows us to treat llvm as an external library. There
183 ;; doesn't seem to be any way to do this with clang's autotools-based
185 (build-system cmake-build-system)
186 (native-inputs (package-native-inputs llvm))
188 `(("libxml2" ,libxml2)
189 ("gcc-lib" ,gcc "lib")
190 ,@(package-inputs llvm)))
193 ("clang-runtime" ,clang-runtime)))
196 (list "-DCLANG_INCLUDE_TESTS=True"
198 ;; Find libgcc_s, crtbegin.o, and crtend.o.
199 (string-append "-DGCC_INSTALL_PREFIX="
200 (assoc-ref %build-inputs "gcc-lib"))
202 ;; Use a sane default include directory.
203 (string-append "-DC_INCLUDE_DIRS="
204 (assoc-ref %build-inputs "libc")
207 ;; Don't use '-g' during the build to save space.
208 #:build-type "Release"
210 #:phases (modify-phases %standard-phases
211 (add-after 'unpack 'add-missing-triplets
213 ;; Clang iterates through known triplets to search for
214 ;; GCC's headers, but does not recognize some of the
215 ;; triplets that are used in Guix.
216 (substitute* ,@(if (version>=? version "6.0")
217 '("lib/Driver/ToolChains/Gnu.cpp")
218 '("lib/Driver/ToolChains.cpp"))
219 (("\"aarch64-linux-gnu\"," all)
220 (string-append "\"aarch64-unknown-linux-gnu\", "
222 (("\"arm-linux-gnueabihf\"," all)
224 " \"arm-unknown-linux-gnueabihf\","))
225 (("\"i686-pc-linux-gnu\"," all)
226 (string-append "\"i686-unknown-linux-gnu\", "
229 (add-after 'unpack 'set-glibc-file-names
230 (lambda* (#:key inputs #:allow-other-keys)
231 (let ((libc (assoc-ref inputs "libc"))
232 (compiler-rt (assoc-ref inputs "clang-runtime"))
233 (gcc (assoc-ref inputs "gcc")))
235 ((version>=? version "6.0")
236 `(;; Link to libclang_rt files from clang-runtime.
237 (substitute* "lib/Driver/ToolChain.cpp"
238 (("getDriver\\(\\)\\.ResourceDir")
239 (string-append "\"" compiler-rt "\"")))
241 ;; Make "LibDir" refer to <glibc>/lib so that it
242 ;; uses the right dynamic linker file name.
243 (substitute* "lib/Driver/ToolChains/Linux.cpp"
244 (("(^[[:blank:]]+LibDir = ).*" _ declaration)
245 (string-append declaration "\"" libc "/lib\";\n"))
247 ;; Make clang look for libstdc++ in the right
249 (("LibStdCXXIncludePathCandidates\\[\\] = \\{")
251 "LibStdCXXIncludePathCandidates[] = { \"" gcc
254 ;; Make sure libc's libdir is on the search path, to
255 ;; allow crt1.o & co. to be found.
257 (string-append libc "/lib")))))
259 `((substitute* "lib/Driver/Tools.cpp"
260 ;; Patch the 'getLinuxDynamicLinker' function so that
261 ;; it uses the right dynamic linker file name.
262 (("/lib64/ld-linux-x86-64.so.2")
264 ,(glibc-dynamic-linker))))
266 ;; Link to libclang_rt files from clang-runtime.
267 ;; This substitution needed slight adjustment in 3.8.
268 ,@(if (version>=? version "3.8")
269 '((substitute* "lib/Driver/Tools.cpp"
270 (("TC\\.getDriver\\(\\)\\.ResourceDir")
271 (string-append "\"" compiler-rt "\""))))
272 '((substitute* "lib/Driver/ToolChain.cpp"
273 (("getDriver\\(\\)\\.ResourceDir")
274 (string-append "\"" compiler-rt "\"")))))
276 ;; Make sure libc's libdir is on the search path, to
277 ;; allow crt1.o & co. to be found.
278 (substitute* "lib/Driver/ToolChains.cpp"
280 (string-append libc "/lib"))))))
282 (add-after 'install 'install-clean-up-/share/clang
283 (lambda* (#:key outputs #:allow-other-keys)
284 (let* ((out (assoc-ref outputs "out"))
285 (compl-dir (string-append
286 out "/etc/bash_completion.d")))
287 (with-directory-excursion (string-append out
291 (when (file-exists? file)
293 ;; Delete extensions for proprietary text editors.
294 '("clang-format-bbedit.applescript"
295 "clang-format-sublime.py"
296 ;; Delete Emacs extensions: see their respective Emacs
297 ;; Guix package instead.
298 "clang-rename.el" "clang-format.el"))
299 ;; Install bash completion.
300 (when (file-exists? "bash-autocomplete.sh")
302 (rename-file "bash-autocomplete.sh"
303 (string-append compl-dir "/clang")))))
306 ;; Clang supports the same environment variables as GCC.
308 (list (search-path-specification
310 (files '("include")))
311 (search-path-specification
312 (variable "LIBRARY_PATH")
313 (files '("lib" "lib64")))))
315 (home-page "https://clang.llvm.org")
316 (synopsis "C language family frontend for LLVM")
318 "Clang is a compiler front end for the C, C++, Objective-C and
319 Objective-C++ programming languages. It uses LLVM as its back end. The Clang
320 project includes the Clang front end, the Clang static analyzer, and several
321 code analysis tools.")
322 (license (if (version>=? version "9.0")
323 license:asl2.0 ;with LLVM exceptions
326 (define (make-clang-toolchain clang)
328 (name (string-append (package-name clang) "-toolchain"))
329 (version (package-version clang))
331 (build-system trivial-build-system)
333 '(#:modules ((guix build union))
335 (use-modules (ice-9 match)
339 (let ((out (assoc-ref %outputs "out")))
342 (((names . directories) ...)
343 (union-build out directories)))
345 (union-build (assoc-ref %outputs "debug")
346 (list (assoc-ref %build-inputs
348 (union-build (assoc-ref %outputs "static")
349 (list (assoc-ref %build-inputs
353 (native-search-paths (package-native-search-paths clang))
354 (search-paths (package-search-paths clang))
356 (license (package-license clang))
357 (home-page "https://clang.llvm.org")
358 (synopsis "Complete Clang toolchain for C/C++ development")
359 (description "This package provides a complete Clang toolchain for C/C++
360 development to be installed in user profiles. This includes Clang, as well as
361 libc (headers and binaries, plus debugging symbols in the @code{debug}
362 output), and Binutils.")
363 (outputs '("out" "debug" "static"))
364 (inputs `(("clang" ,clang)
365 ("ld-wrapper" ,(car (assoc-ref (%final-inputs) "ld-wrapper")))
366 ("binutils" ,binutils)
368 ("libc-debug" ,glibc "debug")
369 ("libc-static" ,glibc "static")))))
371 (define-public clang-runtime
372 (clang-runtime-from-llvm
374 "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2"))
377 (clang-from-llvm llvm clang-runtime
378 "0ls2h3iv4finqyflyhry21qhc9cm9ga7g1zq21020p065qmm2y2p"
379 #:patches '("clang-9.0-libc-search-path.patch")))
381 (define-public clang-toolchain
382 (make-clang-toolchain clang))
384 (define-public llvm-9 llvm)
385 (define-public clang-runtime-9 clang-runtime)
386 (define-public clang-9 clang)
387 (define-public clang-toolchain-9 clang-toolchain)
389 (define-public llvm-8
395 (uri (llvm-download-uri "llvm" version))
398 "0k124sxkfhfi1rca6kzkdraf4axhx99x3cw2rk55056628dvwwl8"))))
399 (license license:ncsa)))
401 (define-public clang-runtime-8
402 (clang-runtime-from-llvm
404 "1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl"))
406 (define-public clang-8
407 (clang-from-llvm llvm-8 clang-runtime-8
408 "0svk1f70hvpwrjp6x5i9kqwrqwxnmcrw5s7f4cxyd100mdd12k08"
409 #:patches '("clang-7.0-libc-search-path.patch")))
411 (define-public clang-toolchain-8
412 (make-clang-toolchain clang-8))
414 (define-public llvm-7
420 (uri (llvm-download-uri "llvm" version))
423 "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3"))))))
425 (define-public clang-runtime-7
426 (clang-runtime-from-llvm
428 "065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq"))
430 (define-public clang-7
431 (clang-from-llvm llvm-7 clang-runtime-7
432 "067lwggnbg0w1dfrps790r5l6k8n5zwhlsw7zb6zvmfpwpfn4nx4"
433 #:patches '("clang-7.0-libc-search-path.patch")))
435 (define-public clang-toolchain-7
436 (make-clang-toolchain clang-7))
438 (define-public llvm-6
444 (uri (llvm-download-uri "llvm" version))
447 "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"))))))
449 (define-public clang-runtime-6
450 (clang-runtime-from-llvm
452 "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl"))
454 (define-public clang-6
455 (clang-from-llvm llvm-6 clang-runtime-6
456 "0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w"
457 #:patches '("clang-6.0-libc-search-path.patch")))
459 (define-public clang-toolchain-6
460 (make-clang-toolchain clang-6))
462 (define-public llvm-3.9.1
463 (package (inherit llvm-6)
469 (uri (llvm-download-uri "llvm" version))
472 "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z"))))))
474 (define-public clang-runtime-3.9.1
475 (clang-runtime-from-llvm
477 "16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk"
478 '("clang-runtime-asan-build-fixes.patch"
479 "clang-runtime-esan-build-fixes.patch"
480 "clang-3.5-libsanitizer-ustat-fix.patch")))
482 (define-public clang-3.9.1
483 (clang-from-llvm llvm-3.9.1 clang-runtime-3.9.1
484 "0qsyyb40iwifhhlx9a3drf8z6ni6zwyk3bvh0kx2gs6yjsxwxi76"
485 #:patches '("clang-3.8-libc-search-path.patch")))
487 (define-public llvm-3.8
488 (package (inherit llvm-3.9.1)
494 (uri (llvm-download-uri "llvm" version))
497 "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf"))))))
499 (define-public clang-runtime-3.8
500 (clang-runtime-from-llvm
502 "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d"
503 '("clang-runtime-asan-build-fixes.patch"
504 "clang-3.5-libsanitizer-ustat-fix.patch")))
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")))
511 (define-public llvm-3.7
512 (package (inherit llvm-3.8)
517 (uri (llvm-download-uri "llvm" version))
520 "1masakdp9g2dan1yrazg7md5am2vacbkb3nahb3dchpc1knr8xxy"))))))
522 (define-public clang-runtime-3.7
523 (clang-runtime-from-llvm
525 "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"
526 '("clang-runtime-asan-build-fixes.patch"
527 "clang-3.5-libsanitizer-ustat-fix.patch")))
529 (define-public clang-3.7
530 (clang-from-llvm llvm-3.7 clang-runtime-3.7
531 "0x065d0w9b51xvdjxwfzjxng0gzpbx45fgiaxpap45ragi61dqjn"
532 #:patches '("clang-3.5-libc-search-path.patch")))
534 (define-public llvm-3.6
535 (package (inherit llvm-3.7)
540 (uri (llvm-download-uri "llvm" version))
543 "153vcvj8gvgwakzr4j0kndc0b7wn91c2g1vy2vg24s6spxcc23gn"))))))
545 (define-public clang-runtime-3.6
546 (clang-runtime-from-llvm
548 "11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg"
549 '("clang-runtime-asan-build-fixes.patch")))
551 (define-public clang-3.6
552 (clang-from-llvm llvm-3.6 clang-runtime-3.6
553 "1wwr8s6lzr324hv4s1k6na4j5zv6n9kdhi14s4kb9b13d93814df"
554 #:patches '("clang-3.5-libc-search-path.patch")))
556 (define-public llvm-3.5
557 (package (inherit llvm-3.6)
562 (uri (llvm-download-uri "llvm" version))
564 (search-patches "llvm-3.5-fix-clang-build-with-gcc5.patch"))
567 "0xf5q17kkxsrm2gsi93h4pwlv663kji73r2g4asb97klsmb626a4"))))))
569 (define-public clang-runtime-3.5
570 (let ((runtime (clang-runtime-from-llvm
572 "1hsdnzzdr5kglz6fnv3lcsjs222zjsy14y8ax9dy6zqysanplbal"
573 '("clang-runtime-asan-build-fixes.patch"
574 "clang-3.5-libsanitizer-ustat-fix.patch"))))
578 (substitute-keyword-arguments (package-arguments runtime)
579 ((#:phases phases '%standard-phases)
580 `(modify-phases ,phases
581 ;; glibc no longer includes rpc/xdr.h, so we use the headers from
583 (add-after 'unpack 'find-rpc-includes
584 (lambda* (#:key inputs #:allow-other-keys)
586 (string-append (assoc-ref inputs "libtirpc")
588 (or (getenv "CPATH") "")))
589 (setenv "CPLUS_INCLUDE_PATH"
590 (string-append (assoc-ref inputs "libtirpc")
592 (or (getenv "CPLUS_INCLUDE_PATH") "")))
595 `(("libtirpc" ,libtirpc)
596 ("llvm" ,llvm-3.5))))))
598 (define-public clang-3.5
599 (clang-from-llvm llvm-3.5 clang-runtime-3.5
600 "0846h8vn3zlc00jkmvrmy88gc6ql6014c02l4jv78fpvfigmgssg"
601 #:patches '("clang-3.5-libc-search-path.patch")))
603 (define-public llvm-for-extempore
604 (package (inherit llvm-3.7)
605 (name "llvm-for-extempore")
608 (inherit (package-source llvm-3.7))
609 (patches (list (search-patch "llvm-for-extempore.patch")))))
610 ;; Extempore refuses to build on architectures other than x86_64
611 (supported-systems '("x86_64-linux"))))
613 (define-public libcxx
620 (uri (llvm-download-uri "libcxx" version))
623 "0d2bj5i6mk4caq7skd5nsdmz8c2m5w5anximl5wz3x32p08zz089"))))
624 (build-system cmake-build-system)
628 (home-page "https://libcxx.llvm.org")
629 (synopsis "C++ standard library")
631 "This package provides an implementation of the C++ standard library for
632 use with Clang, targeting C++11, C++14 and above.")
633 (license license:expat)))
635 ;; Libcxx files specifically used by PySide2.
636 (define-public libcxx-6
639 (version (package-version llvm-6))
642 (inherit (package-source libcxx))
643 (uri (llvm-download-uri "libcxx" version))
646 "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
651 (define-public libclc
659 (url "https://github.com/llvm/llvm-project.git")
660 (commit (string-append "llvmorg-" version))))
661 (file-name (git-file-name name version))
664 "1d1qayvrvvc1di7s7jfxnjvxq2az4lwq1sw1b2gq2ic0nksvajz0"))))
665 (build-system cmake-build-system)
668 (list (string-append "-DLLVM_CLANG="
669 (assoc-ref %build-inputs "clang")
671 (string-append "-DPYTHON="
672 (assoc-ref %build-inputs "python")
675 (modify-phases %standard-phases
676 (add-after 'unpack 'chdir
677 (lambda _ (chdir "libclc") #t)))))
682 (home-page "https://libclc.llvm.org")
683 (synopsis "Libraries for the OpenCL programming language")
685 "This package provides an implementation of the OpenCL library
686 requirements according to version 1.1 of the OpenCL specification.")
687 ;; Apache license 2.0 with LLVM exception
688 (license license:asl2.0)))
690 (define-public libomp
696 (uri (llvm-download-uri "openmp" version))
699 "1knafnpp0f7hylx8q20lkd6g1sf0flly572dayc5d5kghh7hd52w"))
700 (file-name (string-append "libomp-" version ".tar.xz"))))
701 (build-system cmake-build-system)
702 ;; XXX: Note this gets built with GCC because building with Clang itself
703 ;; fails (missing <atomic>, even when libcxx is added as an input.)
705 '(#:configure-flags '("-DLIBOMP_USE_HWLOC=ON"
706 "-DOPENMP_TEST_C_COMPILER=clang"
707 "-DOPENMP_TEST_CXX_COMPILER=clang++")
708 #:test-target "check-libomp"))
713 ("pkg-config" ,pkg-config)))
715 `(("hwloc" ,hwloc "lib")))
716 (home-page "https://openmp.llvm.org")
717 (synopsis "OpenMP run-time support library")
719 "This package provides the run-time support library developed by the LLVM
720 project for the OpenMP multi-theaded programming extension. This package
721 notably provides @file{libgomp.so}, which is has a binary interface compatible
722 with that of libgomp, the GNU Offloading and Multi Processing Library.")
723 (license license:expat)))
725 (define-public python-llvmlite
727 (name "python-llvmlite")
732 (uri (pypi-uri "llvmlite" version))
735 "01wspdc0xhnydl66jyhyr4ii16h3fnw6mjihiwnnxdxg9j6kkajf"))))
736 (build-system python-build-system)
738 ;; FIXME: One test fails unable to find libm.so
739 ;; https://github.com/numba/llvmlite/issues/537
746 (inherit (package-source llvm-7))
751 (uri (string-append "https://raw.githubusercontent.com/numba/"
752 "llvmlite/v" version "/conda-recipes/"
753 "D47188-svml-VF.patch"))
756 "0wxhgb61k17f0zg2m0726sf3hppm41f8jar2kkg2n8sl5cnjj9mr")))
759 (uri (string-append "https://raw.githubusercontent.com/numba/"
760 "llvmlite/v" version "/conda-recipes/"
761 "twine_cfg_undefined_behavior.patch"))
764 "07h71n2m1mn9zcfgw04zglffknplb233zqbcd6pckq0wygkrxflp")))))))))))
765 (home-page "http://llvmlite.pydata.org")
766 (synopsis "Wrapper around basic LLVM functionality")
768 "This package provides a Python binding to LLVM for use in Numba.")
769 (license license:bsd-3)))
771 (define (package-elisp-from-package source-package package-name
773 "Return a package definition named PACKAGE-NAME that packages the Emacs Lisp
774 SOURCE-FILES found in SOURCE-PACKAGE."
775 (let ((orig (package-source source-package)))
777 (inherit source-package)
779 (build-system emacs-build-system)
781 (method (origin-method orig))
782 (uri (origin-uri orig))
783 (sha256 (origin-sha256 orig))
784 (file-name (string-append package-name "-"
785 (package-version source-package)))
786 (modules '((guix build utils)
790 `(let* ((source-files (quote ,source-files))
791 (basenames (map basename source-files)))
793 source-files basenames)
794 (map delete-file-recursively
797 (append '("." "..") basenames)))
800 (define-public emacs-clang-format
803 (name "emacs-clang-format")
804 (build-system emacs-build-system)
809 (modify-phases %standard-phases
810 (add-after 'unpack 'configure
811 (lambda* (#:key inputs #:allow-other-keys)
812 (let ((clang (assoc-ref inputs "clang")))
813 (copy-file "tools/clang-format/clang-format.el" "clang-format.el")
814 (emacs-substitute-variables "clang-format.el"
815 ("clang-format-executable"
816 (string-append clang "/bin/clang-format"))))
818 (synopsis "Format code using clang-format")
819 (description "This package allows to filter code through @code{clang-format}
820 to fix its formatting. @code{clang-format} is a tool that formats
821 C/C++/Obj-C code according to a set of style options, see
822 @url{https://clang.llvm.org/docs/ClangFormatStyleOptions.html}.")))
824 (define-public emacs-clang-rename
827 (name "emacs-clang-rename")
828 (build-system emacs-build-system)
833 (modify-phases %standard-phases
834 (add-after 'unpack 'configure
835 (lambda* (#:key inputs #:allow-other-keys)
836 (let ((clang (assoc-ref inputs "clang")))
837 (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el")
838 (emacs-substitute-variables "clang-rename.el"
839 ("clang-rename-binary"
840 (string-append clang "/bin/clang-rename"))))
842 (synopsis "Rename every occurrence of a symbol using clang-rename")
843 (description "This package renames every occurrence of a symbol at point
844 using @code{clang-rename}.")))