1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
29 (define %gcc-infrastructure
30 ;; Base URL for GCC's infrastructure.
31 "ftp://gcc.gnu.org/pub/gcc/infrastructure/")
33 (define-public gcc-4.7
34 (let ((stripped? #t)) ; TODO: make this a parameter
40 (uri (string-append "mirror://gnu/gcc/gcc-"
41 version "/gcc-" version ".tar.bz2"))
44 "115h03hil99ljig8lkrq4qk426awmzh0g99wrrggxf8g07bq74la"))))
45 (build-system gnu-build-system)
46 (inputs `(("gmp" ,gmp)
48 ("mpc" ,mpc))) ; TODO: libelf, ppl, cloog, zlib, etc.
51 #:strip-binaries? ,stripped?
54 "--enable-languages=c,c++"
57 "--with-local-prefix=/no-gcc-local-prefix"
59 ,(let ((libc (assoc-ref %build-inputs "libc")))
61 (string-append "--with-native-system-header-dir=" libc
63 "--without-headers")))
65 (let ((libc (assoc-ref %build-inputs "libc")))
67 (list (string-append "LDFLAGS_FOR_BUILD="
69 "-Wl,-dynamic-linker "
71 ,(glibc-dynamic-linker)))
73 ,(string-append "BOOT_CFLAGS=-O2 "
74 ,(if stripped? "-g0" "-g"))))
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")))
84 ;; The following is not performed for `--without-headers'
85 ;; cross-compiler builds.
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\"~%"
93 (string-append libc ,(glibc-dynamic-linker)))))
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 \"\"
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\";"))))
118 'configure 'post-configure
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)
132 %standard-phases)))))
134 (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
135 (synopsis "GNU Compiler Collection")
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,...).
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.")
144 (home-page "http://gcc.gnu.org/"))))
152 (uri (list (string-append
153 "ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/isl-"
156 (string-append %gcc-infrastructure
157 name "-" version ".tar.gz")))
160 "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9"))))
161 (build-system gnu-build-system)
162 (inputs `(("gmp" ,gmp)))
163 (home-page "http://www.kotnet.org/~skimo/isl/")
165 "A library for manipulating sets and relations of integer points bounded
166 by linear constraints")
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.")
185 (uri (list (string-append
186 "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-"
189 (string-append %gcc-infrastructure
190 name "-" version ".tar.gz")))
193 "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw"))
194 (file-name (string-append name "-" version ".tar.gz"))))
195 (build-system gnu-build-system)
196 (inputs `(("gmp" ,gmp)
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")
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
215 (define-public libelf
221 (uri (string-append "http://www.mr511.de/software/libelf-"
225 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
226 (build-system gnu-build-system)
227 (arguments '(#:phases (alist-replace
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"))
235 (system* "./configure"
236 (string-append "--prefix=" out)))))
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.")