gnu: Default to GCC 5.
[jackhill/guix/guix.git] / gnu / packages / gcc.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014, 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2015 Efraim Flashner <efraim@flashner.co.il>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages gcc)
24 #:use-module ((guix licenses)
25 #:select (gpl3+ gpl2+ lgpl2.1+ lgpl2.0+ fdl1.3+))
26 #:use-module (gnu packages)
27 #:use-module (gnu packages bootstrap)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages multiprecision)
30 #:use-module (gnu packages texinfo)
31 #:use-module (gnu packages dejagnu)
32 #:use-module (gnu packages doxygen)
33 #:use-module (gnu packages xml)
34 #:use-module (gnu packages docbook)
35 #:use-module (gnu packages graphviz)
36 #:use-module (gnu packages elf)
37 #:use-module (gnu packages perl)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system trivial)
42 #:use-module (guix utils)
43 #:use-module (ice-9 regex))
44
45 (define %gcc-infrastructure
46 ;; Base URL for GCC's infrastructure.
47 "ftp://gcc.gnu.org/pub/gcc/infrastructure/")
48
49 (define (gcc-configure-flags-for-triplet target)
50 "Return a list of additional GCC `configure' flags for TARGET, a GNU triplet.
51
52 The purpose of this procedure is to translate extended GNU triplets---e.g.,
53 where the OS part is overloaded to denote a specific ABI---into GCC
54 `configure' options. We take extended GNU triplets that glibc recognizes."
55 (cond ((string-match "^mips64el.*gnuabin?64$" target)
56 ;; Triplets recognized by glibc as denoting the N64 ABI; see
57 ;; ports/sysdeps/mips/preconfigure.
58 '("--with-abi=64"))
59
60 ((string-match "^arm.*-gnueabihf$" target)
61 '("--with-arch=armv7-a"
62 "--with-float=hard"
63 "--with-mode=thumb"
64 "--with-fpu=neon"))
65
66 (else
67 ;; TODO: Add `arm.*-gnueabi', etc.
68 '())))
69
70 (define-public gcc-4.7
71 (let* ((stripped? #t) ;whether to strip the compiler, not the libraries
72 (maybe-target-tools
73 (lambda ()
74 ;; Return the `_FOR_TARGET' variables that are needed when
75 ;; cross-compiling GCC.
76 (let ((target (%current-target-system)))
77 (if target
78 (map (lambda (var tool)
79 (string-append (string-append var "_FOR_TARGET")
80 "=" target "-" tool))
81 '("CC" "CXX" "LD" "AR" "NM" "RANLIB" "STRIP")
82 '("gcc" "g++" "ld" "ar" "nm" "ranlib" "strip"))
83 '()))))
84 (libdir
85 (let ((base '(or (assoc-ref outputs "lib")
86 (assoc-ref outputs "out"))))
87 (lambda ()
88 ;; Return the directory that contains lib/libgcc_s.so et al.
89 (if (%current-target-system)
90 `(string-append ,base "/" ,(%current-target-system))
91 base))))
92 (configure-flags
93 (lambda ()
94 ;; This is terrible. Since we have two levels of quasiquotation,
95 ;; we have to do this convoluted thing just so we can insert the
96 ;; contents of (maybe-target-tools).
97 (list 'quasiquote
98 (append
99 '("--enable-plugin"
100 "--enable-languages=c,c++"
101 "--disable-multilib"
102 "--with-system-zlib"
103
104 ;; No pre-compiled libstdc++ headers, to save space.
105 "--disable-libstdcxx-pch"
106
107 "--with-local-prefix=/no-gcc-local-prefix"
108
109 ;; With a separate "lib" output, the build system
110 ;; incorrectly guesses GPLUSPLUS_INCLUDE_DIR, so force
111 ;; it. (Don't use a versioned sub-directory, that's
112 ;; unnecessary.)
113 ,(string-append "--with-gxx-include-dir="
114 (assoc-ref %outputs "out")
115 "/include/c++")
116
117 ,(let ((libc (assoc-ref %build-inputs "libc")))
118 (if libc
119 (string-append "--with-native-system-header-dir=" libc
120 "/include")
121 "--without-headers")))
122
123 ;; Pass the right options for the target triplet.
124 (let ((triplet
125 (or (%current-target-system)
126 (nix-system->gnu-triplet (%current-system)))))
127 (gcc-configure-flags-for-triplet triplet))
128
129 (maybe-target-tools))))))
130 (package
131 (name "gcc")
132 (version "4.7.4")
133 (source (origin
134 (method url-fetch)
135 (uri (string-append "mirror://gnu/gcc/gcc-"
136 version "/gcc-" version ".tar.bz2"))
137 (sha256
138 (base32
139 "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))))
140 (build-system gnu-build-system)
141
142 ;; Separate out the run-time support libraries because all the
143 ;; dynamic-linked objects depend on it.
144 (outputs '("out" ;commands, etc. (60+ MiB)
145 "lib" ;libgcc_s, libgomp, etc. (15+ MiB)
146 "debug")) ;debug symbols of run-time libraries
147
148 (inputs `(("gmp" ,gmp)
149 ("mpfr" ,mpfr)
150 ("mpc" ,mpc)
151 ("isl" ,isl)
152 ("cloog" ,cloog)
153 ("libelf" ,libelf)
154 ("zlib" ,zlib)))
155
156 ;; GCC < 5 is one of the few packages that doesn't ship .info files.
157 (native-inputs `(("texinfo" ,texinfo)))
158
159 (arguments
160 `(#:out-of-source? #t
161 #:configure-flags ,(configure-flags)
162 #:make-flags
163 ;; None of the flags below are needed when doing a Canadian cross.
164 ;; TODO: Simplify this.
165 ,(if (%current-target-system)
166 (if stripped?
167 ''("CFLAGS=-g0 -O2")
168 ''())
169 `(let* ((libc (assoc-ref %build-inputs "libc"))
170 (libc-native (or (assoc-ref %build-inputs "libc-native")
171 libc)))
172 `(,@(if libc
173 (list (string-append "LDFLAGS_FOR_TARGET="
174 "-B" libc "/lib "
175 "-Wl,-dynamic-linker "
176 "-Wl," libc
177 ,(glibc-dynamic-linker)))
178 '())
179
180 ;; Native programs like 'genhooks' also need that right.
181 ,(string-append "LDFLAGS="
182 "-Wl,-rpath=" libc-native "/lib "
183 "-Wl,-dynamic-linker "
184 "-Wl," libc-native ,(glibc-dynamic-linker))
185 ,(string-append "BOOT_CFLAGS=-O2 "
186 ,(if stripped? "-g0" "-g")))))
187
188 #:tests? #f
189
190 #:phases
191 (alist-cons-before
192 'configure 'pre-configure
193 (lambda* (#:key inputs outputs #:allow-other-keys)
194 (let ((libdir ,(libdir))
195 (libc (assoc-ref inputs "libc")))
196 (when libc
197 ;; The following is not performed for `--without-headers'
198 ;; cross-compiler builds.
199
200 ;; Join multi-line definitions of GLIBC_DYNAMIC_LINKER* into a
201 ;; single line, to allow the next step to work properly.
202 (for-each
203 (lambda (x)
204 (substitute* (find-files "gcc/config"
205 "^linux(64|-elf|-eabi)?\\.h$")
206 (("(#define GLIBC_DYNAMIC_LINKER.*)\\\\\n$" _ line)
207 line)))
208 '(1 2 3))
209
210 ;; Fix the dynamic linker's file name.
211 (substitute* (find-files "gcc/config"
212 "^(linux|gnu)(64|-elf|-eabi)?\\.h$")
213 (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
214 (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
215 suffix
216 (string-append libc ,(glibc-dynamic-linker)))))
217
218 ;; Tell where to find libstdc++, libc, and `?crt*.o', except
219 ;; `crt{begin,end}.o', which come with GCC.
220 (substitute* (find-files "gcc/config"
221 "^gnu-user.*\\.h$")
222 (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
223 ;; Help libgcc_s.so be found (see also below.) Always use
224 ;; '-lgcc_s' so that libgcc_s.so is always found by those
225 ;; programs that use 'pthread_cancel' (glibc dlopens
226 ;; libgcc_s.so when pthread_cancel support is needed, but
227 ;; having it in the application's RUNPATH isn't enough; see
228 ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
229 ;;
230 ;; NOTE: The '-lgcc_s' added below needs to be removed in a
231 ;; later phase of %gcc-static. If you change the string
232 ;; below, make sure to update the relevant code in
233 ;; %gcc-static package as needed.
234 (format #f "#define GNU_USER_TARGET_LIB_SPEC \
235 \"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
236 libc libc libdir suffix))
237 (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
238 (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
239 #define STANDARD_STARTFILE_PREFIX_2 \"\"
240 ~a"
241 libc line))))
242
243 ;; Don't retain a dependency on the build-time sed.
244 (substitute* "fixincludes/fixincl.x"
245 (("static char const sed_cmd_z\\[\\] =.*;")
246 "static char const sed_cmd_z[] = \"sed\";"))
247
248 (when (file-exists? "libbacktrace")
249 ;; GCC 4.8+ comes with libbacktrace. By default it builds
250 ;; with -Werror, which fails with a -Wcast-qual error in glibc
251 ;; 2.21's stdlib-bsearch.h. Remove -Werror.
252 (substitute* "libbacktrace/configure"
253 (("WARN_FLAGS=(.*)-Werror" _ flags)
254 (string-append "WARN_FLAGS=" flags)))
255
256 (when (file-exists? "libsanitizer/libbacktrace")
257 ;; Same in libsanitizer's bundled copy (!) found in 4.9+.
258 (substitute* "libsanitizer/libbacktrace/Makefile.in"
259 (("-Werror")
260 ""))))
261
262 ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s.
263 ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354>
264 ;; and <http://bugs.gnu.org/20358>.
265 (substitute* "libstdc++-v3/src/Makefile.in"
266 (("^OPT_LDFLAGS = ")
267 "OPT_LDFLAGS = -Wl,-rpath=$(libdir) "))
268
269 ;; Move libstdc++*-gdb.py to the "lib" output to avoid a
270 ;; circularity between "out" and "lib". (Note:
271 ;; --with-python-dir is useless because it imposes $(prefix) as
272 ;; the parent directory.)
273 (substitute* "libstdc++-v3/python/Makefile.in"
274 (("pythondir = .*$")
275 (string-append "pythondir = " libdir "/share"
276 "/gcc-$(gcc_version)/python\n")))
277
278 ;; Avoid another circularity between the outputs: this #define
279 ;; ends up in auto-host.h in the "lib" output, referring to
280 ;; "out". (This variable is used to augment cpp's search path,
281 ;; but there's nothing useful to look for here.)
282 (substitute* "gcc/config.in"
283 (("PREFIX_INCLUDE_DIR")
284 "PREFIX_INCLUDE_DIR_isnt_necessary_here"))))
285
286 (alist-cons-after
287 'configure 'post-configure
288 (lambda _
289 ;; Don't store configure flags, to avoid retaining references to
290 ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'.
291 (substitute* "Makefile"
292 (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
293 "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
294 %standard-phases))))
295
296 (native-search-paths
297 ;; Use the language-specific variables rather than 'CPATH' because they
298 ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
299 ;; The intent is to allow headers that are in the search path to be
300 ;; treated as "system headers" (headers exempt from warnings) just like
301 ;; the typical /usr/include headers on an FHS system.
302 (list (search-path-specification
303 (variable "C_INCLUDE_PATH")
304 (files '("include")))
305 (search-path-specification
306 (variable "CPLUS_INCLUDE_PATH")
307 (files '("include")))
308 (search-path-specification
309 (variable "LIBRARY_PATH")
310 (files '("lib" "lib64")))))
311
312 (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
313 (synopsis "GNU Compiler Collection")
314 (description
315 "GCC is the GNU Compiler Collection. It provides compiler front-ends
316 for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and
317 Go. It also includes runtime support libraries for these languages.")
318 (license gpl3+)
319 (home-page "http://gcc.gnu.org/"))))
320
321 (define-public gcc-4.8
322 (package (inherit gcc-4.7)
323 (version "4.8.5")
324 (source (origin
325 (method url-fetch)
326 (uri (string-append "mirror://gnu/gcc/gcc-"
327 version "/gcc-" version ".tar.bz2"))
328 (sha256
329 (base32
330 "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2"))
331 (patches (list (search-patch "gcc-arm-link-spec-fix.patch")))))))
332
333 (define-public gcc-4.9
334 (package (inherit gcc-4.8)
335 (version "4.9.3")
336 (source (origin
337 (method url-fetch)
338 (uri (string-append "mirror://gnu/gcc/gcc-"
339 version "/gcc-" version ".tar.bz2"))
340 (sha256
341 (base32
342 "0zmnm00d2a1hsd41g34bhvxzvxisa2l584q3p447bd91lfjv4ci3"))
343 (patches (list (search-patch "gcc-libvtv-runpath.patch")))))))
344
345 (define-public gcc-5
346 (package (inherit gcc-4.9)
347 (version "5.3.0")
348 (source (origin
349 (method url-fetch)
350 (uri (string-append "mirror://gnu/gcc/gcc-"
351 version "/gcc-" version ".tar.bz2"))
352 (sha256
353 (base32
354 "1ny4smkp5bzs3cp8ss7pl6lk8yss0d9m4av1mvdp72r1x695akxq"))
355 (patches (list (search-patch "gcc-5.0-libvtv-runpath.patch")
356 (search-patch
357 "gcc-libiberty-printf-decl.patch")))))
358
359 ;; GCC 5 ships with .info files, so no need for Texinfo.
360 (native-inputs '())))
361
362 ;; Note: When changing the default gcc version, update
363 ;; the gcc-toolchain-* definitions accordingly.
364 (define-public gcc gcc-5)
365
366 (define-public (make-libstdc++ gcc)
367 "Return a libstdc++ package based on GCC. The primary use case is when
368 using compilers other than GCC."
369 (package
370 (inherit gcc)
371 (name "libstdc++")
372 (arguments
373 `(#:out-of-source? #t
374 #:phases (alist-cons-before
375 'configure 'chdir
376 (lambda _
377 (chdir "libstdc++-v3"))
378 %standard-phases)
379 #:configure-flags `("--disable-libstdcxx-pch"
380 ,(string-append "--with-gxx-include-dir="
381 (assoc-ref %outputs "out")
382 "/include"))))
383 (outputs '("out" "debug"))
384 (inputs '())
385 (native-inputs '())
386 (propagated-inputs '())
387 (synopsis "GNU C++ standard library")))
388
389 (define-public libstdc++-4.9
390 (make-libstdc++ gcc-4.9))
391
392 (define (make-libiberty gcc)
393 "Return a libiberty package based on GCC."
394 (package
395 (inherit gcc)
396 (name "libiberty")
397 (arguments
398 `(#:out-of-source? #t
399 #:phases
400 (modify-phases %standard-phases
401 (add-before 'configure 'chdir
402 (lambda _
403 (chdir "libiberty")
404 #t))
405 (replace
406 'install
407 (lambda* (#:key outputs #:allow-other-keys)
408 (let* ((out (assoc-ref outputs "out"))
409 (lib (string-append out "/lib/"))
410 (include (string-append out "/include/")))
411 (mkdir-p lib)
412 (mkdir-p include)
413 (copy-file "libiberty.a"
414 (string-append lib "libiberty.a"))
415 (copy-file "../include/libiberty.h"
416 (string-append include "libiberty.h"))
417 #t))))))
418 (inputs '())
419 (outputs '("out"))
420 (native-inputs '())
421 (propagated-inputs '())
422 (synopsis "Collection of subroutines used by various GNU programs")))
423
424 (define-public libiberty
425 (make-libiberty gcc))
426
427 (define* (custom-gcc gcc name languages
428 #:optional
429 (search-paths (package-native-search-paths gcc))
430 #:key (separate-lib-output? #t))
431 "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS
432 as the 'native-search-paths' field."
433 (package (inherit gcc)
434 (name name)
435 (outputs (if separate-lib-output?
436 (package-outputs gcc)
437 (delete "lib" (package-outputs gcc))))
438 (native-search-paths search-paths)
439 (arguments
440 (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
441 (guix build utils)
442 (ice-9 regex)
443 (srfi srfi-1)
444 (srfi srfi-26))
445 ,@(package-arguments gcc))
446 ((#:configure-flags flags)
447 `(cons (string-append "--enable-languages="
448 ,(string-join languages ","))
449 (remove (cut string-match "--enable-languages.*" <>)
450 ,flags)))
451 ((#:phases phases)
452 `(modify-phases ,phases
453 (add-after 'install 'remove-broken-or-conflicting-files
454 (lambda* (#:key outputs #:allow-other-keys)
455 (for-each delete-file
456 (find-files (string-append (assoc-ref outputs "out") "/bin")
457 ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc.*)"))
458 #t))))))))
459
460 (define %generic-search-paths
461 ;; This is the language-neutral search path for GCC. Entries in $CPATH are
462 ;; not considered "system headers", which means GCC can raise warnings for
463 ;; issues in those headers. 'CPATH' is the only one that works for
464 ;; front-ends not in the C family.
465 (list (search-path-specification
466 (variable "CPATH")
467 (files '("include")))
468 (search-path-specification
469 (variable "LIBRARY_PATH")
470 (files '("lib" "lib64")))))
471
472 (define-public gfortran-4.8
473 (custom-gcc gcc-4.8 "gfortran" '("fortran")
474 %generic-search-paths))
475
476 (define-public gfortran-4.9
477 (custom-gcc gcc-4.9 "gfortran" '("fortran")
478 %generic-search-paths))
479
480 (define-public gfortran
481 (custom-gcc gcc "gfortran" '("fortran")
482 %generic-search-paths))
483
484 (define-public gfortran-5
485 (custom-gcc gcc-5 "gfortran" '("fortran")
486 %generic-search-paths))
487
488 (define-public gccgo-4.9
489 (custom-gcc gcc-4.9 "gccgo" '("go")
490 %generic-search-paths
491 ;; Suppress the separate "lib" output, because otherwise the
492 ;; "lib" and "out" outputs would refer to each other, creating
493 ;; a cyclic dependency. <http://debbugs.gnu.org/18101>
494 #:separate-lib-output? #f))
495
496 (define javac.in
497 (origin
498 (method url-fetch)
499 (uri (string-append "http://sources.gentoo.org/cgi-bin/viewvc.cgi/"
500 "gentoo-x86/dev-java/gcj-jdk/files/javac.in?revision=1.1"))
501 (file-name "javac.in")
502 (sha256 (base32
503 "1c3dk4z5yfj6ic2fn3lyxs27n6pmn2wy9k0r1s17lnkf1bzkrciv"))))
504
505 (define-public gcj
506 (package (inherit gcc)
507 (name "gcj")
508 (inputs
509 `(("fastjar" ,fastjar)
510 ("perl" ,perl)
511 ("javac.in" ,javac.in)
512 ("ecj-bootstrap" ,ecj-bootstrap)
513 ,@(package-inputs gcc)))
514 (native-inputs
515 `(("dejagnu" ,dejagnu)
516 ,@(package-native-inputs gcc)))
517 (native-search-paths %generic-search-paths)
518
519 ;; Suppress the separate "lib" output, because otherwise the
520 ;; "lib" and "out" outputs would refer to each other, creating
521 ;; a cyclic dependency. <http://debbugs.gnu.org/18101>
522 (outputs
523 (delete "lib" (package-outputs gcc)))
524 (arguments
525 (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
526 (guix build utils)
527 (ice-9 regex)
528 (srfi srfi-1)
529 (srfi srfi-26))
530 #:test-target "check-target-libjava"
531 ,@(package-arguments gcc))
532 ((#:tests? _) #t)
533 ((#:configure-flags flags)
534 `(let ((ecj (assoc-ref %build-inputs "ecj-bootstrap")))
535 `("--enable-java-home"
536 "--enable-gjdoc"
537 ,(string-append "--with-ecj-jar=" ecj)
538 "--enable-languages=java"
539 ,@(remove (cut string-match "--enable-languages.*" <>)
540 ,flags))))
541 ((#:phases phases)
542 `(modify-phases ,phases
543 (add-after
544 'unpack 'add-lib-output-to-rpath
545 (lambda _
546 (substitute* "libjava/Makefile.in"
547 (("libgcj_bc_dummy_LINK = .* -shared" line)
548 (string-append line " -Wl,-rpath=$(libdir)"))
549 (("libgcj(_bc)?_la_LDFLAGS =" ldflags _)
550 (string-append ldflags " -Wl,-rpath=$(libdir)")))))
551 (add-after
552 'install 'install-javac-and-javap-wrappers
553 (lambda _
554 (let* ((javac (assoc-ref %build-inputs "javac.in"))
555 (ecj (assoc-ref %build-inputs "ecj-bootstrap"))
556 (gcj (assoc-ref %outputs "out"))
557 (gcjbin (string-append gcj "/bin/"))
558 (jvm (string-append gcj "/lib/jvm/"))
559 (target (string-append jvm "/bin/javac")))
560
561 (symlink (string-append gcjbin "jcf-dump")
562 (string-append jvm "/bin/javap"))
563
564 (copy-file ecj (string-append gcj "/share/java/ecj.jar"))
565
566 ;; Create javac wrapper from the template javac.in by
567 ;; replacing the @VARIABLES@ with paths.
568 (copy-file javac target)
569 (patch-shebang target)
570 (substitute* target
571 (("@JAVA@")
572 (string-append jvm "/bin/java"))
573 (("@ECJ_JAR@")
574 (string-append gcj "/share/java/ecj.jar"))
575 (("@RT_JAR@")
576 (string-append jvm "/jre/lib/rt.jar"))
577 (("@TOOLS_JAR@")
578 (string-append jvm "/lib/tools.jar")))
579 (chmod target #o755)
580 #t)))
581 (add-after
582 'install 'remove-broken-or-conflicting-files
583 (lambda _
584 (let ((out (assoc-ref %outputs "out")))
585 (for-each
586 delete-file
587 (append (find-files (string-append out "/lib/jvm/jre/lib")
588 "libjawt.so")
589 (find-files (string-append out "/bin")
590 ".*(c\\+\\+|cpp|g\\+\\+|gcc.*)"))))
591 #t))))))))
592
593 (define ecj-bootstrap
594 (origin
595 (method url-fetch)
596 (uri "ftp://sourceware.org/pub/java/ecj-4.9.jar")
597 (sha256
598 (base32
599 "1k9lgm3qamf6zy534pa2zwskr8mpiqrngbv1vw9j4y1ghrdyf1lm"))))
600
601 (define-public gcc-objc-4.8
602 (custom-gcc gcc-4.8 "gcc-objc" '("objc")
603 (list (search-path-specification
604 (variable "OBJC_INCLUDE_PATH")
605 (files '("include")))
606 (search-path-specification
607 (variable "LIBRARY_PATH")
608 (files '("lib" "lib64"))))))
609
610 (define-public gcc-objc++-4.8
611 (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++")
612 (list (search-path-specification
613 (variable "OBJCPLUS_INCLUDE_PATH")
614 (files '("include")))
615 (search-path-specification
616 (variable "LIBRARY_PATH")
617 (files '("lib" "lib64"))))))
618
619 (define (make-libstdc++-doc gcc)
620 "Return a package with the libstdc++ documentation for GCC."
621 (package
622 (inherit gcc)
623 (name "libstdc++-doc")
624 (version (package-version gcc))
625 (synopsis "GNU libstdc++ documentation")
626 (outputs '("out"))
627 (native-inputs `(("doxygen" ,doxygen)
628 ("texinfo" ,texinfo)
629 ("libxml2" ,libxml2)
630 ("libxslt" ,libxslt)
631 ("docbook-xml" ,docbook-xml)
632 ("docbook-xsl" ,docbook-xsl)
633 ("graphviz" ,graphviz))) ;for 'dot', invoked by 'doxygen'
634 (inputs '())
635 (propagated-inputs '())
636 (arguments
637 '(#:out-of-source? #t
638 #:tests? #f ;it's just documentation
639 #:phases (modify-phases %standard-phases
640 (add-before 'configure 'chdir
641 (lambda _
642 (chdir "libstdc++-v3")))
643 (add-before 'configure 'set-xsl-directory
644 (lambda* (#:key inputs #:allow-other-keys)
645 (let ((docbook (assoc-ref inputs "docbook-xsl")))
646 (substitute* (find-files "doc"
647 "^Makefile\\.in$")
648 (("@XSL_STYLE_DIR@")
649 (string-append
650 docbook "/xml/xsl/"
651 (strip-store-file-name docbook)))))))
652 (replace 'build
653 (lambda _
654 ;; XXX: There's also a 'doc-info' target, but it
655 ;; relies on docbook2X, which itself relies on
656 ;; DocBook 4.1.2, which is not really usable
657 ;; (lacks a catalog.xml.)
658 (zero? (system* "make"
659 "doc-html"
660 "doc-man"))))
661 (replace 'install
662 (lambda* (#:key outputs #:allow-other-keys)
663 (let ((out (assoc-ref outputs "out")))
664 (zero? (system* "make"
665 "doc-install-html"
666 "doc-install-man"))))))))))
667
668 (define-public libstdc++-doc-4.9
669 (make-libstdc++-doc gcc-4.9))
670
671 (define-public libstdc++-doc-5
672 (make-libstdc++-doc gcc-5))
673
674 (define-public isl
675 (package
676 (name "isl")
677 (version "0.11.1")
678 (source (origin
679 (method url-fetch)
680 (uri (list (string-append
681 "http://isl.gforge.inria.fr/isl-"
682 version
683 ".tar.bz2")
684 (string-append %gcc-infrastructure
685 name "-" version ".tar.gz")))
686 (sha256
687 (base32
688 "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9"))))
689 (build-system gnu-build-system)
690 (inputs `(("gmp" ,gmp)))
691 (home-page "http://isl.gforge.inria.fr/")
692 (synopsis
693 "Manipulating sets and relations of integer points \
694 bounded by linear constraints")
695 (description
696 "isl is a library for manipulating sets and relations of integer points
697 bounded by linear constraints. Supported operations on sets include
698 intersection, union, set difference, emptiness check, convex hull, (integer)
699 affine hull, integer projection, computing the lexicographic minimum using
700 parametric integer programming, coalescing and parametric vertex
701 enumeration. It also includes an ILP solver based on generalized basis
702 reduction, transitive closures on maps (which may encode infinite graphs),
703 dependence analysis and bounds on piecewise step-polynomials.")
704 (license lgpl2.1+)))
705
706 (define-public cloog
707 (package
708 (name "cloog")
709 (version "0.18.0")
710 (source
711 (origin
712 (method url-fetch)
713 (uri (list (string-append
714 "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-"
715 version
716 ".tar.gz")
717 (string-append %gcc-infrastructure
718 name "-" version ".tar.gz")))
719 (sha256
720 (base32
721 "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw"))
722 (file-name (string-append name "-" version ".tar.gz"))))
723 (build-system gnu-build-system)
724 (inputs `(("gmp" ,gmp)
725 ("isl" ,isl)))
726 (arguments '(#:configure-flags '("--with-isl=system")))
727 (home-page "http://www.cloog.org/")
728 (synopsis "Library to generate code for scanning Z-polyhedra")
729 (description
730 "CLooG is a free software library to generate code for scanning
731 Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that
732 reaches each integral point of one or more parameterized polyhedra.
733 CLooG has been originally written to solve the code generation problem
734 for optimizing compilers based on the polytope model. Nevertheless it
735 is used now in various area e.g., to build control automata for
736 high-level synthesis or to find the best polynomial approximation of a
737 function. CLooG may help in any situation where scanning polyhedra
738 matters. While the user has full control on generated code quality,
739 CLooG is designed to avoid control overhead and to produce a very
740 effective code.")
741 (license gpl2+)))
742
743 (define-public gnu-c-manual
744 (package
745 (name "gnu-c-manual")
746 (version "0.2.4")
747 (source (origin
748 (method url-fetch)
749 (uri (string-append "mirror://gnu/gnu-c-manual/gnu-c-manual-"
750 version ".tar.gz"))
751 (sha256
752 (base32
753 "0cf4503shr7hxkbrjfi9dky6q2lqk95bgbgbjmvj2s2x312kakd9"))))
754 (build-system gnu-build-system)
755 (native-inputs `(("texinfo" ,texinfo)))
756 (arguments
757 '(#:phases (modify-phases %standard-phases
758 (delete 'configure)
759 (delete 'check)
760 (replace 'build
761 (lambda _
762 (zero? (system* "make"
763 "gnu-c-manual.info"
764 "gnu-c-manual.html"))))
765 (replace 'install
766 (lambda* (#:key outputs #:allow-other-keys)
767 (let* ((out (assoc-ref outputs "out"))
768 (info (string-append out "/share/info"))
769 (html (string-append
770 out "/share/doc/gnu-c-manual")))
771 (mkdir-p info)
772 (mkdir-p html)
773
774 (for-each (lambda (file)
775 (copy-file file
776 (string-append info "/"
777 file)))
778 (find-files "." "\\.info(-[0-9])?$"))
779 (for-each (lambda (file)
780 (copy-file file
781 (string-append html "/"
782 file)))
783 (find-files "." "\\.html$"))
784 #t))))))
785 (synopsis "Reference manual for the C programming language")
786 (description
787 "This is a reference manual for the C programming language, as
788 implemented by the GNU C Compiler (gcc). As a reference, it is not intended
789 to be a tutorial of the language. Rather, it outlines all of the constructs
790 of the language. Library functions are not included.")
791 (home-page "http://www.gnu.org/software/gnu-c-manual")
792 (license fdl1.3+)))