gnu: r-rcpparmadillo: Update to 0.6.700.6.0.
[jackhill/guix/guix.git] / gnu / packages / gcc.scm
CommitLineData
e9c0b944 1;;; GNU Guix --- Functional package management for GNU
e760ec41 2;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
270b501e 3;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
82f145ef 4;;; Copyright © 2014, 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
ed2b1c4f 5;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
b431e3a0 6;;; Copyright © 2015 Efraim Flashner <efraim@flashner.co.il>
e9c0b944
LC
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)
c6d7e299 24 #:use-module ((guix licenses)
50c7a1e2 25 #:select (gpl3+ gpl2+ lgpl2.1+ lgpl2.0+ fdl1.3+))
e9c0b944
LC
26 #:use-module (gnu packages)
27 #:use-module (gnu packages bootstrap)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages multiprecision)
c8ebc821 30 #:use-module (gnu packages texinfo)
c364a287 31 #:use-module (gnu packages dejagnu)
99828fa7 32 #:use-module (gnu packages documentation)
98b385d1
LC
33 #:use-module (gnu packages xml)
34 #:use-module (gnu packages docbook)
35 #:use-module (gnu packages graphviz)
3e778ad3 36 #:use-module (gnu packages elf)
38cf2ba0 37 #:use-module (gnu packages perl)
e9c0b944
LC
38 #:use-module (guix packages)
39 #:use-module (guix download)
ca16cb96 40 #:use-module (guix build-system gnu)
74574fd1 41 #:use-module (guix build-system trivial)
fdd6c726 42 #:use-module (guix utils)
ca16cb96 43 #:use-module (ice-9 regex))
e9c0b944 44
832abc76
LC
45(define %gcc-infrastructure
46 ;; Base URL for GCC's infrastructure.
47 "ftp://gcc.gnu.org/pub/gcc/infrastructure/")
48
76e639a0 49(define (gcc-configure-flags-for-triplet target)
ca16cb96
LC
50 "Return a list of additional GCC `configure' flags for TARGET, a GNU triplet.
51
52The purpose of this procedure is to translate extended GNU triplets---e.g.,
53where 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"))
3f00ff8b
MW
59
60 ((string-match "^arm.*-gnueabihf$" target)
61 '("--with-arch=armv7-a"
62 "--with-float=hard"
63 "--with-mode=thumb"
aa725117 64 "--with-fpu=neon"))
3f00ff8b 65
ca16cb96 66 (else
3f00ff8b 67 ;; TODO: Add `arm.*-gnueabi', etc.
ca16cb96
LC
68 '())))
69
e9c0b944 70(define-public gcc-4.7
9063ef0f 71 (let* ((stripped? #t) ;whether to strip the compiler, not the libraries
de1d41f9
LC
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 '()))))
7e3c9f74
LC
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))))
de1d41f9
LC
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"
98bd851e 102 "--with-system-zlib"
de1d41f9 103
06213498
LC
104 ;; No pre-compiled libstdc++ headers, to save space.
105 "--disable-libstdcxx-pch"
106
de1d41f9
LC
107 "--with-local-prefix=/no-gcc-local-prefix"
108
84e6756c
LC
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
de1d41f9
LC
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
76e639a0
MW
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))
ca16cb96 128
de1d41f9 129 (maybe-target-tools))))))
e9c0b944 130 (package
de1d41f9 131 (name "gcc")
d2e2f142 132 (version "4.7.4")
de1d41f9
LC
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
d2e2f142 139 "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))))
de1d41f9 140 (build-system gnu-build-system)
84e6756c
LC
141
142 ;; Separate out the run-time support libraries because all the
143 ;; dynamic-linked objects depend on it.
9063ef0f
LC
144 (outputs '("out" ;commands, etc. (60+ MiB)
145 "lib" ;libgcc_s, libgomp, etc. (15+ MiB)
146 "debug")) ;debug symbols of run-time libraries
84e6756c 147
de1d41f9
LC
148 (inputs `(("gmp" ,gmp)
149 ("mpfr" ,mpfr)
150 ("mpc" ,mpc)
151 ("isl" ,isl)
152 ("cloog" ,cloog)
153 ("libelf" ,libelf)
154 ("zlib" ,zlib)))
c8ebc821
LC
155
156 ;; GCC is one of the few packages that doesn't ship .info files.
157 (native-inputs `(("texinfo" ,texinfo)))
158
de1d41f9
LC
159 (arguments
160 `(#:out-of-source? #t
de1d41f9
LC
161 #:configure-flags ,(configure-flags)
162 #:make-flags
fd0b2766
LC
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")))))
de1d41f9
LC
187
188 #:tests? #f
dfc8bb20 189
de1d41f9
LC
190 #:phases
191 (alist-cons-before
192 'configure 'pre-configure
193 (lambda* (#:key inputs outputs #:allow-other-keys)
7e3c9f74 194 (let ((libdir ,(libdir))
84e6756c 195 (libc (assoc-ref inputs "libc")))
de1d41f9
LC
196 (when libc
197 ;; The following is not performed for `--without-headers'
198 ;; cross-compiler builds.
199
91c47bef
MW
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"
3f00ff8b 205 "^linux(64|-elf|-eabi)?\\.h$")
91c47bef
MW
206 (("(#define GLIBC_DYNAMIC_LINKER.*)\\\\\n$" _ line)
207 line)))
208 '(1 2 3))
209
de1d41f9
LC
210 ;; Fix the dynamic linker's file name.
211 (substitute* (find-files "gcc/config"
0cce9968 212 "^(linux|gnu)(64|-elf|-eabi)?\\.h$")
de1d41f9
LC
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"
06213498
LC
221 "^gnu-user.*\\.h$")
222 (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
fa1e2f3d
MW
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
a7bf595f 228 ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
270b501e
MW
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.
06213498 234 (format #f "#define GNU_USER_TARGET_LIB_SPEC \
81197492
LC
235\"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
236 libc libc libdir suffix))
06213498 237 (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
de1d41f9 238 (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
e9c0b944 239#define STANDARD_STARTFILE_PREFIX_2 \"\"
06213498 240~a"
de1d41f9
LC
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\\[\\] =.*;")
84e6756c
LC
246 "static char const sed_cmd_z[] = \"sed\";"))
247
d0b62698
LC
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)
ec299071
LC
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 ""))))
d0b62698 261
21e583de
LC
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
84e6756c
LC
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"))))
de1d41f9
LC
285
286 (alist-cons-after
287 'configure 'post-configure
288 (lambda _
289 ;; Don't store configure flags, to avoid retaining references to
6f58d582 290 ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'.
de1d41f9
LC
291 (substitute* "Makefile"
292 (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
293 "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
9063ef0f 294 %standard-phases))))
de1d41f9
LC
295
296 (native-search-paths
009b53fd
LC
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.
de1d41f9 302 (list (search-path-specification
009b53fd
LC
303 (variable "C_INCLUDE_PATH")
304 (files '("include")))
305 (search-path-specification
306 (variable "CPLUS_INCLUDE_PATH")
af070955 307 (files '("include")))
de1d41f9
LC
308 (search-path-specification
309 (variable "LIBRARY_PATH")
af070955 310 (files '("lib" "lib64")))))
de1d41f9
LC
311
312 (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
313 (synopsis "GNU Compiler Collection")
314 (description
a22dc0c4
LC
315 "GCC is the GNU Compiler Collection. It provides compiler front-ends
316for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and
79c311b8 317Go. It also includes runtime support libraries for these languages.")
de1d41f9
LC
318 (license gpl3+)
319 (home-page "http://gcc.gnu.org/"))))
832abc76 320
3b401612 321(define-public gcc-4.8
3b401612 322 (package (inherit gcc-4.7)
ab5f49cf 323 (version "4.8.5")
3b401612 324 (source (origin
7e35b9dd
LC
325 (method url-fetch)
326 (uri (string-append "mirror://gnu/gcc/gcc-"
327 version "/gcc-" version ".tar.bz2"))
328 (sha256
329 (base32
ab5f49cf 330 "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2"))
fc1adab1 331 (patches (search-patches "gcc-arm-link-spec-fix.patch"))))))
3b401612 332
571aa6cd 333(define-public gcc-4.9
7e35b9dd 334 (package (inherit gcc-4.8)
6f317fa3 335 (version "4.9.3")
571aa6cd 336 (source (origin
7e35b9dd
LC
337 (method url-fetch)
338 (uri (string-append "mirror://gnu/gcc/gcc-"
339 version "/gcc-" version ".tar.bz2"))
340 (sha256
341 (base32
6f317fa3 342 "0zmnm00d2a1hsd41g34bhvxzvxisa2l584q3p447bd91lfjv4ci3"))
fc1adab1 343 (patches (search-patches "gcc-libvtv-runpath.patch"))))))
571aa6cd 344
629f4d2e 345(define-public gcc-5
7e35b9dd 346 (package (inherit gcc-4.9)
b431e3a0 347 (version "5.3.0")
60e2d5fe 348 (source (origin
7e35b9dd
LC
349 (method url-fetch)
350 (uri (string-append "mirror://gnu/gcc/gcc-"
351 version "/gcc-" version ".tar.bz2"))
352 (sha256
353 (base32
b431e3a0 354 "1ny4smkp5bzs3cp8ss7pl6lk8yss0d9m4av1mvdp72r1x695akxq"))
fc1adab1 355 (patches (search-patches "gcc-5.0-libvtv-runpath.patch"))))))
60e2d5fe 356
e760ec41
LC
357(define-public gcc-6
358 (package
359 (inherit gcc-5)
360 (version "6.1.0")
361 (source (origin
362 (method url-fetch)
363 (uri (string-append "mirror://gnu/gcc/gcc-"
364 version "/gcc-" version ".tar.bz2"))
365 (sha256
366 (base32
367 "0ld3y4rgimyqgx1nwvzqyl5gr4wzc0ch4akkvsqp3fgbmdfcii09"))
368 (patches (search-patches "gcc-5.0-libvtv-runpath.patch"))))))
369
ce362de8
MW
370;; Note: When changing the default gcc version, update
371;; the gcc-toolchain-* definitions accordingly.
eed67cbb
RW
372(define-public gcc gcc-4.9)
373
d0abf829
LC
374(define-public (make-libstdc++ gcc)
375 "Return a libstdc++ package based on GCC. The primary use case is when
376using compilers other than GCC."
377 (package
378 (inherit gcc)
379 (name "libstdc++")
380 (arguments
381 `(#:out-of-source? #t
382 #:phases (alist-cons-before
383 'configure 'chdir
384 (lambda _
385 (chdir "libstdc++-v3"))
386 %standard-phases)
387 #:configure-flags `("--disable-libstdcxx-pch"
388 ,(string-append "--with-gxx-include-dir="
389 (assoc-ref %outputs "out")
390 "/include"))))
391 (outputs '("out" "debug"))
392 (inputs '())
393 (native-inputs '())
394 (propagated-inputs '())
395 (synopsis "GNU C++ standard library")))
396
397(define-public libstdc++-4.9
398 (make-libstdc++ gcc-4.9))
399
2b6b6d13
RW
400(define (make-libiberty gcc)
401 "Return a libiberty package based on GCC."
402 (package
403 (inherit gcc)
404 (name "libiberty")
405 (arguments
406 `(#:out-of-source? #t
407 #:phases
408 (modify-phases %standard-phases
409 (add-before 'configure 'chdir
410 (lambda _
411 (chdir "libiberty")
412 #t))
413 (replace
414 'install
415 (lambda* (#:key outputs #:allow-other-keys)
416 (let* ((out (assoc-ref outputs "out"))
417 (lib (string-append out "/lib/"))
418 (include (string-append out "/include/")))
419 (mkdir-p lib)
420 (mkdir-p include)
421 (copy-file "libiberty.a"
422 (string-append lib "libiberty.a"))
423 (copy-file "../include/libiberty.h"
424 (string-append include "libiberty.h"))
425 #t))))))
426 (inputs '())
427 (outputs '("out"))
428 (native-inputs '())
429 (propagated-inputs '())
430 (synopsis "Collection of subroutines used by various GNU programs")))
431
432(define-public libiberty
433 (make-libiberty gcc))
434
009b53fd
LC
435(define* (custom-gcc gcc name languages
436 #:optional
437 (search-paths (package-native-search-paths gcc))
438 #:key (separate-lib-output? #t))
439 "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS
440as the 'native-search-paths' field."
fdd6c726
NK
441 (package (inherit gcc)
442 (name name)
c4df90a5
MW
443 (outputs (if separate-lib-output?
444 (package-outputs gcc)
445 (delete "lib" (package-outputs gcc))))
009b53fd 446 (native-search-paths search-paths)
fdd6c726
NK
447 (arguments
448 (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
449 (guix build utils)
450 (ice-9 regex)
451 (srfi srfi-1)
452 (srfi srfi-26))
453 ,@(package-arguments gcc))
454 ((#:configure-flags flags)
455 `(cons (string-append "--enable-languages="
456 ,(string-join languages ","))
457 (remove (cut string-match "--enable-languages.*" <>)
82f145ef
RW
458 ,flags)))
459 ((#:phases phases)
460 `(modify-phases ,phases
461 (add-after 'install 'remove-broken-or-conflicting-files
462 (lambda* (#:key outputs #:allow-other-keys)
463 (for-each delete-file
464 (find-files (string-append (assoc-ref outputs "out") "/bin")
465 ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc.*)"))
466 #t))))))))
fdd6c726 467
009b53fd
LC
468(define %generic-search-paths
469 ;; This is the language-neutral search path for GCC. Entries in $CPATH are
470 ;; not considered "system headers", which means GCC can raise warnings for
471 ;; issues in those headers. 'CPATH' is the only one that works for
472 ;; front-ends not in the C family.
473 (list (search-path-specification
474 (variable "CPATH")
475 (files '("include")))
476 (search-path-specification
477 (variable "LIBRARY_PATH")
478 (files '("lib" "lib64")))))
479
fdd6c726 480(define-public gfortran-4.8
009b53fd
LC
481 (custom-gcc gcc-4.8 "gfortran" '("fortran")
482 %generic-search-paths))
fdd6c726 483
c69a8b7b 484(define-public gfortran-4.9
009b53fd
LC
485 (custom-gcc gcc-4.9 "gfortran" '("fortran")
486 %generic-search-paths))
c69a8b7b 487
eed67cbb 488(define-public gfortran
009b53fd
LC
489 (custom-gcc gcc "gfortran" '("fortran")
490 %generic-search-paths))
eed67cbb 491
e61d9e39 492(define-public gfortran-5
009b53fd
LC
493 (custom-gcc gcc-5 "gfortran" '("fortran")
494 %generic-search-paths))
e61d9e39 495
c8732e19
EF
496(define-public gccgo-4.9
497 (custom-gcc gcc-4.9 "gccgo" '("go")
009b53fd 498 %generic-search-paths
c4df90a5
MW
499 ;; Suppress the separate "lib" output, because otherwise the
500 ;; "lib" and "out" outputs would refer to each other, creating
501 ;; a cyclic dependency. <http://debbugs.gnu.org/18101>
502 #:separate-lib-output? #f))
fdd6c726 503
ed2b1c4f
AE
504(define javac.in
505 (origin
506 (method url-fetch)
507 (uri (string-append "http://sources.gentoo.org/cgi-bin/viewvc.cgi/"
61af1014
LC
508 "gentoo-x86/dev-java/gcj-jdk/files/javac.in?revision=1.1"))
509 (file-name "javac.in")
ed2b1c4f
AE
510 (sha256 (base32
511 "1c3dk4z5yfj6ic2fn3lyxs27n6pmn2wy9k0r1s17lnkf1bzkrciv"))))
512
397dbde8
RW
513(define-public gcj
514 (package (inherit gcc)
74574fd1
RW
515 (name "gcj")
516 (inputs
517 `(("fastjar" ,fastjar)
518 ("perl" ,perl)
ed2b1c4f 519 ("javac.in" ,javac.in)
397dbde8
RW
520 ("ecj-bootstrap" ,ecj-bootstrap)
521 ,@(package-inputs gcc)))
c364a287
RW
522 (native-inputs
523 `(("dejagnu" ,dejagnu)
524 ,@(package-native-inputs gcc)))
009b53fd
LC
525 (native-search-paths %generic-search-paths)
526
74574fd1
RW
527 ;; Suppress the separate "lib" output, because otherwise the
528 ;; "lib" and "out" outputs would refer to each other, creating
529 ;; a cyclic dependency. <http://debbugs.gnu.org/18101>
530 (outputs
397dbde8 531 (delete "lib" (package-outputs gcc)))
74574fd1
RW
532 (arguments
533 (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
534 (guix build utils)
535 (ice-9 regex)
536 (srfi srfi-1)
537 (srfi srfi-26))
c364a287
RW
538 #:test-target "check-target-libjava"
539 ,@(package-arguments gcc))
540 ((#:tests? _) #t)
74574fd1
RW
541 ((#:configure-flags flags)
542 `(let ((ecj (assoc-ref %build-inputs "ecj-bootstrap")))
543 `("--enable-java-home"
544 "--enable-gjdoc"
545 ,(string-append "--with-ecj-jar=" ecj)
546 "--enable-languages=java"
547 ,@(remove (cut string-match "--enable-languages.*" <>)
548 ,flags))))
ad12c43e
RW
549 ((#:phases phases)
550 `(modify-phases ,phases
551 (add-after
552 'unpack 'add-lib-output-to-rpath
553 (lambda _
554 (substitute* "libjava/Makefile.in"
555 (("libgcj_bc_dummy_LINK = .* -shared" line)
556 (string-append line " -Wl,-rpath=$(libdir)"))
557 (("libgcj(_bc)?_la_LDFLAGS =" ldflags _)
558 (string-append ldflags " -Wl,-rpath=$(libdir)")))))
559 (add-after
560 'install 'install-javac-and-javap-wrappers
561 (lambda _
562 (let* ((javac (assoc-ref %build-inputs "javac.in"))
563 (ecj (assoc-ref %build-inputs "ecj-bootstrap"))
564 (gcj (assoc-ref %outputs "out"))
565 (gcjbin (string-append gcj "/bin/"))
566 (jvm (string-append gcj "/lib/jvm/"))
567 (target (string-append jvm "/bin/javac")))
568
569 (symlink (string-append gcjbin "jcf-dump")
570 (string-append jvm "/bin/javap"))
571
572 (copy-file ecj (string-append gcj "/share/java/ecj.jar"))
573
574 ;; Create javac wrapper from the template javac.in by
575 ;; replacing the @VARIABLES@ with paths.
576 (copy-file javac target)
577 (patch-shebang target)
578 (substitute* target
579 (("@JAVA@")
580 (string-append jvm "/bin/java"))
581 (("@ECJ_JAR@")
582 (string-append gcj "/share/java/ecj.jar"))
583 (("@RT_JAR@")
584 (string-append jvm "/jre/lib/rt.jar"))
585 (("@TOOLS_JAR@")
586 (string-append jvm "/lib/tools.jar")))
587 (chmod target #o755)
588 #t)))
589 (add-after
5f6887e8
RW
590 'install 'remove-broken-or-conflicting-files
591 (lambda _
592 (let ((out (assoc-ref %outputs "out")))
593 (for-each
594 delete-file
595 (append (find-files (string-append out "/lib/jvm/jre/lib")
596 "libjawt.so")
597 (find-files (string-append out "/bin")
598 ".*(c\\+\\+|cpp|g\\+\\+|gcc.*)"))))
ad12c43e 599 #t))))))))
74574fd1 600
397dbde8 601(define ecj-bootstrap
74574fd1
RW
602 (origin
603 (method url-fetch)
397dbde8 604 (uri "ftp://sourceware.org/pub/java/ecj-4.9.jar")
74574fd1
RW
605 (sha256
606 (base32
397dbde8 607 "1k9lgm3qamf6zy534pa2zwskr8mpiqrngbv1vw9j4y1ghrdyf1lm"))))
74574fd1 608
fdd6c726 609(define-public gcc-objc-4.8
009b53fd
LC
610 (custom-gcc gcc-4.8 "gcc-objc" '("objc")
611 (list (search-path-specification
612 (variable "OBJC_INCLUDE_PATH")
613 (files '("include")))
614 (search-path-specification
615 (variable "LIBRARY_PATH")
616 (files '("lib" "lib64"))))))
fdd6c726
NK
617
618(define-public gcc-objc++-4.8
009b53fd
LC
619 (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++")
620 (list (search-path-specification
621 (variable "OBJCPLUS_INCLUDE_PATH")
622 (files '("include")))
623 (search-path-specification
624 (variable "LIBRARY_PATH")
625 (files '("lib" "lib64"))))))
fdd6c726 626
98b385d1
LC
627(define (make-libstdc++-doc gcc)
628 "Return a package with the libstdc++ documentation for GCC."
629 (package
630 (inherit gcc)
631 (name "libstdc++-doc")
632 (version (package-version gcc))
633 (synopsis "GNU libstdc++ documentation")
634 (outputs '("out"))
635 (native-inputs `(("doxygen" ,doxygen)
636 ("texinfo" ,texinfo)
637 ("libxml2" ,libxml2)
638 ("libxslt" ,libxslt)
639 ("docbook-xml" ,docbook-xml)
640 ("docbook-xsl" ,docbook-xsl)
641 ("graphviz" ,graphviz))) ;for 'dot', invoked by 'doxygen'
642 (inputs '())
643 (propagated-inputs '())
644 (arguments
645 '(#:out-of-source? #t
646 #:tests? #f ;it's just documentation
647 #:phases (modify-phases %standard-phases
648 (add-before 'configure 'chdir
649 (lambda _
650 (chdir "libstdc++-v3")))
651 (add-before 'configure 'set-xsl-directory
652 (lambda* (#:key inputs #:allow-other-keys)
653 (let ((docbook (assoc-ref inputs "docbook-xsl")))
654 (substitute* (find-files "doc"
655 "^Makefile\\.in$")
656 (("@XSL_STYLE_DIR@")
657 (string-append
658 docbook "/xml/xsl/"
b7c7c03e 659 (strip-store-file-name docbook)))))))
98b385d1
LC
660 (replace 'build
661 (lambda _
662 ;; XXX: There's also a 'doc-info' target, but it
663 ;; relies on docbook2X, which itself relies on
664 ;; DocBook 4.1.2, which is not really usable
665 ;; (lacks a catalog.xml.)
666 (zero? (system* "make"
667 "doc-html"
668 "doc-man"))))
669 (replace 'install
670 (lambda* (#:key outputs #:allow-other-keys)
671 (let ((out (assoc-ref outputs "out")))
672 (zero? (system* "make"
673 "doc-install-html"
674 "doc-install-man"))))))))))
675
676(define-public libstdc++-doc-4.9
677 (make-libstdc++-doc gcc-4.9))
678
629f4d2e
MW
679(define-public libstdc++-doc-5
680 (make-libstdc++-doc gcc-5))
98b385d1 681
832abc76
LC
682(define-public isl
683 (package
684 (name "isl")
685 (version "0.11.1")
686 (source (origin
687 (method url-fetch)
688 (uri (list (string-append
590a4904 689 "http://isl.gforge.inria.fr/isl-"
832abc76
LC
690 version
691 ".tar.bz2")
692 (string-append %gcc-infrastructure
693 name "-" version ".tar.gz")))
694 (sha256
695 (base32
696 "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9"))))
697 (build-system gnu-build-system)
698 (inputs `(("gmp" ,gmp)))
590a4904 699 (home-page "http://isl.gforge.inria.fr/")
832abc76 700 (synopsis
9e771e3b
LC
701 "Manipulating sets and relations of integer points \
702bounded by linear constraints")
832abc76
LC
703 (description
704 "isl is a library for manipulating sets and relations of integer points
35b9e423 705bounded by linear constraints. Supported operations on sets include
832abc76
LC
706intersection, union, set difference, emptiness check, convex hull, (integer)
707affine hull, integer projection, computing the lexicographic minimum using
708parametric integer programming, coalescing and parametric vertex
35b9e423 709enumeration. It also includes an ILP solver based on generalized basis
832abc76
LC
710reduction, transitive closures on maps (which may encode infinite graphs),
711dependence analysis and bounds on piecewise step-polynomials.")
712 (license lgpl2.1+)))
713
714(define-public cloog
715 (package
716 (name "cloog")
717 (version "0.18.0")
718 (source
719 (origin
720 (method url-fetch)
721 (uri (list (string-append
722 "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-"
723 version
724 ".tar.gz")
725 (string-append %gcc-infrastructure
726 name "-" version ".tar.gz")))
727 (sha256
728 (base32
729 "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw"))
730 (file-name (string-append name "-" version ".tar.gz"))))
731 (build-system gnu-build-system)
732 (inputs `(("gmp" ,gmp)
733 ("isl" ,isl)))
734 (arguments '(#:configure-flags '("--with-isl=system")))
735 (home-page "http://www.cloog.org/")
9e771e3b 736 (synopsis "Library to generate code for scanning Z-polyhedra")
832abc76
LC
737 (description
738 "CLooG is a free software library to generate code for scanning
739Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that
740reaches each integral point of one or more parameterized polyhedra.
741CLooG has been originally written to solve the code generation problem
742for optimizing compilers based on the polytope model. Nevertheless it
743is used now in various area e.g., to build control automata for
744high-level synthesis or to find the best polynomial approximation of a
745function. CLooG may help in any situation where scanning polyhedra
746matters. While the user has full control on generated code quality,
747CLooG is designed to avoid control overhead and to produce a very
748effective code.")
749 (license gpl2+)))
5c126b64 750
50c7a1e2
LC
751(define-public gnu-c-manual
752 (package
753 (name "gnu-c-manual")
754 (version "0.2.4")
755 (source (origin
756 (method url-fetch)
757 (uri (string-append "mirror://gnu/gnu-c-manual/gnu-c-manual-"
758 version ".tar.gz"))
759 (sha256
760 (base32
761 "0cf4503shr7hxkbrjfi9dky6q2lqk95bgbgbjmvj2s2x312kakd9"))))
762 (build-system gnu-build-system)
763 (native-inputs `(("texinfo" ,texinfo)))
764 (arguments
765 '(#:phases (modify-phases %standard-phases
766 (delete 'configure)
767 (delete 'check)
768 (replace 'build
769 (lambda _
770 (zero? (system* "make"
771 "gnu-c-manual.info"
772 "gnu-c-manual.html"))))
773 (replace 'install
774 (lambda* (#:key outputs #:allow-other-keys)
775 (let* ((out (assoc-ref outputs "out"))
776 (info (string-append out "/share/info"))
777 (html (string-append
778 out "/share/doc/gnu-c-manual")))
779 (mkdir-p info)
780 (mkdir-p html)
781
782 (for-each (lambda (file)
783 (copy-file file
784 (string-append info "/"
785 file)))
786 (find-files "." "\\.info(-[0-9])?$"))
787 (for-each (lambda (file)
788 (copy-file file
789 (string-append html "/"
790 file)))
791 (find-files "." "\\.html$"))
792 #t))))))
793 (synopsis "Reference manual for the C programming language")
794 (description
795 "This is a reference manual for the C programming language, as
796implemented by the GNU C Compiler (gcc). As a reference, it is not intended
797to be a tutorial of the language. Rather, it outlines all of the constructs
798of the language. Library functions are not included.")
799 (home-page "http://www.gnu.org/software/gnu-c-manual")
800 (license fdl1.3+)))