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