gnu: Add oneko.
[jackhill/guix/guix.git] / gnu / packages / gcc.scm
CommitLineData
e9c0b944 1;;; GNU Guix --- Functional package management for GNU
2bb5b1d4 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
f888d5bb 3;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
fbeb92d7 4;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
ed2b1c4f 5;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
cac88b28 6;;; Copyright © 2015, 2016, 2017, 2018, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
fc649d0a 7;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
ba81ca6a 8;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5d8a4354 9;;; Copyright © 2018, 2020 Marius Bakke <mbakke@fastmail.com>
76d2b9a2 10;;; Copyright © 2020 Joseph LaFreniere <joseph@lafreniere.xyz>
0f7e6964 11;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
a4fe16ee 12;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
cac88b28 13;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
e9c0b944
LC
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 gcc)
c6d7e299 31 #:use-module ((guix licenses)
50c7a1e2 32 #:select (gpl3+ gpl2+ lgpl2.1+ lgpl2.0+ fdl1.3+))
e9c0b944
LC
33 #:use-module (gnu packages)
34 #:use-module (gnu packages bootstrap)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages multiprecision)
c8ebc821 37 #:use-module (gnu packages texinfo)
c364a287 38 #:use-module (gnu packages dejagnu)
99828fa7 39 #:use-module (gnu packages documentation)
98b385d1
LC
40 #:use-module (gnu packages xml)
41 #:use-module (gnu packages docbook)
42 #:use-module (gnu packages graphviz)
3e778ad3 43 #:use-module (gnu packages elf)
38cf2ba0 44 #:use-module (gnu packages perl)
e9c0b944
LC
45 #:use-module (guix packages)
46 #:use-module (guix download)
ca16cb96 47 #:use-module (guix build-system gnu)
74574fd1 48 #:use-module (guix build-system trivial)
fdd6c726 49 #:use-module (guix utils)
e052c7e1 50 #:use-module (srfi srfi-1)
ca16cb96 51 #:use-module (ice-9 regex))
e9c0b944 52
832abc76
LC
53(define %gcc-infrastructure
54 ;; Base URL for GCC's infrastructure.
966a543b 55 "mirror://gcc/infrastructure/")
832abc76 56
76e639a0 57(define (gcc-configure-flags-for-triplet target)
ca16cb96
LC
58 "Return a list of additional GCC `configure' flags for TARGET, a GNU triplet.
59
60The purpose of this procedure is to translate extended GNU triplets---e.g.,
61where the OS part is overloaded to denote a specific ABI---into GCC
62`configure' options. We take extended GNU triplets that glibc recognizes."
63 (cond ((string-match "^mips64el.*gnuabin?64$" target)
64 ;; Triplets recognized by glibc as denoting the N64 ABI; see
65 ;; ports/sysdeps/mips/preconfigure.
66 '("--with-abi=64"))
3f00ff8b
MW
67
68 ((string-match "^arm.*-gnueabihf$" target)
69 '("--with-arch=armv7-a"
70 "--with-float=hard"
71 "--with-mode=thumb"
aa725117 72 "--with-fpu=neon"))
3f00ff8b 73
ec6ba5c1
LC
74 ((and (string-suffix? "-gnu" target)
75 (not (string-contains target "-linux")))
76 ;; Cross-compilation of libcilkrts in GCC 5.5.0 to GNU/Hurd fails
77 ;; with:
78 ;; libcilkrts/runtime/os-unix.c:388:2: error: #error "Unknown architecture"
79 ;; Cilk has been removed from GCC 8 anyway.
80 '("--disable-libcilkrts"))
81
ca16cb96 82 (else
3f00ff8b 83 ;; TODO: Add `arm.*-gnueabi', etc.
ca16cb96
LC
84 '())))
85
e9c0b944 86(define-public gcc-4.7
9063ef0f 87 (let* ((stripped? #t) ;whether to strip the compiler, not the libraries
de1d41f9
LC
88 (maybe-target-tools
89 (lambda ()
90 ;; Return the `_FOR_TARGET' variables that are needed when
91 ;; cross-compiling GCC.
92 (let ((target (%current-target-system)))
93 (if target
94 (map (lambda (var tool)
95 (string-append (string-append var "_FOR_TARGET")
96 "=" target "-" tool))
066ccc2c
LC
97 '("CC" "CXX" "LD" "AR" "NM" "OBJDUMP" "RANLIB" "STRIP")
98 '("gcc" "g++" "ld" "ar" "nm" "objdump" "ranlib" "strip"))
de1d41f9 99 '()))))
7e3c9f74
LC
100 (libdir
101 (let ((base '(or (assoc-ref outputs "lib")
102 (assoc-ref outputs "out"))))
103 (lambda ()
104 ;; Return the directory that contains lib/libgcc_s.so et al.
105 (if (%current-target-system)
106 `(string-append ,base "/" ,(%current-target-system))
107 base))))
de1d41f9
LC
108 (configure-flags
109 (lambda ()
110 ;; This is terrible. Since we have two levels of quasiquotation,
111 ;; we have to do this convoluted thing just so we can insert the
112 ;; contents of (maybe-target-tools).
113 (list 'quasiquote
114 (append
115 '("--enable-plugin"
116 "--enable-languages=c,c++"
117 "--disable-multilib"
98bd851e 118 "--with-system-zlib"
de1d41f9 119
06213498
LC
120 ;; No pre-compiled libstdc++ headers, to save space.
121 "--disable-libstdcxx-pch"
122
de1d41f9
LC
123 "--with-local-prefix=/no-gcc-local-prefix"
124
84e6756c
LC
125 ;; With a separate "lib" output, the build system
126 ;; incorrectly guesses GPLUSPLUS_INCLUDE_DIR, so force
127 ;; it. (Don't use a versioned sub-directory, that's
128 ;; unnecessary.)
129 ,(string-append "--with-gxx-include-dir="
130 (assoc-ref %outputs "out")
131 "/include/c++")
132
de1d41f9
LC
133 ,(let ((libc (assoc-ref %build-inputs "libc")))
134 (if libc
135 (string-append "--with-native-system-header-dir=" libc
136 "/include")
137 "--without-headers")))
138
76e639a0
MW
139 ;; Pass the right options for the target triplet.
140 (let ((triplet
141 (or (%current-target-system)
142 (nix-system->gnu-triplet (%current-system)))))
143 (gcc-configure-flags-for-triplet triplet))
ca16cb96 144
de1d41f9 145 (maybe-target-tools))))))
d78010b8
RW
146 (hidden-package
147 (package
148 (name "gcc")
149 (version "4.7.4")
150 (source (origin
151 (method url-fetch)
152 (uri (string-append "mirror://gnu/gcc/gcc-"
153 version "/gcc-" version ".tar.bz2"))
154 (sha256
155 (base32
156 "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))
157 (patches (search-patches "gcc-4-compile-with-gcc-5.patch"
158 "gcc-fix-texi2pod.patch"))))
159 (build-system gnu-build-system)
160
161 ;; Separate out the run-time support libraries because all the
162 ;; dynamic-linked objects depend on it.
163 (outputs '("out" ;commands, etc. (60+ MiB)
164 "lib" ;libgcc_s, libgomp, etc. (15+ MiB)
165 "debug")) ;debug symbols of run-time libraries
166
167 (inputs `(("gmp" ,gmp)
168 ("mpfr" ,mpfr)
169 ("mpc" ,mpc)
170 ("libelf" ,libelf)
171 ("zlib" ,zlib)))
172
173 ;; GCC < 5 is one of the few packages that doesn't ship .info files.
174 ;; Newer texinfos fail to build the manual, so we use an older one.
175 (native-inputs `(("perl" ,perl) ;for manpages
176 ("texinfo" ,texinfo-5)))
177
178 (arguments
179 `(#:out-of-source? #t
180 #:configure-flags ,(configure-flags)
181 #:make-flags
182 ;; None of the flags below are needed when doing a Canadian cross.
183 ;; TODO: Simplify this.
184 ,(if (%current-target-system)
185 (if stripped?
186 ''("CFLAGS=-g0 -O2")
187 ''())
188 `(let* ((libc (assoc-ref %build-inputs "libc"))
189 (libc-native (or (assoc-ref %build-inputs "libc-native")
190 libc)))
191 `(,@(if libc
192 (list (string-append "LDFLAGS_FOR_TARGET="
193 "-B" libc "/lib "
194 "-Wl,-dynamic-linker "
195 "-Wl," libc
196 ,(glibc-dynamic-linker)))
197 '())
198
199 ;; Native programs like 'genhooks' also need that right.
200 ,(string-append "LDFLAGS="
201 "-Wl,-rpath=" libc-native "/lib "
202 "-Wl,-dynamic-linker "
203 "-Wl," libc-native ,(glibc-dynamic-linker))
204 ,(string-append "BOOT_CFLAGS=-O2 "
205 ,(if stripped? "-g0" "-g")))))
206
207 #:tests? #f
208
209 #:phases
210 (modify-phases %standard-phases
211 (add-before 'configure 'pre-configure
212 (lambda* (#:key inputs outputs #:allow-other-keys)
213 (let ((libdir ,(libdir))
214 (libc (assoc-ref inputs "libc")))
215 (when libc
216 ;; The following is not performed for `--without-headers'
217 ;; cross-compiler builds.
218
219 ;; Join multi-line definitions of GLIBC_DYNAMIC_LINKER* into a
220 ;; single line, to allow the next step to work properly.
221 (for-each
222 (lambda (x)
ba81ca6a
TGR
223 (substitute* (find-files "gcc/config"
224 "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
d78010b8
RW
225 (("(#define (GLIBC|GNU_USER)_DYNAMIC_LINKER.*)\\\\\n$" _ line)
226 line)))
227 '(1 2 3))
228
229 ;; Fix the dynamic linker's file name.
230 (substitute* (find-files "gcc/config"
231 "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
232 (("#define (GLIBC|GNU_USER)_DYNAMIC_LINKER([^ \t]*).*$"
233 _ gnu-user suffix)
234 (format #f "#define ~a_DYNAMIC_LINKER~a \"~a\"~%"
235 gnu-user suffix
236 (string-append libc ,(glibc-dynamic-linker)))))
237
238 ;; Tell where to find libstdc++, libc, and `?crt*.o', except
239 ;; `crt{begin,end}.o', which come with GCC.
240 (substitute* (find-files "gcc/config"
241 "^gnu-user.*\\.h$")
242 (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
243 ;; Help libgcc_s.so be found (see also below.) Always use
244 ;; '-lgcc_s' so that libgcc_s.so is always found by those
245 ;; programs that use 'pthread_cancel' (glibc dlopens
246 ;; libgcc_s.so when pthread_cancel support is needed, but
247 ;; having it in the application's RUNPATH isn't enough; see
248 ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
249 ;;
250 ;; NOTE: The '-lgcc_s' added below needs to be removed in a
251 ;; later phase of %gcc-static. If you change the string
252 ;; below, make sure to update the relevant code in
253 ;; %gcc-static package as needed.
254 (format #f "#define GNU_USER_TARGET_LIB_SPEC \
81197492 255\"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
d78010b8
RW
256 libc libc libdir suffix))
257 (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
258 (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
e9c0b944 259#define STANDARD_STARTFILE_PREFIX_2 \"\"
06213498 260~a"
d78010b8
RW
261 libc line)))
262
263 ;; The rs6000 (a.k.a. powerpc) config in GCC does not use
264 ;; GNU_USER_* defines. Do the above for this case.
265 (substitute*
266 "gcc/config/rs6000/sysv4.h"
267 (("#define LIB_LINUX_SPEC (.*)$" _ suffix)
268 (format #f "#define LIB_LINUX_SPEC \
fc649d0a 269\"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
d78010b8
RW
270 libc libc libdir suffix))
271 (("#define STARTFILE_LINUX_SPEC.*$" line)
272 (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
fc649d0a
CSLL
273#define STANDARD_STARTFILE_PREFIX_2 \"\"
274~a"
d78010b8
RW
275 libc line))))
276
cac88b28
CM
277 ;; TODO: Make this unconditional in core-updates.
278 ,@(if (target-powerpc?)
279 `((when (file-exists? "gcc/config/rs6000")
280 ;; Force powerpc libdir to be /lib and not /lib64
281 (substitute* (find-files "gcc/config/rs6000")
282 (("/lib64") "/lib"))))
283 `())
284
d78010b8
RW
285 ;; Don't retain a dependency on the build-time sed.
286 (substitute* "fixincludes/fixincl.x"
287 (("static char const sed_cmd_z\\[\\] =.*;")
288 "static char const sed_cmd_z[] = \"sed\";"))
289
290 ;; Aarch64 support didn't land in GCC until the 4.8 series.
291 (when (file-exists? "gcc/config/aarch64")
292 ;; Force Aarch64 libdir to be /lib and not /lib64
293 (substitute* "gcc/config/aarch64/t-aarch64-linux"
294 (("lib64") "lib")))
295
296 (when (file-exists? "libbacktrace")
297 ;; GCC 4.8+ comes with libbacktrace. By default it builds
298 ;; with -Werror, which fails with a -Wcast-qual error in glibc
299 ;; 2.21's stdlib-bsearch.h. Remove -Werror.
300 (substitute* "libbacktrace/configure"
301 (("WARN_FLAGS=(.*)-Werror" _ flags)
302 (string-append "WARN_FLAGS=" flags)))
303
304 (when (file-exists? "libsanitizer/libbacktrace")
305 ;; Same in libsanitizer's bundled copy (!) found in 4.9+.
306 (substitute* "libsanitizer/libbacktrace/Makefile.in"
307 (("-Werror")
308 ""))))
309
310 ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s.
311 ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354>
312 ;; and <http://bugs.gnu.org/20358>.
313 (substitute* "libstdc++-v3/src/Makefile.in"
314 (("^OPT_LDFLAGS = ")
315 "OPT_LDFLAGS = -Wl,-rpath=$(libdir) "))
316
317 ;; Move libstdc++*-gdb.py to the "lib" output to avoid a
318 ;; circularity between "out" and "lib". (Note:
319 ;; --with-python-dir is useless because it imposes $(prefix) as
320 ;; the parent directory.)
321 (substitute* "libstdc++-v3/python/Makefile.in"
322 (("pythondir = .*$")
323 (string-append "pythondir = " libdir "/share"
324 "/gcc-$(gcc_version)/python\n")))
325
326 ;; Avoid another circularity between the outputs: this #define
327 ;; ends up in auto-host.h in the "lib" output, referring to
328 ;; "out". (This variable is used to augment cpp's search path,
329 ;; but there's nothing useful to look for here.)
330 (substitute* "gcc/config.in"
331 (("PREFIX_INCLUDE_DIR")
332 "PREFIX_INCLUDE_DIR_isnt_necessary_here"))
333 #t)))
334
335 (add-after 'configure 'post-configure
336 (lambda _
337 ;; Don't store configure flags, to avoid retaining references to
338 ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'.
339 (substitute* "Makefile"
340 (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
341 "TOPLEVEL_CONFIGURE_ARGUMENTS=\n"))
342 #t)))))
343
344 (native-search-paths
345 ;; Use the language-specific variables rather than 'CPATH' because they
346 ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
347 ;; The intent is to allow headers that are in the search path to be
348 ;; treated as "system headers" (headers exempt from warnings) just like
349 ;; the typical /usr/include headers on an FHS system.
350 (list (search-path-specification
351 (variable "C_INCLUDE_PATH")
352 (files '("include")))
353 (search-path-specification
354 (variable "CPLUS_INCLUDE_PATH")
2073b55e
LC
355 ;; Add 'include/c++' here so that <cstdlib>'s "#include_next
356 ;; <stdlib.h>" finds GCC's <stdlib.h>, not libc's.
357 (files '("include/c++" "include")))
d78010b8
RW
358 (search-path-specification
359 (variable "LIBRARY_PATH")
360 (files '("lib" "lib64")))))
361
362 (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
363 (synopsis "GNU Compiler Collection")
364 (description
365 "GCC is the GNU Compiler Collection. It provides compiler front-ends
a22dc0c4 366for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and
79c311b8 367Go. It also includes runtime support libraries for these languages.")
d78010b8
RW
368 (license gpl3+)
369 (supported-systems (delete "aarch64-linux" %supported-systems))
370 (home-page "https://gcc.gnu.org/")))))
832abc76 371
3b401612 372(define-public gcc-4.8
3b401612 373 (package (inherit gcc-4.7)
ab5f49cf 374 (version "4.8.5")
3b401612 375 (source (origin
7e35b9dd
LC
376 (method url-fetch)
377 (uri (string-append "mirror://gnu/gcc/gcc-"
378 version "/gcc-" version ".tar.bz2"))
379 (sha256
380 (base32
ab5f49cf 381 "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2"))
19d27131 382 (patches (search-patches "gcc-arm-link-spec-fix.patch"
0b93d04a 383 "gcc-4.8-libsanitizer-fix.patch"
8e7ec29d 384 "gcc-asan-missing-include.patch"
7bbc708a
EF
385 "gcc-fix-texi2pod.patch"))
386 (modules '((guix build utils)))
387 ;; This is required for building with glibc-2.26.
388 ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
389 (snippet
6cbee49d
MW
390 '(begin
391 (for-each
392 (lambda (dir)
393 (substitute* (string-append "libgcc/config/"
394 dir "/linux-unwind.h")
395 (("struct ucontext") "ucontext_t")))
396 '("aarch64" "alpha" "bfin" "i386" "m68k"
397 "pa" "sh" "tilepro" "xtensa"))
398 #t))))
2b8d4ce8
EF
399 (supported-systems %supported-systems)
400 (inputs
ab53bdf0 401 `(("isl" ,isl-0.11)
2b8d4ce8
EF
402 ("cloog" ,cloog)
403 ,@(package-inputs gcc-4.7)))))
3b401612 404
571aa6cd 405(define-public gcc-4.9
dd4efefd 406 (package (inherit gcc-4.8)
b0847497 407 (version "4.9.4")
571aa6cd 408 (source (origin
7e35b9dd
LC
409 (method url-fetch)
410 (uri (string-append "mirror://gnu/gcc/gcc-"
411 version "/gcc-" version ".tar.bz2"))
412 (sha256
413 (base32
b0847497 414 "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc"))
d6593070 415 (patches (search-patches "gcc-4.9-libsanitizer-fix.patch"
3469a5ea 416 "gcc-4.9-libsanitizer-ustat.patch"
a33eac03 417 "gcc-4.9-libsanitizer-mode-size.patch"
d6593070 418 "gcc-arm-bug-71399.patch"
e80514bc 419 "gcc-asan-missing-include.patch"
19d27131 420 "gcc-libvtv-runpath.patch"
809b0a90
EF
421 "gcc-fix-texi2pod.patch"))
422 (modules '((guix build utils)))
423 ;; This is required for building with glibc-2.26.
424 ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
425 (snippet
6cbee49d
MW
426 '(begin
427 (for-each
428 (lambda (dir)
429 (substitute* (string-append "libgcc/config/"
430 dir "/linux-unwind.h")
431 (("struct ucontext") "ucontext_t")))
432 '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2"
433 "pa" "sh" "tilepro" "xtensa"))
434 #t))))
19d27131
MC
435 ;; Override inherited texinfo-5 with latest version.
436 (native-inputs `(("perl" ,perl) ;for manpages
56c833ea
MB
437 ("texinfo" ,texinfo)))
438 (arguments
439 (if (%current-target-system)
440 (package-arguments gcc-4.8)
441 ;; For native builds of GCC 4.9 and GCC 5, the C++ include path needs
442 ;; to be adjusted so it does not interfere with GCC's own build processes.
443 (substitute-keyword-arguments (package-arguments gcc-4.8)
444 ((#:modules modules %gnu-build-system-modules)
445 `((srfi srfi-1)
446 ,@modules))
447 ((#:phases phases)
448 `(modify-phases ,phases
449 (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
450 (lambda* (#:key inputs #:allow-other-keys)
451 (let ((libc (assoc-ref inputs "libc"))
452 (gcc (assoc-ref inputs "gcc")))
453 (setenv "CPLUS_INCLUDE_PATH"
454 (string-join (fold delete
455 (string-split (getenv "CPLUS_INCLUDE_PATH")
456 #\:)
457 (list (string-append libc "/include")
458 (string-append gcc "/include/c++")))
459 ":"))
460 (format #t
461 "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
462 (getenv "CPLUS_INCLUDE_PATH"))
463 #t))))))))))
571aa6cd 464
629f4d2e 465(define-public gcc-5
7912677c
LC
466 ;; Note: GCC >= 5 ships with .info files but 'make install' fails to install
467 ;; them in a VPATH build.
7e35b9dd 468 (package (inherit gcc-4.9)
404e3d8b 469 (version "5.5.0")
60e2d5fe 470 (source (origin
7e35b9dd
LC
471 (method url-fetch)
472 (uri (string-append "mirror://gnu/gcc/gcc-"
404e3d8b 473 version "/gcc-" version ".tar.xz"))
7e35b9dd
LC
474 (sha256
475 (base32
404e3d8b 476 "11zd1hgzkli3b2v70qsm2hyqppngd4616qc96lmm9zl2kl9yl32k"))
b810a850 477 (patches (search-patches "gcc-arm-bug-71399.patch"
1aef659e 478 "gcc-libsanitizer-ustat.patch"
b810a850 479 "gcc-strmov-store-file-names.patch"
d71d6fe8
MB
480 "gcc-5.0-libvtv-runpath.patch"
481 "gcc-5-source-date-epoch-1.patch"
19d27131 482 "gcc-5-source-date-epoch-2.patch"
a33eac03 483 "gcc-6-libsanitizer-mode-size.patch"
25bc0f34
JN
484 "gcc-fix-texi2pod.patch"
485 "gcc-5-hurd.patch"))
066ccc2c
LC
486 (modules '((guix build utils)))
487 (snippet
488 ;; Fix 'libcc1/configure' error when cross-compiling GCC.
489 ;; Without that, 'libcc1/configure' wrongfully determines that
490 ;; '-rdynamic' support is missing because $gcc_cv_objdump is
491 ;; empty:
492 ;;
493 ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67590
494 ;; http://cgit.openembedded.org/openembedded-core/commit/?id=f6e47aa9b12f9ab61530c40e0343f451699d9077
6cbee49d
MW
495 '(begin
496 (substitute* "libcc1/configure"
497 (("\\$gcc_cv_objdump -T")
498 "$OBJDUMP_FOR_TARGET -T"))
499 #t))))
eb9696e7 500 (inputs
25bd7267
MB
501 `(;; GCC5 needs <isl/band.h> which is removed in later versions.
502 ("isl" ,isl-0.18)
eb9696e7 503 ,@(package-inputs gcc-4.7)))))
60e2d5fe 504
e760ec41
LC
505(define-public gcc-6
506 (package
507 (inherit gcc-5)
8d65ae44 508 (version "6.5.0")
e760ec41
LC
509 (source (origin
510 (method url-fetch)
511 (uri (string-append "mirror://gnu/gcc/gcc-"
0dd87919 512 version "/gcc-" version ".tar.xz"))
e760ec41
LC
513 (sha256
514 (base32
8d65ae44
MB
515 "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby"))
516 (patches (search-patches "gcc-strmov-store-file-names.patch"
a33eac03 517 "gcc-6-libsanitizer-mode-size.patch"
aace9be8
MB
518 "gcc-6-source-date-epoch-1.patch"
519 "gcc-6-source-date-epoch-2.patch"
8d65ae44 520 "gcc-5.0-libvtv-runpath.patch"))))
56c833ea
MB
521
522 ;; GCC 4.9 and 5 has a workaround that is not needed for GCC 6 and later.
523 (arguments (package-arguments gcc-4.8))
524
2b8d4ce8
EF
525 (inputs
526 `(("isl" ,isl)
12dc9f58
LC
527
528 ;; XXX: This gross hack allows us to have libstdc++'s <bits/c++config.h>
529 ;; in the search path, thereby avoiding misconfiguration of libstdc++:
530 ;; <https://bugs.gnu.org/42392>.
531 ("libstdc++" ,libstdc++-headers)
532
2073b55e 533 ,@(package-inputs gcc-4.7)))))
2b8d4ce8 534
0c5658df
EF
535(define-public gcc-7
536 (package
537 (inherit gcc-6)
8456f9fc 538 (version "7.5.0")
0c5658df
EF
539 (source (origin
540 (method url-fetch)
541 (uri (string-append "mirror://gnu/gcc/gcc-"
2bccf1c0 542 version "/gcc-" version ".tar.xz"))
0c5658df
EF
543 (sha256
544 (base32
8456f9fc 545 "0qg6kqc5l72hpnj4vr6l0p69qav0rh4anlkk3y55540zy3klc6dq"))
0c5658df 546 (patches (search-patches "gcc-strmov-store-file-names.patch"
a33eac03 547 "gcc-7-libsanitizer-mode-size.patch"
35dadded
EF
548 "gcc-5.0-libvtv-runpath.patch"))))
549 (description
550 "GCC is the GNU Compiler Collection. It provides compiler front-ends
551for several languages, including C, C++, Objective-C, Fortran, Ada, and Go.
552It also includes runtime support libraries for these languages.")))
e760ec41 553
a1fa2691
MB
554(define-public gcc-8
555 (package
556 (inherit gcc-7)
f7e5ecf7 557 (version "8.5.0")
a1fa2691
MB
558 (source (origin
559 (method url-fetch)
560 (uri (string-append "mirror://gnu/gcc/gcc-"
561 version "/gcc-" version ".tar.xz"))
562 (sha256
563 (base32
f7e5ecf7 564 "0l7d4m9jx124xsk6xardchgy2k5j5l2b15q322k31f0va4d8826k"))
a1fa2691 565 (patches (search-patches "gcc-8-strmov-store-file-names.patch"
83d9e2ee
CD
566 "gcc-5.0-libvtv-runpath.patch"
567 "gcc-8-sort-libtool-find-output.patch"))))))
a1fa2691 568
bdfc3276
CD
569(define-public gcc-9
570 (package
571 (inherit gcc-8)
9ea6e3f4 572 (version "9.4.0")
bdfc3276
CD
573 (source (origin
574 (method url-fetch)
575 (uri (string-append "mirror://gnu/gcc/gcc-"
576 version "/gcc-" version ".tar.xz"))
577 (sha256
578 (base32
9ea6e3f4 579 "13l3p6g2krilaawbapmn9zmmrh3zdwc36mfr3msxfy038hps6pf9"))
bdfc3276 580 (patches (search-patches "gcc-9-strmov-store-file-names.patch"
0e293f75 581 "gcc-9-asan-fix-limits-include.patch"
bdfc3276
CD
582 "gcc-5.0-libvtv-runpath.patch"))))))
583
2bb5b1d4
LC
584(define-public gcc-10
585 (package
586 (inherit gcc-8)
a365777e 587 (version "10.3.0")
2bb5b1d4
LC
588 (source (origin
589 (method url-fetch)
590 (uri (string-append "mirror://gnu/gcc/gcc-"
591 version "/gcc-" version ".tar.xz"))
592 (sha256
593 (base32
a365777e 594 "0i6378ig6h397zkhd7m4ccwjx5alvzrf2hm27p1pzwjhlv0h9x34"))
2bb5b1d4
LC
595 (patches (search-patches "gcc-9-strmov-store-file-names.patch"
596 "gcc-5.0-libvtv-runpath.patch"))))))
597
007ec662
EF
598(define-public gcc-11
599 (package
600 (inherit gcc-8)
601 (version "11.1.0")
602 (source (origin
603 (method url-fetch)
604 (uri (string-append "mirror://gnu/gcc/gcc-"
605 version "/gcc-" version ".tar.xz"))
606 (sha256
607 (base32
608 "1pwxrjhsymv90xzh0x42cxfnmhjinf2lnrrf3hj5jq1rm2w6yjjc"))
609 (patches (search-patches "gcc-9-strmov-store-file-names.patch"
610 "gcc-5.0-libvtv-runpath.patch"))))))
611
ce362de8 612;; Note: When changing the default gcc version, update
a172def5 613;; the gcc-toolchain-* definitions.
01e8263f 614(define-public gcc gcc-7)
eed67cbb 615
d0abf829
LC
616(define-public (make-libstdc++ gcc)
617 "Return a libstdc++ package based on GCC. The primary use case is when
618using compilers other than GCC."
619 (package
620 (inherit gcc)
621 (name "libstdc++")
622 (arguments
623 `(#:out-of-source? #t
cac88b28
CM
624 #:phases
625 ;; TODO: Use the target-powerpc arm for everyone.
626 ,(if (target-powerpc?)
627 `(modify-phases %standard-phases
628 ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
629 (add-before 'chdir 'fix-rs6000-libdir
630 (lambda _
631 (when (file-exists? "gcc/config/rs6000")
632 (substitute* (find-files "gcc/config/rs6000")
633 (("/lib64") "/lib")))
634 #t))
635 (add-before 'configure 'chdir
636 (lambda _
637 (chdir "libstdc++-v3")
638 #t)))
639 `(alist-cons-before 'configure 'chdir
640 (lambda _
641 (chdir "libstdc++-v3")
642 #t)
643 %standard-phases))
644
d0abf829
LC
645 #:configure-flags `("--disable-libstdcxx-pch"
646 ,(string-append "--with-gxx-include-dir="
647 (assoc-ref %outputs "out")
648 "/include"))))
649 (outputs '("out" "debug"))
650 (inputs '())
651 (native-inputs '())
652 (propagated-inputs '())
653 (synopsis "GNU C++ standard library")))
654
12dc9f58
LC
655(define libstdc++
656 ;; Libstdc++ matching the default GCC.
657 (make-libstdc++ gcc))
658
659(define libstdc++-headers
660 ;; XXX: This package is for internal use to work around
661 ;; <https://bugs.gnu.org/42392> (see above). The main difference compared
662 ;; to the libstdc++ headers that come with 'gcc' is that <bits/c++config.h>
663 ;; is right under include/c++ and not under
664 ;; include/c++/x86_64-unknown-linux-gnu (aka. GPLUSPLUS_TOOL_INCLUDE_DIR).
665 (package
666 (inherit libstdc++)
667 (name "libstdc++-headers")
668 (outputs '("out"))
669 (build-system trivial-build-system)
670 (arguments
671 '(#:builder (let* ((out (assoc-ref %outputs "out"))
672 (libstdc++ (assoc-ref %build-inputs "libstdc++")))
673 (mkdir out)
674 (mkdir (string-append out "/include"))
675 (symlink (string-append libstdc++ "/include")
676 (string-append out "/include/c++")))))
677 (inputs `(("libstdc++" ,libstdc++)))
678 (synopsis "Headers of GNU libstdc++")))
679
d0abf829
LC
680(define-public libstdc++-4.9
681 (make-libstdc++ gcc-4.9))
682
2b6b6d13
RW
683(define (make-libiberty gcc)
684 "Return a libiberty package based on GCC."
685 (package
686 (inherit gcc)
687 (name "libiberty")
688 (arguments
689 `(#:out-of-source? #t
690 #:phases
691 (modify-phases %standard-phases
692 (add-before 'configure 'chdir
0f7e6964 693 (lambda _
694 (chdir "libiberty")
695 #t))
696 (replace 'install
697 (lambda* (#:key outputs #:allow-other-keys)
698 (let* ((out (assoc-ref outputs "out"))
699 (lib (string-append out "/lib/"))
700 (include (string-append out "/include/")))
701 (install-file "libiberty.a" lib)
702 (install-file "../include/libiberty.h" include))
703 #t)))))
2b6b6d13
RW
704 (inputs '())
705 (outputs '("out"))
706 (native-inputs '())
707 (propagated-inputs '())
0f665134 708 (properties '())
2b6b6d13
RW
709 (synopsis "Collection of subroutines used by various GNU programs")))
710
711(define-public libiberty
712 (make-libiberty gcc))
713
009b53fd
LC
714(define* (custom-gcc gcc name languages
715 #:optional
716 (search-paths (package-native-search-paths gcc))
717 #:key (separate-lib-output? #t))
718 "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS
719as the 'native-search-paths' field."
fdd6c726
NK
720 (package (inherit gcc)
721 (name name)
c4df90a5
MW
722 (outputs (if separate-lib-output?
723 (package-outputs gcc)
724 (delete "lib" (package-outputs gcc))))
009b53fd 725 (native-search-paths search-paths)
fbeb92d7 726 (properties (alist-delete 'hidden? (package-properties gcc)))
fdd6c726 727 (arguments
587398d2
MB
728 (substitute-keyword-arguments (package-arguments gcc)
729 ((#:modules modules %gnu-build-system-modules)
730 `(,@modules
731 (srfi srfi-1)
732 (srfi srfi-26)
733 (ice-9 regex)))
fdd6c726
NK
734 ((#:configure-flags flags)
735 `(cons (string-append "--enable-languages="
736 ,(string-join languages ","))
737 (remove (cut string-match "--enable-languages.*" <>)
82f145ef
RW
738 ,flags)))
739 ((#:phases phases)
740 `(modify-phases ,phases
741 (add-after 'install 'remove-broken-or-conflicting-files
742 (lambda* (#:key outputs #:allow-other-keys)
743 (for-each delete-file
744 (find-files (string-append (assoc-ref outputs "out") "/bin")
a1a3b25d 745 ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))
82f145ef 746 #t))))))))
fdd6c726 747
009b53fd
LC
748(define %generic-search-paths
749 ;; This is the language-neutral search path for GCC. Entries in $CPATH are
750 ;; not considered "system headers", which means GCC can raise warnings for
751 ;; issues in those headers. 'CPATH' is the only one that works for
752 ;; front-ends not in the C family.
753 (list (search-path-specification
754 (variable "CPATH")
755 (files '("include")))
756 (search-path-specification
757 (variable "LIBRARY_PATH")
758 (files '("lib" "lib64")))))
759
0681f054 760(define-public gfortran
a7c75b8d 761 (hidden-package
12dc9f58
LC
762 (custom-gcc (package
763 (inherit gcc)
764 ;; XXX: Remove LIBSTDC++-HEADERS from the inputs just to
765 ;; avoid a rebuild of all the GFORTRAN dependents.
766 ;; TODO: Remove this hack on the next rebuild cycle.
767 (inputs (alist-delete "libstdc++" (package-inputs gcc))))
768 "gfortran" '("fortran")
a7c75b8d 769 %generic-search-paths)))
f66be84d 770
163686d8 771(define-public gdc-10
772 (hidden-package
773 (custom-gcc gcc-10 "gdc" '("d")
774 %generic-search-paths)))
775
1f5543e7
EF
776(define-public gdc-11
777 (hidden-package
778 (custom-gcc gcc-11 "gdc" '("d")
779 %generic-search-paths)))
780
76d2b9a2
JL
781(define-public libgccjit
782 (package
783 (inherit gcc-9)
784 (name "libgccjit")
785 (outputs (delete "lib" (package-outputs gcc)))
786 (properties (alist-delete 'hidden? (package-properties gcc)))
787 (arguments
788 (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
789 (guix build utils)
790 (ice-9 regex)
791 (srfi srfi-1)
792 (srfi srfi-26))
793 ,@(package-arguments gcc))
794 ((#:configure-flags flags)
795 `(append `("--enable-host-shared"
796 ,(string-append "--enable-languages=jit"))
797 (remove (cut string-match "--enable-languages.*" <>)
798 ,flags)))
799 ((#:phases phases)
800 `(modify-phases ,phases
801 (add-after 'install 'remove-broken-or-conflicting-files
802 (lambda* (#:key outputs #:allow-other-keys)
803 (for-each delete-file
804 (find-files (string-append (assoc-ref outputs "out") "/bin")
805 ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))
a4fe16ee 806 #t))))))
807 (synopsis "GCC library generating machine code on-the-fly at runtime")
808 (description
809 "This package is part of the GNU Compiler Collection and provides an
810embeddable library for generating machine code on-the-fly at runtime. This
811shared library can then be dynamically-linked into bytecode interpreters and
812other such programs that want to generate machine code on-the-fly at run-time.
813It can also be used for ahead-of-time code generation for building standalone
814compilers. The just-in-time (jit) part of the name is now something of a
815misnomer.")))
76d2b9a2
JL
816
817
c8732e19 818(define-public gccgo-4.9
542c4707 819 (custom-gcc (package
820 (inherit gcc-4.9)
821 (synopsis "Go frontend to GCC")
822 (description
823 "This package is part of the GNU Compiler Collection and
824provides the GNU compiler for the Go programming language."))
825 "gccgo" '("go")
009b53fd 826 %generic-search-paths
c4df90a5
MW
827 ;; Suppress the separate "lib" output, because otherwise the
828 ;; "lib" and "out" outputs would refer to each other, creating
829 ;; a cyclic dependency. <http://debbugs.gnu.org/18101>
830 #:separate-lib-output? #f))
fdd6c726 831
14cce84c
JK
832(define %objc-search-paths
833 (list (search-path-specification
834 (variable "OBJC_INCLUDE_PATH")
835 (files '("include")))
836 (search-path-specification
837 (variable "LIBRARY_PATH")
838 (files '("lib" "lib64")))))
839
fdd6c726 840(define-public gcc-objc-4.8
009b53fd 841 (custom-gcc gcc-4.8 "gcc-objc" '("objc")
14cce84c 842 %objc-search-paths))
fdd6c726 843
2d69c161
RW
844(define-public gcc-objc-4.9
845 (custom-gcc gcc-4.9 "gcc-objc" '("objc")
14cce84c 846 %objc-search-paths))
2d69c161 847
f51d01e1
EF
848(define-public gcc-objc-5
849 (custom-gcc gcc-5 "gcc-objc" '("objc")
14cce84c 850 %objc-search-paths))
f51d01e1 851
4072c10b
EF
852(define-public gcc-objc-6
853 (custom-gcc gcc-6 "gcc-objc" '("objc")
14cce84c 854 %objc-search-paths))
ce9afe2b
EF
855
856(define-public gcc-objc-7
857 (custom-gcc gcc-7 "gcc-objc" '("objc")
14cce84c 858 %objc-search-paths))
4072c10b 859
f66be84d
EB
860(define-public gcc-objc-8
861 (custom-gcc gcc-8 "gcc-objc" '("objc")
14cce84c
JK
862 %objc-search-paths))
863
864(define-public gcc-objc-9
865 (custom-gcc gcc-9 "gcc-objc" '("objc")
866 %objc-search-paths))
867
868(define-public gcc-objc-10
869 (custom-gcc gcc-10 "gcc-objc" '("objc")
870 %objc-search-paths))
f66be84d 871
01e8263f 872(define-public gcc-objc gcc-objc-7)
8b196ad2 873
14cce84c
JK
874(define %objc++-search-paths
875 (list (search-path-specification
876 (variable "OBJCPLUS_INCLUDE_PATH")
877 (files '("include")))
878 (search-path-specification
879 (variable "LIBRARY_PATH")
880 (files '("lib" "lib64")))))
881
fdd6c726 882(define-public gcc-objc++-4.8
009b53fd 883 (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++")
14cce84c 884 %objc++-search-paths))
fdd6c726 885
a5948c0d
RW
886(define-public gcc-objc++-4.9
887 (custom-gcc gcc-4.9 "gcc-objc++" '("obj-c++")
14cce84c 888 %objc++-search-paths))
fdd6c726 889
ed8cdab8
EF
890(define-public gcc-objc++-5
891 (custom-gcc gcc-5 "gcc-objc++" '("obj-c++")
14cce84c 892 %objc++-search-paths))
ed8cdab8 893
7a7c6308
EF
894(define-public gcc-objc++-6
895 (custom-gcc gcc-6 "gcc-objc++" '("obj-c++")
14cce84c 896 %objc++-search-paths))
7a7c6308 897
e05f8d2f
EF
898(define-public gcc-objc++-7
899 (custom-gcc gcc-7 "gcc-objc++" '("obj-c++")
14cce84c 900 %objc++-search-paths))
e05f8d2f 901
f66be84d
EB
902(define-public gcc-objc++-8
903 (custom-gcc gcc-8 "gcc-objc++" '("obj-c++")
14cce84c
JK
904 %objc++-search-paths))
905
906(define-public gcc-objc++-9
907 (custom-gcc gcc-9 "gcc-objc++" '("obj-c++")
908 %objc++-search-paths))
909
910(define-public gcc-objc++-10
911 (custom-gcc gcc-10 "gcc-objc++" '("obj-c++")
912 %objc++-search-paths))
f66be84d 913
01e8263f 914(define-public gcc-objc++ gcc-objc++-7)
987a1183 915
98b385d1
LC
916(define (make-libstdc++-doc gcc)
917 "Return a package with the libstdc++ documentation for GCC."
918 (package
919 (inherit gcc)
920 (name "libstdc++-doc")
921 (version (package-version gcc))
922 (synopsis "GNU libstdc++ documentation")
923 (outputs '("out"))
924 (native-inputs `(("doxygen" ,doxygen)
925 ("texinfo" ,texinfo)
926 ("libxml2" ,libxml2)
927 ("libxslt" ,libxslt)
928 ("docbook-xml" ,docbook-xml)
929 ("docbook-xsl" ,docbook-xsl)
930 ("graphviz" ,graphviz))) ;for 'dot', invoked by 'doxygen'
931 (inputs '())
932 (propagated-inputs '())
933 (arguments
934 '(#:out-of-source? #t
935 #:tests? #f ;it's just documentation
936 #:phases (modify-phases %standard-phases
937 (add-before 'configure 'chdir
938 (lambda _
61a815eb
MW
939 (chdir "libstdc++-v3")
940 #t))
98b385d1
LC
941 (add-before 'configure 'set-xsl-directory
942 (lambda* (#:key inputs #:allow-other-keys)
943 (let ((docbook (assoc-ref inputs "docbook-xsl")))
944 (substitute* (find-files "doc"
945 "^Makefile\\.in$")
946 (("@XSL_STYLE_DIR@")
947 (string-append
948 docbook "/xml/xsl/"
61a815eb
MW
949 (strip-store-file-name docbook))))
950 #t)))
98b385d1
LC
951 (replace 'build
952 (lambda _
953 ;; XXX: There's also a 'doc-info' target, but it
954 ;; relies on docbook2X, which itself relies on
955 ;; DocBook 4.1.2, which is not really usable
956 ;; (lacks a catalog.xml.)
61a815eb
MW
957 (invoke "make"
958 "doc-html"
959 "doc-man")))
98b385d1
LC
960 (replace 'install
961 (lambda* (#:key outputs #:allow-other-keys)
962 (let ((out (assoc-ref outputs "out")))
61a815eb
MW
963 (invoke "make"
964 "doc-install-html"
798591b6
LC
965 "doc-install-man")))))))
966 (properties (alist-delete 'hidden? (package-properties gcc)))))
98b385d1 967
629f4d2e
MW
968(define-public libstdc++-doc-5
969 (make-libstdc++-doc gcc-5))
98b385d1 970
e7313ae2
LC
971(define-public libstdc++-doc-9
972 (make-libstdc++-doc gcc-9))
973
832abc76
LC
974(define-public isl
975 (package
976 (name "isl")
4a0c71f9 977 (version "0.22.1")
832abc76
LC
978 (source (origin
979 (method url-fetch)
980 (uri (list (string-append
590a4904 981 "http://isl.gforge.inria.fr/isl-"
832abc76
LC
982 version
983 ".tar.bz2")
984 (string-append %gcc-infrastructure
9f1da6ce 985 name "-" version ".tar.bz2")))
832abc76
LC
986 (sha256
987 (base32
4a0c71f9 988 "1kf54jib0nind1pvakblnfhimmwzm0y1llz8470ag0di5vwqwrhs"))))
832abc76 989 (build-system gnu-build-system)
5d8a4354
MB
990 (outputs '("out" "static"))
991 (arguments
992 '(#:phases (modify-phases %standard-phases
993 (add-after 'install 'move-static-library
994 (lambda* (#:key outputs #:allow-other-keys)
995 (let* ((out (assoc-ref outputs "out"))
996 (static (assoc-ref outputs "static"))
997 (source (string-append out "/lib/libisl.a"))
998 (target (string-append static "/lib/libisl.a")))
999 (mkdir-p (dirname target))
1000 (link source target)
1001 (delete-file source)
1002
1003 ;; Remove reference to libisl.a from the .la file so
1004 ;; libtool looks for it in the usual locations.
1005 (substitute* (string-append out "/lib/libisl.la")
1006 (("^old_library=.*")
1007 "old_library=''\n"))
1008 #t))))))
832abc76 1009 (inputs `(("gmp" ,gmp)))
590a4904 1010 (home-page "http://isl.gforge.inria.fr/")
832abc76 1011 (synopsis
9e771e3b
LC
1012 "Manipulating sets and relations of integer points \
1013bounded by linear constraints")
832abc76
LC
1014 (description
1015 "isl is a library for manipulating sets and relations of integer points
35b9e423 1016bounded by linear constraints. Supported operations on sets include
832abc76
LC
1017intersection, union, set difference, emptiness check, convex hull, (integer)
1018affine hull, integer projection, computing the lexicographic minimum using
1019parametric integer programming, coalescing and parametric vertex
35b9e423 1020enumeration. It also includes an ILP solver based on generalized basis
832abc76
LC
1021reduction, transitive closures on maps (which may encode infinite graphs),
1022dependence analysis and bounds on piecewise step-polynomials.")
1023 (license lgpl2.1+)))
1024
25bd7267
MB
1025(define-public isl-0.18
1026 (package
1027 (inherit isl)
1028 (version "0.18")
1029 (source (origin
1030 (method url-fetch)
1031 (uri (list (string-append "http://isl.gforge.inria.fr/isl-"
1032 version ".tar.bz2")
1033 (string-append %gcc-infrastructure
9f1da6ce 1034 "isl-" version ".tar.bz2")))
25bd7267
MB
1035 (sha256
1036 (base32
1037 "06ybml6llhi4i56q90jnimbcgk1lpcdwhy9nxdxra2hxz3bhz2vb"))))))
1038
ab53bdf0
EF
1039(define-public isl-0.11
1040 (package
1041 (inherit isl)
1042 (name "isl")
1043 (version "0.11.1")
1044 (source (origin
1045 (method url-fetch)
1046 (uri (list (string-append
1047 "http://isl.gforge.inria.fr/isl-"
1048 version
1049 ".tar.bz2")
1050 (string-append %gcc-infrastructure
9f1da6ce 1051 name "-" version ".tar.bz2")))
ab53bdf0
EF
1052 (sha256
1053 (base32
1054 "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9"))
1055 (patches (search-patches "isl-0.11.1-aarch64-support.patch"))))))
1056
832abc76
LC
1057(define-public cloog
1058 (package
1059 (name "cloog")
1060 (version "0.18.0")
1061 (source
1062 (origin
1063 (method url-fetch)
1064 (uri (list (string-append
1065 "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-"
1066 version
1067 ".tar.gz")
1068 (string-append %gcc-infrastructure
1069 name "-" version ".tar.gz")))
1070 (sha256
1071 (base32
1072 "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw"))
1073 (file-name (string-append name "-" version ".tar.gz"))))
1074 (build-system gnu-build-system)
1075 (inputs `(("gmp" ,gmp)
ab53bdf0 1076 ("isl" ,isl-0.11)))
832abc76
LC
1077 (arguments '(#:configure-flags '("--with-isl=system")))
1078 (home-page "http://www.cloog.org/")
9e771e3b 1079 (synopsis "Library to generate code for scanning Z-polyhedra")
832abc76
LC
1080 (description
1081 "CLooG is a free software library to generate code for scanning
1082Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that
1083reaches each integral point of one or more parameterized polyhedra.
1084CLooG has been originally written to solve the code generation problem
1085for optimizing compilers based on the polytope model. Nevertheless it
1086is used now in various area e.g., to build control automata for
1087high-level synthesis or to find the best polynomial approximation of a
1088function. CLooG may help in any situation where scanning polyhedra
1089matters. While the user has full control on generated code quality,
1090CLooG is designed to avoid control overhead and to produce a very
1091effective code.")
1092 (license gpl2+)))
5c126b64 1093
50c7a1e2
LC
1094(define-public gnu-c-manual
1095 (package
1096 (name "gnu-c-manual")
d35f8c7c 1097 (version "0.2.5")
50c7a1e2
LC
1098 (source (origin
1099 (method url-fetch)
1100 (uri (string-append "mirror://gnu/gnu-c-manual/gnu-c-manual-"
1101 version ".tar.gz"))
1102 (sha256
1103 (base32
d35f8c7c 1104 "1sfsj9256w18qzylgag2h5h377aq8in8929svblfnj9svfriqcys"))))
50c7a1e2
LC
1105 (build-system gnu-build-system)
1106 (native-inputs `(("texinfo" ,texinfo)))
1107 (arguments
1108 '(#:phases (modify-phases %standard-phases
1109 (delete 'configure)
1110 (delete 'check)
1111 (replace 'build
1112 (lambda _
9feb4fd5
MW
1113 (invoke "make"
1114 "gnu-c-manual.info"
1115 "gnu-c-manual.html")))
50c7a1e2
LC
1116 (replace 'install
1117 (lambda* (#:key outputs #:allow-other-keys)
1118 (let* ((out (assoc-ref outputs "out"))
1119 (info (string-append out "/share/info"))
1120 (html (string-append
1121 out "/share/doc/gnu-c-manual")))
1122 (mkdir-p info)
1123 (mkdir-p html)
1124
1125 (for-each (lambda (file)
1126 (copy-file file
1127 (string-append info "/"
1128 file)))
1129 (find-files "." "\\.info(-[0-9])?$"))
1130 (for-each (lambda (file)
1131 (copy-file file
1132 (string-append html "/"
1133 file)))
1134 (find-files "." "\\.html$"))
1135 #t))))))
1136 (synopsis "Reference manual for the C programming language")
1137 (description
1138 "This is a reference manual for the C programming language, as
1139implemented by the GNU C Compiler (gcc). As a reference, it is not intended
1140to be a tutorial of the language. Rather, it outlines all of the constructs
1141of the language. Library functions are not included.")
6fd52309 1142 (home-page "https://www.gnu.org/software/gnu-c-manual/")
50c7a1e2 1143 (license fdl1.3+)))