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