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> |
6b26f915 | 4 | ;;; Copyright © 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
ee077430 | 5 | ;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com> |
8892cac3 | 6 | ;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net> |
584da12d | 7 | ;;; Copyright © 2017 Roel Janssen <roel@gnu.org> |
9bdbabe9 | 8 | ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com> |
148df605 | 9 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
0627f93d | 10 | ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il> |
3a3d4d9d | 11 | ;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de> |
7628ff1f | 12 | ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz> |
3e4249ce EB |
13 | ;;; |
14 | ;;; This file is part of GNU Guix. | |
15 | ;;; | |
16 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
17 | ;;; under the terms of the GNU General Public License as published by | |
18 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
19 | ;;; your option) any later version. | |
20 | ;;; | |
21 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
22 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 | ;;; GNU General Public License for more details. | |
25 | ;;; | |
26 | ;;; You should have received a copy of the GNU General Public License | |
27 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
28 | ||
29 | (define-module (gnu packages llvm) | |
30 | #:use-module (guix packages) | |
ac00973c | 31 | #:use-module ((guix licenses) #:prefix license:) |
3e4249ce EB |
32 | #:use-module (guix download) |
33 | #:use-module (guix utils) | |
34 | #:use-module (guix build-system gnu) | |
35 | #:use-module (guix build-system cmake) | |
7628ff1f | 36 | #:use-module (guix build-system emacs) |
8892cac3 | 37 | #:use-module (guix build-system python) |
3e4249ce | 38 | #:use-module (gnu packages) |
fd6ae1b9 LC |
39 | #:use-module (gnu packages gcc) |
40 | #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker | |
ee077430 EB |
41 | #:use-module (gnu packages compression) |
42 | #:use-module (gnu packages libffi) | |
3e4249ce EB |
43 | #:use-module (gnu packages perl) |
44 | #:use-module (gnu packages python) | |
45 | #:use-module (gnu packages xml)) | |
46 | ||
47 | (define-public llvm | |
48 | (package | |
49 | (name "llvm") | |
148df605 | 50 | (version "6.0.1") |
3e4249ce EB |
51 | (source |
52 | (origin | |
53 | (method url-fetch) | |
54 | (uri (string-append "http://llvm.org/releases/" | |
55 | version "/llvm-" version ".src.tar.xz")) | |
56 | (sha256 | |
57 | (base32 | |
148df605 | 58 | "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn")))) |
3e4249ce EB |
59 | (build-system cmake-build-system) |
60 | (native-inputs | |
3ebc0905 | 61 | `(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2 |
3e4249ce | 62 | ("perl" ,perl))) |
ee077430 | 63 | (inputs |
44e8559d EB |
64 | `(("libffi" ,libffi))) |
65 | (propagated-inputs | |
66 | `(("zlib" ,zlib))) ;to use output from llvm-config | |
3e4249ce | 67 | (arguments |
22d0e9b7 | 68 | `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" |
ee077430 | 69 | "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" |
ab78618f | 70 | "-DBUILD_SHARED_LIBS:BOOL=TRUE" |
22897187 | 71 | "-DLLVM_ENABLE_FFI:BOOL=TRUE" |
fc9dbf41 | 72 | "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities |
22897187 | 73 | "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. |
0935fb27 EB |
74 | |
75 | ;; Don't use '-g' during the build, to save space. | |
ab78618f EB |
76 | #:build-type "Release" |
77 | #:phases (modify-phases %standard-phases | |
78 | (add-before 'build 'shared-lib-workaround | |
79 | ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen | |
80 | ;; doesn't seem to get the correct rpath to be able to run | |
81 | ;; from the build directory. Set LD_LIBRARY_PATH as a | |
82 | ;; workaround. | |
83 | (lambda _ | |
84 | (setenv "LD_LIBRARY_PATH" | |
85 | (string-append (getcwd) "/lib")) | |
86 | #t))))) | |
ac97dce1 | 87 | (home-page "https://www.llvm.org") |
3e4249ce EB |
88 | (synopsis "Optimizing compiler infrastructure") |
89 | (description | |
e881752c AK |
90 | "LLVM is a compiler infrastructure designed for compile-time, link-time, |
91 | runtime, and idle-time optimization of programs from arbitrary programming | |
92 | languages. It currently supports compilation of C and C++ programs, using | |
93 | front-ends derived from GCC 4.0.1. A new front-end for the C family of | |
94 | languages is in development. The compiler infrastructure includes mirror sets | |
95 | of programming tools as well as libraries with equivalent functionality.") | |
ac00973c | 96 | (license license:ncsa))) |
3e4249ce | 97 | |
d022c204 RH |
98 | ;; TODO: Build Mesa with LLVM 7 in the next staging cycle. |
99 | ;; TODO: Make LLVM 7 the default LLVM once Clang is also upgraded. | |
522d1b87 | 100 | (define-public llvm-7.0.1 |
d022c204 RH |
101 | (package (inherit llvm) |
102 | (name "llvm") | |
522d1b87 | 103 | (version "7.0.1") |
d022c204 RH |
104 | (source |
105 | (origin | |
106 | (method url-fetch) | |
107 | (uri (string-append "http://llvm.org/releases/" | |
108 | version "/llvm-" version ".src.tar.xz")) | |
109 | (sha256 | |
110 | (base32 | |
522d1b87 | 111 | "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3")))))) |
d022c204 | 112 | |
f8cba3ff MB |
113 | ;; FIXME: This package is here to prevent many rebuilds on x86_64 and i686 |
114 | ;; from commit fc9dbf41311d99d0fd8befc789ea7c0e35911890. Update users of | |
115 | ;; this in the next rebuild cycle. | |
116 | (define-public llvm-without-rtti | |
117 | (package | |
118 | (inherit llvm) | |
119 | (arguments | |
120 | `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" | |
121 | "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" | |
122 | "-DBUILD_SHARED_LIBS:BOOL=TRUE" | |
123 | "-DLLVM_ENABLE_FFI:BOOL=TRUE" | |
124 | "-DLLVM_INSTALL_UTILS=ON") | |
125 | #:build-type "Release" | |
126 | #:phases (modify-phases %standard-phases | |
127 | (add-before 'build 'shared-lib-workaround | |
128 | (lambda _ | |
129 | (setenv "LD_LIBRARY_PATH" | |
130 | (string-append (getcwd) "/lib")) | |
131 | #t))))))) | |
132 | ||
6b26f915 LC |
133 | (define* (clang-runtime-from-llvm llvm hash |
134 | #:optional (patches '())) | |
b81f5693 AW |
135 | (package |
136 | (name "clang-runtime") | |
137 | (version (package-version llvm)) | |
138 | (source | |
139 | (origin | |
140 | (method url-fetch) | |
141 | (uri (string-append "http://llvm.org/releases/" | |
142 | version "/compiler-rt-" version ".src.tar.xz")) | |
6b26f915 LC |
143 | (sha256 (base32 hash)) |
144 | (patches (map search-patch patches)))) | |
b81f5693 AW |
145 | (build-system cmake-build-system) |
146 | (native-inputs (package-native-inputs llvm)) | |
147 | (inputs | |
148 | `(("llvm" ,llvm))) | |
149 | (arguments | |
150 | `(;; Don't use '-g' during the build to save space. | |
3b956a33 EB |
151 | #:build-type "Release" |
152 | #:tests? #f)) ; Tests require gtest | |
ac97dce1 | 153 | (home-page "https://compiler-rt.llvm.org") |
b81f5693 AW |
154 | (synopsis "Runtime library for Clang/LLVM") |
155 | (description | |
156 | "The \"clang-runtime\" library provides the implementations of run-time | |
157 | functions for C and C++ programs. It also provides header files that allow C | |
158 | and C++ source code to interface with the \"sanitization\" passes of the clang | |
159 | compiler. In LLVM this library is called \"compiler-rt\".") | |
ac00973c | 160 | (license license:ncsa) |
9e6b9ea4 | 161 | |
ac97dce1 | 162 | ;; <https://compiler-rt.llvm.org/> doesn't list MIPS as supported. |
9e6b9ea4 | 163 | (supported-systems (delete "mips64el-linux" %supported-systems)))) |
b81f5693 | 164 | |
3b956a33 | 165 | (define* (clang-from-llvm llvm clang-runtime hash |
9bdbabe9 | 166 | #:key (patches '())) |
3e4249ce EB |
167 | (package |
168 | (name "clang") | |
169 | (version (package-version llvm)) | |
170 | (source | |
171 | (origin | |
172 | (method url-fetch) | |
173 | (uri (string-append "http://llvm.org/releases/" | |
174 | version "/cfe-" version ".src.tar.xz")) | |
fd6ae1b9 | 175 | (sha256 (base32 hash)) |
3b956a33 | 176 | (patches (map search-patch patches)))) |
3e4249ce EB |
177 | ;; Using cmake allows us to treat llvm as an external library. There |
178 | ;; doesn't seem to be any way to do this with clang's autotools-based | |
179 | ;; build system. | |
180 | (build-system cmake-build-system) | |
181 | (native-inputs (package-native-inputs llvm)) | |
182 | (inputs | |
183 | `(("libxml2" ,libxml2) | |
c92f1c0a | 184 | ("gcc-lib" ,gcc "lib") |
3e4249ce EB |
185 | ,@(package-inputs llvm))) |
186 | (propagated-inputs | |
b81f5693 AW |
187 | `(("llvm" ,llvm) |
188 | ("clang-runtime" ,clang-runtime))) | |
fd6ae1b9 LC |
189 | (arguments |
190 | `(#:configure-flags | |
191 | (list "-DCLANG_INCLUDE_TESTS=True" | |
192 | ||
193 | ;; Find libgcc_s, crtbegin.o, and crtend.o. | |
194 | (string-append "-DGCC_INSTALL_PREFIX=" | |
195 | (assoc-ref %build-inputs "gcc-lib")) | |
196 | ||
197 | ;; Use a sane default include directory. | |
198 | (string-append "-DC_INCLUDE_DIRS=" | |
199 | (assoc-ref %build-inputs "libc") | |
200 | "/include")) | |
201 | ||
94585e88 LC |
202 | ;; Don't use '-g' during the build to save space. |
203 | #:build-type "Release" | |
204 | ||
fd6ae1b9 LC |
205 | #:phases (modify-phases %standard-phases |
206 | (add-after | |
207 | 'unpack 'set-glibc-file-names | |
208 | (lambda* (#:key inputs #:allow-other-keys) | |
b81f5693 AW |
209 | (let ((libc (assoc-ref inputs "libc")) |
210 | (compiler-rt (assoc-ref inputs "clang-runtime"))) | |
9bdbabe9 MB |
211 | (case (string->number ,(version-major |
212 | (package-version clang-runtime))) | |
213 | ((6) | |
214 | ;; Link to libclang_rt files from clang-runtime. | |
215 | (substitute* "lib/Driver/ToolChain.cpp" | |
216 | (("getDriver\\(\\)\\.ResourceDir") | |
217 | (string-append "\"" compiler-rt "\""))) | |
218 | ||
219 | ;; Make "LibDir" refer to <glibc>/lib so that it | |
220 | ;; uses the right dynamic linker file name. | |
221 | (substitute* "lib/Driver/ToolChains/Linux.cpp" | |
222 | (("(^[[:blank:]]+LibDir = ).*" _ declaration) | |
223 | (string-append declaration "\"" libc "/lib\";\n")) | |
224 | ||
225 | ;; Make sure libc's libdir is on the search path, to | |
226 | ;; allow crt1.o & co. to be found. | |
227 | (("@GLIBC_LIBDIR@") | |
228 | (string-append libc "/lib")))) | |
229 | ((3) | |
230 | (substitute* "lib/Driver/Tools.cpp" | |
231 | ;; Patch the 'getLinuxDynamicLinker' function so that | |
232 | ;; it uses the right dynamic linker file name. | |
233 | (("/lib64/ld-linux-x86-64.so.2") | |
234 | (string-append libc | |
235 | ,(glibc-dynamic-linker)))) | |
236 | ||
237 | ;; Link to libclang_rt files from clang-runtime. | |
238 | ;; This substitution needed slight adjustment in 3.8. | |
239 | (if (< 3.8 (string->number ,(version-major+minor | |
240 | (package-version | |
241 | clang-runtime)))) | |
242 | (substitute* "lib/Driver/Tools.cpp" | |
243 | (("TC\\.getDriver\\(\\)\\.ResourceDir") | |
244 | (string-append "\"" compiler-rt "\""))) | |
245 | (substitute* "lib/Driver/ToolChain.cpp" | |
246 | (("getDriver\\(\\)\\.ResourceDir") | |
247 | (string-append "\"" compiler-rt "\"")))) | |
248 | ||
249 | ;; Make sure libc's libdir is on the search path, to | |
250 | ;; allow crt1.o & co. to be found. | |
251 | (substitute* "lib/Driver/ToolChains.cpp" | |
252 | (("@GLIBC_LIBDIR@") | |
253 | (string-append libc "/lib"))))) | |
1c7372a5 PN |
254 | #t))) |
255 | (add-after 'install 'install-clean-up-/share/clang | |
256 | (lambda* (#:key outputs #:allow-other-keys) | |
257 | (let* ((out (assoc-ref outputs "out")) | |
258 | (compl-dir (string-append | |
259 | out "/etc/bash_completion.d"))) | |
260 | (with-directory-excursion (string-append out | |
261 | "/share/clang") | |
ad8a4a66 PN |
262 | (for-each |
263 | (lambda (file) | |
264 | (when (file-exists? file) | |
265 | (delete-file file))) | |
266 | ;; Delete extensions for proprietary text editors. | |
267 | '("clang-format-bbedit.applescript" | |
268 | "clang-format-sublime.py" | |
269 | ;; Delete Emacs extensions: see their respective Emacs | |
270 | ;; Guix package instead. | |
271 | "clang-rename.el" "clang-format.el")) | |
1c7372a5 | 272 | ;; Install bash completion. |
ad8a4a66 PN |
273 | (when (file-exists? "bash-autocomplete.sh") |
274 | (mkdir-p compl-dir) | |
275 | (rename-file "bash-autocomplete.sh" | |
276 | (string-append compl-dir "/clang"))))) | |
1c7372a5 | 277 | #t))))) |
ef11ac87 LC |
278 | |
279 | ;; Clang supports the same environment variables as GCC. | |
280 | (native-search-paths | |
281 | (list (search-path-specification | |
282 | (variable "CPATH") | |
283 | (files '("include"))) | |
284 | (search-path-specification | |
285 | (variable "LIBRARY_PATH") | |
286 | (files '("lib" "lib64"))))) | |
287 | ||
ac97dce1 | 288 | (home-page "https://clang.llvm.org") |
3e4249ce EB |
289 | (synopsis "C language family frontend for LLVM") |
290 | (description | |
291 | "Clang is a compiler front end for the C, C++, Objective-C and | |
292 | Objective-C++ programming languages. It uses LLVM as its back end. The Clang | |
293 | project includes the Clang front end, the Clang static analyzer, and several | |
294 | code analysis tools.") | |
ac00973c | 295 | (license license:ncsa))) |
1204c510 | 296 | |
b81f5693 AW |
297 | (define-public clang-runtime |
298 | (clang-runtime-from-llvm | |
299 | llvm | |
148df605 | 300 | "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl")) |
b81f5693 | 301 | |
1204c510 | 302 | (define-public clang |
b81f5693 | 303 | (clang-from-llvm llvm clang-runtime |
148df605 | 304 | "0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w" |
9bdbabe9 | 305 | #:patches '("clang-6.0-libc-search-path.patch"))) |
3b956a33 | 306 | |
584da12d RJ |
307 | (define-public llvm-3.9.1 |
308 | (package (inherit llvm) | |
309 | (name "llvm") | |
310 | (version "3.9.1") | |
311 | (source | |
312 | (origin | |
313 | (method url-fetch) | |
314 | (uri (string-append "http://llvm.org/releases/" | |
315 | version "/llvm-" version ".src.tar.xz")) | |
316 | (sha256 | |
317 | (base32 | |
318 | "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z")))))) | |
319 | ||
320 | (define-public clang-runtime-3.9.1 | |
321 | (clang-runtime-from-llvm | |
322 | llvm-3.9.1 | |
6b26f915 LC |
323 | "16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk" |
324 | '("clang-runtime-asan-build-fixes.patch" | |
0627f93d | 325 | "clang-runtime-esan-build-fixes.patch" |
1a2d8d06 | 326 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
584da12d RJ |
327 | |
328 | (define-public clang-3.9.1 | |
329 | (clang-from-llvm llvm-3.9.1 clang-runtime-3.9.1 | |
330 | "0qsyyb40iwifhhlx9a3drf8z6ni6zwyk3bvh0kx2gs6yjsxwxi76" | |
9bdbabe9 MB |
331 | #:patches '("clang-3.8-libc-search-path.patch"))) |
332 | ||
333 | (define-public llvm-3.8 | |
334 | (package (inherit llvm) | |
335 | (name "llvm") | |
336 | (version "3.8.1") | |
337 | (source | |
338 | (origin | |
339 | (method url-fetch) | |
340 | (uri (string-append "https://llvm.org/releases/" | |
341 | version "/llvm-" version ".src.tar.xz")) | |
342 | (sha256 | |
343 | (base32 | |
344 | "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf")))))) | |
345 | ||
346 | (define-public clang-runtime-3.8 | |
347 | (clang-runtime-from-llvm | |
348 | llvm-3.8 | |
349 | "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d" | |
0627f93d | 350 | '("clang-runtime-asan-build-fixes.patch" |
1a2d8d06 | 351 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
9bdbabe9 MB |
352 | |
353 | (define-public clang-3.8 | |
354 | (clang-from-llvm llvm-3.8 clang-runtime-3.8 | |
355 | "1prc72xmkgx8wrzmrr337776676nhsp1qd3mw2bvb22bzdnq7lsc" | |
356 | #:patches '("clang-3.8-libc-search-path.patch"))) | |
584da12d | 357 | |
3b956a33 EB |
358 | (define-public llvm-3.7 |
359 | (package (inherit llvm) | |
360 | (version "3.7.1") | |
361 | (source | |
362 | (origin | |
363 | (method url-fetch) | |
364 | (uri (string-append "http://llvm.org/releases/" | |
365 | version "/llvm-" version ".src.tar.xz")) | |
366 | (sha256 | |
367 | (base32 | |
368 | "1masakdp9g2dan1yrazg7md5am2vacbkb3nahb3dchpc1knr8xxy")))))) | |
369 | ||
370 | (define-public clang-runtime-3.7 | |
371 | (clang-runtime-from-llvm | |
372 | llvm-3.7 | |
6b26f915 | 373 | "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx" |
0627f93d | 374 | '("clang-runtime-asan-build-fixes.patch" |
1a2d8d06 | 375 | "clang-3.5-libsanitizer-ustat-fix.patch"))) |
3b956a33 EB |
376 | |
377 | (define-public clang-3.7 | |
378 | (clang-from-llvm llvm-3.7 clang-runtime-3.7 | |
9bdbabe9 MB |
379 | "0x065d0w9b51xvdjxwfzjxng0gzpbx45fgiaxpap45ragi61dqjn" |
380 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
3ebc0905 EB |
381 | |
382 | (define-public llvm-3.6 | |
383 | (package (inherit llvm) | |
384 | (version "3.6.2") | |
385 | (source | |
386 | (origin | |
387 | (method url-fetch) | |
388 | (uri (string-append "http://llvm.org/releases/" | |
389 | version "/llvm-" version ".src.tar.xz")) | |
390 | (sha256 | |
391 | (base32 | |
392 | "153vcvj8gvgwakzr4j0kndc0b7wn91c2g1vy2vg24s6spxcc23gn")))))) | |
393 | ||
394 | (define-public clang-runtime-3.6 | |
395 | (clang-runtime-from-llvm | |
396 | llvm-3.6 | |
6b26f915 LC |
397 | "11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg" |
398 | '("clang-runtime-asan-build-fixes.patch"))) | |
3ebc0905 EB |
399 | |
400 | (define-public clang-3.6 | |
401 | (clang-from-llvm llvm-3.6 clang-runtime-3.6 | |
9bdbabe9 MB |
402 | "1wwr8s6lzr324hv4s1k6na4j5zv6n9kdhi14s4kb9b13d93814df" |
403 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
1204c510 MW |
404 | |
405 | (define-public llvm-3.5 | |
406 | (package (inherit llvm) | |
a53c486d | 407 | (version "3.5.2") |
1204c510 MW |
408 | (source |
409 | (origin | |
410 | (method url-fetch) | |
411 | (uri (string-append "http://llvm.org/releases/" | |
412 | version "/llvm-" version ".src.tar.xz")) | |
6ba4eca2 RW |
413 | (patches |
414 | (search-patches "llvm-3.5-fix-clang-build-with-gcc5.patch")) | |
1204c510 MW |
415 | (sha256 |
416 | (base32 | |
a53c486d | 417 | "0xf5q17kkxsrm2gsi93h4pwlv663kji73r2g4asb97klsmb626a4")))))) |
1204c510 | 418 | |
b81f5693 AW |
419 | (define-public clang-runtime-3.5 |
420 | (clang-runtime-from-llvm | |
421 | llvm-3.5 | |
6b26f915 LC |
422 | "1hsdnzzdr5kglz6fnv3lcsjs222zjsy14y8ax9dy6zqysanplbal" |
423 | '("clang-runtime-asan-build-fixes.patch"))) | |
b81f5693 | 424 | |
1204c510 | 425 | (define-public clang-3.5 |
b81f5693 | 426 | (clang-from-llvm llvm-3.5 clang-runtime-3.5 |
9bdbabe9 MB |
427 | "0846h8vn3zlc00jkmvrmy88gc6ql6014c02l4jv78fpvfigmgssg" |
428 | #:patches '("clang-3.5-libc-search-path.patch"))) | |
921cb13a RW |
429 | |
430 | (define-public llvm-for-extempore | |
431 | (package (inherit llvm-3.7) | |
7355634d | 432 | (name "llvm-for-extempore") |
921cb13a RW |
433 | (source |
434 | (origin | |
435 | (inherit (package-source llvm-3.7)) | |
39162ee4 RW |
436 | (patches (list (search-patch "llvm-for-extempore.patch"))))) |
437 | ;; Extempore refuses to build on architectures other than x86_64 | |
438 | (supported-systems '("x86_64-linux")))) | |
8892cac3 RW |
439 | |
440 | (define-public python-llvmlite | |
441 | (package | |
442 | (name "python-llvmlite") | |
443 | (version "0.24.0") | |
444 | (source | |
445 | (origin | |
446 | (method url-fetch) | |
447 | (uri (pypi-uri "llvmlite" version)) | |
448 | (sha256 | |
449 | (base32 | |
450 | "01zwjlc3c5mhrwmv4b73zgbskwqps9ly0nrh54bbj1f1l72f839j")))) | |
451 | (build-system python-build-system) | |
452 | (inputs | |
453 | `(("llvm" | |
454 | ,(package | |
455 | (inherit llvm) | |
456 | (source (origin | |
457 | (inherit (package-source llvm)) | |
458 | (patches | |
459 | (list | |
460 | (origin | |
461 | (method url-fetch) | |
462 | (uri (string-append "https://raw.githubusercontent.com/numba/" | |
463 | "llvmlite/v" version "/conda-recipes/" | |
464 | "D47188-svml.patch")) | |
465 | (sha256 | |
466 | (base32 | |
467 | "0mrj24jvkv3hjcmyg98zmvmyl1znlh2j63rdr69f6g7s96d2pfv1"))) | |
468 | (origin | |
469 | (method url-fetch) | |
470 | (uri (string-append "https://raw.githubusercontent.com/numba/" | |
471 | "llvmlite/v" version "/conda-recipes/" | |
472 | "twine_cfg_undefined_behavior.patch")) | |
473 | (sha256 | |
474 | (base32 | |
7a20877a | 475 | "07h71n2m1mn9zcfgw04zglffknplb233zqbcd6pckq0wygkrxflp"))))))))))) |
8892cac3 RW |
476 | (home-page "http://llvmlite.pydata.org") |
477 | (synopsis "Wrapper around basic LLVM functionality") | |
478 | (description | |
479 | "This package provides a Python binding to LLVM for use in Numba.") | |
480 | (license license:bsd-3))) | |
7628ff1f | 481 | |
67eebb19 LC |
482 | (define (package-elisp-from-package source-package package-name |
483 | source-files) | |
484 | "Return a package definition named PACKAGE-NAME that packages the Emacs Lisp | |
485 | SOURCE-FILES found in SOURCE-PACKAGE." | |
486 | (let ((orig (package-source source-package))) | |
487 | (package | |
488 | (inherit source-package) | |
489 | (name package-name) | |
490 | (build-system emacs-build-system) | |
491 | (source (origin | |
492 | (method (origin-method orig)) | |
493 | (uri (origin-uri orig)) | |
494 | (sha256 (origin-sha256 orig)) | |
495 | (file-name (string-append package-name "-" | |
496 | (package-version source-package))) | |
497 | (modules '((guix build utils) | |
498 | (srfi srfi-1) | |
499 | (ice-9 ftw))) | |
500 | (snippet | |
501 | `(let* ((source-files (quote ,source-files)) | |
502 | (basenames (map basename source-files))) | |
503 | (map copy-file | |
504 | source-files basenames) | |
505 | (map delete-file-recursively | |
506 | (fold delete | |
507 | (scandir ".") | |
508 | (append '("." "..") basenames))) | |
509 | #t))))))) | |
510 | ||
7628ff1f TG |
511 | (define-public emacs-clang-format |
512 | (package | |
3a3d4d9d PN |
513 | (inherit clang) |
514 | (name "emacs-clang-format") | |
515 | (build-system emacs-build-system) | |
516 | (inputs | |
517 | `(("clang" ,clang))) | |
518 | (arguments | |
519 | `(#:phases | |
520 | (modify-phases %standard-phases | |
521 | (add-after 'unpack 'configure | |
522 | (lambda* (#:key inputs #:allow-other-keys) | |
523 | (let ((clang (assoc-ref inputs "clang"))) | |
524 | (copy-file "tools/clang-format/clang-format.el" "clang-format.el") | |
525 | (emacs-substitute-variables "clang-format.el" | |
526 | ("clang-format-executable" | |
527 | (string-append clang "/bin/clang-format")))) | |
528 | #t))))) | |
7628ff1f TG |
529 | (synopsis "Format code using clang-format") |
530 | (description "This package allows to filter code through @code{clang-format} | |
531 | to fix its formatting. @code{clang-format} is a tool that formats | |
532 | C/C++/Obj-C code according to a set of style options, see | |
533 | @url{http://clang.llvm.org/docs/ClangFormatStyleOptions.html}."))) | |
51002b72 PN |
534 | |
535 | (define-public emacs-clang-rename | |
536 | (package | |
3a3d4d9d PN |
537 | (inherit clang) |
538 | (name "emacs-clang-rename") | |
539 | (build-system emacs-build-system) | |
540 | (inputs | |
541 | `(("clang" ,clang))) | |
542 | (arguments | |
543 | `(#:phases | |
544 | (modify-phases %standard-phases | |
545 | (add-after 'unpack 'configure | |
546 | (lambda* (#:key inputs #:allow-other-keys) | |
547 | (let ((clang (assoc-ref inputs "clang"))) | |
548 | (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el") | |
549 | (emacs-substitute-variables "clang-rename.el" | |
550 | ("clang-rename-binary" | |
551 | (string-append clang "/bin/clang-rename")))) | |
552 | #t))))) | |
51002b72 PN |
553 | (synopsis "Rename every occurrence of a symbol using clang-rename") |
554 | (description "This package renames every occurrence of a symbol at point | |
555 | using @code{clang-rename}."))) |