Commit | Line | Data |
---|---|---|
e9c0b944 LC |
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) | |
c6d7e299 LC |
20 | #:use-module ((guix licenses) |
21 | #:select (gpl3+ gpl2+ lgpl2.1+ lgpl2.0+)) | |
e9c0b944 LC |
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 | ||
832abc76 LC |
30 | (define %gcc-infrastructure |
31 | ;; Base URL for GCC's infrastructure. | |
32 | "ftp://gcc.gnu.org/pub/gcc/infrastructure/") | |
33 | ||
e9c0b944 LC |
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 | |
4928e500 LC |
68 | (list (string-append "LDFLAGS_FOR_TARGET=" |
69 | "-B" libc "/lib " | |
e9c0b944 LC |
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 \ | |
4928e500 | 105 | %{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib}} \" ~a" |
e9c0b944 LC |
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 | ||
a18eda27 LC |
135 | (native-search-paths |
136 | (list (search-path-specification | |
137 | (variable "CPATH") | |
138 | (directories '("include"))) | |
139 | (search-path-specification | |
140 | (variable "LIBRARY_PATH") | |
141 | (directories '("lib" "lib64"))))) | |
142 | ||
e9c0b944 | 143 | (properties `((gcc-libc . ,(assoc-ref inputs "libc")))) |
f50d2669 | 144 | (synopsis "GNU Compiler Collection") |
e9c0b944 LC |
145 | (description |
146 | "The GNU Compiler Collection includes compiler front ends for C, C++, | |
147 | Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well as | |
148 | libraries for these languages (libstdc++, libgcj, libgomp,...). | |
149 | ||
150 | GCC development is a part of the GNU Project, aiming to improve the compiler | |
151 | used in the GNU system including the GNU/Linux variant.") | |
152 | (license gpl3+) | |
153 | (home-page "http://gcc.gnu.org/")))) | |
832abc76 LC |
154 | |
155 | (define-public isl | |
156 | (package | |
157 | (name "isl") | |
158 | (version "0.11.1") | |
159 | (source (origin | |
160 | (method url-fetch) | |
161 | (uri (list (string-append | |
162 | "ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/isl-" | |
163 | version | |
164 | ".tar.bz2") | |
165 | (string-append %gcc-infrastructure | |
166 | name "-" version ".tar.gz"))) | |
167 | (sha256 | |
168 | (base32 | |
169 | "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9")))) | |
170 | (build-system gnu-build-system) | |
171 | (inputs `(("gmp" ,gmp))) | |
172 | (home-page "http://www.kotnet.org/~skimo/isl/") | |
173 | (synopsis | |
174 | "A library for manipulating sets and relations of integer points bounded | |
175 | by linear constraints") | |
176 | (description | |
177 | "isl is a library for manipulating sets and relations of integer points | |
178 | bounded by linear constraints. Supported operations on sets include | |
179 | intersection, union, set difference, emptiness check, convex hull, (integer) | |
180 | affine hull, integer projection, computing the lexicographic minimum using | |
181 | parametric integer programming, coalescing and parametric vertex | |
182 | enumeration. It also includes an ILP solver based on generalized basis | |
183 | reduction, transitive closures on maps (which may encode infinite graphs), | |
184 | dependence analysis and bounds on piecewise step-polynomials.") | |
185 | (license lgpl2.1+))) | |
186 | ||
187 | (define-public cloog | |
188 | (package | |
189 | (name "cloog") | |
190 | (version "0.18.0") | |
191 | (source | |
192 | (origin | |
193 | (method url-fetch) | |
194 | (uri (list (string-append | |
195 | "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-" | |
196 | version | |
197 | ".tar.gz") | |
198 | (string-append %gcc-infrastructure | |
199 | name "-" version ".tar.gz"))) | |
200 | (sha256 | |
201 | (base32 | |
202 | "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw")) | |
203 | (file-name (string-append name "-" version ".tar.gz")))) | |
204 | (build-system gnu-build-system) | |
205 | (inputs `(("gmp" ,gmp) | |
206 | ("isl" ,isl))) | |
207 | (arguments '(#:configure-flags '("--with-isl=system"))) | |
208 | (home-page "http://www.cloog.org/") | |
209 | (synopsis "A library to generate code for scanning Z-polyhedra") | |
210 | (description | |
211 | "CLooG is a free software library to generate code for scanning | |
212 | Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that | |
213 | reaches each integral point of one or more parameterized polyhedra. | |
214 | CLooG has been originally written to solve the code generation problem | |
215 | for optimizing compilers based on the polytope model. Nevertheless it | |
216 | is used now in various area e.g., to build control automata for | |
217 | high-level synthesis or to find the best polynomial approximation of a | |
218 | function. CLooG may help in any situation where scanning polyhedra | |
219 | matters. While the user has full control on generated code quality, | |
220 | CLooG is designed to avoid control overhead and to produce a very | |
221 | effective code.") | |
222 | (license gpl2+))) | |
5c126b64 LC |
223 | |
224 | (define-public libelf | |
225 | (package | |
226 | (name "libelf") | |
227 | (version "0.8.13") | |
228 | (source (origin | |
229 | (method url-fetch) | |
230 | (uri (string-append "http://www.mr511.de/software/libelf-" | |
231 | version ".tar.gz")) | |
232 | (sha256 | |
233 | (base32 | |
234 | "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr")))) | |
235 | (build-system gnu-build-system) | |
236 | (arguments '(#:phases (alist-replace | |
237 | 'configure | |
238 | (lambda* (#:key outputs #:allow-other-keys) | |
239 | ;; This old `configure' script doesn't support | |
240 | ;; variables passed as arguments. | |
241 | (let ((out (assoc-ref outputs "out"))) | |
242 | (setenv "CONFIG_SHELL" (which "bash")) | |
243 | (zero? | |
244 | (system* "./configure" | |
245 | (string-append "--prefix=" out))))) | |
246 | %standard-phases))) | |
247 | (home-page "http://www.mr511.de/software/english.html") | |
248 | (synopsis "An ELF object file access library") | |
249 | (description "libelf is a C library to access ELF object files.") | |
250 | (license lgpl2.0+))) |