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