gnu: Use synopses from the Womb.
[jackhill/guix/guix.git] / gnu / packages / gcc.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages gcc)
20 #:use-module (guix licenses)
21 #:use-module (gnu packages)
22 #:use-module (gnu packages bootstrap)
23 #:use-module (gnu packages compression)
24 #:use-module (gnu packages multiprecision)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu))
28
29 (define %gcc-infrastructure
30 ;; Base URL for GCC's infrastructure.
31 "ftp://gcc.gnu.org/pub/gcc/infrastructure/")
32
33 (define-public gcc-4.7
34 (let ((stripped? #t)) ; TODO: make this a parameter
35 (package
36 (name "gcc")
37 (version "4.7.2")
38 (source (origin
39 (method url-fetch)
40 (uri (string-append "mirror://gnu/gcc/gcc-"
41 version "/gcc-" version ".tar.bz2"))
42 (sha256
43 (base32
44 "115h03hil99ljig8lkrq4qk426awmzh0g99wrrggxf8g07bq74la"))))
45 (build-system gnu-build-system)
46 (inputs `(("gmp" ,gmp)
47 ("mpfr" ,mpfr)
48 ("mpc" ,mpc))) ; TODO: libelf, ppl, cloog, zlib, etc.
49 (arguments
50 `(#:out-of-source? #t
51 #:strip-binaries? ,stripped?
52 #:configure-flags
53 `("--enable-plugin"
54 "--enable-languages=c,c++"
55 "--disable-multilib"
56
57 "--with-local-prefix=/no-gcc-local-prefix"
58
59 ,(let ((libc (assoc-ref %build-inputs "libc")))
60 (if libc
61 (string-append "--with-native-system-header-dir=" libc
62 "/include")
63 "--without-headers")))
64 #:make-flags
65 (let ((libc (assoc-ref %build-inputs "libc")))
66 `(,@(if libc
67 (list (string-append "LDFLAGS_FOR_BUILD="
68 "-L" libc "/lib "
69 "-Wl,-dynamic-linker "
70 "-Wl," libc
71 ,(glibc-dynamic-linker)))
72 '())
73 ,(string-append "BOOT_CFLAGS=-O2 "
74 ,(if stripped? "-g0" "-g"))))
75
76 #:tests? #f
77 #:phases
78 (alist-cons-before
79 'configure 'pre-configure
80 (lambda* (#:key inputs outputs #:allow-other-keys)
81 (let ((out (assoc-ref outputs "out"))
82 (libc (assoc-ref inputs "libc")))
83 (when libc
84 ;; The following is not performed for `--without-headers'
85 ;; cross-compiler builds.
86
87 ;; Fix the dynamic linker's file name.
88 (substitute* (find-files "gcc/config"
89 "^linux(64|-elf)?\\.h$")
90 (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
91 (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
92 suffix
93 (string-append libc ,(glibc-dynamic-linker)))))
94
95 ;; Tell where to find libstdc++, libc, and `?crt*.o', except
96 ;; `crt{begin,end}.o', which come with GCC.
97 (substitute* (find-files "gcc/config"
98 "^(gnu-user(64)?|linux-elf)\\.h$")
99 (("#define LIB_SPEC (.*)$" _ suffix)
100 ;; Note that with this "lib" spec, we may still add a
101 ;; RUNPATH to GCC even when `libgcc_s' is not NEEDED.
102 ;; There's not much that can be done to avoid it, though.
103 (format #f "#define LIB_SPEC \"-L~a/lib %{!static:-rpath=~a/lib \
104 %{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib}} \" ~a~%"
105 libc libc out out suffix))
106 (("#define STARTFILE_SPEC.*$" line)
107 (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
108 #define STANDARD_STARTFILE_PREFIX_2 \"\"
109 ~a~%"
110 libc line))))
111
112 ;; Don't retain a dependency on the build-time sed.
113 (substitute* "fixincludes/fixincl.x"
114 (("static char const sed_cmd_z\\[\\] =.*;")
115 "static char const sed_cmd_z[] = \"sed\";"))))
116
117 (alist-cons-after
118 'configure 'post-configure
119 (lambda _
120 ;; Don't store configure flags, to avoid retaining references to
121 ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'.
122 (substitute* "Makefile"
123 (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
124 "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
125 (alist-replace 'install
126 (lambda* (#:key outputs #:allow-other-keys)
127 (zero?
128 (system* "make"
129 ,(if stripped?
130 "install-strip"
131 "install"))))
132 %standard-phases)))))
133
134 (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
135 (synopsis "GNU Compiler Collection")
136 (description
137 "The GNU Compiler Collection includes compiler front ends for C, C++,
138 Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well as
139 libraries for these languages (libstdc++, libgcj, libgomp,...).
140
141 GCC development is a part of the GNU Project, aiming to improve the compiler
142 used in the GNU system including the GNU/Linux variant.")
143 (license gpl3+)
144 (home-page "http://gcc.gnu.org/"))))
145
146 (define-public isl
147 (package
148 (name "isl")
149 (version "0.11.1")
150 (source (origin
151 (method url-fetch)
152 (uri (list (string-append
153 "ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/isl-"
154 version
155 ".tar.bz2")
156 (string-append %gcc-infrastructure
157 name "-" version ".tar.gz")))
158 (sha256
159 (base32
160 "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9"))))
161 (build-system gnu-build-system)
162 (inputs `(("gmp" ,gmp)))
163 (home-page "http://www.kotnet.org/~skimo/isl/")
164 (synopsis
165 "A library for manipulating sets and relations of integer points bounded
166 by linear constraints")
167 (description
168 "isl is a library for manipulating sets and relations of integer points
169 bounded by linear constraints. Supported operations on sets include
170 intersection, union, set difference, emptiness check, convex hull, (integer)
171 affine hull, integer projection, computing the lexicographic minimum using
172 parametric integer programming, coalescing and parametric vertex
173 enumeration. It also includes an ILP solver based on generalized basis
174 reduction, transitive closures on maps (which may encode infinite graphs),
175 dependence analysis and bounds on piecewise step-polynomials.")
176 (license lgpl2.1+)))
177
178 (define-public cloog
179 (package
180 (name "cloog")
181 (version "0.18.0")
182 (source
183 (origin
184 (method url-fetch)
185 (uri (list (string-append
186 "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-"
187 version
188 ".tar.gz")
189 (string-append %gcc-infrastructure
190 name "-" version ".tar.gz")))
191 (sha256
192 (base32
193 "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw"))
194 (file-name (string-append name "-" version ".tar.gz"))))
195 (build-system gnu-build-system)
196 (inputs `(("gmp" ,gmp)
197 ("isl" ,isl)))
198 (arguments '(#:configure-flags '("--with-isl=system")))
199 (home-page "http://www.cloog.org/")
200 (synopsis "A library to generate code for scanning Z-polyhedra")
201 (description
202 "CLooG is a free software library to generate code for scanning
203 Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that
204 reaches each integral point of one or more parameterized polyhedra.
205 CLooG has been originally written to solve the code generation problem
206 for optimizing compilers based on the polytope model. Nevertheless it
207 is used now in various area e.g., to build control automata for
208 high-level synthesis or to find the best polynomial approximation of a
209 function. CLooG may help in any situation where scanning polyhedra
210 matters. While the user has full control on generated code quality,
211 CLooG is designed to avoid control overhead and to produce a very
212 effective code.")
213 (license gpl2+)))
214
215 (define-public libelf
216 (package
217 (name "libelf")
218 (version "0.8.13")
219 (source (origin
220 (method url-fetch)
221 (uri (string-append "http://www.mr511.de/software/libelf-"
222 version ".tar.gz"))
223 (sha256
224 (base32
225 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
226 (build-system gnu-build-system)
227 (arguments '(#:phases (alist-replace
228 'configure
229 (lambda* (#:key outputs #:allow-other-keys)
230 ;; This old `configure' script doesn't support
231 ;; variables passed as arguments.
232 (let ((out (assoc-ref outputs "out")))
233 (setenv "CONFIG_SHELL" (which "bash"))
234 (zero?
235 (system* "./configure"
236 (string-append "--prefix=" out)))))
237 %standard-phases)))
238 (home-page "http://www.mr511.de/software/english.html")
239 (synopsis "An ELF object file access library")
240 (description "libelf is a C library to access ELF object files.")
241 (license lgpl2.0+)))