Commit | Line | Data |
---|---|---|
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 | ||
59 | The purpose of this procedure is to translate extended GNU triplets---e.g., | |
60 | where 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 | 357 | for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and |
79c311b8 | 358 | Go. 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 | |
6cbee49d MW |
381 | '(begin |
382 | (for-each | |
383 | (lambda (dir) | |
384 | (substitute* (string-append "libgcc/config/" | |
385 | dir "/linux-unwind.h") | |
386 | (("struct ucontext") "ucontext_t"))) | |
387 | '("aarch64" "alpha" "bfin" "i386" "m68k" | |
388 | "pa" "sh" "tilepro" "xtensa")) | |
389 | #t)))) | |
2b8d4ce8 EF |
390 | (supported-systems %supported-systems) |
391 | (inputs | |
ab53bdf0 | 392 | `(("isl" ,isl-0.11) |
2b8d4ce8 EF |
393 | ("cloog" ,cloog) |
394 | ,@(package-inputs gcc-4.7))))) | |
3b401612 | 395 | |
571aa6cd | 396 | (define-public gcc-4.9 |
dd4efefd | 397 | (package (inherit gcc-4.8) |
b0847497 | 398 | (version "4.9.4") |
571aa6cd | 399 | (source (origin |
7e35b9dd LC |
400 | (method url-fetch) |
401 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
402 | version "/gcc-" version ".tar.bz2")) | |
403 | (sha256 | |
404 | (base32 | |
b0847497 | 405 | "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc")) |
d6593070 | 406 | (patches (search-patches "gcc-4.9-libsanitizer-fix.patch" |
3469a5ea | 407 | "gcc-4.9-libsanitizer-ustat.patch" |
a33eac03 | 408 | "gcc-4.9-libsanitizer-mode-size.patch" |
d6593070 | 409 | "gcc-arm-bug-71399.patch" |
e80514bc | 410 | "gcc-asan-missing-include.patch" |
19d27131 | 411 | "gcc-libvtv-runpath.patch" |
809b0a90 EF |
412 | "gcc-fix-texi2pod.patch")) |
413 | (modules '((guix build utils))) | |
414 | ;; This is required for building with glibc-2.26. | |
415 | ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712 | |
416 | (snippet | |
6cbee49d MW |
417 | '(begin |
418 | (for-each | |
419 | (lambda (dir) | |
420 | (substitute* (string-append "libgcc/config/" | |
421 | dir "/linux-unwind.h") | |
422 | (("struct ucontext") "ucontext_t"))) | |
423 | '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2" | |
424 | "pa" "sh" "tilepro" "xtensa")) | |
425 | #t)))) | |
19d27131 MC |
426 | ;; Override inherited texinfo-5 with latest version. |
427 | (native-inputs `(("perl" ,perl) ;for manpages | |
56c833ea MB |
428 | ("texinfo" ,texinfo))) |
429 | (arguments | |
430 | (if (%current-target-system) | |
431 | (package-arguments gcc-4.8) | |
432 | ;; For native builds of GCC 4.9 and GCC 5, the C++ include path needs | |
433 | ;; to be adjusted so it does not interfere with GCC's own build processes. | |
434 | (substitute-keyword-arguments (package-arguments gcc-4.8) | |
435 | ((#:modules modules %gnu-build-system-modules) | |
436 | `((srfi srfi-1) | |
437 | ,@modules)) | |
438 | ((#:phases phases) | |
439 | `(modify-phases ,phases | |
440 | (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH | |
441 | (lambda* (#:key inputs #:allow-other-keys) | |
442 | (let ((libc (assoc-ref inputs "libc")) | |
443 | (gcc (assoc-ref inputs "gcc"))) | |
444 | (setenv "CPLUS_INCLUDE_PATH" | |
445 | (string-join (fold delete | |
446 | (string-split (getenv "CPLUS_INCLUDE_PATH") | |
447 | #\:) | |
448 | (list (string-append libc "/include") | |
449 | (string-append gcc "/include/c++"))) | |
450 | ":")) | |
451 | (format #t | |
452 | "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%" | |
453 | (getenv "CPLUS_INCLUDE_PATH")) | |
454 | #t)))))))))) | |
571aa6cd | 455 | |
629f4d2e | 456 | (define-public gcc-5 |
7912677c LC |
457 | ;; Note: GCC >= 5 ships with .info files but 'make install' fails to install |
458 | ;; them in a VPATH build. | |
7e35b9dd | 459 | (package (inherit gcc-4.9) |
404e3d8b | 460 | (version "5.5.0") |
60e2d5fe | 461 | (source (origin |
7e35b9dd LC |
462 | (method url-fetch) |
463 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
404e3d8b | 464 | version "/gcc-" version ".tar.xz")) |
7e35b9dd LC |
465 | (sha256 |
466 | (base32 | |
404e3d8b | 467 | "11zd1hgzkli3b2v70qsm2hyqppngd4616qc96lmm9zl2kl9yl32k")) |
b810a850 | 468 | (patches (search-patches "gcc-arm-bug-71399.patch" |
1aef659e | 469 | "gcc-libsanitizer-ustat.patch" |
b810a850 | 470 | "gcc-strmov-store-file-names.patch" |
d71d6fe8 MB |
471 | "gcc-5.0-libvtv-runpath.patch" |
472 | "gcc-5-source-date-epoch-1.patch" | |
19d27131 | 473 | "gcc-5-source-date-epoch-2.patch" |
a33eac03 | 474 | "gcc-6-libsanitizer-mode-size.patch" |
25bc0f34 JN |
475 | "gcc-fix-texi2pod.patch" |
476 | "gcc-5-hurd.patch")) | |
066ccc2c LC |
477 | (modules '((guix build utils))) |
478 | (snippet | |
479 | ;; Fix 'libcc1/configure' error when cross-compiling GCC. | |
480 | ;; Without that, 'libcc1/configure' wrongfully determines that | |
481 | ;; '-rdynamic' support is missing because $gcc_cv_objdump is | |
482 | ;; empty: | |
483 | ;; | |
484 | ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67590 | |
485 | ;; http://cgit.openembedded.org/openembedded-core/commit/?id=f6e47aa9b12f9ab61530c40e0343f451699d9077 | |
6cbee49d MW |
486 | '(begin |
487 | (substitute* "libcc1/configure" | |
488 | (("\\$gcc_cv_objdump -T") | |
489 | "$OBJDUMP_FOR_TARGET -T")) | |
490 | #t)))) | |
eb9696e7 | 491 | (inputs |
25bd7267 MB |
492 | `(;; GCC5 needs <isl/band.h> which is removed in later versions. |
493 | ("isl" ,isl-0.18) | |
eb9696e7 | 494 | ,@(package-inputs gcc-4.7))))) |
60e2d5fe | 495 | |
e760ec41 LC |
496 | (define-public gcc-6 |
497 | (package | |
498 | (inherit gcc-5) | |
8d65ae44 | 499 | (version "6.5.0") |
e760ec41 LC |
500 | (source (origin |
501 | (method url-fetch) | |
502 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
0dd87919 | 503 | version "/gcc-" version ".tar.xz")) |
e760ec41 LC |
504 | (sha256 |
505 | (base32 | |
8d65ae44 MB |
506 | "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby")) |
507 | (patches (search-patches "gcc-strmov-store-file-names.patch" | |
a33eac03 | 508 | "gcc-6-libsanitizer-mode-size.patch" |
aace9be8 MB |
509 | "gcc-6-source-date-epoch-1.patch" |
510 | "gcc-6-source-date-epoch-2.patch" | |
8d65ae44 | 511 | "gcc-5.0-libvtv-runpath.patch")))) |
56c833ea MB |
512 | |
513 | ;; GCC 4.9 and 5 has a workaround that is not needed for GCC 6 and later. | |
514 | (arguments (package-arguments gcc-4.8)) | |
515 | ||
2b8d4ce8 EF |
516 | (inputs |
517 | `(("isl" ,isl) | |
12dc9f58 LC |
518 | |
519 | ;; XXX: This gross hack allows us to have libstdc++'s <bits/c++config.h> | |
520 | ;; in the search path, thereby avoiding misconfiguration of libstdc++: | |
521 | ;; <https://bugs.gnu.org/42392>. | |
522 | ("libstdc++" ,libstdc++-headers) | |
523 | ||
2073b55e | 524 | ,@(package-inputs gcc-4.7))))) |
2b8d4ce8 | 525 | |
0c5658df EF |
526 | (define-public gcc-7 |
527 | (package | |
528 | (inherit gcc-6) | |
8456f9fc | 529 | (version "7.5.0") |
0c5658df EF |
530 | (source (origin |
531 | (method url-fetch) | |
532 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
2bccf1c0 | 533 | version "/gcc-" version ".tar.xz")) |
0c5658df EF |
534 | (sha256 |
535 | (base32 | |
8456f9fc | 536 | "0qg6kqc5l72hpnj4vr6l0p69qav0rh4anlkk3y55540zy3klc6dq")) |
0c5658df | 537 | (patches (search-patches "gcc-strmov-store-file-names.patch" |
a33eac03 | 538 | "gcc-7-libsanitizer-mode-size.patch" |
35dadded EF |
539 | "gcc-5.0-libvtv-runpath.patch")))) |
540 | (description | |
541 | "GCC is the GNU Compiler Collection. It provides compiler front-ends | |
542 | for several languages, including C, C++, Objective-C, Fortran, Ada, and Go. | |
543 | It also includes runtime support libraries for these languages."))) | |
e760ec41 | 544 | |
a1fa2691 MB |
545 | (define-public gcc-8 |
546 | (package | |
547 | (inherit gcc-7) | |
60ce496a | 548 | (version "8.4.0") |
a1fa2691 MB |
549 | (source (origin |
550 | (method url-fetch) | |
551 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
552 | version "/gcc-" version ".tar.xz")) | |
553 | (sha256 | |
554 | (base32 | |
60ce496a | 555 | "1m1d3gfix56w4aq8myazzfffkl8bqcrx4jhhapnjf7qfs596w2p3")) |
a1fa2691 MB |
556 | (patches (search-patches "gcc-8-strmov-store-file-names.patch" |
557 | "gcc-5.0-libvtv-runpath.patch")))))) | |
558 | ||
bdfc3276 CD |
559 | (define-public gcc-9 |
560 | (package | |
561 | (inherit gcc-8) | |
3dade1d5 | 562 | (version "9.3.0") |
bdfc3276 CD |
563 | (source (origin |
564 | (method url-fetch) | |
565 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
566 | version "/gcc-" version ".tar.xz")) | |
567 | (sha256 | |
568 | (base32 | |
3dade1d5 | 569 | "1la2yy27ziasyf0jvzk58y1i5b5bq2h176qil550bxhifs39gqbi")) |
bdfc3276 | 570 | (patches (search-patches "gcc-9-strmov-store-file-names.patch" |
0e293f75 | 571 | "gcc-9-asan-fix-limits-include.patch" |
bdfc3276 CD |
572 | "gcc-5.0-libvtv-runpath.patch")))))) |
573 | ||
2bb5b1d4 LC |
574 | (define-public gcc-10 |
575 | (package | |
576 | (inherit gcc-8) | |
b1d3c122 | 577 | (version "10.2.0") |
2bb5b1d4 LC |
578 | (source (origin |
579 | (method url-fetch) | |
580 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
581 | version "/gcc-" version ".tar.xz")) | |
582 | (sha256 | |
583 | (base32 | |
b1d3c122 | 584 | "130xdkhmz1bc2kzx061s3sfwk36xah1fw5w332c0nzwwpdl47pdq")) |
2bb5b1d4 LC |
585 | (patches (search-patches "gcc-9-strmov-store-file-names.patch" |
586 | "gcc-5.0-libvtv-runpath.patch")))))) | |
587 | ||
ce362de8 | 588 | ;; Note: When changing the default gcc version, update |
cb4805e3 RW |
589 | ;; the gcc-toolchain-* definitions and the gfortran definition |
590 | ;; accordingly. | |
01e8263f | 591 | (define-public gcc gcc-7) |
eed67cbb | 592 | |
d0abf829 LC |
593 | (define-public (make-libstdc++ gcc) |
594 | "Return a libstdc++ package based on GCC. The primary use case is when | |
595 | using compilers other than GCC." | |
596 | (package | |
597 | (inherit gcc) | |
598 | (name "libstdc++") | |
599 | (arguments | |
600 | `(#:out-of-source? #t | |
601 | #:phases (alist-cons-before | |
602 | 'configure 'chdir | |
603 | (lambda _ | |
eb8ea381 MW |
604 | (chdir "libstdc++-v3") |
605 | #t) | |
d0abf829 LC |
606 | %standard-phases) |
607 | #:configure-flags `("--disable-libstdcxx-pch" | |
608 | ,(string-append "--with-gxx-include-dir=" | |
609 | (assoc-ref %outputs "out") | |
610 | "/include")))) | |
611 | (outputs '("out" "debug")) | |
612 | (inputs '()) | |
613 | (native-inputs '()) | |
614 | (propagated-inputs '()) | |
615 | (synopsis "GNU C++ standard library"))) | |
616 | ||
12dc9f58 LC |
617 | (define libstdc++ |
618 | ;; Libstdc++ matching the default GCC. | |
619 | (make-libstdc++ gcc)) | |
620 | ||
621 | (define libstdc++-headers | |
622 | ;; XXX: This package is for internal use to work around | |
623 | ;; <https://bugs.gnu.org/42392> (see above). The main difference compared | |
624 | ;; to the libstdc++ headers that come with 'gcc' is that <bits/c++config.h> | |
625 | ;; is right under include/c++ and not under | |
626 | ;; include/c++/x86_64-unknown-linux-gnu (aka. GPLUSPLUS_TOOL_INCLUDE_DIR). | |
627 | (package | |
628 | (inherit libstdc++) | |
629 | (name "libstdc++-headers") | |
630 | (outputs '("out")) | |
631 | (build-system trivial-build-system) | |
632 | (arguments | |
633 | '(#:builder (let* ((out (assoc-ref %outputs "out")) | |
634 | (libstdc++ (assoc-ref %build-inputs "libstdc++"))) | |
635 | (mkdir out) | |
636 | (mkdir (string-append out "/include")) | |
637 | (symlink (string-append libstdc++ "/include") | |
638 | (string-append out "/include/c++"))))) | |
639 | (inputs `(("libstdc++" ,libstdc++))) | |
640 | (synopsis "Headers of GNU libstdc++"))) | |
641 | ||
d0abf829 LC |
642 | (define-public libstdc++-4.9 |
643 | (make-libstdc++ gcc-4.9)) | |
644 | ||
2b6b6d13 RW |
645 | (define (make-libiberty gcc) |
646 | "Return a libiberty package based on GCC." | |
647 | (package | |
648 | (inherit gcc) | |
649 | (name "libiberty") | |
650 | (arguments | |
651 | `(#:out-of-source? #t | |
652 | #:phases | |
653 | (modify-phases %standard-phases | |
654 | (add-before 'configure 'chdir | |
0f7e6964 | 655 | (lambda _ |
656 | (chdir "libiberty") | |
657 | #t)) | |
658 | (replace 'install | |
659 | (lambda* (#:key outputs #:allow-other-keys) | |
660 | (let* ((out (assoc-ref outputs "out")) | |
661 | (lib (string-append out "/lib/")) | |
662 | (include (string-append out "/include/"))) | |
663 | (install-file "libiberty.a" lib) | |
664 | (install-file "../include/libiberty.h" include)) | |
665 | #t))))) | |
2b6b6d13 RW |
666 | (inputs '()) |
667 | (outputs '("out")) | |
668 | (native-inputs '()) | |
669 | (propagated-inputs '()) | |
0f665134 | 670 | (properties '()) |
2b6b6d13 RW |
671 | (synopsis "Collection of subroutines used by various GNU programs"))) |
672 | ||
673 | (define-public libiberty | |
674 | (make-libiberty gcc)) | |
675 | ||
009b53fd LC |
676 | (define* (custom-gcc gcc name languages |
677 | #:optional | |
678 | (search-paths (package-native-search-paths gcc)) | |
679 | #:key (separate-lib-output? #t)) | |
680 | "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS | |
681 | as the 'native-search-paths' field." | |
fdd6c726 NK |
682 | (package (inherit gcc) |
683 | (name name) | |
c4df90a5 MW |
684 | (outputs (if separate-lib-output? |
685 | (package-outputs gcc) | |
686 | (delete "lib" (package-outputs gcc)))) | |
009b53fd | 687 | (native-search-paths search-paths) |
fbeb92d7 | 688 | (properties (alist-delete 'hidden? (package-properties gcc))) |
fdd6c726 | 689 | (arguments |
587398d2 MB |
690 | (substitute-keyword-arguments (package-arguments gcc) |
691 | ((#:modules modules %gnu-build-system-modules) | |
692 | `(,@modules | |
693 | (srfi srfi-1) | |
694 | (srfi srfi-26) | |
695 | (ice-9 regex))) | |
fdd6c726 NK |
696 | ((#:configure-flags flags) |
697 | `(cons (string-append "--enable-languages=" | |
698 | ,(string-join languages ",")) | |
699 | (remove (cut string-match "--enable-languages.*" <>) | |
82f145ef RW |
700 | ,flags))) |
701 | ((#:phases phases) | |
702 | `(modify-phases ,phases | |
703 | (add-after 'install 'remove-broken-or-conflicting-files | |
704 | (lambda* (#:key outputs #:allow-other-keys) | |
705 | (for-each delete-file | |
706 | (find-files (string-append (assoc-ref outputs "out") "/bin") | |
a1a3b25d | 707 | ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)")) |
82f145ef | 708 | #t)))))))) |
fdd6c726 | 709 | |
009b53fd LC |
710 | (define %generic-search-paths |
711 | ;; This is the language-neutral search path for GCC. Entries in $CPATH are | |
712 | ;; not considered "system headers", which means GCC can raise warnings for | |
713 | ;; issues in those headers. 'CPATH' is the only one that works for | |
714 | ;; front-ends not in the C family. | |
715 | (list (search-path-specification | |
716 | (variable "CPATH") | |
717 | (files '("include"))) | |
718 | (search-path-specification | |
719 | (variable "LIBRARY_PATH") | |
720 | (files '("lib" "lib64"))))) | |
721 | ||
0681f054 | 722 | (define-public gfortran |
a7c75b8d | 723 | (hidden-package |
12dc9f58 LC |
724 | (custom-gcc (package |
725 | (inherit gcc) | |
726 | ;; XXX: Remove LIBSTDC++-HEADERS from the inputs just to | |
727 | ;; avoid a rebuild of all the GFORTRAN dependents. | |
728 | ;; TODO: Remove this hack on the next rebuild cycle. | |
729 | (inputs (alist-delete "libstdc++" (package-inputs gcc)))) | |
730 | "gfortran" '("fortran") | |
a7c75b8d | 731 | %generic-search-paths))) |
f66be84d | 732 | |
163686d8 | 733 | (define-public gdc-10 |
734 | (hidden-package | |
735 | (custom-gcc gcc-10 "gdc" '("d") | |
736 | %generic-search-paths))) | |
737 | ||
76d2b9a2 JL |
738 | (define-public libgccjit |
739 | (package | |
740 | (inherit gcc-9) | |
741 | (name "libgccjit") | |
742 | (outputs (delete "lib" (package-outputs gcc))) | |
743 | (properties (alist-delete 'hidden? (package-properties gcc))) | |
744 | (arguments | |
745 | (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system) | |
746 | (guix build utils) | |
747 | (ice-9 regex) | |
748 | (srfi srfi-1) | |
749 | (srfi srfi-26)) | |
750 | ,@(package-arguments gcc)) | |
751 | ((#:configure-flags flags) | |
752 | `(append `("--enable-host-shared" | |
753 | ,(string-append "--enable-languages=jit")) | |
754 | (remove (cut string-match "--enable-languages.*" <>) | |
755 | ,flags))) | |
756 | ((#:phases phases) | |
757 | `(modify-phases ,phases | |
758 | (add-after 'install 'remove-broken-or-conflicting-files | |
759 | (lambda* (#:key outputs #:allow-other-keys) | |
760 | (for-each delete-file | |
761 | (find-files (string-append (assoc-ref outputs "out") "/bin") | |
762 | ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)")) | |
a4fe16ee | 763 | #t)))))) |
764 | (synopsis "GCC library generating machine code on-the-fly at runtime") | |
765 | (description | |
766 | "This package is part of the GNU Compiler Collection and provides an | |
767 | embeddable library for generating machine code on-the-fly at runtime. This | |
768 | shared library can then be dynamically-linked into bytecode interpreters and | |
769 | other such programs that want to generate machine code on-the-fly at run-time. | |
770 | It can also be used for ahead-of-time code generation for building standalone | |
771 | compilers. The just-in-time (jit) part of the name is now something of a | |
772 | misnomer."))) | |
76d2b9a2 JL |
773 | |
774 | ||
c8732e19 | 775 | (define-public gccgo-4.9 |
542c4707 | 776 | (custom-gcc (package |
777 | (inherit gcc-4.9) | |
778 | (synopsis "Go frontend to GCC") | |
779 | (description | |
780 | "This package is part of the GNU Compiler Collection and | |
781 | provides the GNU compiler for the Go programming language.")) | |
782 | "gccgo" '("go") | |
009b53fd | 783 | %generic-search-paths |
c4df90a5 MW |
784 | ;; Suppress the separate "lib" output, because otherwise the |
785 | ;; "lib" and "out" outputs would refer to each other, creating | |
786 | ;; a cyclic dependency. <http://debbugs.gnu.org/18101> | |
787 | #:separate-lib-output? #f)) | |
fdd6c726 | 788 | |
14cce84c JK |
789 | (define %objc-search-paths |
790 | (list (search-path-specification | |
791 | (variable "OBJC_INCLUDE_PATH") | |
792 | (files '("include"))) | |
793 | (search-path-specification | |
794 | (variable "LIBRARY_PATH") | |
795 | (files '("lib" "lib64"))))) | |
796 | ||
fdd6c726 | 797 | (define-public gcc-objc-4.8 |
009b53fd | 798 | (custom-gcc gcc-4.8 "gcc-objc" '("objc") |
14cce84c | 799 | %objc-search-paths)) |
fdd6c726 | 800 | |
2d69c161 RW |
801 | (define-public gcc-objc-4.9 |
802 | (custom-gcc gcc-4.9 "gcc-objc" '("objc") | |
14cce84c | 803 | %objc-search-paths)) |
2d69c161 | 804 | |
f51d01e1 EF |
805 | (define-public gcc-objc-5 |
806 | (custom-gcc gcc-5 "gcc-objc" '("objc") | |
14cce84c | 807 | %objc-search-paths)) |
f51d01e1 | 808 | |
4072c10b EF |
809 | (define-public gcc-objc-6 |
810 | (custom-gcc gcc-6 "gcc-objc" '("objc") | |
14cce84c | 811 | %objc-search-paths)) |
ce9afe2b EF |
812 | |
813 | (define-public gcc-objc-7 | |
814 | (custom-gcc gcc-7 "gcc-objc" '("objc") | |
14cce84c | 815 | %objc-search-paths)) |
4072c10b | 816 | |
f66be84d EB |
817 | (define-public gcc-objc-8 |
818 | (custom-gcc gcc-8 "gcc-objc" '("objc") | |
14cce84c JK |
819 | %objc-search-paths)) |
820 | ||
821 | (define-public gcc-objc-9 | |
822 | (custom-gcc gcc-9 "gcc-objc" '("objc") | |
823 | %objc-search-paths)) | |
824 | ||
825 | (define-public gcc-objc-10 | |
826 | (custom-gcc gcc-10 "gcc-objc" '("objc") | |
827 | %objc-search-paths)) | |
f66be84d | 828 | |
01e8263f | 829 | (define-public gcc-objc gcc-objc-7) |
8b196ad2 | 830 | |
14cce84c JK |
831 | (define %objc++-search-paths |
832 | (list (search-path-specification | |
833 | (variable "OBJCPLUS_INCLUDE_PATH") | |
834 | (files '("include"))) | |
835 | (search-path-specification | |
836 | (variable "LIBRARY_PATH") | |
837 | (files '("lib" "lib64"))))) | |
838 | ||
fdd6c726 | 839 | (define-public gcc-objc++-4.8 |
009b53fd | 840 | (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++") |
14cce84c | 841 | %objc++-search-paths)) |
fdd6c726 | 842 | |
a5948c0d RW |
843 | (define-public gcc-objc++-4.9 |
844 | (custom-gcc gcc-4.9 "gcc-objc++" '("obj-c++") | |
14cce84c | 845 | %objc++-search-paths)) |
fdd6c726 | 846 | |
ed8cdab8 EF |
847 | (define-public gcc-objc++-5 |
848 | (custom-gcc gcc-5 "gcc-objc++" '("obj-c++") | |
14cce84c | 849 | %objc++-search-paths)) |
ed8cdab8 | 850 | |
7a7c6308 EF |
851 | (define-public gcc-objc++-6 |
852 | (custom-gcc gcc-6 "gcc-objc++" '("obj-c++") | |
14cce84c | 853 | %objc++-search-paths)) |
7a7c6308 | 854 | |
e05f8d2f EF |
855 | (define-public gcc-objc++-7 |
856 | (custom-gcc gcc-7 "gcc-objc++" '("obj-c++") | |
14cce84c | 857 | %objc++-search-paths)) |
e05f8d2f | 858 | |
f66be84d EB |
859 | (define-public gcc-objc++-8 |
860 | (custom-gcc gcc-8 "gcc-objc++" '("obj-c++") | |
14cce84c JK |
861 | %objc++-search-paths)) |
862 | ||
863 | (define-public gcc-objc++-9 | |
864 | (custom-gcc gcc-9 "gcc-objc++" '("obj-c++") | |
865 | %objc++-search-paths)) | |
866 | ||
867 | (define-public gcc-objc++-10 | |
868 | (custom-gcc gcc-10 "gcc-objc++" '("obj-c++") | |
869 | %objc++-search-paths)) | |
f66be84d | 870 | |
01e8263f | 871 | (define-public gcc-objc++ gcc-objc++-7) |
987a1183 | 872 | |
98b385d1 LC |
873 | (define (make-libstdc++-doc gcc) |
874 | "Return a package with the libstdc++ documentation for GCC." | |
875 | (package | |
876 | (inherit gcc) | |
877 | (name "libstdc++-doc") | |
878 | (version (package-version gcc)) | |
879 | (synopsis "GNU libstdc++ documentation") | |
880 | (outputs '("out")) | |
881 | (native-inputs `(("doxygen" ,doxygen) | |
882 | ("texinfo" ,texinfo) | |
883 | ("libxml2" ,libxml2) | |
884 | ("libxslt" ,libxslt) | |
885 | ("docbook-xml" ,docbook-xml) | |
886 | ("docbook-xsl" ,docbook-xsl) | |
887 | ("graphviz" ,graphviz))) ;for 'dot', invoked by 'doxygen' | |
888 | (inputs '()) | |
889 | (propagated-inputs '()) | |
890 | (arguments | |
891 | '(#:out-of-source? #t | |
892 | #:tests? #f ;it's just documentation | |
893 | #:phases (modify-phases %standard-phases | |
894 | (add-before 'configure 'chdir | |
895 | (lambda _ | |
61a815eb MW |
896 | (chdir "libstdc++-v3") |
897 | #t)) | |
98b385d1 LC |
898 | (add-before 'configure 'set-xsl-directory |
899 | (lambda* (#:key inputs #:allow-other-keys) | |
900 | (let ((docbook (assoc-ref inputs "docbook-xsl"))) | |
901 | (substitute* (find-files "doc" | |
902 | "^Makefile\\.in$") | |
903 | (("@XSL_STYLE_DIR@") | |
904 | (string-append | |
905 | docbook "/xml/xsl/" | |
61a815eb MW |
906 | (strip-store-file-name docbook)))) |
907 | #t))) | |
98b385d1 LC |
908 | (replace 'build |
909 | (lambda _ | |
910 | ;; XXX: There's also a 'doc-info' target, but it | |
911 | ;; relies on docbook2X, which itself relies on | |
912 | ;; DocBook 4.1.2, which is not really usable | |
913 | ;; (lacks a catalog.xml.) | |
61a815eb MW |
914 | (invoke "make" |
915 | "doc-html" | |
916 | "doc-man"))) | |
98b385d1 LC |
917 | (replace 'install |
918 | (lambda* (#:key outputs #:allow-other-keys) | |
919 | (let ((out (assoc-ref outputs "out"))) | |
61a815eb MW |
920 | (invoke "make" |
921 | "doc-install-html" | |
798591b6 LC |
922 | "doc-install-man"))))))) |
923 | (properties (alist-delete 'hidden? (package-properties gcc))))) | |
98b385d1 | 924 | |
629f4d2e MW |
925 | (define-public libstdc++-doc-5 |
926 | (make-libstdc++-doc gcc-5)) | |
98b385d1 | 927 | |
e7313ae2 LC |
928 | (define-public libstdc++-doc-9 |
929 | (make-libstdc++-doc gcc-9)) | |
930 | ||
832abc76 LC |
931 | (define-public isl |
932 | (package | |
933 | (name "isl") | |
4a0c71f9 | 934 | (version "0.22.1") |
832abc76 LC |
935 | (source (origin |
936 | (method url-fetch) | |
937 | (uri (list (string-append | |
590a4904 | 938 | "http://isl.gforge.inria.fr/isl-" |
832abc76 LC |
939 | version |
940 | ".tar.bz2") | |
941 | (string-append %gcc-infrastructure | |
9f1da6ce | 942 | name "-" version ".tar.bz2"))) |
832abc76 LC |
943 | (sha256 |
944 | (base32 | |
4a0c71f9 | 945 | "1kf54jib0nind1pvakblnfhimmwzm0y1llz8470ag0di5vwqwrhs")))) |
832abc76 | 946 | (build-system gnu-build-system) |
5d8a4354 MB |
947 | (outputs '("out" "static")) |
948 | (arguments | |
949 | '(#:phases (modify-phases %standard-phases | |
950 | (add-after 'install 'move-static-library | |
951 | (lambda* (#:key outputs #:allow-other-keys) | |
952 | (let* ((out (assoc-ref outputs "out")) | |
953 | (static (assoc-ref outputs "static")) | |
954 | (source (string-append out "/lib/libisl.a")) | |
955 | (target (string-append static "/lib/libisl.a"))) | |
956 | (mkdir-p (dirname target)) | |
957 | (link source target) | |
958 | (delete-file source) | |
959 | ||
960 | ;; Remove reference to libisl.a from the .la file so | |
961 | ;; libtool looks for it in the usual locations. | |
962 | (substitute* (string-append out "/lib/libisl.la") | |
963 | (("^old_library=.*") | |
964 | "old_library=''\n")) | |
965 | #t)))))) | |
832abc76 | 966 | (inputs `(("gmp" ,gmp))) |
590a4904 | 967 | (home-page "http://isl.gforge.inria.fr/") |
832abc76 | 968 | (synopsis |
9e771e3b LC |
969 | "Manipulating sets and relations of integer points \ |
970 | bounded by linear constraints") | |
832abc76 LC |
971 | (description |
972 | "isl is a library for manipulating sets and relations of integer points | |
35b9e423 | 973 | bounded by linear constraints. Supported operations on sets include |
832abc76 LC |
974 | intersection, union, set difference, emptiness check, convex hull, (integer) |
975 | affine hull, integer projection, computing the lexicographic minimum using | |
976 | parametric integer programming, coalescing and parametric vertex | |
35b9e423 | 977 | enumeration. It also includes an ILP solver based on generalized basis |
832abc76 LC |
978 | reduction, transitive closures on maps (which may encode infinite graphs), |
979 | dependence analysis and bounds on piecewise step-polynomials.") | |
980 | (license lgpl2.1+))) | |
981 | ||
25bd7267 MB |
982 | (define-public isl-0.18 |
983 | (package | |
984 | (inherit isl) | |
985 | (version "0.18") | |
986 | (source (origin | |
987 | (method url-fetch) | |
988 | (uri (list (string-append "http://isl.gforge.inria.fr/isl-" | |
989 | version ".tar.bz2") | |
990 | (string-append %gcc-infrastructure | |
9f1da6ce | 991 | "isl-" version ".tar.bz2"))) |
25bd7267 MB |
992 | (sha256 |
993 | (base32 | |
994 | "06ybml6llhi4i56q90jnimbcgk1lpcdwhy9nxdxra2hxz3bhz2vb")))))) | |
995 | ||
ab53bdf0 EF |
996 | (define-public isl-0.11 |
997 | (package | |
998 | (inherit isl) | |
999 | (name "isl") | |
1000 | (version "0.11.1") | |
1001 | (source (origin | |
1002 | (method url-fetch) | |
1003 | (uri (list (string-append | |
1004 | "http://isl.gforge.inria.fr/isl-" | |
1005 | version | |
1006 | ".tar.bz2") | |
1007 | (string-append %gcc-infrastructure | |
9f1da6ce | 1008 | name "-" version ".tar.bz2"))) |
ab53bdf0 EF |
1009 | (sha256 |
1010 | (base32 | |
1011 | "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9")) | |
1012 | (patches (search-patches "isl-0.11.1-aarch64-support.patch")))))) | |
1013 | ||
832abc76 LC |
1014 | (define-public cloog |
1015 | (package | |
1016 | (name "cloog") | |
1017 | (version "0.18.0") | |
1018 | (source | |
1019 | (origin | |
1020 | (method url-fetch) | |
1021 | (uri (list (string-append | |
1022 | "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-" | |
1023 | version | |
1024 | ".tar.gz") | |
1025 | (string-append %gcc-infrastructure | |
1026 | name "-" version ".tar.gz"))) | |
1027 | (sha256 | |
1028 | (base32 | |
1029 | "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw")) | |
1030 | (file-name (string-append name "-" version ".tar.gz")))) | |
1031 | (build-system gnu-build-system) | |
1032 | (inputs `(("gmp" ,gmp) | |
ab53bdf0 | 1033 | ("isl" ,isl-0.11))) |
832abc76 LC |
1034 | (arguments '(#:configure-flags '("--with-isl=system"))) |
1035 | (home-page "http://www.cloog.org/") | |
9e771e3b | 1036 | (synopsis "Library to generate code for scanning Z-polyhedra") |
832abc76 LC |
1037 | (description |
1038 | "CLooG is a free software library to generate code for scanning | |
1039 | Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that | |
1040 | reaches each integral point of one or more parameterized polyhedra. | |
1041 | CLooG has been originally written to solve the code generation problem | |
1042 | for optimizing compilers based on the polytope model. Nevertheless it | |
1043 | is used now in various area e.g., to build control automata for | |
1044 | high-level synthesis or to find the best polynomial approximation of a | |
1045 | function. CLooG may help in any situation where scanning polyhedra | |
1046 | matters. While the user has full control on generated code quality, | |
1047 | CLooG is designed to avoid control overhead and to produce a very | |
1048 | effective code.") | |
1049 | (license gpl2+))) | |
5c126b64 | 1050 | |
50c7a1e2 LC |
1051 | (define-public gnu-c-manual |
1052 | (package | |
1053 | (name "gnu-c-manual") | |
d35f8c7c | 1054 | (version "0.2.5") |
50c7a1e2 LC |
1055 | (source (origin |
1056 | (method url-fetch) | |
1057 | (uri (string-append "mirror://gnu/gnu-c-manual/gnu-c-manual-" | |
1058 | version ".tar.gz")) | |
1059 | (sha256 | |
1060 | (base32 | |
d35f8c7c | 1061 | "1sfsj9256w18qzylgag2h5h377aq8in8929svblfnj9svfriqcys")))) |
50c7a1e2 LC |
1062 | (build-system gnu-build-system) |
1063 | (native-inputs `(("texinfo" ,texinfo))) | |
1064 | (arguments | |
1065 | '(#:phases (modify-phases %standard-phases | |
1066 | (delete 'configure) | |
1067 | (delete 'check) | |
1068 | (replace 'build | |
1069 | (lambda _ | |
9feb4fd5 MW |
1070 | (invoke "make" |
1071 | "gnu-c-manual.info" | |
1072 | "gnu-c-manual.html"))) | |
50c7a1e2 LC |
1073 | (replace 'install |
1074 | (lambda* (#:key outputs #:allow-other-keys) | |
1075 | (let* ((out (assoc-ref outputs "out")) | |
1076 | (info (string-append out "/share/info")) | |
1077 | (html (string-append | |
1078 | out "/share/doc/gnu-c-manual"))) | |
1079 | (mkdir-p info) | |
1080 | (mkdir-p html) | |
1081 | ||
1082 | (for-each (lambda (file) | |
1083 | (copy-file file | |
1084 | (string-append info "/" | |
1085 | file))) | |
1086 | (find-files "." "\\.info(-[0-9])?$")) | |
1087 | (for-each (lambda (file) | |
1088 | (copy-file file | |
1089 | (string-append html "/" | |
1090 | file))) | |
1091 | (find-files "." "\\.html$")) | |
1092 | #t)))))) | |
1093 | (synopsis "Reference manual for the C programming language") | |
1094 | (description | |
1095 | "This is a reference manual for the C programming language, as | |
1096 | implemented by the GNU C Compiler (gcc). As a reference, it is not intended | |
1097 | to be a tutorial of the language. Rather, it outlines all of the constructs | |
1098 | of the language. Library functions are not included.") | |
6fd52309 | 1099 | (home-page "https://www.gnu.org/software/gnu-c-manual/") |
50c7a1e2 | 1100 | (license fdl1.3+))) |