gnu: emacs-svg-icon: Fix grammar.
[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)
60ce496a 557 (version "8.4.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
60ce496a 564 "1m1d3gfix56w4aq8myazzfffkl8bqcrx4jhhapnjf7qfs596w2p3"))
a1fa2691
MB
565 (patches (search-patches "gcc-8-strmov-store-file-names.patch"
566 "gcc-5.0-libvtv-runpath.patch"))))))
567
bdfc3276
CD
568(define-public gcc-9
569 (package
570 (inherit gcc-8)
3dade1d5 571 (version "9.3.0")
bdfc3276
CD
572 (source (origin
573 (method url-fetch)
574 (uri (string-append "mirror://gnu/gcc/gcc-"
575 version "/gcc-" version ".tar.xz"))
576 (sha256
577 (base32
3dade1d5 578 "1la2yy27ziasyf0jvzk58y1i5b5bq2h176qil550bxhifs39gqbi"))
bdfc3276 579 (patches (search-patches "gcc-9-strmov-store-file-names.patch"
0e293f75 580 "gcc-9-asan-fix-limits-include.patch"
bdfc3276
CD
581 "gcc-5.0-libvtv-runpath.patch"))))))
582
2bb5b1d4
LC
583(define-public gcc-10
584 (package
585 (inherit gcc-8)
a365777e 586 (version "10.3.0")
2bb5b1d4
LC
587 (source (origin
588 (method url-fetch)
589 (uri (string-append "mirror://gnu/gcc/gcc-"
590 version "/gcc-" version ".tar.xz"))
591 (sha256
592 (base32
a365777e 593 "0i6378ig6h397zkhd7m4ccwjx5alvzrf2hm27p1pzwjhlv0h9x34"))
2bb5b1d4
LC
594 (patches (search-patches "gcc-9-strmov-store-file-names.patch"
595 "gcc-5.0-libvtv-runpath.patch"))))))
596
ce362de8 597;; Note: When changing the default gcc version, update
a172def5 598;; the gcc-toolchain-* definitions.
01e8263f 599(define-public gcc gcc-7)
eed67cbb 600
d0abf829
LC
601(define-public (make-libstdc++ gcc)
602 "Return a libstdc++ package based on GCC. The primary use case is when
603using compilers other than GCC."
604 (package
605 (inherit gcc)
606 (name "libstdc++")
607 (arguments
608 `(#:out-of-source? #t
cac88b28
CM
609 #:phases
610 ;; TODO: Use the target-powerpc arm for everyone.
611 ,(if (target-powerpc?)
612 `(modify-phases %standard-phases
613 ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
614 (add-before 'chdir 'fix-rs6000-libdir
615 (lambda _
616 (when (file-exists? "gcc/config/rs6000")
617 (substitute* (find-files "gcc/config/rs6000")
618 (("/lib64") "/lib")))
619 #t))
620 (add-before 'configure 'chdir
621 (lambda _
622 (chdir "libstdc++-v3")
623 #t)))
624 `(alist-cons-before 'configure 'chdir
625 (lambda _
626 (chdir "libstdc++-v3")
627 #t)
628 %standard-phases))
629
d0abf829
LC
630 #:configure-flags `("--disable-libstdcxx-pch"
631 ,(string-append "--with-gxx-include-dir="
632 (assoc-ref %outputs "out")
633 "/include"))))
634 (outputs '("out" "debug"))
635 (inputs '())
636 (native-inputs '())
637 (propagated-inputs '())
638 (synopsis "GNU C++ standard library")))
639
12dc9f58
LC
640(define libstdc++
641 ;; Libstdc++ matching the default GCC.
642 (make-libstdc++ gcc))
643
644(define libstdc++-headers
645 ;; XXX: This package is for internal use to work around
646 ;; <https://bugs.gnu.org/42392> (see above). The main difference compared
647 ;; to the libstdc++ headers that come with 'gcc' is that <bits/c++config.h>
648 ;; is right under include/c++ and not under
649 ;; include/c++/x86_64-unknown-linux-gnu (aka. GPLUSPLUS_TOOL_INCLUDE_DIR).
650 (package
651 (inherit libstdc++)
652 (name "libstdc++-headers")
653 (outputs '("out"))
654 (build-system trivial-build-system)
655 (arguments
656 '(#:builder (let* ((out (assoc-ref %outputs "out"))
657 (libstdc++ (assoc-ref %build-inputs "libstdc++")))
658 (mkdir out)
659 (mkdir (string-append out "/include"))
660 (symlink (string-append libstdc++ "/include")
661 (string-append out "/include/c++")))))
662 (inputs `(("libstdc++" ,libstdc++)))
663 (synopsis "Headers of GNU libstdc++")))
664
d0abf829
LC
665(define-public libstdc++-4.9
666 (make-libstdc++ gcc-4.9))
667
2b6b6d13
RW
668(define (make-libiberty gcc)
669 "Return a libiberty package based on GCC."
670 (package
671 (inherit gcc)
672 (name "libiberty")
673 (arguments
674 `(#:out-of-source? #t
675 #:phases
676 (modify-phases %standard-phases
677 (add-before 'configure 'chdir
0f7e6964 678 (lambda _
679 (chdir "libiberty")
680 #t))
681 (replace 'install
682 (lambda* (#:key outputs #:allow-other-keys)
683 (let* ((out (assoc-ref outputs "out"))
684 (lib (string-append out "/lib/"))
685 (include (string-append out "/include/")))
686 (install-file "libiberty.a" lib)
687 (install-file "../include/libiberty.h" include))
688 #t)))))
2b6b6d13
RW
689 (inputs '())
690 (outputs '("out"))
691 (native-inputs '())
692 (propagated-inputs '())
0f665134 693 (properties '())
2b6b6d13
RW
694 (synopsis "Collection of subroutines used by various GNU programs")))
695
696(define-public libiberty
697 (make-libiberty gcc))
698
009b53fd
LC
699(define* (custom-gcc gcc name languages
700 #:optional
701 (search-paths (package-native-search-paths gcc))
702 #:key (separate-lib-output? #t))
703 "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS
704as the 'native-search-paths' field."
fdd6c726
NK
705 (package (inherit gcc)
706 (name name)
c4df90a5
MW
707 (outputs (if separate-lib-output?
708 (package-outputs gcc)
709 (delete "lib" (package-outputs gcc))))
009b53fd 710 (native-search-paths search-paths)
fbeb92d7 711 (properties (alist-delete 'hidden? (package-properties gcc)))
fdd6c726 712 (arguments
587398d2
MB
713 (substitute-keyword-arguments (package-arguments gcc)
714 ((#:modules modules %gnu-build-system-modules)
715 `(,@modules
716 (srfi srfi-1)
717 (srfi srfi-26)
718 (ice-9 regex)))
fdd6c726
NK
719 ((#:configure-flags flags)
720 `(cons (string-append "--enable-languages="
721 ,(string-join languages ","))
722 (remove (cut string-match "--enable-languages.*" <>)
82f145ef
RW
723 ,flags)))
724 ((#:phases phases)
725 `(modify-phases ,phases
726 (add-after 'install 'remove-broken-or-conflicting-files
727 (lambda* (#:key outputs #:allow-other-keys)
728 (for-each delete-file
729 (find-files (string-append (assoc-ref outputs "out") "/bin")
a1a3b25d 730 ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))
82f145ef 731 #t))))))))
fdd6c726 732
009b53fd
LC
733(define %generic-search-paths
734 ;; This is the language-neutral search path for GCC. Entries in $CPATH are
735 ;; not considered "system headers", which means GCC can raise warnings for
736 ;; issues in those headers. 'CPATH' is the only one that works for
737 ;; front-ends not in the C family.
738 (list (search-path-specification
739 (variable "CPATH")
740 (files '("include")))
741 (search-path-specification
742 (variable "LIBRARY_PATH")
743 (files '("lib" "lib64")))))
744
0681f054 745(define-public gfortran
a7c75b8d 746 (hidden-package
12dc9f58
LC
747 (custom-gcc (package
748 (inherit gcc)
749 ;; XXX: Remove LIBSTDC++-HEADERS from the inputs just to
750 ;; avoid a rebuild of all the GFORTRAN dependents.
751 ;; TODO: Remove this hack on the next rebuild cycle.
752 (inputs (alist-delete "libstdc++" (package-inputs gcc))))
753 "gfortran" '("fortran")
a7c75b8d 754 %generic-search-paths)))
f66be84d 755
163686d8 756(define-public gdc-10
757 (hidden-package
758 (custom-gcc gcc-10 "gdc" '("d")
759 %generic-search-paths)))
760
76d2b9a2
JL
761(define-public libgccjit
762 (package
763 (inherit gcc-9)
764 (name "libgccjit")
765 (outputs (delete "lib" (package-outputs gcc)))
766 (properties (alist-delete 'hidden? (package-properties gcc)))
767 (arguments
768 (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
769 (guix build utils)
770 (ice-9 regex)
771 (srfi srfi-1)
772 (srfi srfi-26))
773 ,@(package-arguments gcc))
774 ((#:configure-flags flags)
775 `(append `("--enable-host-shared"
776 ,(string-append "--enable-languages=jit"))
777 (remove (cut string-match "--enable-languages.*" <>)
778 ,flags)))
779 ((#:phases phases)
780 `(modify-phases ,phases
781 (add-after 'install 'remove-broken-or-conflicting-files
782 (lambda* (#:key outputs #:allow-other-keys)
783 (for-each delete-file
784 (find-files (string-append (assoc-ref outputs "out") "/bin")
785 ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))
a4fe16ee 786 #t))))))
787 (synopsis "GCC library generating machine code on-the-fly at runtime")
788 (description
789 "This package is part of the GNU Compiler Collection and provides an
790embeddable library for generating machine code on-the-fly at runtime. This
791shared library can then be dynamically-linked into bytecode interpreters and
792other such programs that want to generate machine code on-the-fly at run-time.
793It can also be used for ahead-of-time code generation for building standalone
794compilers. The just-in-time (jit) part of the name is now something of a
795misnomer.")))
76d2b9a2
JL
796
797
c8732e19 798(define-public gccgo-4.9
542c4707 799 (custom-gcc (package
800 (inherit gcc-4.9)
801 (synopsis "Go frontend to GCC")
802 (description
803 "This package is part of the GNU Compiler Collection and
804provides the GNU compiler for the Go programming language."))
805 "gccgo" '("go")
009b53fd 806 %generic-search-paths
c4df90a5
MW
807 ;; Suppress the separate "lib" output, because otherwise the
808 ;; "lib" and "out" outputs would refer to each other, creating
809 ;; a cyclic dependency. <http://debbugs.gnu.org/18101>
810 #:separate-lib-output? #f))
fdd6c726 811
14cce84c
JK
812(define %objc-search-paths
813 (list (search-path-specification
814 (variable "OBJC_INCLUDE_PATH")
815 (files '("include")))
816 (search-path-specification
817 (variable "LIBRARY_PATH")
818 (files '("lib" "lib64")))))
819
fdd6c726 820(define-public gcc-objc-4.8
009b53fd 821 (custom-gcc gcc-4.8 "gcc-objc" '("objc")
14cce84c 822 %objc-search-paths))
fdd6c726 823
2d69c161
RW
824(define-public gcc-objc-4.9
825 (custom-gcc gcc-4.9 "gcc-objc" '("objc")
14cce84c 826 %objc-search-paths))
2d69c161 827
f51d01e1
EF
828(define-public gcc-objc-5
829 (custom-gcc gcc-5 "gcc-objc" '("objc")
14cce84c 830 %objc-search-paths))
f51d01e1 831
4072c10b
EF
832(define-public gcc-objc-6
833 (custom-gcc gcc-6 "gcc-objc" '("objc")
14cce84c 834 %objc-search-paths))
ce9afe2b
EF
835
836(define-public gcc-objc-7
837 (custom-gcc gcc-7 "gcc-objc" '("objc")
14cce84c 838 %objc-search-paths))
4072c10b 839
f66be84d
EB
840(define-public gcc-objc-8
841 (custom-gcc gcc-8 "gcc-objc" '("objc")
14cce84c
JK
842 %objc-search-paths))
843
844(define-public gcc-objc-9
845 (custom-gcc gcc-9 "gcc-objc" '("objc")
846 %objc-search-paths))
847
848(define-public gcc-objc-10
849 (custom-gcc gcc-10 "gcc-objc" '("objc")
850 %objc-search-paths))
f66be84d 851
01e8263f 852(define-public gcc-objc gcc-objc-7)
8b196ad2 853
14cce84c
JK
854(define %objc++-search-paths
855 (list (search-path-specification
856 (variable "OBJCPLUS_INCLUDE_PATH")
857 (files '("include")))
858 (search-path-specification
859 (variable "LIBRARY_PATH")
860 (files '("lib" "lib64")))))
861
fdd6c726 862(define-public gcc-objc++-4.8
009b53fd 863 (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++")
14cce84c 864 %objc++-search-paths))
fdd6c726 865
a5948c0d
RW
866(define-public gcc-objc++-4.9
867 (custom-gcc gcc-4.9 "gcc-objc++" '("obj-c++")
14cce84c 868 %objc++-search-paths))
fdd6c726 869
ed8cdab8
EF
870(define-public gcc-objc++-5
871 (custom-gcc gcc-5 "gcc-objc++" '("obj-c++")
14cce84c 872 %objc++-search-paths))
ed8cdab8 873
7a7c6308
EF
874(define-public gcc-objc++-6
875 (custom-gcc gcc-6 "gcc-objc++" '("obj-c++")
14cce84c 876 %objc++-search-paths))
7a7c6308 877
e05f8d2f
EF
878(define-public gcc-objc++-7
879 (custom-gcc gcc-7 "gcc-objc++" '("obj-c++")
14cce84c 880 %objc++-search-paths))
e05f8d2f 881
f66be84d
EB
882(define-public gcc-objc++-8
883 (custom-gcc gcc-8 "gcc-objc++" '("obj-c++")
14cce84c
JK
884 %objc++-search-paths))
885
886(define-public gcc-objc++-9
887 (custom-gcc gcc-9 "gcc-objc++" '("obj-c++")
888 %objc++-search-paths))
889
890(define-public gcc-objc++-10
891 (custom-gcc gcc-10 "gcc-objc++" '("obj-c++")
892 %objc++-search-paths))
f66be84d 893
01e8263f 894(define-public gcc-objc++ gcc-objc++-7)
987a1183 895
98b385d1
LC
896(define (make-libstdc++-doc gcc)
897 "Return a package with the libstdc++ documentation for GCC."
898 (package
899 (inherit gcc)
900 (name "libstdc++-doc")
901 (version (package-version gcc))
902 (synopsis "GNU libstdc++ documentation")
903 (outputs '("out"))
904 (native-inputs `(("doxygen" ,doxygen)
905 ("texinfo" ,texinfo)
906 ("libxml2" ,libxml2)
907 ("libxslt" ,libxslt)
908 ("docbook-xml" ,docbook-xml)
909 ("docbook-xsl" ,docbook-xsl)
910 ("graphviz" ,graphviz))) ;for 'dot', invoked by 'doxygen'
911 (inputs '())
912 (propagated-inputs '())
913 (arguments
914 '(#:out-of-source? #t
915 #:tests? #f ;it's just documentation
916 #:phases (modify-phases %standard-phases
917 (add-before 'configure 'chdir
918 (lambda _
61a815eb
MW
919 (chdir "libstdc++-v3")
920 #t))
98b385d1
LC
921 (add-before 'configure 'set-xsl-directory
922 (lambda* (#:key inputs #:allow-other-keys)
923 (let ((docbook (assoc-ref inputs "docbook-xsl")))
924 (substitute* (find-files "doc"
925 "^Makefile\\.in$")
926 (("@XSL_STYLE_DIR@")
927 (string-append
928 docbook "/xml/xsl/"
61a815eb
MW
929 (strip-store-file-name docbook))))
930 #t)))
98b385d1
LC
931 (replace 'build
932 (lambda _
933 ;; XXX: There's also a 'doc-info' target, but it
934 ;; relies on docbook2X, which itself relies on
935 ;; DocBook 4.1.2, which is not really usable
936 ;; (lacks a catalog.xml.)
61a815eb
MW
937 (invoke "make"
938 "doc-html"
939 "doc-man")))
98b385d1
LC
940 (replace 'install
941 (lambda* (#:key outputs #:allow-other-keys)
942 (let ((out (assoc-ref outputs "out")))
61a815eb
MW
943 (invoke "make"
944 "doc-install-html"
798591b6
LC
945 "doc-install-man")))))))
946 (properties (alist-delete 'hidden? (package-properties gcc)))))
98b385d1 947
629f4d2e
MW
948(define-public libstdc++-doc-5
949 (make-libstdc++-doc gcc-5))
98b385d1 950
e7313ae2
LC
951(define-public libstdc++-doc-9
952 (make-libstdc++-doc gcc-9))
953
832abc76
LC
954(define-public isl
955 (package
956 (name "isl")
4a0c71f9 957 (version "0.22.1")
832abc76
LC
958 (source (origin
959 (method url-fetch)
960 (uri (list (string-append
590a4904 961 "http://isl.gforge.inria.fr/isl-"
832abc76
LC
962 version
963 ".tar.bz2")
964 (string-append %gcc-infrastructure
9f1da6ce 965 name "-" version ".tar.bz2")))
832abc76
LC
966 (sha256
967 (base32
4a0c71f9 968 "1kf54jib0nind1pvakblnfhimmwzm0y1llz8470ag0di5vwqwrhs"))))
832abc76 969 (build-system gnu-build-system)
5d8a4354
MB
970 (outputs '("out" "static"))
971 (arguments
972 '(#:phases (modify-phases %standard-phases
973 (add-after 'install 'move-static-library
974 (lambda* (#:key outputs #:allow-other-keys)
975 (let* ((out (assoc-ref outputs "out"))
976 (static (assoc-ref outputs "static"))
977 (source (string-append out "/lib/libisl.a"))
978 (target (string-append static "/lib/libisl.a")))
979 (mkdir-p (dirname target))
980 (link source target)
981 (delete-file source)
982
983 ;; Remove reference to libisl.a from the .la file so
984 ;; libtool looks for it in the usual locations.
985 (substitute* (string-append out "/lib/libisl.la")
986 (("^old_library=.*")
987 "old_library=''\n"))
988 #t))))))
832abc76 989 (inputs `(("gmp" ,gmp)))
590a4904 990 (home-page "http://isl.gforge.inria.fr/")
832abc76 991 (synopsis
9e771e3b
LC
992 "Manipulating sets and relations of integer points \
993bounded by linear constraints")
832abc76
LC
994 (description
995 "isl is a library for manipulating sets and relations of integer points
35b9e423 996bounded by linear constraints. Supported operations on sets include
832abc76
LC
997intersection, union, set difference, emptiness check, convex hull, (integer)
998affine hull, integer projection, computing the lexicographic minimum using
999parametric integer programming, coalescing and parametric vertex
35b9e423 1000enumeration. It also includes an ILP solver based on generalized basis
832abc76
LC
1001reduction, transitive closures on maps (which may encode infinite graphs),
1002dependence analysis and bounds on piecewise step-polynomials.")
1003 (license lgpl2.1+)))
1004
25bd7267
MB
1005(define-public isl-0.18
1006 (package
1007 (inherit isl)
1008 (version "0.18")
1009 (source (origin
1010 (method url-fetch)
1011 (uri (list (string-append "http://isl.gforge.inria.fr/isl-"
1012 version ".tar.bz2")
1013 (string-append %gcc-infrastructure
9f1da6ce 1014 "isl-" version ".tar.bz2")))
25bd7267
MB
1015 (sha256
1016 (base32
1017 "06ybml6llhi4i56q90jnimbcgk1lpcdwhy9nxdxra2hxz3bhz2vb"))))))
1018
ab53bdf0
EF
1019(define-public isl-0.11
1020 (package
1021 (inherit isl)
1022 (name "isl")
1023 (version "0.11.1")
1024 (source (origin
1025 (method url-fetch)
1026 (uri (list (string-append
1027 "http://isl.gforge.inria.fr/isl-"
1028 version
1029 ".tar.bz2")
1030 (string-append %gcc-infrastructure
9f1da6ce 1031 name "-" version ".tar.bz2")))
ab53bdf0
EF
1032 (sha256
1033 (base32
1034 "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9"))
1035 (patches (search-patches "isl-0.11.1-aarch64-support.patch"))))))
1036
832abc76
LC
1037(define-public cloog
1038 (package
1039 (name "cloog")
1040 (version "0.18.0")
1041 (source
1042 (origin
1043 (method url-fetch)
1044 (uri (list (string-append
1045 "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-"
1046 version
1047 ".tar.gz")
1048 (string-append %gcc-infrastructure
1049 name "-" version ".tar.gz")))
1050 (sha256
1051 (base32
1052 "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw"))
1053 (file-name (string-append name "-" version ".tar.gz"))))
1054 (build-system gnu-build-system)
1055 (inputs `(("gmp" ,gmp)
ab53bdf0 1056 ("isl" ,isl-0.11)))
832abc76
LC
1057 (arguments '(#:configure-flags '("--with-isl=system")))
1058 (home-page "http://www.cloog.org/")
9e771e3b 1059 (synopsis "Library to generate code for scanning Z-polyhedra")
832abc76
LC
1060 (description
1061 "CLooG is a free software library to generate code for scanning
1062Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that
1063reaches each integral point of one or more parameterized polyhedra.
1064CLooG has been originally written to solve the code generation problem
1065for optimizing compilers based on the polytope model. Nevertheless it
1066is used now in various area e.g., to build control automata for
1067high-level synthesis or to find the best polynomial approximation of a
1068function. CLooG may help in any situation where scanning polyhedra
1069matters. While the user has full control on generated code quality,
1070CLooG is designed to avoid control overhead and to produce a very
1071effective code.")
1072 (license gpl2+)))
5c126b64 1073
50c7a1e2
LC
1074(define-public gnu-c-manual
1075 (package
1076 (name "gnu-c-manual")
d35f8c7c 1077 (version "0.2.5")
50c7a1e2
LC
1078 (source (origin
1079 (method url-fetch)
1080 (uri (string-append "mirror://gnu/gnu-c-manual/gnu-c-manual-"
1081 version ".tar.gz"))
1082 (sha256
1083 (base32
d35f8c7c 1084 "1sfsj9256w18qzylgag2h5h377aq8in8929svblfnj9svfriqcys"))))
50c7a1e2
LC
1085 (build-system gnu-build-system)
1086 (native-inputs `(("texinfo" ,texinfo)))
1087 (arguments
1088 '(#:phases (modify-phases %standard-phases
1089 (delete 'configure)
1090 (delete 'check)
1091 (replace 'build
1092 (lambda _
9feb4fd5
MW
1093 (invoke "make"
1094 "gnu-c-manual.info"
1095 "gnu-c-manual.html")))
50c7a1e2
LC
1096 (replace 'install
1097 (lambda* (#:key outputs #:allow-other-keys)
1098 (let* ((out (assoc-ref outputs "out"))
1099 (info (string-append out "/share/info"))
1100 (html (string-append
1101 out "/share/doc/gnu-c-manual")))
1102 (mkdir-p info)
1103 (mkdir-p html)
1104
1105 (for-each (lambda (file)
1106 (copy-file file
1107 (string-append info "/"
1108 file)))
1109 (find-files "." "\\.info(-[0-9])?$"))
1110 (for-each (lambda (file)
1111 (copy-file file
1112 (string-append html "/"
1113 file)))
1114 (find-files "." "\\.html$"))
1115 #t))))))
1116 (synopsis "Reference manual for the C programming language")
1117 (description
1118 "This is a reference manual for the C programming language, as
1119implemented by the GNU C Compiler (gcc). As a reference, it is not intended
1120to be a tutorial of the language. Rather, it outlines all of the constructs
1121of the language. Library functions are not included.")
6fd52309 1122 (home-page "https://www.gnu.org/software/gnu-c-manual/")
50c7a1e2 1123 (license fdl1.3+)))